/* ═══════════════════════════════════════════
   StreamBox — Netflix-inspired Dark Theme
   ═══════════════════════════════════════════ */

:root {
    --bg: #0a0a0a;
    --bg-card: #141414;
    --bg-elevated: #1a1a1a;
    --bg-input: #222;
    --border: #2a2a2a;
    --text: #e5e5e5;
    --text-muted: #888;
    --text-dim: #555;
    --accent: #e50914;
    --accent-hover: #f40612;
    --accent-glow: rgba(229, 9, 20, 0.3);
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 20px var(--accent-glow); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text-muted); background: var(--bg-elevated); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }

/* ── Header ── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-icon {
    color: var(--accent);
    font-size: 18px;
}

.logo-accent { color: var(--accent); }

.main-nav {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.nav-link:hover { color: #fff; background: var(--bg-elevated); }
.nav-link.active { color: #fff; }

.header-search {
    position: relative;
    flex: 1;
    max-width: 400px;
    margin-left: auto;
}

.header-search input {
    width: 100%;
    padding: 8px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.header-search input:focus { border-color: var(--accent); }

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 4px;
    display: none;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.search-results.visible { display: block; }

.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text);
    transition: background 0.15s;
}

.search-result-item:hover { background: var(--bg-elevated); }
.search-result-item img { width: 32px; height: 32px; border-radius: 4px; object-fit: contain; background: var(--bg-input); }
.sr-name { font-size: 13px; font-weight: 500; }
.sr-group { font-size: 11px; color: var(--text-muted); }

.search-result-all {
    display: block;
    padding: 10px 14px;
    text-align: center;
    font-size: 13px;
    border-top: 1px solid var(--border);
    color: var(--accent);
}

.search-result-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* Mobile menu */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    transition: all 0.3s;
}

.mobile-nav {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px;
    z-index: 99;
}

.mobile-nav.open { display: flex; flex-direction: column; gap: 4px; }
.mobile-nav a { padding: 12px 16px; color: var(--text); font-size: 15px; border-radius: var(--radius-sm); }
.mobile-nav a:hover { background: var(--bg-elevated); }

/* ── Hero ── */
.hero {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a0a0e 50%, #0a0a0a 100%);
    padding: 80px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, var(--accent-glow) 0%, transparent 60%);
    pointer-events: none;
}

.hero-inner {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
}

.hero-title {
    font-size: 48px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 16px;
}

.text-accent { color: var(--accent); }

.hero-subtitle {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.hero-search {
    display: flex;
    max-width: 500px;
    margin: 0 auto 40px;
    gap: 8px;
}

.hero-search input {
    flex: 1;
    padding: 14px 20px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: #fff;
    font-size: 15px;
    outline: none;
}

.hero-search input:focus { border-color: var(--accent); }
.hero-search button { padding: 14px 28px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius); font-size: 15px; font-weight: 600; cursor: pointer; }
.hero-search button:hover { background: var(--accent-hover); }

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
}

.stat { text-align: center; }
.stat-num { display: block; font-size: 28px; font-weight: 700; color: #fff; }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* ── Sections ── */
.section { padding: 40px 24px; }
.section-inner { max-width: 1400px; margin: 0 auto; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-title { font-size: 22px; font-weight: 700; margin-bottom: 16px; }
.see-all { font-size: 14px; color: var(--text-muted); }
.see-all:hover { color: var(--accent); }

/* ── Channel Cards ── */
.channel-carousel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.channel-carousel::-webkit-scrollbar { height: 4px; }
.channel-carousel::-webkit-scrollbar-track { background: transparent; }
.channel-carousel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.channel-card {
    flex-shrink: 0;
    width: 200px;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    scroll-snap-align: start;
    text-decoration: none;
    color: var(--text);
}

.channel-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.card-thumb {
    width: 100%;
    height: 120px;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.card-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 16px;
}

.card-logo-placeholder {
    font-size: 28px;
    color: var(--text-dim);
    font-weight: 700;
}

.card-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 32px;
    opacity: 0;
    transition: opacity 0.2s;
}

.channel-card:hover .card-play { opacity: 1; }

.card-info { padding: 10px 12px; }
.card-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-group { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Category Grid ── */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text);
}

