/* ==================================================================
   SportsStream — main stylesheet
   ================================================================== */

:root {
    --bg:          #0d1119;
    --bg-soft:     #121826;
    --panel:       #161d2c;
    --card:        #1a2233;
    --border:      #232d42;
    --text:        #e8ecf4;
    --text-soft:   #9aa7bf;
    --accent:      #ff7a18;
    --accent-2:    #ffb020;
    --live:        #ff2d55;
    --radius:      10px;
    --shadow:      0 8px 26px rgba(0, 0, 0, .35);
    --glow:        0 0 0 2px rgba(255, 122, 24, .35), 0 6px 26px rgba(255, 122, 24, .18);
}

html[data-theme="light"] {
    --bg:        #f4f6fb;
    --bg-soft:   #ffffff;
    --panel:     #ffffff;
    --card:      #f7f9fc;
    --border:    #dde3ee;
    --text:      #101828;
    --text-soft: #5b6b85;
    --shadow:    0 8px 26px rgba(16, 24, 40, .10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Montserrat, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
img { max-width: 100%; }
.muted { color: var(--text-soft); font-size: 12px; }

/* ---------- navbar ---------- */
.navbar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 12px 22px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 200;
}
.navbar__brand img { display: block; }
.navbar__links { display: flex; gap: 6px; flex-wrap: wrap; }
.navbar__links a {
    color: var(--text);
    padding: 7px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
}
.navbar__links a:hover { background: var(--card); color: var(--accent); }
.navbar__right { margin-left: auto; }
.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
    padding: 4px;
    border-radius: 5px;
    background: var(--accent);
    color: #17110a;
    font-size: 11px;
}
.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 16px;
    cursor: pointer;
}

/* ---------- category bar ---------- */
.catbar {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 9px 22px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}
.catbar::-webkit-scrollbar { display: none; }
.catbar__item {
    white-space: nowrap;
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-soft);
    border: 1px solid transparent;
}
.catbar__item:hover { color: var(--text); background: var(--card); }
.catbar__item.is-active { background: var(--accent); color: #17110a; }

/* ---------- layout ---------- */
.main { max-width: 1240px; margin: 0 auto; padding: 22px; }
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 0 12px;
}
.section-head h1, .section-head h2 { font-size: 21px; margin: 0; font-weight: 800; letter-spacing: -.2px; }

/* ---------- search ---------- */
.search { margin: 14px 0; }
.search--with-tz { display: flex; gap: 10px; flex-wrap: wrap; }
.search input, .search select {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: var(--radius);
    font: inherit;
    min-width: 220px;
}
.search input { flex: 1; }

/* ---------- schedule ---------- */
.schedule__day { margin-bottom: 26px; }
.schedule__dayTitle {
    font-weight: 800;
    font-size: 13px;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--text-soft);
    margin-bottom: 10px;
}
.schedule__category {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 9px;
    overflow: hidden;
    background: var(--panel);
}
.schedule__catHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 14px;
    cursor: pointer;
    background: var(--card);
    font-weight: 700;
}
.schedule__catHeader:hover { color: var(--accent); }
.schedule__categoryBody { display: none; }
.schedule__category.is-expanded .schedule__categoryBody { display: block; }
.schedule__event { border-top: 1px solid var(--border); }
.schedule__eventHeader {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
}
.schedule__eventHeader:hover { background: var(--card); }
.schedule__time {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--accent);
    min-width: 58px;
    font-size: 13px;
}
.schedule__eventTitle { flex: 1; font-weight: 600; }
.schedule__event.is-open .schedule__eventHeader { background: var(--card); }
.schedule__channels {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px 12px 84px;
}
.schedule__event.is-open .schedule__channels { display: flex; }
.schedule__channels a {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}
.schedule__channels a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- watch page ---------- */
.watch__notice {
    display: flex;
    gap: 11px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 16px;
    color: var(--text-soft);
    font-size: 12.5px;
}
.watch__notice i { color: var(--accent); margin-top: 2px; }
.watch__notice p { margin: 0 0 5px; }
.watch__title { font-size: 22px; font-weight: 800; margin: 6px 0 14px; }
.badge-live {
    background: var(--live);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 20px;
    vertical-align: middle;
    letter-spacing: .6px;
}

.watch { display: flex; gap: 16px; align-items: flex-start; }
.watch__player { flex: 2; min-width: 0; }
.watch__side {
    flex: 1;
    min-width: 280px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px;
}

.watch__playerFrame {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--accent);
    box-shadow: var(--glow);
    min-height: 500px;
}
.watch__playerFrame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.watch__actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.watch__actionsRight { margin-left: auto; }
.btn-group { display: flex; gap: 7px; flex-wrap: wrap; }
.watch__group { margin-bottom: 16px; }
.watch__group label { display: block; font-size: 12px; font-weight: 700; color: var(--text-soft); margin-bottom: 6px; }
.watch__group textarea, .watch__group input {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-soft);
    border-radius: 8px;
    padding: 9px;
    font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace;
    resize: vertical;
}
.watch__chans { display: flex; flex-wrap: wrap; gap: 6px; }
.watch__chans a {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 5px 10px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text);
}
.watch__chans a:hover { border-color: var(--accent); color: var(--accent); }
.watch__back { margin: 20px 0; }

/* ---------- buttons ---------- */
.btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 8px;
    font: 600 13px Montserrat, Arial, sans-serif;
    cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: #17110a; }
