/* ============================================
   FRONTEND - PROFESSIONAL DESIGN SYSTEM
   ============================================ */

:root {
    /* Primary Colors */
    --primary: #E31B23;
    --primary-dark: #B71419;
    --primary-light: #FF4D54;

    /* Neutral Colors */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   BASE STYLES
   ============================================ */

body {
    font-family: 'Noto Naskh Arabic', serif;
    background-color: #F9FAFB;
    color: var(--gray-900);
}

h1,
h2,
h3,
h4,
h5,
h6,
.kufi {
    font-family: 'Noto Kufi Arabic', sans-serif;
}

.logo {
    font-family: 'Pacifico', serif;
    background: linear-gradient(135deg, #E31B23 0%, #B71419 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all var(--transition-base);
}

.logo:hover {
    transform: scale(1.05);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes ticker {
    0% {
        transform: translateX(100%);
    }

    100% {
        transform: translateX(-100%);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

/* ============================================
   TOP BAR
   ============================================ */

.top-bar {
    background: linear-gradient(135deg, #1F2937 0%, #111827 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.top-bar-link {
    transition: all var(--transition-fast);
    position: relative;
}

.top-bar-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width var(--transition-base);
}

.top-bar-link:hover::after {
    width: 100%;
}

.social-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.social-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(227, 27, 35, 0.2);
    border-radius: 50%;
    transform: scale(0);
    transition: transform var(--transition-base);
}

.social-icon:hover::before {
    transform: scale(1);
}

/* ============================================
   HEADER
   ============================================ */

.main-header {
    background: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 3px solid var(--gray-100);
    animation: slideInLeft 0.5s ease-out;
}

.nav-link {
    position: relative;
    padding: 8px 16px;
    transition: all var(--transition-base);
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.nav-link:hover::before,
.nav-link.active::before {
    transform: scaleX(1);
}

.search-input {
    transition: all var(--transition-base);
    font-family: 'Noto Kufi Arabic', sans-serif;
}

.search-input:focus {
    width: 300px;
}

.search-input::placeholder {
    font-size: 0.875rem;
}

/* Search Suggestions */
#searchSuggestions {
    animation: fadeIn 0.2s ease-out;
}

.search-suggestion-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    transition: all var(--transition-fast);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

.search-suggestion-item:hover {
    background: var(--gray-50);
    padding-right: 20px;
}

.search-suggestion-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: 8px;
    color: var(--primary);
    flex-shrink: 0;
}

.search-suggestion-text {
    flex: 1;
}

.search-suggestion-title {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 2px;
    font-size: 0.875rem;
}

.search-suggestion-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.search-no-results {
    padding: 24px;
    text-align: center;
    color: var(--gray-500);
}


/* ============================================
   BREAKING NEWS TICKER
   ============================================ */

.breaking-news-bar {
    background: linear-gradient(135deg, #E31B23 0%, #B71419 100%);
    position: relative;
    overflow: hidden;
}

.breaking-news-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

.ticker {
    animation: ticker 30s linear infinite;
    will-change: transform;
}

.ticker:hover {
    animation-play-state: paused;
}

/* ============================================
   MATCH CARDS
   ============================================ */

.match-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    padding: 16px;
    transition: all var(--transition-base);
    animation: fadeIn 0.5s ease-out;
}

.match-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.match-status-live {
    animation: pulse 2s ease-in-out infinite;
}

.match-tab {
    transition: all var(--transition-base);
    position: relative;
}

.match-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(227, 27, 35, 0.3);
}

/* ============================================
   NEWS CARDS
   ============================================ */

.news-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    animation: scaleIn 0.5s ease-out;
    position: relative;
}

.news-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(227, 27, 35, 0.1) 0%, transparent 70%);
    transform: translate(30%, -30%);
    transition: all var(--transition-base);
}

.news-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.news-card:hover::before {
    transform: translate(30%, -30%) scale(1.5);
}

.news-card-image {
    position: relative;
    overflow: hidden;
}

.news-card-image img {
    transition: transform var(--transition-slow);
}

