/* ==========================================================================
   Modern Reset & Professional Palette
   ========================================================================== */
:root {
    --live-text: #ff3333;
    --live-bg: rgba(255, 51, 51, 0.15);
    --live-red: #ff3333;
    --live-red-glow: rgba(255, 51, 51, 0.8);
    --orange: #fbbf24;
    --orange-glow: rgba(251, 191, 36, 0.4);
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* --- Dark Theme (Default) --- */
body.dark {
    --bg-primary: #1a1f2e;
    --bg-secondary: #242a38;
    --bg-card: #2d3342;
    --bg-sidebar: transparent;
    --bg-pill: #323a4a;
    --bg-line-cut: #242a38;
    --border-color: #3e4555;
    --border-light: #4a5162;
    --border-ad: #5a6275;
    --text-primary: #ffffff;
    --text-secondary: #e6edf5;
    --text-muted: #b0c4ce;
    --text-ad: #a0b3c6;
    --orange: #fbbf24;
    --orange-glow: rgba(251, 191, 36, 0.4);
    --red: #ff3333;
    --red-glow: rgba(255, 51, 51, 0.8);
    --yellow: #fcd34d;
    --yellow-glow: rgba(252, 211, 77, 0.3);
    --gradient-logo: linear-gradient(145deg, #ffffff, #e6edf5);
    --card-hover: #383f51;
    --shadow: 0 20px 35px -8px rgba(0,0,0,0.4);
    --sport-solid: #ffffff;
    --card-border: #3e4555;
    --icon-color: #ffffff;
}

/* --- Light Theme --- */
body.light {
    --bg-primary: #eef2f6;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-sidebar: transparent;
    --bg-pill: #f0f3f7;
    --bg-line-cut: #ffffff;
    --border-color: #b8c4d4;
    --border-light: #c9d2e0;
    --border-ad: #9aabbf;
    --text-primary: #0a1a2c;
    --text-secondary: #1e3a5f;
    --text-muted: #4d6a89;
    --text-ad: #4d6a89;
    --orange: #e68a2e;
    --orange-glow: rgba(230, 138, 46, 0.25);
    --red: #c41e1e;
    --red-glow: rgba(196, 30, 30, 0.25);
    --yellow: #b45309;
    --yellow-glow: rgba(180, 83, 9, 0.2);
    --sport-solid: #0a2a44;
    --card-hover: #f5f9ff;
    --shadow: 0 8px 20px -4px rgba(0,20,40,0.2);
    --gradient-logo: none;
    --card-border: #b8c4d4;
    --icon-color: #0a2a44;
}

/* ==========================================================================
   Header & Brand (Option 3: 48H Stack)
   ========================================================================== */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-secondary);
    border-radius: 0 0 28px 28px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    padding: 8px 0;
}

.header-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 12px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.brand-mega {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    font-family: 'Montserrat', sans-serif;
    text-transform: uppercase;
    font-weight: 900;
    gap: 20px;
}

.sport-time-mega {
    display: flex;
    align-items: baseline;
    position: relative;
    font-size: 44px;
    padding-bottom: 14px;
}

body.dark .brand-sport, body.dark .brand-time {
    background: var(--gradient-logo);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light .brand-sport, body.light .brand-time {
    color: var(--sport-solid);
    -webkit-text-fill-color: var(--sport-solid);
    background: none;
}

.orange-line-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 24px;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.orange-line {
    width: 100%;
    height: 3px;
    background: var(--orange);
    border-radius: 3px;
    box-shadow: 0 0 12px var(--orange-glow);
    position: relative;
}

.www-text {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-line-cut);
    padding: 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--yellow);
    letter-spacing: 1.5px;
    text-transform: lowercase;
    font-family: 'Inter', sans-serif;
    text-shadow: 0 0 6px var(--yellow-glow);
    line-height: 1;
    z-index: 2;
}

/* --- LIVE + 48H STACK --- */
.live-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.brand-live-tiny {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--orange);
    border-radius: 60px;
    padding: 6px 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    animation: border-red-flash 10s infinite linear;
}

.live-text-tiny {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 1;
    position: relative;
    z-index: 2;
}

.hours-tag-block {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 900;
    background: var(--orange);
    color: #000;
    padding: 1px 10px;
    border-radius: 4px;
    letter-spacing: 1px;
    text-align: center;
    box-shadow: 0 0 8px var(--orange-glow);
    line-height: 1.2;
}

