/* ==========================================================================
   LiveBD TV — Premium public theme (light, mobile-first, professional)
   ========================================================================== */

:root {
    --primary: #e11d48;
    --secondary: #0f172a;
    --accent: #f59e0b;
    --primary-rgb: 225, 29, 72;

    --bg: #eef1f8;
    --bg-2: #f7f8fc;
    --surface: #ffffff;
    --text: #0b1220;
    --muted: #64748b;
    --border: #e7eaf3;
    --live: #ef4444;

    --radius: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-sm: 0 4px 14px rgba(15, 23, 42, .07);
    --shadow: 0 14px 40px rgba(15, 23, 42, .12);
    --shadow-lg: 0 28px 70px rgba(15, 23, 42, .20);
    --glow: 0 10px 30px rgba(var(--primary-rgb), .35);

    --header-h: 66px;
    --maxw: 1240px;
    --font: 'Hind Siliguri', 'Plus Jakarta Sans', 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ---- Dark mode (toggled via <html data-theme="dark">) ---- */
html[data-theme="dark"] {
    --bg: #0b1220;
    --bg-2: #111a2e;
    --surface: #161f33;
    --text: #e8edf7;
    --muted: #93a1bd;
    --border: #243049;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, .45);
    --shadow: 0 14px 40px rgba(0, 0, 0, .55);
    --shadow-lg: 0 28px 70px rgba(0, 0, 0, .7);
}
html[data-theme="dark"] body {
    background:
        radial-gradient(1200px 500px at 100% -10%, rgba(var(--primary-rgb), .14), transparent 60%),
        radial-gradient(900px 500px at -10% 0%, rgba(245, 158, 11, .10), transparent 55%),
        var(--bg);
}
html[data-theme="dark"] .site-header { background: rgba(13, 19, 33, .78); border-bottom-color: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .search-box input { background: rgba(255, 255, 255, .06); color: var(--text); }
html[data-theme="dark"] .search-box input:focus { background: rgba(255, 255, 255, .1); }
html[data-theme="dark"] .nav-chip { background: rgba(255, 255, 255, .05); }
html[data-theme="dark"] .btn-ghost { background: rgba(255, 255, 255, .07); color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .bottom-nav { background: rgba(13, 19, 33, .94); border-top-color: var(--border); }
html[data-theme="dark"] .theme-toggle { background: rgba(255, 255, 255, .07); border-color: var(--border); color: var(--text); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
    background:
        radial-gradient(1200px 500px at 100% -10%, rgba(var(--primary-rgb), .08), transparent 60%),
        radial-gradient(900px 500px at -10% 0%, rgba(245, 158, 11, .08), transparent 55%),
        var(--bg);
    background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
::selection { background: rgba(var(--primary-rgb), .2); }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ============================ Header ============================ */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255, 255, 255, .72);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, .6);
    box-shadow: var(--shadow-sm);
}

/* mobile-first: brand + toggle on row 1, full-width search on row 2 */
.header-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 0; min-height: 58px; }
.brand { order: 1; }
.theme-toggle { order: 2; margin-left: auto; }
.search-box { order: 3; flex: 1 1 100%; }
.header-top > .live-pill { order: 4; }

.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 1.18rem; letter-spacing: -.01em; }
.brand-logo {
    width: 42px; height: 42px; border-radius: 13px; position: relative;
    display: grid; place-items: center; color: #fff; font-size: 1.35rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: var(--glow);
}
.brand-logo::after {
    content: ''; position: absolute; inset: 0; border-radius: 13px;
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35);
}
.brand-logo-img { overflow: hidden; background: #fff; }
.brand-logo-img img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.brand-name { line-height: 1.02; }
.brand-name small { display: block; font-size: .6rem; font-weight: 600; color: var(--muted); letter-spacing: .03em; margin-top: 2px; }

.live-pill {
    display: inline-flex; align-items: center; gap: 6px;
    background: linear-gradient(135deg, var(--live), #b91c1c);
    color: #fff; font-size: .66rem; font-weight: 800; letter-spacing: .1em;
    padding: 5px 11px; border-radius: 999px; box-shadow: 0 6px 16px rgba(239, 68, 68, .4);
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: livePulse 1.3s infinite; }
@keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .85); }
    70% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.header-spacer { flex: 1; }