.news-card:hover .news-card-image img {
    transform: scale(1.1);
}

.news-card-category {
    background: linear-gradient(135deg, #E31B23 0%, #B71419 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(227, 27, 35, 0.3);
}

.news-card-title {
    transition: color var(--transition-base);
}

.news-card:hover .news-card-title {
    color: var(--primary);
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.6s ease-out;
}

.hero-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
    transition: all var(--transition-base);
}

.hero-card:hover .hero-card-overlay {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.5) 50%, transparent 100%);
}

.hero-card img {
    transition: transform var(--transition-slow);
}

.hero-card:hover img {
    transform: scale(1.05);
}

/* ============================================
   SIDEBAR WIDGETS
   ============================================ */

.widget {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    animation: slideInRight 0.5s ease-out;
    transition: all var(--transition-base);
}

.widget:hover {
    box-shadow: var(--shadow-lg);
}

.widget-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    padding-bottom: 12px;
}

.widget-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, transparent 100%);
}

.popular-news-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
    transition: all var(--transition-base);
}

.popular-news-item:hover {
    transform: translateX(-4px);
    background: var(--gray-50);
    padding-right: 8px;
    border-radius: 8px;
}

.popular-news-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-200);
    transition: color var(--transition-base);
}

.popular-news-item:hover .popular-news-number {
    color: var(--primary);
}

/* ============================================
   LEAGUE TABLE
   ============================================ */

.league-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.league-table thead th {
    background: var(--gray-50);
    color: var(--gray-700);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 12px 8px;
    border-bottom: 2px solid var(--gray-200);
}

.league-table tbody tr {
    transition: all var(--transition-base);
}

.league-table tbody tr:hover {
    background: var(--gray-50);
    transform: scale(1.02);
}

.league-table tbody td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--gray-100);
}

.league-table tbody tr:first-child td {
    border-right: 3px solid #10B981;
}

.league-table tbody tr:nth-child(2) td,
.league-table tbody tr:nth-child(3) td,
.league-table tbody tr:nth-child(4) td {
    border-right: 3px solid #3B82F6;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-base);
    cursor: pointer;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #E31B23 0%, #B71419 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(227, 27, 35, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(227, 27, 35, 0.4);
}

.btn-outline {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline:hover {
    background: rgba(227, 27, 35, 0.05);
    transform: translateY(-2px);
}

/* ============================================
   NEWSLETTER FORM
   ============================================ */

.newsletter-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    transition: all var(--transition-base);
}

.newsletter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(227, 27, 35, 0.1);
    transform: translateY(-2px);
}

.newsletter-button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #E31B23 0%, #B71419 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
}

.newsletter-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(227, 27, 35, 0.4);
}

/* ============================================
   SOCIAL BUTTONS
   ============================================ */

.social-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-base);
    color: white;
}

.social-button:hover {
    transform: translateY(-2px);
    opacity: 0.9;
    box-shadow: var(--shadow-lg);
}

.social-facebook {
    background: #3b5998;
}

.social-twitter {
    background: #1da1f2;
}

.social-instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.social-youtube {
    background: #ff0000;
}

.social-tiktok {
    background: #000000;
}

/* ============================================
   TABS
   ============================================ */

.tab-button {
    padding: 12px 24px;
    font-weight: 600;
    transition: all var(--transition-base);
    position: relative;
    border-bottom: 3px solid transparent;
}

.tab-button::before {
    content: '';
    position: absolute;
    bottom: -3px;
    right: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.tab-button.active::before {
    transform: scaleX(1);
}

.tab-button.active {
    color: var(--primary);
}

/* ============================================
   MOBILE MENU
   ============================================ */

.mobile-menu {
    animation: slideInRight 0.3s ease-out;
}

.mobile-menu-backdrop {
    backdrop-filter: blur(4px);
}

.mobile-menu-link {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    transition: all var(--transition-base);
}

.mobile-menu-link:hover {
    background: var(--gray-50);
    color: var(--primary);
    transform: translateX(-4px);
}

/* ============================================
   SCROLLBAR
   ============================================ */

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ============================================
   LINE CLAMP
   ============================================ */

.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 1;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 2;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 3;
}

