@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800;900&family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

/* --- Theme Variables & Tokens --- */
:root {
    --bg-base: #0b0e11;
    --bg-surface: #15181f;
    --bg-surface-hover: #1c212a;
    --border-color: #222630;
    
    --text-primary: #ffffff;
    --text-secondary: #9aa0a6;
    --text-muted: #5f6368;
    
    --primary-color: #b51940;       /* Crimson Red */
    --primary-hover: #961232;
    --primary-glow: rgba(181, 25, 64, 0.25);
    
    --yesterday-color: #104783;     /* Royal Blue */
    --tomorrow-color: #af5100;      /* Amber Orange */
    --live-color: #e50914;          /* Pulsing Live Red */
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.8);
    
    --font-en: 'Outfit', sans-serif;
    --font-ar: 'Cairo', sans-serif;
    --font-family: var(--font-en);
}

/* --- Light Mode Variables --- */
html[data-theme="light"] {
    --bg-base: #f4f6f9;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f3f7;
    --border-color: #e1e4ea;
    
    --text-primary: #1c1e21;
    --text-secondary: #5f6368;
    --text-muted: #9aa0a6;
    
    --primary-color: #b51940;
    --primary-hover: #961232;
    --primary-glow: rgba(181, 25, 64, 0.15);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
}

/* --- Reset & Base Styles --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-family);
    line-height: 1.6;
    overflow-x: hidden;
}

/* RTL Override */
html[dir="rtl"] {
    --font-family: var(--font-ar);
}
html[dir="rtl"] body {
    font-family: var(--font-family);
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Sticky Navbar --- */
.navbar {
    background-color: rgba(var(--bg-base-rgb, 11, 14, 17), 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

html[data-theme="light"] .navbar {
    background-color: rgba(244, 246, 249, 0.85);
}

.navbar .nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

/* Logo with Shine Animation */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 900;
    letter-spacing: -0.5px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.logo .play-icon {
    background: var(--primary-color);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 0 10px var(--primary-glow);
}

.logo-text {
    background: linear-gradient(90deg, var(--text-primary), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-20deg);
    animation: shine 4s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    15% { left: 150%; }
    100% { left: 150%; }
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Buttons */
.btn-action {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background-color: var(--bg-surface-hover);
    transform: translateY(-2px);
}

.btn-lang {
    border-radius: 20px;
    width: auto;
    padding: 0 15px;
    font-family: var(--font-ar);
    font-size: 13px;
}

/* --- Hero Section --- */
.hero {
    text-align: center;
    padding: 60px 20px;
    background: radial-gradient(circle at top, var(--primary-glow) 0%, transparent 70%);
    border-bottom: 1px solid var(--border-color);
}

.hero .live-badge {
    background: rgba(229, 9, 20, 0.15);
    color: var(--live-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.5px;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 12px rgba(229, 9, 20, 0.2);
}

.hero .live-badge .pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--live-color);
    border-radius: 50%;
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 10px var(--live-color); }
    100% { transform: scale(0.9); opacity: 0.6; }
}

.hero h1 {
    font-size: clamp(32px, 5vw, 52px);
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 15px;
    letter-spacing: -1px;
}

.hero .desc {
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 30px;
    font-size: 16px;
}

/* Search Bar */
.search-wrapper {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-radius: 30px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.search-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-glow);
}

.search-wrapper input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    outline: none;
    width: 100%;
    font-size: 16px;
    margin: 0 10px;
    font-family: inherit;
}

.search-wrapper .search-icon {
    color: var(--text-secondary);
    font-size: 16px;
}

/* --- Main Dashboard --- */
.dashboard-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin: 40px 0 20px;
    gap: 15px;
}

.dashboard-title-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dashboard-title {
    font-size: 24px;
    font-weight: 850;
    letter-spacing: -0.5px;
}

.timezone-badge {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Date Tabs */
.date-tabs {
    display: flex;
    gap: 10px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 4px;
    border-radius: 30px;
    box-shadow: var(--shadow-sm);
}

.tab-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active[data-filter="yesterday"] {
    background-color: var(--yesterday-color);
    color: #fff;
}

.tab-btn.active[data-filter="today"] {
    background-color: var(--primary-color);
    color: #fff;
}

.tab-btn.active[data-filter="tomorrow"] {
    background-color: var(--tomorrow-color);
    color: #fff;
}

/* --- Inline Stream Player --- */
.player-section {
    display: none;
    margin-bottom: 40px;
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.player-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.player-header h2 {
    font-size: 20px;
    font-weight: 800;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.btn-close:hover {
    color: var(--text-primary);
}

.iframe-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

.iframe-container .player-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-secondary);
    font-size: 14px;
    z-index: 1;
}

/* Server Controls */
.server-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.server-btn {
    background-color: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.server-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.server-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 10px var(--primary-glow);
}

/* --- Matches Grid --- */
.matches-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 50px;
}

