/* =============================================
   Wisery.live - Netflix-inspired Dark Theme
   TV & Radio Streaming Platform
   ============================================= */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-card: #1a1a1a;
    --bg-card-hover: #222;
    --bg-surface: #181818;
    --accent: #e50914;
    --accent-hover: #f40612;
    --accent-gradient: linear-gradient(135deg, #e50914, #ff6b35);
    --text-primary: #e5e5e5;
    --text-secondary: #808080;
    --text-muted: #555;
    --border: #2a2a2a;
    --success: #46d369;
    --warning: #f5c518;
    --danger: #e50914;
    --radius: 6px;
    --radius-lg: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.5);
    --transition: all 0.3s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Quality colors */
    --q-4k: #9b59b6;
    --q-fhd: #3498db;
    --q-hd: #46d369;
    --q-sd: #808080;
}

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

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }

/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0 4%;
    height: 64px;
    display: flex;
    align-items: center;
    background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, transparent 100%);
    transition: background 0.3s;
}
.navbar.scrolled {
    background: rgba(10,10,10,0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.nav-container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 32px;
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.logo-text .accent {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.nav-links {
    display: flex;
    gap: 4px;
}
.nav-link {
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    white-space: nowrap;
}
.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
    background: rgba(255,255,255,0.08);
}
.nav-link i { margin-right: 6px; font-size: 0.85rem; }
.nav-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: var(--transition);
    position: relative;
}
.nav-icon-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.fav-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}
.nav-hamburger { display: none; }

/* Search */
.search-wrapper { position: relative; }
.search-box {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    overflow: hidden;
    transition: width 0.3s ease;
}
.search-box.open {
    width: 320px;
    overflow: visible;
}
.search-box input {
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.search-results {
    position: absolute;
    top: 100%;
    right: 0;
    width: 420px;
    max-height: 500px;
    overflow-y: auto;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    margin-top: 8px;
    display: none;
    box-shadow: 0 8px 40px rgba(0,0,0,0.8);
    z-index: 9999;
}
.search-results.show { display: block; }
.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    transition: background 0.2s;
    cursor: pointer;
}
.search-result-item:hover { background: rgba(255,255,255,0.05); }
.search-result-item img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--bg-surface);
}
.search-result-item .sr-name { font-size: 0.9rem; font-weight: 500; }
.search-result-item .sr-meta { font-size: 0.75rem; color: var(--text-secondary); }

/* ===== MAIN CONTENT ===== */
.main-content {
    min-height: 100vh;
    padding-top: 64px;
}

/* ===== HERO ===== */
.hero {
    position: relative;
    height: 70vh;
    min-height: 500px;
    max-height: 800px;
    display: flex;
    align-items: flex-end;
    padding: 0 4% 60px;
    overflow: hidden;
}
.hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: 0;
}
.hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, var(--bg-primary) 0%, transparent 50%, rgba(0,0,0,0.4) 100%);
}
.hero-content {
    position: relative;
    z-index: 1;
    max-width: 600px;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--accent);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 16px;
}
.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 12px;
}
.hero-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
.hero-meta .quality-badge {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 700;
}
.hero-actions {
    display: flex;
    gap: 12px;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
}
.btn-primary {
    background: #fff;
    color: #000;
}
.btn-primary:hover { background: rgba(255,255,255,0.85); }
.btn-secondary {
    background: rgba(109,109,110,0.7);
    color: #fff;
}
.btn-secondary:hover { background: rgba(109,109,110,0.5); }
.btn-accent {
    background: var(--accent);
    color: #fff;
}
.btn-accent:hover { background: var(--accent-hover); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
}

/* ===== CONTENT ROWS ===== */
.content-section {
    padding: 20px 4% 0;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section-title {
    font-size: 1.3rem;
    font-weight: 700;
}
.section-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.section-link:hover { color: var(--accent); }

/* Horizontal Scroll Row */
.scroll-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 20px;
    scroll-snap-type: x mandatory;
}
.scroll-row::-webkit-scrollbar { display: none; }
.scroll-row-wrapper {
    position: relative;
}
.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: #fff;
    font-size: 1.1rem;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s;
}
.scroll-row-wrapper:hover .scroll-btn { opacity: 1; }
.scroll-btn.left { left: -8px; }
.scroll-btn.right { right: -8px; }
.scroll-btn:hover { background: rgba(229,9,20,0.8); }