body.light .hours-tag-block {
    background: var(--text-primary);
    color: var(--bg-primary);
    box-shadow: none;
}

.brand-live-tiny::before {
    content: "";
    position: absolute;
    top: 0; left: -200%; width: 150%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.0) 10%, rgba(255, 255, 255, 0.9) 50%, rgba(255, 255, 255, 0.0) 90%, transparent);
    transform: skewX(-30deg);
    animation: sweep-white 10s infinite linear;
    z-index: 1;
}

@keyframes sweep-white { 
    0%, 70% { left: -200%; } 
    90% { left: 200%; } 
    100% { left: 200%; } 
}

@keyframes border-red-flash { 
    0%, 89.9% { border-color: var(--orange); box-shadow: 0 0 0px transparent; }
    92% { border-color: var(--red); box-shadow: 0 0 20px var(--red-glow); background: rgba(255, 51, 51, 0.2); }
    100% { border-color: var(--orange); box-shadow: 0 0 0px transparent; }
}

/* ==========================================================================
   Header Controls
   ========================================================================== */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-pill {
    background: var(--bg-pill);
    border: 1px solid var(--border-light);
    height: 44px;
    padding: 0 18px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    gap: 6px;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

select.filter-pill {
    background: var(--bg-pill);
    color: var(--text-primary);
}

select.filter-pill option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.search-box {
    background: var(--bg-pill);
    border: 1px solid var(--border-light);
    border-radius: 40px;
    height: 44px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    width: 200px;
}

.search-box input::placeholder { 
    color: var(--text-muted); 
    opacity: 0.8; 
}

#clearSearch {
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    font-size: 18px;
}

#clearSearch.visible { 
    display: inline-block; 
}

.scheme-toggle-header {
    background: var(--bg-pill);
    border: 1px solid var(--border-light);
    border-radius: 40px;
    display: flex;
    padding: 3px;
    gap: 2px;
}

.scheme-toggle-header .scheme-btn {
    border: none;
    background: transparent;
    border-radius: 30px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.scheme-toggle-header .scheme-btn.active {
    background: var(--orange);
    color: #000;
}

/* ==========================================================================
   Main Layout & Ads
   ========================================================================== */
.main-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 30px 30px;
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.content-wrapper {
    flex: 1;
    min-width: 0;
}

.sidebar-ad {
    width: 160px;
    flex-shrink: 0;
    display: none;
    position: sticky;
    top: 100px;
    height: fit-content;
    z-index: 10;
}

@media (min-width: 1200px) { 
    .sidebar-ad { display: block; }
}

.sidebar-ad .desktop-sidebar-ad-slot {
    width: 120px;
    min-height: 600px;
    margin: 0 auto;
    background: transparent;
}

.mobile-ad-container, .desktop-ad-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.ad-slot {
    border-radius: 16px;
    overflow: hidden;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-ad);
}

.mobile-ad-slot { width: 300px; height: 250px; }
.desktop-ad-slot { width: 728px; height: 90px; }

@media (max-width: 767px) { 
    .desktop-ad-container { display: none; } 
    .mobile-ad-container { display: flex; } 
}

@media (min-width: 768px) { 
    .mobile-ad-container { display: none; } 
    .desktop-ad-container { display: flex; } 
}

/* ==========================================================================
   Event Cards
   ========================================================================== */
#container { 
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
}

.card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 6px 18px;
    align-items: start;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s;
}

.card:hover {
    background: var(--card-hover);
    border-color: var(--orange);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--orange);
    box-shadow: 0 0 8px var(--orange-glow);
}

.card.live-event::before {
    background: var(--live-red) !important;
    box-shadow: 0 0 10px var(--red-glow);
    width: 6px;
}

body.light .card.live-event::before {
    box-shadow: 0 0 8px var(--red-glow);
}

.card.live-event .sport-type-status-badge {
    color: var(--live-red) !important;
    font-weight: 800;
}

.material-icons.icon {
    grid-row: 1 / span 2;
    font-size: 28px;
    width: 48px; 
    height: 48px;
    display: flex;
    align-items: center; 
    justify-content: center;
    border-radius: 12px;
    background: var(--bg-pill);
}

