:root {
    --bg: #0b0e14;
    --surface: #141925;
    --surface-2: #1b2230;
    --border: #232c3d;
    --text: #e6e9ef;
    --muted: #8a93a6;
    --accent: #e11d3a;
    --accent-2: #ff5a3c;
    --live: #19c37d;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

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

/* Header / Nav */
.site-header {
    background: linear-gradient(180deg, #0d1119 0%, #0b0e14 100%);
    border-bottom: 2px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
}

.brand {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #fff;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.brand span { color: var(--accent); }
.brand-logo { height: 28px; width: auto; }

.main-nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    margin-right: 12px;
    scrollbar-width: none;
}

.main-nav::-webkit-scrollbar { display: none; }

.nav-ico { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; margin-right: 4px; flex: none; }

.header-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.nav-search {
    display: flex;
    align-items: center;
}

.nav-search input {
    width: 180px;
    max-width: 40vw;
    padding: 7px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color .15s ease, width .2s ease;
}

.nav-search input:focus {
    border-color: var(--accent);
    width: 220px;
}

/* Search page */
.search-page { max-width: 980px; margin: 0 auto; }
.search-title { font-size: 22px; font-weight: 800; margin: 8px 0 16px; }
.search-form { display: flex; gap: 8px; margin-bottom: 18px; }
.search-form input {
    flex: 1;
    max-width: 420px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 15px;
    outline: none;
}
.search-form input:focus { border-color: var(--accent); }
.search-form button {
    padding: 10px 18px;
    border-radius: 8px;
    border: 0;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}
.search-hint { color: var(--muted); }
.search-count { color: var(--muted); font-size: 14px; margin-bottom: 12px; }

.nav-link {
    padding: 7px 12px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
    color: var(--muted);
    border-radius: 6px;
    text-transform: uppercase;
    white-space: nowrap;
    transition: all .15s ease;
}

.nav-link:hover { color: #fff; background: var(--surface-2); }
.nav-link.active { color: #fff; background: var(--accent); }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
}
.nav-toggle span { width: 22px; height: 2px; background: #fff; display: block; }

@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .main-nav {
        display: none;
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        flex-direction: column;
        align-items: stretch;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 8px 12px;
    }
    .main-nav.open { display: flex; }
}

@media (max-width: 600px) {
    .header-row { flex-wrap: wrap; gap: 10px; }
    .header-tools { margin-left: 0; width: 100%; order: 3; }
    .nav-search { flex: 1; }
    .nav-search input { width: 100%; max-width: none; }
    .theme-toggle .theme-label { display: none; }
}

/* Body */
.site-body { padding: 24px 15px 60px; }

.banner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 12px 0;
    width: 100%;
    text-align: center;
}
.banner-container iframe {
    margin: 0 auto;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.home-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
}

.home-rail {
    position: sticky;
    top: 90px;
}

.rail-chips {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.rail-chips .chip {
    width: 100%;
    justify-content: flex-start;
}

@media (max-width: 900px) {
    .home-layout {
        grid-template-columns: 1fr;
    }

    .home-rail {
        display: none;
    }
}

.hero {
    text-align: center;
    padding: 18px 0 8px;
}


.hero h1 {
    font-size: 30px;
    font-weight: 800;
    margin: 0 0 6px;
    background: linear-gradient(90deg, #fff, var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero .muted { color: var(--muted); margin: 0; }

.section-title {
    font-size: 20px;
    font-weight: 800;
    margin: 28px 0 14px;
    padding-left: 12px;
    border-left: 4px solid var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* League section */
.league-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 26px;
    overflow: visible;
}

.important-section {
    border-color: #ffb020;
    box-shadow: 0 0 0 1px rgba(255, 176, 32, 0.25);
}

.league-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.league-head img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; }
.league-head h3 { margin: 0; font-size: 20px; font-weight: 700; }

/* Match card */
.match-list { display: grid; gap: 1px; background: var(--border); }

.match-card {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--surface);
    transition: background .15s ease;
}

.match-card:hover { background: var(--surface-2); }

.team {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.team.away { flex-direction: row-reverse; text-align: right; }

.team img {
    width: 24px; height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: #0b0e14;
    flex-shrink: 0;
}

.team .name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-meta {
    text-align: center;
    min-width: 120px;
}

.badge-live {
    display: inline-block;
    background: #ef4444;
    color: #fff;
    font-weight: 800;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    animation: pulse 1.4s infinite;
}

.badge-replay {
    display: inline-block;
    background: #5a6275;
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
}

.countdown {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.countdown strong { color: var(--accent-2); }

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.55; }
    100% { opacity: 1; }
}

/* Chips (leagues / teams) */
.chip-grid { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    transition: all .15s ease;
}

.chip:hover { border-color: var(--accent); color: #fff; }
.chip img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }

/* Detail page */
.detail-wrap { max-width: 900px; margin: 0 auto; }
.stream-embed {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 12px;
    background: #000;
    margin: 12px 0 18px;
}
.stream-btn {
    display: block;
    padding: 12px 16px;
    margin-bottom: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 600;
    color: var(--text);
    transition: background .15s, border-color .15s;
}
.stream-btn:hover { border-color: var(--accent); }
.stream-btn.active {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
    padding: 3px 8px;
    margin-bottom: 0;
}
.player-btn-row .stream-btn { display: inline-block; width: auto; flex: 0 0 auto; }
.player-btn-row .stream-btn:not(.active) { background: #1e2a3a; border-color: #2a3a50; }
.player-btn-row .stream-btn:not(.active):hover { background: #243244; }
.player-btn-row .stream-btn.active {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
    padding: 3px 8px;
    margin-bottom: 0;
}

.back-link { color: var(--muted); font-size: 14px; }
.back-link:hover { color: var(--accent); }

/* Footer */
.site-footer {
    background: #0a0d13;
    border-top: 1px solid var(--border);
    padding: 26px 0;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.footer-networks a { color: var(--accent); margin: 0 2px; }
.footer-networks a:hover { color: var(--accent-2); }
.footer-copy { margin: 10px 0 0; }

/* Admin */
.admin-nav {
    background: #0d1119;
    border-bottom: 2px solid var(--accent);
    padding: 12px 0;
}
.admin-brand { font-size: 20px; font-weight: 800; color: #fff; }
.admin-brand span { color: var(--accent); }
.admin-nav-links { display: flex; gap: 8px; align-items: center; }
.admin-body { padding-top: 24px; padding-bottom: 60px; max-width: 1100px; }

.admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 22px;
}
.admin-card h3 { margin: 0; font-size: 17px; font-weight: 700; }
.admin-card .cat-meta { color: var(--muted); font-size: 12px; margin-bottom: 12px; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}
.admin-table th { color: var(--muted); font-weight: 600; }
.admin-table th.text-center, .admin-table td.text-center { text-align: center; }
.admin-table img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; margin-right: 8px; vertical-align: middle; }
.admin-badge { font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 700; }
.admin-badge.live { background: #e11d48; color: #fff; }
.admin-badge.upcoming { background: #2a3650; color: #cdd6e6; }
.admin-badge.replay { background: #5a6275; color: #fff; }

.admin-form label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 13px; }
.admin-form .form-control, .admin-form select {
    background: #0b0e14; color: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; width: 100%;
}
.admin-form .text-danger { color: #ff6b6b; font-size: 12px; }
.admin-login-wrap { max-width: 380px; margin: 8vh auto 0; }

/* Admin: important badge + disabled row dimming */
.admin-badge.important { background: #ffb020; color: #1a1205; }
.badge-important { display: inline-block; background: #ffb020; color: #1a1205; font-weight: 800; font-size: 11px; padding: 2px 6px; border-radius: 4px; margin-left: 6px; }
.opacity-50 { opacity: 0.5; }
/* Admin tick boxes (live / ended) */
.tick { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text); padding: 4px 9px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; user-select: none; }
.tick:hover { border-color: var(--accent); }
.tick input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
/* stream buttons act as iframe switchers */
.stream-btn { font: inherit; text-align: left; width: 100%; cursor: pointer; color: var(--text); }
.player-btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.player-btn-row .stream-btn { display: inline-block; width: auto; flex: 0 0 auto; }

.ended-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 20px;
    text-align: center;
}
.ended-box .badge-replay { font-size: 13px; }
.ended-box .muted { margin: 10px 0 0; }

/* Theme toggle button (top-right) */
.brand-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1;
    white-space: nowrap;
    transition: border-color .15s ease, color .15s ease;
}

.theme-toggle .theme-label { text-transform: uppercase; }
.theme-toggle #themeIcon { font-size: 15px; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Light theme ===== */
[data-theme="light"] {
    --bg: #eef1f6;
    --surface: #ffffff;
    --surface-2: #f1f4f9;
    --border: #d7dce5;
    --text: #11161f;
    --muted: #5b6577;
    --accent: #e11d3a;
    --accent-2: #ff5a3c;
    --live: #19c37d;
}

[data-theme="light"] .site-header {
    background: linear-gradient(180deg, #ffffff 0%, #eef1f6 100%);
}

[data-theme="light"] .admin-nav {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
}

[data-theme="light"] .site-footer {
    background: #e7ebf2;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

[data-theme="light"] .brand,
[data-theme="light"] .admin-brand { color: var(--text); }

[data-theme="light"] .nav-toggle span { background: var(--text); }

[data-theme="light"] .hero h1 {
    background: linear-gradient(90deg, var(--text), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .nav-link { color: var(--muted); }
[data-theme="light"] .nav-link:hover { color: var(--text); background: var(--surface-2); }
[data-theme="light"] .chip:hover { color: var(--text); }
[data-theme="light"] .team img { background: var(--surface-2); }

[data-theme="light"] .admin-form .form-control,
[data-theme="light"] .admin-form select {
    background: var(--surface);
    color: var(--text);
}

[data-theme="light"] .btn-outline-light {
    color: var(--text);
    border-color: var(--border);
    background-color: transparent;
}

[data-theme="light"] .btn-outline-light:hover {
    background-color: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

[data-theme="light"] .player-btn-row .stream-btn:not(.active) {
    background: var(--surface-2);
    border-color: var(--border);
}
[data-theme="light"] .player-btn-row .stream-btn:not(.active):hover {
    background: #e2e6ed;
}

/* ===== Homepage SEO content ===== */
.seo-content {
    max-width: 900px;
    margin: 36px auto 0;
    padding: 24px 18px 8px;
    color: var(--text);
    line-height: 1.7;
}

.seo-content h2 {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 14px;
    color: var(--text);
}

.seo-content h3 {
    font-size: 19px;
    font-weight: 700;
    margin: 22px 0 10px;
    color: var(--text);
}

.seo-content p { margin: 0 0 14px; color: var(--muted); }
.seo-content strong { color: var(--text); }
.seo-content ul { margin: 0 0 14px; padding-left: 20px; color: var(--muted); }
.seo-content li { margin-bottom: 6px; }

.seo-content .faq { margin: 8px 0 14px; }

.seo-content .faq details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.seo-content .faq summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--text);
}

.seo-content .faq details p {
    margin: 10px 0 2px;
    color: var(--muted);
}

.seo-content .seo-note {
    font-size: 13px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    color: var(--muted);
}

@media (max-width: 600px) {
    .stream-btn-row-flex > * {
        flex: 0 0 50% !important;
        width: 50% !important;
        padding: 2px 6px !important;
        font-size: 10px !important;
        line-height: 1.2 !important;
    }
    .player-btn-row .stream-btn {
        padding: 2px 6px !important;
        font-size: 10px !important;
        line-height: 1.2 !important;
    }
}

@media (min-width: 601px) {
    .stream-btn-row-flex > * {
        flex: 0 0 25% !important;
    }
}