/* ===== CHANNEL CARD ===== */
.channel-card {
    flex: 0 0 220px;
    scroll-snap-align: start;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    position: relative;
}
.channel-card:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    z-index: 5;
}
.card-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.card-thumb img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}
.card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}
.channel-card:hover .card-overlay { opacity: 1; }
.play-circle {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border-radius: 50%;
    font-size: 1.2rem;
    color: #fff;
}
.card-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    gap: 4px;
}
.badge {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-live { background: var(--accent); color: #fff; }
.badge-4k { background: var(--q-4k); color: #fff; }
.badge-fhd { background: var(--q-fhd); color: #fff; }
.badge-hd { background: var(--q-hd); color: #fff; }
.badge-sd { background: var(--q-sd); color: #fff; }
.card-flag {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 1.2rem;
}
.card-info {
    padding: 10px 12px;
}
.card-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-fav {
    position: absolute;
    bottom: 10px;
    right: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.2s;
    z-index: 6;
}
.card-fav:hover, .card-fav.active { color: var(--accent); }

/* ===== RADIO CARD ===== */
.radio-card {
    flex: 0 0 180px;
    scroll-snap-align: start;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}
.radio-card:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}
.radio-card-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.radio-card-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.radio-card .card-name { text-align: center; }

/* ===== COUNTRY PILLS ===== */
.country-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 20px;
}
.country-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: 50px;
    font-size: 0.85rem;
    transition: var(--transition);
}
.country-pill:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}
.country-pill .flag { font-size: 1.3rem; }
.country-pill .count { color: var(--text-secondary); font-size: 0.75rem; }

/* ===== BROWSE/GRID ===== */
.page-header {
    padding: 100px 4% 30px;
    background: linear-gradient(180deg, rgba(229,9,20,0.15) 0%, var(--bg-primary) 100%);
}
.page-header h1 { font-size: 2.2rem; font-weight: 800; }
.page-header p { color: var(--text-secondary); margin-top: 8px; }

.filter-bar {
    display: flex;
    gap: 12px;
    padding: 20px 4%;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar select, .filter-bar input {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--accent); }
.type-toggle {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}
.type-toggle button {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}
.type-toggle button.active {
    background: var(--accent);
    color: #fff;
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 0 4% 40px;
}
.channel-grid .channel-card { flex: none; }

/* ===== PLAYER PAGE ===== */
.player-wrapper {
    width: 100%;
    height: calc(100vh - 64px);
    background: #000;
    position: relative;
}
.player-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.player-info {
    padding: 24px 4%;
    display: flex;
    gap: 20px;
}
.player-details {
    flex: 1;
}
.player-details h1 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}
.player-details .channel-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: contain;
    background: var(--bg-card);
}
.player-meta {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.player-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}
.player-sidebar {
    width: 350px;
    flex-shrink: 0;
}
.sidebar-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}
.related-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.related-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--bg-card);
    border-radius: var(--radius);
    transition: background 0.2s;
}
.related-item:hover { background: var(--bg-card-hover); }
.related-item img {
    width: 60px;
    height: 40px;
    border-radius: 4px;
    object-fit: contain;
    background: var(--bg-surface);
}

/* ===== RADIO PLAYER ===== */
.radio-player-page {
    padding: 100px 4% 40px;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}
.radio-cover {
    width: 200px;
    height: 200px;
    margin: 0 auto 24px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 0 60px rgba(229,9,20,0.2);
}
.radio-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.radio-visualizer {
    width: 100%;
    max-width: 400px;
    height: 80px;
    margin: 24px auto;
}
.radio-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 24px 0;
}
.radio-play-btn {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border-radius: 50%;
    font-size: 1.5rem;
    color: #fff;
    transition: transform 0.2s;
}
.radio-play-btn:hover { transform: scale(1.1); }

/* ===== RADIO MINI PLAYER ===== */
.radio-mini-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(20,20,20,0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 999;
}
.mini-player-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.mini-player-info img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
}
.mini-player-name { font-size: 0.85rem; font-weight: 600; }
.mini-player-meta { font-size: 0.75rem; color: var(--text-secondary); }
.mini-player-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}
.mini-play-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border-radius: 50%;
    color: #fff;
}
.mini-volume {
    width: 80px;
    accent-color: var(--accent);
}
.mini-close-btn {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== EPG GUIDE ===== */
.epg-grid {
    padding: 20px 4%;
    overflow-x: auto;
}
.epg-table {
    width: 100%;
    border-collapse: collapse;
}
.epg-table th, .epg-table td {
    padding: 10px 16px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
}
.epg-table th {
    background: var(--bg-card);
    font-weight: 600;
    position: sticky;
    top: 0;
}
.epg-now { background: rgba(229,9,20,0.1); }

/* ===== FAVORITES ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}
.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); }

/* ===== FOOTER ===== */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 60px 4% 30px;
    margin-top: 60px;
}
.footer-container { max-width: 1400px; margin: 0 auto; }
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}
.footer-logo { margin-bottom: 16px; display: inline-block; }
.footer-desc { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; }
.footer-col h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 16px; }
.footer-col a {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 4px 0;
    transition: color 0.2s;
}
.footer-col a:hover { color: var(--text-primary); }
.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== LOADING ===== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius);
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 80px;
    right: 20px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    z-index: 9999;
    transform: translateX(120%);
    transition: transform 0.3s;
    box-shadow: var(--shadow);
}
.toast.show { transform: translateX(0); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .player-info { flex-direction: column; }
    .player-sidebar { width: 100%; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: rgba(10,10,10,0.98);
        padding: 20px;
        gap: 8px;
        border-bottom: 1px solid var(--border);
    }
    .nav-hamburger { display: flex; }
    .hero { height: 50vh; min-height: 350px; }
    .hero h1 { font-size: 2rem; }
    .channel-card { flex: 0 0 160px; }
    .radio-card { flex: 0 0 140px; }
    .channel-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .search-box.open { width: 240px; }
    .page-header h1 { font-size: 1.6rem; }
    .filter-bar { gap: 8px; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.5rem; }
    .hero-actions { flex-direction: column; }
    .btn { padding: 10px 20px; font-size: 0.9rem; }
    .channel-card { flex: 0 0 140px; }
}