.theme-toggle {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border);
    background: rgba(255, 255, 255, .9); color: var(--secondary); display: grid; place-items: center;
    font-size: 1.15rem; box-shadow: var(--shadow-xs); transition: transform .2s, background .2s;
}
.theme-toggle:hover { transform: translateY(-2px) rotate(-12deg); }

.search-box { position: relative; }
.search-box input {
    width: 100%; height: 46px; border: 1.5px solid var(--border); border-radius: 999px;
    padding: 0 42px 0 44px; background: var(--bg-2); font-size: .92rem; color: var(--text);
    font-family: inherit; transition: box-shadow .25s, border-color .25s, background .25s;
}
.search-box input::placeholder { color: var(--muted); }
.search-box input:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .14); }
.search-box svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--primary); pointer-events: none; }
.search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: none; border-radius: 50%;
    background: var(--border); color: var(--text); font-size: .8rem; display: grid; place-items: center; cursor: pointer; }
.search-clear:hover { background: var(--primary); color: #fff; }

/* live search dropdown */
.search-results {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 200;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: var(--shadow-lg); max-height: 60vh; overflow-y: auto; padding: 6px;
}
.search-results .sr-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; transition: background .15s; }
.search-results .sr-item:hover { background: var(--bg-2); }
.sr-logo { width: 38px; height: 38px; border-radius: 9px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; background: #fff; border: 1px solid var(--border); }
.sr-logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.sr-logo.sr-mono { color: #fff; font-weight: 800; font-size: .78rem; background: linear-gradient(135deg, var(--primary), var(--accent)); border: 0; }
.sr-name { font-weight: 600; font-size: .9rem; }
.sr-name small { color: var(--muted); font-weight: 500; }
.sr-empty { padding: 16px; text-align: center; color: var(--muted); font-size: .85rem; }
html[data-theme="dark"] .sr-logo, html[data-theme="dark"] .sr-logo img { background: #fff; }

/* nav row (2nd line) */
.header-nav { display: flex; gap: 9px; padding: 9px 0; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--border); scroll-snap-type: x proximity; }
.header-nav::-webkit-scrollbar { display: none; }
.nav-chip {
    flex: 0 0 auto; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 15px; border-radius: 999px; font-size: .85rem; font-weight: 700;
    background: rgba(255, 255, 255, .9); border: 1px solid var(--border); color: var(--secondary);
    transition: all .25s; box-shadow: var(--shadow-xs);
}
.nav-chip:hover, .nav-chip.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; border-color: transparent; transform: translateY(-2px); box-shadow: var(--glow);
}

/* ============================ Live ticker (marquee) ============================ */
.ticker {
    display: flex; align-items: stretch; gap: 0; overflow: hidden; position: relative;
    background: linear-gradient(90deg, var(--secondary), #1e293b);
    border-radius: 14px; margin: 16px 0 4px; box-shadow: var(--shadow-sm);
}
.ticker-label {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; z-index: 2;
    background: linear-gradient(135deg, var(--live), #b91c1c); color: #fff; font-weight: 800;
    font-size: .74rem; letter-spacing: .08em; padding: 10px 14px; box-shadow: 6px 0 16px rgba(0,0,0,.25);
}
.ticker-track { display: flex; align-items: center; white-space: nowrap; overflow: hidden; flex: 1; -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.ticker-move { display: inline-flex; align-items: center; gap: 28px; padding-left: 28px; animation: tickerScroll 32s linear infinite; }
.ticker:hover .ticker-move { animation-play-state: paused; }
.ticker-item { color: #e2e8f0; font-size: .82rem; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; }
.ticker-item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(239,68,68,.7); animation: livePulse 1.3s infinite; }
@keyframes tickerScroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ============================ Live hero (player only) ============================ */
.live-hero { margin: 18px 0 8px; }
.live-hero .hero-spotlight { aspect-ratio: 16/9; border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
@media (max-width: 760px) { .live-hero { margin: 12px 0 6px; } .live-hero .hero-spotlight { border-radius: 16px; } }

/* ============================ Hero spotlight ============================ */
.hero {
    margin: 20px 0 8px; border-radius: var(--radius); overflow: hidden; position: relative;
    color: #fff; box-shadow: var(--shadow); isolation: isolate;
    background: linear-gradient(125deg, var(--secondary) 0%, #182338 45%, var(--primary) 120%);
}
.hero::before {
    content: ''; position: absolute; inset: 0; z-index: -1;
    background:
        radial-gradient(600px 240px at 88% -20%, rgba(245, 158, 11, .55), transparent 60%),
        radial-gradient(500px 300px at 0% 120%, rgba(var(--primary-rgb), .5), transparent 60%);
}
.hero-inner { display: grid; grid-template-columns: 1fr; gap: 18px; padding: 26px 22px; position: relative; }
.hero-badges { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero h1 { font-size: 1.65rem; font-weight: 800; line-height: 1.18; letter-spacing: -.02em; }
.hero p { color: rgba(255, 255, 255, .82); font-size: .94rem; max-width: 560px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

.hero-spotlight {
    position: relative; border-radius: var(--radius-md); overflow: hidden;
    aspect-ratio: 16/9; background: rgba(0, 0, 0, .25); box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, .12);
}
.hero-spotlight .sp-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-spotlight .sp-logo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 12% 14%; background: radial-gradient(120% 120% at 50% 0%, #ffffff, #e9eef7 85%); }
.hero-spotlight .sp-fallback {
    position: absolute; inset: 0; width: 100%; height: 100%; display: grid; place-items: center; font-size: 2.6rem; font-weight: 800; color: #fff;
    background: linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.04));
}
.hero-spotlight .sp-play {
    position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .25);
    transition: background .25s;
}
.hero-spotlight:hover .sp-play { background: rgba(0, 0, 0, .4); }
.hero-spotlight .sp-play span {
    width: 64px; height: 64px; border-radius: 50%; background: rgba(255, 255, 255, .94); color: var(--primary);
    display: grid; place-items: center; box-shadow: var(--shadow-lg); transition: transform .25s;
}
.hero-spotlight:hover .sp-play span { transform: scale(1.08); }
.hero-spotlight .sp-meta { position: absolute; left: 12px; bottom: 12px; right: 12px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; z-index: 3; }
.sp-name { font-weight: 800; text-shadow: 0 2px 12px rgba(0,0,0,.85); background: linear-gradient(transparent, rgba(0,0,0,.0)); color: #fff; }

/* hero embedded auto-playing live player */
.hero-player { background: #000; }
.hero-player iframe, .hero-player .hls-video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
.hero-open {
    position: absolute; top: 10px; right: 10px; z-index: 4; width: 40px; height: 40px; border-radius: 11px;
    background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; font-size: 1.1rem;
    backdrop-filter: blur(4px); transition: background .2s, transform .2s;
}
.hero-open:hover { background: var(--primary); transform: translateY(-2px); }

/* ============================ Sections ============================ */
.section { margin: 30px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; }
.section-title { font-size: 1.18rem; font-weight: 800; display: flex; align-items: center; gap: 10px; letter-spacing: -.01em; }
.section-title .bar { width: 6px; height: 24px; border-radius: 5px; background: linear-gradient(var(--primary), var(--accent)); box-shadow: var(--glow); }
.section-more {
    font-size: .8rem; font-weight: 700; color: var(--primary); display: inline-flex; align-items: center; gap: 4px;
    padding: 7px 13px; border-radius: 999px; background: rgba(var(--primary-rgb), .08); transition: all .2s;
}
.section-more:hover { background: rgba(var(--primary-rgb), .15); transform: translateX(2px); }

/* ============================ Channel grid (2 cols mobile) ============================ */
.channel-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

.channel-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
    transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s, border-color .3s;
    animation: fadeUp .5s both;
}
.channel-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: rgba(var(--primary-rgb), .25); }

.card-thumb { position: relative; aspect-ratio: 4/3; overflow: hidden; border-radius: var(--radius-md); }

/* any-size image auto-fits proportionally — never cropped or stretched */
.poster-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.channel-card:hover .poster-cover { transform: scale(1.07); }
.poster-logo {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
    padding: 8%; background: radial-gradient(130% 130% at 50% 0%, #ffffff, #eef2f9 85%);
    transition: transform .45s;
}
.channel-card:hover .poster-logo { transform: scale(1.08); }

/* fresh animated placeholder — NO text */
.card-mono {
    position: absolute; inset: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, var(--secondary), var(--primary) 60%, var(--accent));
    background-size: 220% 220%; animation: monoShift 7s ease infinite;
}
.card-mono::before {
    content: ''; position: absolute; inset: 0; opacity: .18;
    background-image: radial-gradient(circle at 25% 25%, rgba(255,255,255,.6) 1px, transparent 1px);
    background-size: 16px 16px;
}
@keyframes monoShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.badge-live {
    position: absolute; top: 9px; left: 9px; display: inline-flex; align-items: center; gap: 5px;
    background: rgba(239, 68, 68, .96); color: #fff; font-size: .6rem; font-weight: 800; letter-spacing: .08em;
    padding: 4px 9px; border-radius: 999px; box-shadow: 0 4px 12px rgba(239, 68, 68, .5);
    backdrop-filter: blur(4px);
}
.badge-live .live-dot { width: 6px; height: 6px; }
.badge-views {
    position: absolute; top: 9px; right: 9px; font-size: .62rem; font-weight: 700; color: #fff;
    background: rgba(0, 0, 0, .45); padding: 4px 8px; border-radius: 999px; backdrop-filter: blur(4px);
    display: inline-flex; align-items: center; gap: 4px;
}

.play-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(11, 18, 32, 0); transition: background .3s; opacity: 0; }
.channel-card:hover .play-overlay { background: rgba(11, 18, 32, .4); opacity: 1; }
.play-overlay span {
    width: 54px; height: 54px; border-radius: 50%; background: rgba(255, 255, 255, .95); color: var(--primary);
    display: grid; place-items: center; transform: scale(.75); transition: transform .3s; box-shadow: var(--shadow-lg);
}
.channel-card:hover .play-overlay span { transform: scale(1); }

/* placeholder (no logo) cards: play button always visible + pulsing */
.card-thumb.no-logo .play-overlay { opacity: 1; background: rgba(11, 18, 32, .18); }
.card-thumb.no-logo .play-overlay span { transform: scale(1); animation: playPulse 2s ease-in-out infinite; }
.channel-card:hover .card-thumb.no-logo .play-overlay span { animation: none; transform: scale(1.08); }
@keyframes playPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,255,255,.5); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255,255,255,0); }
}