.no-matches-fallback {
    text-align: center;
    padding: 60px 20px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-secondary);
    font-size: 16px;
}

/* Match Card */
.match-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.match-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background-color: var(--bg-surface-hover);
}

/* Team Section */
.team-side {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 38%;
}

.team-side.home {
    justify-content: flex-end;
    text-align: right;
}

.team-side.away {
    justify-content: flex-start;
    text-align: left;
}

.team-name {
    font-size: 16px;
    font-weight: 700;
}

/* Badges and Placeholders */
.team-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: contain;
    background-color: #fff;
    border: 1px solid var(--border-color);
    padding: 4px;
    flex-shrink: 0;
}

.initials-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.5px;
    flex-shrink: 0;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.2);
}

/* Center Details */
.match-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 24%;
    gap: 6px;
}

.league-tag {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary-color);
    background: var(--primary-glow);
    padding: 3px 8px;
    border-radius: 6px;
}

.match-time {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.match-score {
    font-size: 22px;
    font-weight: 900;
    display: flex;
    gap: 10px;
    align-items: center;
}

.score-divider {
    color: var(--text-muted);
}

.match-status-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background-color: var(--border-color);
    color: var(--text-secondary);
}

.match-status-badge.live {
    background-color: var(--live-color);
    color: #fff;
    box-shadow: 0 0 10px rgba(229, 9, 20, 0.4);
    animation: blinker 1s ease-in-out infinite;
}

@keyframes blinker {
    50% { opacity: 0.6; }
}

.watch-overlay-btn {
    margin-top: 5px;
    background-color: var(--primary-color);
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px var(--primary-glow);
}

.watch-overlay-btn:hover {
    background-color: var(--primary-hover);
}

/* --- Responsive Adaptations --- */
@media (max-width: 768px) {
    .match-card {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 12px 10px !important;
        gap: 6px !important;
    }
    
    .team-side {
        width: 38% !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        gap: 6px !important;
    }
    
    .team-side.home, .team-side.away {
        justify-content: center !important;
        text-align: center !important;
    }
    
    .team-name {
        font-size: 12px !important;
        line-height: 1.2 !important;
        font-weight: 700 !important;
        word-break: break-word;
        max-width: 100%;
    }
    
    .team-logo, .initials-badge {
        width: 36px !important;
        height: 36px !important;
        font-size: 11px !important;
        padding: 2px !important;
    }
    
    .match-center {
        width: 24% !important;
        gap: 4px !important;
        padding: 0 !important;
        border: none !important;
    }
    
    .league-tag {
        font-size: 8px !important;
        padding: 2px 4px !important;
        border-radius: 4px !important;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 75px;
    }
    
    .match-time {
        font-size: 12px !important;
    }
    
    .match-score {
        font-size: 14px !important;
        gap: 4px !important;
    }
    
    .match-status-badge {
        font-size: 9px !important;
        padding: 2px 6px !important;
    }
    
    .watch-overlay-btn {
        padding: 4px 10px !important;
        font-size: 9px !important;
        margin-top: 2px !important;
        border-radius: 12px !important;
    }
    
    .tab-btn {
        padding: 6px 12px !important;
        font-size: 12px !important;
    }
}

/* --- SEO & FAQ Sections --- */
.seo-section {
    margin: 60px auto 40px;
    border-top: 1px solid var(--border-color);
    padding-top: 40px;
}

.seo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.seo-box h2, .seo-box h3 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.seo-box p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

.faq-title {
    font-size: 26px;
    font-weight: 900;
    text-align: center;
    margin-bottom: 30px;
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 15px;
    overflow: hidden;
}

.faq-item summary {
    padding: 16px 20px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '▼';
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
    transform: rotate(180deg);
}

.faq-item p {
    padding: 0 20px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* --- Footer --- */
.site-footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 40px 0;
    margin-top: 60px;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.footer-logo {
    font-size: 20px;
    font-weight: 900;
    color: var(--text-primary);
}

.footer-copyright {
    color: var(--text-secondary);
    font-size: 13px;
}

.footer-links {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--text-primary);
}

/* Hide bilingual segments dynamically based on lang class */
html[lang="en"] .ar-only { display: none !important; }
html[lang="ar"] .en-only { display: none !important; }

/* --- Collapsible SEO Keyword Block --- */
.collapsible-seo-wrapper {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-top: 40px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.collapsible-seo-content {
    max-height: 110px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.collapsible-seo-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(to bottom, transparent, var(--bg-surface));
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.collapsible-seo-wrapper.expanded .collapsible-seo-content {
    max-height: 2000px;
}

.collapsible-seo-wrapper.expanded .collapsible-seo-content::after {
    opacity: 0;
}

.seo-readmore-btn {
    display: block;
    margin: 20px auto 0;
    background-color: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 24px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.seo-readmore-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}