.btn--accent:hover { background: var(--accent-2); color: #17110a; }
.btn--ghost { background: transparent; }
.player-btn.is-active { background: var(--accent); border-color: var(--accent); color: #17110a; }

/* ==================================================================
   ADS
   ================================================================== */
.site-ad { margin: 18px auto; text-align: center; }

.ad-slot { margin: 14px auto; text-align: center; position: relative; }
.ad-slot__label {
    display: inline-block;
    font-size: 9px;
    letter-spacing: 1px;
    font-weight: 800;
    color: var(--text-soft);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    margin-bottom: 5px;
}
.ad-slot__inner { margin: 0 auto; }
.ad-slot__inner img { display: block; margin: 0 auto; }

/* --- THE in-player ad -------------------------------------------
   .ad-slot--player_in sits inside .watch__playerFrame when the mode
   is "overlay", so it scales with the video box.  Width/height come
   from the admin panel (see /admin/ads.php). */
.ad-slot--player_in .ad-slot__inner { max-width: 100%; }

.ad-slot--overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 8, 12, .70);
    margin: 0;
    transition: opacity .25s ease;
}
.ad-slot--overlay.is-dismissed { opacity: 0; }
.ad-slot--overlay .ad-slot__overlay { position: relative; max-width: 96%; text-align: center; }
.ad-slot--overlay .ad-slot__inner { margin: 0 auto; }
.ad-slot--overlay .ad-slot__close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 0;
    background: var(--accent);
    color: #17110a;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    box-shadow: var(--shadow);
}
.ad-slot--overlay .ad-slot__close:disabled { background: #4a5468; color: #c7cede; cursor: not-allowed; }
.ad-slot--overlay .ad-slot__timer {
    margin-top: 8px;
    font-size: 11.5px;
    font-weight: 600;
    color: #cfd7e6;
    text-shadow: 0 1px 3px #000;
}

/* non-overlay player ad: full-width friendly */
.ad-slot--above, .ad-slot--below { margin: 12px auto; }

/* header / footer / sidebar ad sizing is inline (from the DB) */
.ad-slot--sidebar .ad-slot__inner img { max-width: 100%; }

/* ---------- 24/7 channels ---------- */
.chan-group { margin-bottom: 26px; }
.chan-group__title { font-size: 16px; font-weight: 800; margin: 0 0 10px; }
.chan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 9px;
}
.chan-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 13px;
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
}
.chan-card:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.chan-card__play { color: var(--accent); }

/* ---------- forms / notices ---------- */
.form label { display: block; margin-bottom: 12px; font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.form input, .form textarea, .form select {
    display: block;
    width: 100%;
    margin-top: 5px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 9px 12px;
    border-radius: 8px;
    font: inherit;
}
.form--narrow { max-width: 560px; }
.notice { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 600; }
.notice--ok  { background: rgba(46, 200, 120, .12); border: 1px solid rgba(46, 200, 120, .4); }
.notice--err { background: rgba(255, 45, 85, .12);  border: 1px solid rgba(255, 45, 85, .4); }
.empty {
    background: var(--panel);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 26px;
    text-align: center;
    color: var(--text-soft);
}
.prose { max-width: 760px; color: var(--text-soft); }
.prose h2 { color: var(--text); font-size: 16px; margin-top: 22px; }

/* ---------- footer ---------- */
.footer {
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
    margin-top: 34px;
    padding: 24px 22px;
    color: var(--text-soft);
    font-size: 12px;
}
.footer__inner { max-width: 1240px; margin: 0 auto; text-align: center; }
.footer__note { max-width: 780px; margin: 8px auto; opacity: .75; }
.footer__links a { color: var(--text-soft); }
.footer__links a:hover { color: var(--accent); }

/* ---------- chat drawer ---------- */
.chat-tab {
    position: fixed;
    right: 0;
    top: 42%;
    z-index: 300;
    background: var(--accent);
    color: #17110a;
    border: 0;
    border-radius: 8px 0 0 8px;
    padding: 12px 9px;
    font: 800 11px Montserrat, Arial, sans-serif;
    cursor: pointer;
    writing-mode: vertical-rl;
}
.chat-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    max-width: 92vw;
    height: 100%;
    background: var(--panel);
    border-left: 1px solid var(--border);
    z-index: 320;
    transform: translateX(100%);
    transition: transform .25s ease;
    display: flex;
    flex-direction: column;
}
html.chat-hidden .chat-drawer { transform: translateX(100%); }
html:not(.chat-hidden) .chat-drawer { transform: translateX(0); }
.chat-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}
.chat-drawer__head button { background: none; border: 0; color: var(--text); font-size: 22px; cursor: pointer; }
.chat-drawer__body { flex: 1; overflow: hidden; }
.chat-drawer__body iframe { width: 100%; height: 100%; border: 0; }

/* ---------- theater mode ---------- */
.theater-mode .catbar,
.theater-mode .footer,
.theater-mode .site-ad,
.theater-mode .watch__side,
.theater-mode .watch__notice,
.theater-mode .chat-tab { display: none; }
.theater-mode .main { max-width: 96%; }
.theater-mode .watch__playerFrame { height: 74vh; min-height: 0; }
.theater-mode .navbar { position: static; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
    .navbar__links { display: none; }
    .nav-toggle { display: inline-block; }
    .navbar { flex-wrap: wrap; }
    html.drawer-open .navbar__links {
        display: flex;
        flex-direction: column;
        width: 100%;
        order: 3;
        padding-top: 8px;
    }
    .watch { flex-direction: column; }
    .watch__side { width: 100%; min-width: 0; }
    .watch__playerFrame { min-height: 230px; }
    .chat-tab { top: auto; bottom: 16px; writing-mode: horizontal-tb; border-radius: 20px 0 0 20px; }
}

@media (max-width: 700px) {
    .main { padding: 14px; }
    .schedule__channels { padding-left: 14px; }
    .watch__title { font-size: 18px; }
    .ad-slot--overlay .ad-slot__inner { max-width: 94%; }
    .chan-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