.category-card:hover {
    border-color: var(--accent);
    background: rgba(229, 9, 20, 0.05);
    transform: translateY(-2px);
}

.category-count { font-size: 24px; font-weight: 700; color: var(--accent); }
.category-name { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Indian category highlight */
.category-card.indian { border-color: #ff9933; background: rgba(255, 153, 51, 0.05); }
.category-card.indian:hover { border-color: #ff9933; background: rgba(255, 153, 51, 0.1); }
.category-card.indian .category-count { color: #ff9933; }

.group-count { font-size: 14px; font-weight: 400; color: var(--text-muted); }

/* ── CTA Section ── */
.cta-section {
    padding: 80px 24px;
    text-align: center;
    background: linear-gradient(to bottom, var(--bg), var(--bg-card));
}

.cta-inner { max-width: 600px; margin: 0 auto; }
.cta-inner h2 { font-size: 32px; font-weight: 700; margin-bottom: 12px; }
.cta-inner p { color: var(--text-muted); margin-bottom: 24px; }

/* ── Watch Page ── */
.watch-layout {
    display: flex;
    min-height: calc(100vh - 64px);
}

.watch-sidebar {
    width: 320px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.watch-sidebar .sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.watch-sidebar .sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
}

.sidebar-search, .sidebar-group-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 13px;
    outline: none;
    margin-bottom: 8px;
}

.sidebar-search:focus, .sidebar-group-select:focus { border-color: var(--accent); }

.sidebar-channels {
    flex: 1;
    overflow-y: auto;
}

.sidebar-channels::-webkit-scrollbar { width: 4px; }
.sidebar-channels::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sb-channel {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.sb-channel:hover { background: var(--bg-elevated); }
.sb-channel.active { background: rgba(229, 9, 20, 0.1); border-left: 3px solid var(--accent); }

.sb-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    object-fit: contain;
    flex-shrink: 0;
}

.sb-logo-ph {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-dim);
    flex-shrink: 0;
}

.sb-info { flex: 1; min-width: 0; }
.sb-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-group { font-size: 11px; color: var(--text-muted); }

.sidebar-footer {
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
}

/* ── Player ── */
.watch-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.player-wrapper { background: #000; }

.player-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #000;
}

.player-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.player-overlay, .player-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 5;
}

.player-overlay.hidden, .player-loading.hidden { display: none; }

.overlay-content { text-align: center; }
.overlay-content svg { opacity: 0.4; }
.overlay-content p { margin-top: 12px; color: var(--text-muted); font-size: 14px; }

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.player-loading p { margin-top: 12px; color: var(--text-muted); font-size: 14px; text-align: center; }

.player-error {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    padding: 12px 16px;
    background: rgba(229, 9, 20, 0.9);
    border-radius: var(--radius);
    font-size: 13px;
    z-index: 10;
}

.player-error.hidden { display: none; }

/* Now Playing Bar */
.now-playing-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.np-info { display: flex; align-items: center; gap: 12px; }

.np-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.np-status.live {
    background: rgba(229, 9, 20, 0.15);
    color: #ff4444;
}

.np-status.live::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #ff4444;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 1.5s infinite;
}

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

.np-channel { font-size: 14px; color: var(--text-muted); }

/* Channel Detail */
.channel-detail {
    padding: 20px;
}

.channel-detail.hidden { display: none; }

.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.detail-logo img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: var(--bg-input);
    object-fit: contain;
}

.detail-logo-ph {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
}

.detail-info h1 { font-size: 18px; font-weight: 600; }
.detail-group { font-size: 13px; color: var(--text-muted); }

/* ── Channels Browse Page ── */
.channels-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}

.channels-header {
    margin-bottom: 24px;
}

.channels-header h1 { font-size: 28px; font-weight: 700; }
.channels-header p { color: var(--text-muted); margin-top: 8px; }