/* ============================================
   UTILITIES
   ============================================ */

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

.slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

.scale-in {
    animation: scaleIn 0.5s ease-out;
}

/* ============================================
   CUSTOM CHECKBOX
   ============================================ */

.custom-checkbox {
    display: none;
}

.custom-checkbox+label {
    position: relative;
    padding-right: 30px;
    cursor: pointer;
    display: inline-block;
}

.custom-checkbox+label:before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    background: white;
    border-radius: 4px;
    transition: all var(--transition-base);
}

.custom-checkbox:checked+label:before {
    background: var(--primary);
    border-color: var(--primary);
}

.custom-checkbox:checked+label:after {
    content: '';
    position: absolute;
    right: 6px;
    top: 3px;
    width: 8px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .ticker {
        font-size: 0.875rem;
        white-space: nowrap;
    }

    .news-card {
        margin-bottom: 16px;
    }

    .widget {
        padding: 16px;
        margin-bottom: 16px;
    }

    .search-input:focus {
        width: 100%;
    }

    .hero-card {
        margin-bottom: 16px;
    }

    button,
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    input,
    textarea,
    select {
        min-height: 44px;
    }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* ============================================
   LOADING STATES
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: 8px;
}

.loading-spinner {
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white;
    }

    .news-card,
    .widget,
    .match-card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}

/* ============================================
   DARK MODE STYLES
   ============================================ */

.dark {
    /* Dark mode color overrides */
    --gray-50: #0f172a;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;
    
    /* For dark mode, we want the background to be dark and text to be light */
    --dark-bg-primary: #0f172a;
    --dark-bg-secondary: #1e293b;
    --dark-text-primary: #f8fafc;
    --dark-text-secondary: #cbd5e1;
}

/* Dark mode specific styles */
.dark body {
    background-color: var(--dark-bg-primary);
    color: var(--dark-text-primary);
}

.dark .main-header {
    background: var(--dark-bg-secondary);
    border-bottom-color: var(--gray-300);
}

.dark .top-bar {
    background: linear-gradient(135deg, var(--dark-bg-primary) 0%, var(--dark-bg-secondary) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dark .news-card,
.dark .widget,
.dark .match-card {
    background: var(--dark-bg-secondary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-color: var(--gray-300);
}

.dark .nav-link {
    color: var(--dark-text-secondary);
}

.dark .nav-link:hover,
.dark .nav-link.active {
    color: var(--primary);
}

.dark .search-input {
    background: var(--gray-300);
    border-color: var(--gray-400);
    color: var(--dark-text-primary);
}

.dark .search-input:focus {
    background: var(--gray-200);
    border-color: var(--primary);
}

.dark .search-suggestion-item {
    background: var(--dark-bg-secondary);
    border-bottom-color: var(--gray-300);
    color: var(--dark-text-primary);
}

.dark .search-suggestion-item:hover {
    background: var(--gray-300);
}

.dark .top-bar-link {
    color: var(--dark-text-secondary);
}

.dark .top-bar-link:hover {
    color: var(--dark-text-primary);
}

.dark .social-icon {
    color: var(--dark-text-secondary);
}

.dark .social-icon:hover {
    color: var(--dark-text-primary);
}

.dark .league-table thead th {
    background: var(--dark-bg-secondary);
    color: var(--dark-text-primary);
    border-bottom-color: var(--gray-300);
}

.dark .league-table tbody tr {
    background: var(--dark-bg-primary);
    border-bottom-color: var(--gray-300);
}

.dark .league-table tbody tr:hover {
    background: var(--gray-300);
}

.dark .breaking-news-bar {
    background: linear-gradient(135deg, #B71419 0%, #E31B23 100%);
}

.dark .popular-news-item {
    border-bottom-color: var(--gray-300);
}

.dark .popular-news-item:hover {
    background: var(--gray-300);
}

/* Dark mode transitions */
.dark * {
    transition: background-color var(--transition-base), color var(--transition-base), border-color var(--transition-base);
}