body.dark .material-icons.icon {
    background: var(--gradient-logo);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.light .material-icons.icon {
    color: var(--icon-color) !important;
    -webkit-text-fill-color: var(--icon-color);
    background: none;
}

.top-info-row {
    grid-column: 2 / 4;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sport-type-status-badge {
    font-size: 12px;
    font-weight: 700;
    color: var(--orange);
    text-transform: uppercase;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.match-title {
    grid-column: 2 / 3;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

.time-day-container {
    grid-column: 3 / 4;
    text-align: right;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.time { 
    font-size: 18px; 
    font-weight: 800; 
    color: var(--text-primary);
    line-height: 1.2;
}

.day-text { 
    font-size: 11px; 
    font-weight: 600; 
    color: var(--text-muted);
    text-transform: uppercase;
    line-height: 1.2;
}

.card.live-event .day-text {
    color: var(--live-red);
    font-weight: 800;
}

.loading, .no-results { 
    text-align: center; 
    padding: 50px; 
    color: var(--text-muted); 
    background: var(--bg-card); 
    border-radius: 20px; 
}

/* ==========================================================================
   Mobile Header - Scrollable
   ========================================================================== */
@media (max-width: 599px) {
    header {
        position: relative; /* Change from sticky to relative on mobile */
        top: auto;
        border-radius: 0 0 20px 20px;
        margin-bottom: 10px;
    }
    
    /* Optional: Adjust header padding for better mobile scrolling */
    .header-container {
        padding: 10px 15px;
        max-height: none;
        overflow: visible;
    }
    
    /* Ensure the brand and controls stack properly */
    .brand-mega {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    
    /* Make the sport-time-mega responsive */
    .sport-time-mega {
        font-size: 32px;
        padding-bottom: 20px;
    }
    
    /* Ensure the orange line adjusts */
    .orange-line-container {
        height: 20px;
    }
    
    .www-text {
        left: 12px;
        font-size: 10px;
        padding: 0 8px;
    }
    
    /* Adjust live stack for better mobile display */
    .live-stack {
        margin-left: 0;
        flex-direction: row;
        gap: 8px;
    }
    
    .brand-live-tiny {
        padding: 4px 16px;
    }
    
    .live-text-tiny {
        font-size: 16px;
    }
    
    .hours-tag-block {
        font-size: 10px;
        padding: 2px 8px;
    }
    
    /* Make header controls wrap properly */
    .header-controls {
        width: 100%;
        justify-content: center;
        gap: 8px;
    }
    
    /* Adjust filter pills for mobile */
    .filter-pill {
        height: 40px;
        padding: 0 14px;
        font-size: 13px;
    }
    
    /* Make search box full width on very small devices */
    .search-box {
        width: 100%;
        max-width: 300px;
    }
    
    .search-box input {
        width: 100%;
    }
    
    /* Adjust scheme toggle for mobile */
    .scheme-toggle-header {
        margin-left: 0;
    }
    
    .scheme-toggle-header .scheme-btn {
        padding: 4px 10px;
        font-size: 12px;
    }
}

/* For very small devices */
@media (max-width: 380px) {
    .sport-time-mega {
        font-size: 28px;
    }
    
    .www-text {
        font-size: 9px;
        left: 8px;
    }
    
    .header-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-pill, .search-box, .scheme-toggle-header {
        width: 100%;
    }
    
    .search-box {
        max-width: none;
    }
    
    .scheme-toggle-header {
        justify-content: center;
    }
}

/* ==========================================================================
   Responsive Utilities
   ========================================================================== */
@media (max-width: 850px) {
    .header-container { flex-direction: column; align-items: stretch; }
    .brand-mega { justify-content: center; }
    .sport-time-mega { font-size: 38px; }
    .header-controls { justify-content: center; }
}

@media (max-width: 599px) {
    .main-container { padding: 0 15px 20px; }
    .card { grid-template-columns: 44px 1fr 75px; gap: 4px 10px; padding: 15px; }
    .match-title { font-size: 15px; }
    .time { font-size: 15px; }
    .time-day-container { width: 75px; gap: 2px; }
    .sport-time-mega { font-size: 32px; }
    .brand-live-tiny { padding: 4px 16px; }
    .live-text-tiny { font-size: 16px; }
    .www-text { left: 12px; font-size: 11px; }
}

@media (min-width: 600px) and (max-width: 1024px) {
    .search-box input { width: 150px; }
}