/* logo-only cards: no name text */

@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

/* ============================ Watch / player ============================ */
.player-wrap { background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); margin: 18px 0; border: 1px solid var(--border); }
.player-frame { position: relative; width: 100%; aspect-ratio: 16/9; }
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-frame .hls-video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; object-fit: contain; }
/* guard blocks click-through to YouTube — everything stays on the site */
.yt-guard { position: absolute; inset: 0; z-index: 2; cursor: pointer; background: transparent; display: block; }
.fs-btn { position: absolute; right: 10px; bottom: 10px; z-index: 3; width: 40px; height: 40px; border: none; border-radius: 11px;
    background: rgba(0,0,0,.55); color: #fff; font-size: 1.1rem; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(4px); transition: background .2s; }
.fs-btn:hover { background: var(--primary); }
.chip-country { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; color: var(--text); background: var(--bg-2); border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px; }

/* tap-for-sound overlay button */
.sound-cta {
    position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 5;
    display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
    background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
    font-weight: 800; font-size: .85rem; padding: 11px 20px; border-radius: 999px;
    box-shadow: 0 10px 28px rgba(0,0,0,.4); animation: soundPulse 1.8s infinite;
}
.sound-cta:hover { transform: translateX(-50%) translateY(-2px); }
@keyframes soundPulse {
    0%,100% { box-shadow: 0 10px 28px rgba(var(--primary-rgb),.5); }
    50% { box-shadow: 0 10px 36px rgba(var(--primary-rgb),.9); }
}
.sound-cta.faded { opacity: .55; animation: none; }
.sound-cta.faded:hover { opacity: 1; }

.watch-head { display: flex; align-items: center; gap: 13px; margin: 8px 0 16px; }
.watch-logo {
    width: 58px; height: 58px; border-radius: 16px; flex: 0 0 auto; overflow: hidden; display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 1.1rem; background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: var(--glow);
}
.watch-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; background: #fff; }
.watch-title { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }
.watch-meta { font-size: .8rem; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; margin-top: 3px; align-items: center; }
.chip-live { display: inline-flex; align-items: center; gap: 6px; color: #fff; background: var(--live); padding: 3px 10px; border-radius: 999px; font-weight: 800; font-size: .7rem; box-shadow: 0 4px 12px rgba(239,68,68,.4); }

.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 13px; font-weight: 700; font-size: .86rem; border: none;
    background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: var(--glow); transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-ghost { background: rgba(255, 255, 255, .9); color: var(--secondary); border: 1px solid var(--border); box-shadow: var(--shadow-xs); }
.btn-glass { background: rgba(255, 255, 255, .16); color: #fff; border: 1px solid rgba(255, 255, 255, .25); box-shadow: none; backdrop-filter: blur(6px); }

/* ============================ Footer ============================ */
.site-footer { background: linear-gradient(180deg, #0b1220, var(--secondary)); color: #cbd5e1; margin-top: 46px; padding: 38px 0 96px; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
.footer-brand { display: flex; align-items: center; gap: 11px; color: #fff; font-weight: 800; font-size: 1.12rem; margin-bottom: 10px; }
.footer-col h4 { color: #fff; font-size: .95rem; margin-bottom: 12px; }
.footer-col a { display: block; color: #94a3b8; font-size: .85rem; padding: 5px 0; transition: color .2s, transform .2s; }
.footer-col a:hover { color: var(--accent); transform: translateX(3px); }
.footer-social { display: flex; gap: 10px; margin-top: 12px; }
.footer-social a { width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .08); display: grid; place-items: center; color: #fff; transition: all .2s; }
.footer-social a:hover { background: linear-gradient(135deg, var(--primary), var(--accent)); transform: translateY(-3px); }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 26px; padding-top: 18px; text-align: center; font-size: .8rem; color: #64748b; }

/* ============================ Mobile bottom nav ============================ */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(16px); border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, .08); display: flex; justify-content: space-around;
    padding: 7px 0 calc(7px + env(safe-area-inset-bottom));
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .62rem; font-weight: 700; color: var(--muted); padding: 5px 14px; border-radius: 12px; transition: all .2s; }
.bottom-nav a.active { color: var(--primary); background: rgba(var(--primary-rgb), .1); }
.bottom-nav svg { width: 22px; height: 22px; }

/* ============================ Misc ============================ */
.alert { padding: 13px 16px; border-radius: 13px; font-size: .88rem; font-weight: 600; margin: 14px 0; box-shadow: var(--shadow-xs); }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .emoji { font-size: 3.2rem; }

/* ===== Ad slots ===== */
.ad-slot { margin: 18px auto; text-align: center; overflow: hidden; max-width: 100%; }
.ad-slot img, .ad-slot iframe, .ad-slot ins { max-width: 100%; }
.ad-in-feed { grid-column: 1 / -1; background: rgba(var(--primary-rgb), .04); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 8px; min-height: 40px; }
.ad-top, .ad-bottom, .ad-below-hero { background: rgba(var(--primary-rgb), .03); border-radius: var(--radius-sm); padding: 8px; }

/* ===== App Install popup ===== */
.app-popup-backdrop {
    position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px;
    background: rgba(8, 12, 22, .62); backdrop-filter: blur(4px);
    opacity: 0; transition: opacity .3s ease;
}
.app-popup-backdrop.show { opacity: 1; }
.app-popup {
    position: relative; width: 100%; max-width: 380px; text-align: center;
    background: var(--surface); color: var(--text); border-radius: 24px; padding: 30px 24px 26px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .5); border: 1px solid var(--border);
    transform: translateY(26px) scale(.92); opacity: 0; transition: transform .35s cubic-bezier(.2,.9,.3,1.2), opacity .35s;
}
.app-popup-backdrop.show .app-popup { transform: none; opacity: 1; }
.app-popup-close {
    position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font-size: 1rem; line-height: 1;
    display: grid; place-items: center; transition: transform .2s, background .2s;
}
.app-popup-close:hover { transform: rotate(90deg); background: var(--primary); color: #fff; border-color: transparent; }
.app-popup-icon {
    width: 78px; height: 78px; margin: 0 auto 14px; border-radius: 22px; display: grid; place-items: center; font-size: 2.4rem;
    background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: var(--glow);
    animation: popupFloat 2.4s ease-in-out infinite;
}
@keyframes popupFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.app-popup-title { font-size: 1.25rem; font-weight: 800; margin-bottom: 8px; }
.app-popup-text { font-size: .9rem; color: var(--muted); margin-bottom: 20px; line-height: 1.6; }
.app-popup-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px;
    border-radius: 14px; font-weight: 800; font-size: .95rem; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: var(--glow);
    transition: transform .2s, box-shadow .2s;
}
.app-popup-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.app-popup-ad { margin-top: 16px; }

.autofill-bar {
    position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 95;
    display: inline-flex; align-items: center; gap: 9px; white-space: nowrap;
    background: linear-gradient(135deg, var(--secondary), #1e293b); color: #fff;
    font-size: .82rem; font-weight: 700; padding: 11px 18px; border-radius: 999px;
    box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.12);
}
@media (min-width: 900px) { .autofill-bar { bottom: 24px; } }

/* ============================ Responsive ============================ */
@media (min-width: 600px) { .channel-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; } .hero h1 { font-size: 1.85rem; } }
@media (min-width: 860px) {
    .hero-inner { grid-template-columns: 1.05fr .95fr; align-items: center; padding: 32px 28px; }
    .hero h1 { font-size: 2.15rem; }
}
/* space for the fixed mobile bottom nav (footer removed) */
@media (max-width: 899px) { body { padding-bottom: calc(78px + env(safe-area-inset-bottom)); } }

@media (min-width: 900px) {
    .channel-grid { grid-template-columns: repeat(4, 1fr); }
    .bottom-nav { display: none; }
    .site-footer { padding-bottom: 38px; }
    .footer-grid { grid-template-columns: 2fr 1fr 1fr 1.4fr; }
    .watch-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
}
@media (min-width: 1150px) { .channel-grid { grid-template-columns: repeat(5, 1fr); } }

/* related list */
.related-list { display: flex; flex-direction: column; gap: 12px; }
.related-card { display: flex; gap: 11px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 9px; box-shadow: var(--shadow-xs); transition: transform .2s, box-shadow .2s; }
.related-card:hover { transform: translateX(4px); box-shadow: var(--shadow-sm); }
.related-thumb { width: 80px; height: 52px; border-radius: 10px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; font-weight: 800; background: linear-gradient(135deg, var(--primary), var(--accent)); overflow: hidden; }
.related-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 5px; background: #fff; }
.related-info { font-size: .82rem; min-width: 0; align-self: center; }
.related-info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.related-info small { color: var(--muted); }

/* ============================ Country grid ============================ */
.country-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.country-card {
    position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 14px 8px 11px; text-align: center; box-shadow: var(--shadow);
    transition: transform .28s cubic-bezier(.2,.8,.2,1), box-shadow .28s, border-color .28s;
    display: flex; flex-direction: column; align-items: center; gap: 5px; overflow: hidden;
    animation: fadeUp .5s both;
}
.country-card::before {
    content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent)); opacity: 0; transition: opacity .28s;
}
.country-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: rgba(var(--primary-rgb), .35); }
.country-card:hover::before { opacity: 1; }
.cc-flag {
    font-size: 1.55rem; line-height: 1; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%;
    background: radial-gradient(120% 120% at 50% 20%, #fff, #eef2f9); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm); transition: transform .28s;
}
.country-card:hover .cc-flag { transform: scale(1.1) rotate(-4deg); }
.cc-name { font-weight: 700; font-size: .76rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cc-count {
    font-size: .62rem; font-weight: 700; color: var(--primary); background: rgba(var(--primary-rgb), .1);
    padding: 2px 8px; border-radius: 999px;
}
.country-card.is-empty { opacity: .6; }
.country-card.is-empty:hover { opacity: 1; }
.country-card.is-empty .cc-count { color: var(--muted); background: var(--bg-2); }
html[data-theme="dark"] .cc-flag { background: radial-gradient(120% 120% at 50% 20%, #f8fafc, #e2e8f0); }

@media (min-width: 480px) { .country-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; } .cc-flag { width: 54px; height: 54px; font-size: 1.8rem; } .cc-name { font-size: .82rem; } }
@media (min-width: 768px) { .country-grid { grid-template-columns: repeat(6, 1fr); } .cc-flag { width: 60px; height: 60px; font-size: 2rem; } }
@media (min-width: 1024px) { .country-grid { grid-template-columns: repeat(8, 1fr); } }

/* ============================ Mobile & tablet polish ============================ */
/* desktop / tablet: single-row header with inline search on the right */
@media (min-width: 761px) {
    .header-top { flex-wrap: nowrap; min-height: var(--header-h); padding: 0; gap: 14px; }
    .brand { order: 1; }
    .header-top > .live-pill { order: 2; }
    .search-box { order: 3; flex: 0 1 360px; margin-left: auto; }
    .search-box input { height: 42px; }
    .theme-toggle { order: 4; margin-left: 0; }
}

@media (max-width: 760px) {
    /* Header: brand + toggle row, full-width modern search below */
    .brand { gap: 9px; font-size: 1rem; }
    .brand-logo { width: 38px; height: 38px; font-size: 1.2rem; border-radius: 11px; }
    .brand-name small { display: none; }            /* hide tagline on small screens */
    .header-top > .live-pill { display: none; }      /* redundant with hero badge */
    .theme-toggle { width: 44px; height: 44px; }

    /* Hero: compact, proportional, player stays a clean 16:9 */
    .hero { margin: 14px 0 6px; border-radius: 18px; }
    .hero-inner { padding: 16px; gap: 14px; }
    .hero-badges { gap: 8px; }
    .hero h1 { font-size: 1.5rem; line-height: 1.2; }
    .hero p { font-size: .85rem; }
    .hero-cta { gap: 8px; }
    .hero-cta .btn { padding: 10px 14px; font-size: .82rem; }
    .hero-spotlight { border-radius: 14px; }
    .hero-open { width: 36px; height: 36px; }

    /* Sections + cards tighter */
    .section { margin: 22px 0; }
    .section-title { font-size: 1.05rem; }
    .channel-grid { gap: 11px; }
}

@media (max-width: 380px) {
    .brand-name { font-size: .9rem; }
    .search-box input { font-size: .82rem; padding-left: 38px; }
    .hero h1 { font-size: 1.35rem; }
}

/* Tablet: balanced 2-column hero with a big player */
@media (min-width: 760px) and (max-width: 1000px) {
    .channel-grid { grid-template-columns: repeat(4, 1fr); }
}