.channels-filters { margin-bottom: 24px; }

.filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-search {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: #fff;
    font-size: 14px;
    outline: none;
}

.filter-search:focus { border-color: var(--accent); }

.filter-select {
    padding: 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: #fff;
    font-size: 14px;
    outline: none;
    min-width: 180px;
}

.filter-sort { min-width: 140px; }
.filter-info { margin-top: 8px; font-size: 13px; color: var(--text-muted); }

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.load-more-container {
    display: flex;
    justify-content: center;
    padding: 32px;
}

/* ── Blog ── */
.blog-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
}

.blog-grid { display: grid; gap: 24px; }

.blog-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.blog-card-thumb img { width: 100%; height: 200px; object-fit: cover; }
.blog-card-body { padding: 16px; }
.blog-card-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.blog-card-body h2 { font-size: 18px; margin-bottom: 8px; }
.blog-card-body h2 a { color: var(--text); }
.blog-card-body h2 a:hover { color: var(--accent); }
.blog-card-body p { font-size: 14px; color: var(--text-muted); }
.read-more { font-size: 13px; color: var(--accent); display: inline-block; margin-top: 8px; }

.blog-sidebar .widget {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.widget-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }

/* Single post */
.single-post { max-width: 800px; }
.post-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.single-post h1 { font-size: 32px; font-weight: 700; margin-bottom: 20px; }
.post-featured { margin-bottom: 24px; border-radius: var(--radius); overflow: hidden; }
.post-content { font-size: 16px; line-height: 1.8; }
.post-content p { margin-bottom: 16px; }
.post-content h2 { font-size: 24px; margin: 32px 0 12px; }
.post-content h3 { font-size: 20px; margin: 24px 0 8px; }

/* ── Content Pages ── */
.content-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
}

.page-title { font-size: 32px; font-weight: 700; margin-bottom: 24px; }

.page-content {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-muted);
}

.page-content p { margin-bottom: 16px; }
.page-content h2 { font-size: 24px; color: var(--text); margin: 32px 0 12px; }
.page-content h3 { font-size: 20px; color: var(--text); margin: 24px 0 8px; }
.page-content ul, .page-content ol { margin-bottom: 16px; padding-left: 24px; }
.page-content li { margin-bottom: 8px; }

/* ── Ad Slots ── */
.ad-container {
    max-width: 1400px;
    margin: 16px auto;
    padding: 0 24px;
}

.ad-slot {
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    min-height: 90px;
}

/* ── Footer ── */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 48px 24px 24px;
    margin-top: 48px;
}

.footer-inner { max-width: 1200px; margin: 0 auto; }

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr;
    gap: 32px;
    margin-bottom: 32px;
}

.footer-col h4 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.footer-desc { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 6px; }
.footer-col a { color: var(--text-muted); font-size: 13px; }
.footer-col a:hover { color: var(--accent); }

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 13px;
    color: var(--text-dim);
}

/* ── Loading Placeholder ── */
.loading-placeholder {
    padding: 40px;
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
}

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Responsive ── */
@media (max-width: 1024px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .blog-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .main-nav { display: none; }
    .mobile-menu-btn { display: flex; }
    .header-search { max-width: 200px; }

    .hero { padding: 48px 16px; }
    .hero-title { font-size: 32px; }
    .hero-subtitle { font-size: 15px; }
    .hero-stats { gap: 24px; }
    .stat-num { font-size: 22px; }

    .watch-layout { flex-direction: column; }
    .watch-sidebar { width: 100%; max-height: 40vh; }
    .watch-main { min-height: 60vh; }

    .channels-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .channel-card { width: 160px; }
    .card-thumb { height: 90px; }

    .filter-bar { flex-direction: column; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }

    .section { padding: 24px 16px; }
    .section-title { font-size: 18px; }
}

@media (max-width: 480px) {
    .hero-search { flex-direction: column; }
    .hero-search button { width: 100%; }
    .header-search { display: none; }
}
