/* =====================================================
   UTAKO WEB PLAYER - NETFLIX-STYLE UI
   ===================================================== */

/* ==================== CSS VARIABLES / THEMES ==================== */

/* Tailwind CSS custom color fallbacks - ensure these always work */
:root,
[data-theme="netflix-dark"],
[data-theme="netflix-light"],
[data-theme="midnight"],
[data-theme="ocean"],
[data-theme="forest"],
[data-theme="sunset"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1f1f1f;
    --bg-hover: #2a2a2a;
    --accent: #e50914;
    --accent-hover: #f6121d;
    --accent-secondary: #f5c518;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #666666;
    --border-color: #2a2a2a;
    --overlay: rgba(0, 0, 0, 0.75);
    --shadow: rgba(0, 0, 0, 0.5);
    --card-radius: 6px;
    --modal-radius: 12px;
    --transition: 0.2s ease;
    --live-color: #e50914;
    --success: #46d369;
}

/* Fallback for Tailwind custom colors (in case CDN doesn't generate them) */
.bg-bg-primary { background-color: var(--bg-primary) !important; }
.bg-bg-secondary { background-color: var(--bg-secondary) !important; }
.bg-bg-tertiary { background-color: var(--bg-tertiary) !important; }
.bg-bg-hover { background-color: var(--bg-hover) !important; }
.bg-primary { background-color: var(--accent) !important; }
.bg-overlay { background-color: var(--overlay) !important; }
.text-text-primary { color: var(--text-primary) !important; }
.text-text-secondary { color: var(--text-secondary) !important; }
.text-text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--accent) !important; }
.border-border-color { border-color: var(--border-color) !important; }
.shadow-shadow { box-shadow: 0 4px 20px var(--shadow) !important; }

/* ==================== CSS VARIABLES / THEMES ==================== */
:root,
[data-theme="netflix-dark"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1f1f1f;
    --bg-hover: #2a2a2a;
    --accent: #e50914;
    --accent-hover: #f6121d;
    --accent-secondary: #f5c518;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #666666;
    --border-color: #2a2a2a;
    --overlay: rgba(0, 0, 0, 0.75);
    --shadow: rgba(0, 0, 0, 0.5);
    --card-radius: 6px;
    --modal-radius: 12px;
    --transition: 0.2s ease;
    --live-color: #e50914;
    --success: #46d369;
}

[data-theme="netflix-light"] {
    --bg-primary: #f5f5f1;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0eb;
    --bg-hover: #e8e8e3;
    --accent: #e50914;
    --accent-hover: #c40812;
    --accent-secondary: #f5c518;
    --text-primary: #141414;
    --text-secondary: #555555;
    --text-muted: #888888;
    --border-color: #e0e0db;
    --overlay: rgba(0, 0, 0, 0.5);
    --shadow: rgba(0, 0, 0, 0.1);
    --card-radius: 6px;
    --modal-radius: 12px;
    --transition: 0.2s ease;
    --live-color: #e50914;
    --success: #2ea04a;
}

[data-theme="midnight"] {
    --bg-primary: #0f0f23;
    --bg-secondary: #16162a;
    --bg-tertiary: #1e1e38;
    --bg-hover: #2a2a4a;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-secondary: #fbbf24;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #1e1e38;
    --overlay: rgba(0, 0, 0, 0.7);
    --shadow: rgba(0, 0, 0, 0.4);
    --card-radius: 8px;
    --modal-radius: 14px;
    --transition: 0.2s ease;
    --live-color: #7c3aed;
    --success: #34d399;
}

[data-theme="ocean"] {
    --bg-primary: #0a1929;
    --bg-secondary: #0f2847;
    --bg-tertiary: #143660;
    --bg-hover: #1a4275;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --accent-secondary: #fbbf24;
    --text-primary: #e0f2fe;
    --text-secondary: #7dd3fc;
    --text-muted: #38bdf8;
    --border-color: #1e3a5f;
    --overlay: rgba(0, 0, 0, 0.6);
    --shadow: rgba(0, 0, 0, 0.3);
    --card-radius: 8px;
    --modal-radius: 12px;
    --transition: 0.2s ease;
    --live-color: #38bdf8;
    --success: #34d399;
}

/* ==================== BASE STYLES ==================== */
* {
    box-sizing: border-box;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background var(--transition), color var(--transition);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
}

body.no-scroll {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input {
    font-family: inherit;
}

/* ==================== HEADER ==================== */
#mainHeader {
    background: rgba(10, 10, 10, 0.9);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    z-index: 100;
}

.header-scrolled,
#mainHeader.scrolled {
    background: var(--bg-primary) !important;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 60px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@media (max-width: 768px) {
    .header-inner {
        padding: 0 16px;
        height: 56px;
    }
}

.header-logo {
    transition: opacity var(--transition);
}

.header-logo:hover {
    opacity: 0.8;
}

.logo-icon {
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.25rem;
    color: var(--text-primary);
    letter-spacing: 2px;
}

.nav-item {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.nav-item:hover {
    color: var(--text-primary);
}

.nav-item.active {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .nav-item span {
        display: none;
    }
    .nav-item::after {
        content: attr(data-page);
        font-size: 0.75rem;
    }
}

.header-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}

.header-icon-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Theme Dropdown */
.theme-dropdown {
    position: relative;
}

.theme-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--modal-radius);
    padding: 8px;
    min-width: 180px;
    box-shadow: 0 8px 32px var(--shadow);
    z-index: 100;
}

.theme-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.theme-opt:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.theme-opt.active {
    color: var(--accent);
    font-weight: 600;
}

.theme-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ==================== HERO BANNER ==================== */
.hero-section {
    height: 38vh;
    min-height: 280px;
    max-height: 420px;
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

@media (max-width: 768px) {
    .hero-section {
        height: 36vh;
        min-height: 220px;
        max-height: 320px;
    }
}

.hero-backdrop {
    position: absolute;
    inset: 0;
    background-color: var(--bg-secondary);
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    transition: background-image 0.8s ease, opacity 0.5s ease;
}

.hero-backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 30%,
        rgba(0,0,0,0.3) 50%,
        var(--bg-primary) 100%
    );
}

.hero-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(
        to top,
        var(--bg-primary) 0%,
        transparent 100%
    );
    pointer-events: none;
}

.hero-content {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0 60px 80px;
    position: relative;
    z-index: 2;
}

@media (max-width: 768px) {
    .hero-content {
        padding: 0 16px 48px;
    }
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--accent);
    color: white;
}

.hero-channel {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin: 0 0 16px;
    max-width: 600px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
}

.hero-desc {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 0 12px;
}

.hero-time {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 24px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-play {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 16px rgba(229, 9, 20, 0.3);
}

.btn-play:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
}

.btn-info {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    background: rgba(109, 109, 110, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-info:hover {
    background: rgba(109, 109, 110, 0.5);
}

.hero-dots {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.hero-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: all var(--transition);
    border: none;
}

.hero-dot.active {
    background: white;
    transform: scale(1.2);
}

/* ==================== CAROUSELS ==================== */
.carousels-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 60px 32px;
    margin-top: -32px;
    position: relative;
    z-index: 10;
}

@media (max-width: 768px) {
    .carousels-section {
        padding: 0 16px 32px;
    }
}

.carousel-row {
    margin-bottom: 28px;
    padding-top: 12px;
}

.carousel-row:last-child {
    margin-bottom: 0;
}

.carousel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.carousel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: 0.02em;
}

.carousel-see-all {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
    transition: opacity var(--transition);
}

.carousel-see-all:hover {
    opacity: 0.8;
}

.carousel-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding-bottom: 16px;
    position: relative;
    min-height: 160px; /* Prevent rows from collapsing when empty */
}

.carousel-track::-webkit-scrollbar {
    display: none;
}

/* Scroll fade edges */
.carousel-track::before,
.carousel-track::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 16px;
    width: 60px;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition);
}

.carousel-track::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-primary), transparent);
}

.carousel-track::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-primary), transparent);
}

.carousel-track.scroll-left::before,
.carousel-track.scroll-right::after {
    opacity: 1;
}

/* ==================== CHANNEL CARD ==================== */
.channel-card {
    flex-shrink: 0;
    width: 220px !important;
    min-width: 220px;
    border-radius: var(--card-radius);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--bg-secondary);
}

.channel-card:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 8px 32px var(--shadow);
}

.channel-card-img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    background: var(--bg-tertiary);
}

.channel-card-img-wrap {
    position: relative;
    overflow: hidden;
}

.channel-card-img-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition);
}

.channel-card:hover .channel-card-img-wrap::after {
    opacity: 1;
}

.channel-card-live {
    position: absolute;
    top: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--live-color);
    color: white;
    text-transform: uppercase;
}

.channel-card-bookmark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all var(--transition);
    z-index: 5;
    color: white;
    border: none;
    cursor: pointer;
}

.channel-card:hover .channel-card-bookmark {
    opacity: 1;
}

.channel-card-bookmark.saved {
    opacity: 1;
    color: var(--accent);
}

.channel-card-body {
    padding: 12px;
}

.channel-card-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-card-now {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Placeholder card (no image) */
.channel-card-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 2rem;
}

/* ==================== LIVE DOT ==================== */
.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--live-color);
}

.animate-pulse .live-dot {
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ==================== FILTER PILLS ==================== */
.filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-pill:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.filter-pill.active {
    background: var(--text-primary);
    color: var(--bg-primary);
}

/* ==================== SEARCH ==================== */
.search-input {
    padding: 8px 12px 8px 36px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 220px;
    transition: all var(--transition);
    outline: none;
}

.search-input:focus {
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* ==================== CHANNEL GRID (for All Channels / Saved pages) ==================== */
.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

@media (max-width: 640px) {
    .channel-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    color: var(--text-muted);
}

/* ==================== EPG PAGE ==================== */
.epg-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
    flex-wrap: wrap;
    min-height: 56px;
}

.epg-close-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
    white-space: nowrap;
}
.epg-close-btn:hover {
    background: rgba(255,255,255,0.14);
}

.epg-timeline-header {
    height: 36px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
}

.epg-timeline-bar {
    position: relative;
    height: 100%;
    width: 100%;
    min-width: max-content;
}

.epg-timeline-marker {
    position: absolute;
    top: 0;
    height: 100%;
    border-left: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding-left: 4px;
}

.epg-tl-label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .epg-toolbar {
        padding: 8px 12px;
    }
    .epg-timeline-header {
        height: 28px;
    }
    .epg-tl-label {
        font-size: 10px;
    }
    .epg-close-btn span {
        display: none;
    }
}

.epg-timeline-now {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--accent);
    z-index: 10;
    transform: translateX(-1px);
}

.epg-timeline-now::before {
    content: '';
    position: absolute;
    top: 0;
    left: -4px;
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
}

@media (max-width: 768px) {
    .epg-toolbar {
        padding: 12px 16px;
    }
}

.epg-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.epg-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.epg-grid-container {
    height: calc(100vh - 64px - 56px - 36px);
    overflow: auto;
    padding: 0 0;
}

@media (max-width: 768px) {
    .epg-grid-container {
        padding: 0;
    }
}

.epg-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    color: var(--text-muted);
}

/* ==================== SPINNER ==================== */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-lg {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== BUTTONS ==================== */
.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-sm:hover {
    background: var(--bg-hover);
}

.btn-sm.btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-sm.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* ==================== VIDEO PLAYER OVERLAY ==================== */
.player-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 16px 24px;
}

.player-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    max-height: 50vh;
    aspect-ratio: 16/9;
    background: black;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* Floating close button - always visible, large hit area */
.player-overlay-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 250;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.75);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.player-overlay-close:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.05);
}

.player-video {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* Player Loading */
.player-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    z-index: 10;
}

/* Player Controls */
.player-controls {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.6) 0%,
        transparent 20%,
        transparent 70%,
        rgba(0,0,0,0.7) 100%
    );
}

.player-controls.visible,
.player-container:hover .player-controls {
    opacity: 1;
    pointer-events: auto;
}

.controls-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px;
}

.controls-channel {
    display: flex;
    align-items: center;
    gap: 12px;
}

.channel-logo-small {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: contain;
    background: var(--bg-secondary);
}

.channel-name {
    font-size: 1rem;
    font-weight: 600;
    color: white;
}

.live-badge-mini {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
}

.controls-top-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ctrl-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 40px;
    min-height: 40px;
    padding: 0 8px;
    border-radius: 8px;
    color: white;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(4px);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}

.ctrl-icon-btn:hover {
    background: rgba(255,255,255,0.2);
}

.ctrl-play-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}

.ctrl-play-center:hover {
    background: rgba(255,255,255,0.25);
    transform: translate(-50%, -50%) scale(1.1);
}

.controls-bottom {
    padding: 14px 20px 18px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.controls-progress {
    margin-bottom: 12px;
}

.progress-bar {
    position: relative;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    cursor: pointer;
    margin-bottom: 8px;
}

.progress-bar:hover {
    height: 6px;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.progress-thumb {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity var(--transition);
}

.progress-bar:hover .progress-thumb {
    opacity: 1;
}

.progress-time {
    display: flex;
    gap: 4px;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    color: rgba(255,255,255,0.8);
}

.controls-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
}

/* Program Info Overlay */
.player-program-info {
    position: absolute;
    bottom: 80px;
    left: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.player-controls.visible .player-program-info,
.player-container:hover .player-program-info {
    opacity: 1;
}

.program-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.5);
}

.program-meta {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
}

/* Now Playing */
.player-now-playing {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 52px;
    padding: 12px 24px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    gap: 16px;
    border-top: 1px solid var(--border-color);
}

.now-playing-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
    flex-shrink: 0;
}

.now-playing-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.now-playing-epg {
    font-size: 0.875rem;
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== PLAYER SIDEBAR ==================== */
.player-sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-pills {
    margin-top: 10px;
}

.sidebar-search {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-channel-list {
    flex: 1;
    overflow-y: auto;
}

.sidebar-channel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-channel-item:hover {
    background: var(--bg-tertiary);
}

.sidebar-channel-item.active {
    background: var(--bg-hover);
    border-left: 3px solid var(--accent);
}

.sidebar-channel-logo {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: contain;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.sidebar-channel-info {
    flex: 1;
    min-width: 0;
}

.sidebar-channel-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-channel-group {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ==================== EPG MINI PANEL ==================== */
.epg-mini-panel {
    position: absolute;
    top: 80px;
    right: 24px;
    width: 320px;
    max-height: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--modal-radius);
    box-shadow: 0 16px 48px var(--shadow);
    overflow: hidden;
    z-index: 20;
}

.epg-mini-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.epg-mini-list {
    overflow-y: auto;
    max-height: 340px;
}

.epg-mini-item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition);
}

.epg-mini-item:hover {
    background: var(--bg-tertiary);
}

.epg-mini-time {
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.epg-mini-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== CHANNEL DETAIL OVERLAY ==================== */
.detail-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 300;
    display: flex;
    justify-content: flex-end;
}

.detail-panel {
    width: 480px;
    max-width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    overflow-y: auto;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.detail-header {
    display: flex;
    justify-content: flex-end;
    padding: 16px;
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 1;
}

.detail-content {
    padding: 0 24px 40px;
}

.detail-banner {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: var(--card-radius);
    background: var(--bg-tertiary);
    margin-bottom: 20px;
}

.detail-channel-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.detail-channel-logo {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: contain;
    background: var(--bg-tertiary);
}

.detail-channel-info h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 6px;
}

.detail-channel-group {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--accent);
    color: white;
}

.detail-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.detail-btn-watch {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--accent);
    color: white;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
}

.detail-btn-watch:hover {
    background: var(--accent-hover);
}

.detail-btn-bookmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid var(--border-color);
}

.detail-btn-bookmark:hover {
    background: var(--bg-hover);
}

.detail-btn-bookmark.saved {
    color: var(--accent);
    border-color: var(--accent);
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.detail-epg-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-epg-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: background var(--transition);
}

.detail-epg-item:hover {
    background: var(--bg-hover);
}

.detail-epg-time {
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    min-width: 90px;
}

.detail-epg-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detail-epg-live {
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    background: var(--live-color);
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.detail-similar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.detail-similar-card {
    cursor: pointer;
    transition: transform var(--transition);
}

.detail-similar-card:hover {
    transform: scale(1.05);
}

.detail-similar-img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg-tertiary);
    margin-bottom: 4px;
}

.detail-similar-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== SEARCH MODAL ==================== */
.search-modal {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 400;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 120px;
}

.search-modal-content {
    width: 600px;
    max-width: calc(100vw - 32px);
    background: var(--bg-secondary);
    border-radius: var(--modal-radius);
    overflow: hidden;
    box-shadow: 0 24px 80px var(--shadow);
}

.search-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
}

.search-modal-input {
    flex: 1;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-primary);
    outline: none;
}

.search-modal-input::placeholder {
    color: var(--text-muted);
}

.search-kbd {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.search-hint {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-section {
    margin-bottom: 16px;
}

.search-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 12px 4px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--transition);
}

.search-result-item:hover {
    background: var(--bg-tertiary);
}

.search-result-img {
    width: 48px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.search-result-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.search-result-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==================== CHAT PANEL MINIMAL ==================== */
.chat-panel-minimal {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 360px;
    max-height: 500px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--modal-radius);
    box-shadow: 0 16px 48px var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 150;
}

@media (max-width: 480px) {
    .chat-panel-minimal {
        right: 8px;
        bottom: 8px;
        left: 8px;
        width: auto;
    }
}

.chat-mini-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
}

.chat-tabs-mini {
    display: flex;
    gap: 4px;
}

.chat-tab-mini {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.chat-tab-mini.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.chat-mini-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    max-height: 300px;
}

.chat-mini-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
}

.chat-emoji-btn-mini {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background var(--transition);
}

.chat-emoji-btn-mini:hover {
    background: var(--bg-hover);
}

.chat-mini-input {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color var(--transition);
}

.chat-mini-input:focus {
    border-color: var(--accent);
}

.chat-mini-send {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--accent);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.chat-mini-send:hover {
    background: var(--accent-hover);
}

/* ==================== DONATION BANNER ==================== */
.donation-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.donation-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.donation-text {
    flex: 1;
    min-width: 200px;
}

.donation-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.donation-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

.donation-actions {
    display: flex;
    gap: 10px;
}

.donation-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all var(--transition);
    border: none;
}

.donation-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ==================== MODALS ==================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-sm {
    background: var(--bg-secondary);
    border-radius: var(--modal-radius);
    width: 400px;
    max-width: 100%;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-body {
    padding: 20px;
}

.crypto-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.crypto-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.crypto-addr {
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
    word-break: break-all;
    background: var(--bg-tertiary);
    padding: 8px;
    border-radius: 4px;
}

.copy-btn-sm {
    align-self: flex-start;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid var(--border-color);
}

.copy-btn-sm:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Amazon Giftcard modal */
.amazon-notice {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}
.amazon-notice strong { color: var(--text-primary); }

.amazon-steps { display: flex; flex-direction: column; gap: 8px; }
.amazon-step {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.amazon-step strong { color: var(--accent); flex-shrink: 0; }
.amazon-step a { color: var(--accent); text-decoration: none; }
.amazon-step a:hover { text-decoration: underline; }

.amazon-method-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 20px 0 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}
.amazon-method-title:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }

.amazon-guide-img-wrap {
    margin: 12px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.amazon-guide-img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: contain;
    background: var(--bg-tertiary);
}

/* Light theme overrides */
[data-theme="light"] .donation-banner {
    background: #f5f5f7;
    border-top-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .donation-title { color: #1a1a2e; }
[data-theme="light"] .donation-sub { color: #555; }
[data-theme="light"] .donation-close { background: rgba(0,0,0,0.08); color: #555; border: 1px solid rgba(0,0,0,0.1); }
[data-theme="light"] .donation-close:hover { background: rgba(0,0,0,0.15); color: #1a1a2e; }
[data-theme="light"] .amazon-notice { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.1); color: #333; }
[data-theme="light"] .amazon-notice strong { color: #1a1a2e; }
[data-theme="light"] .amazon-step { color: #555; }
[data-theme="light"] .amazon-step strong { color: #e74d3c; }
[data-theme="light"] .amazon-step a { color: #e74d3c; }
[data-theme="light"] .amazon-method-title { color: #1a1a2e; border-top-color: rgba(0,0,0,0.1); }
[data-theme="light"] .amazon-guide-img-wrap { border-color: rgba(0,0,0,0.1); }
[data-theme="light"] .amazon-guide-img { background: rgba(0,0,0,0.04); }
[data-theme="light"] .copy-btn-sm { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.12); color: #333; }
[data-theme="light"] .copy-btn-sm:hover { background: #e74d3c; color: white; border-color: #e74d3c; }

/* ==================== FLASH NOTICE ==================== */
.flash-notice {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 600;
}

.flash-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--modal-radius);
    box-shadow: 0 8px 32px var(--shadow);
    font-size: 0.9rem;
    color: var(--text-primary);
    animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ==================== FOOTER ==================== */
.footer-minimal {
    padding: 32px 60px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

@media (max-width: 768px) {
    .footer-minimal {
        padding: 24px 16px;
    }
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-link {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: color var(--transition);
}

.footer-link:hover {
    color: var(--text-secondary);
}

/* ==================== HIDDEN UTILITY ==================== */
.hidden {
    display: none !important;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==================== TEXT UTILITIES ==================== */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.bg-primary { background: var(--bg-primary); }
.bg-secondary { background: var(--bg-secondary); }
.bg-tertiary { background: var(--bg-tertiary); }
.border-color { border-color: var(--border-color); }

/* ==================== FOCUS STATES ==================== */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ==================== MOBILE RESPONSIVE ADJUSTMENTS ==================== */
@media (max-width: 640px) {
    .hero-title {
        font-size: 1.75rem;
    }

    .hero-desc {
        font-size: 0.9rem;
    }

    .carousel-title {
        font-size: 1rem;
    }

    .detail-panel {
        width: 100%;
    }
}

/* ==================== HEADER SCROLLED STATE ==================== */
.header-scrolled {
    background: var(--bg-primary) !important;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
}

/* ==================== CHANNEL CARD (NETFLIX STYLE) ==================== */
.card-image-wrap {
    position: relative;
    overflow: hidden;
    border-radius: var(--card-radius);
    aspect-ratio: 16/10;
    background: var(--bg-tertiary);
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
}

.card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: var(--card-radius);
}

.channel-card:hover .card-overlay {
    opacity: 1;
}

.card-play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    box-shadow: 0 4px 16px rgba(229, 9, 20, 0.4);
}

.card-play-btn:hover {
    transform: scale(1.1);
    background: var(--accent-hover);
}

.card-bookmark-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
    z-index: 5;
}

.channel-card:hover .card-bookmark-btn,
.card-bookmark-btn.active {
    opacity: 1;
}

.card-bookmark-btn.active {
    color: var(--accent);
}

.card-info {
    padding: 12px 10px 10px;
}

.card-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.card-epg {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Override carousel track to use channel-card */
.carousel-track .channel-card {
    width: 200px;
}

/* ==================== CAROUSEL ARROWS ==================== */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 80px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 10;
    transition: opacity 0.2s ease, background 0.2s ease;
    border-radius: 4px;
}

.carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.8);
}

.carousel-arrow-left {
    left: 0;
    border-radius: 0 4px 4px 0;
}

.carousel-arrow-right {
    right: 0;
    border-radius: 4px 0 0 4px;
}

/* ==================== DETAIL PANEL STYLES ==================== */
.detail-hero {
    width: 100%;
    height: 200px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: var(--bg-tertiary);
    border-radius: var(--card-radius);
    margin-bottom: 20px;
    position: relative;
}

.detail-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--bg-secondary), transparent);
    border-radius: var(--card-radius);
}

.detail-logo {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: contain;
    background: var(--bg-tertiary);
}

.detail-channel-name {
    font-size: 1.4rem !important;
    font-weight: 700;
    margin: 0 0 6px !important;
}

.detail-group-badge {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--accent);
    color: white;
}

.detail-watch-btn {
    width: 100%;
    margin-bottom: 16px;
    font-size: 1rem !important;
}

.detail-actions-row {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.detail-action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition);
}

.detail-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.detail-action-btn.active {
    color: var(--accent);
    border-color: var(--accent);
}

.detail-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.detail-now-playing {
    margin-bottom: 20px;
}

.detail-now-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.detail-now-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.detail-epg-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-epg-item:last-child {
    border-bottom: none;
}

.detail-epg-time {
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    min-width: 50px;
}

.detail-epg-title {
    font-size: 0.85rem;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== SEARCH RESULTS ==================== */
.search-group-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 12px 4px;
}

.search-result-logo {
    width: 40px;
    height: 28px;
    object-fit: contain;
    background: var(--bg-tertiary);
    border-radius: 4px;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* ==================== EPG GRID ==================== */
.epg-grid {
    gap: 1px;
    position: relative;
}

.epg-sticky-header {
    position: sticky;
    top: 0;
    z-index: 4;
}

.epg-header-cell {
    padding: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.epg-time-label {
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    font-weight: 600;
}

.epg-channel-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    min-width: 120px;
}

.epg-channel-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 4px;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.epg-channel-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.epg-cell {
    padding: 6px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.epg-program-cell {
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: background 0.2s ease;
}

.epg-program-cell:hover {
    background: var(--bg-hover);
}

.epg-prog-title {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.epg-empty-cell {
    background: var(--bg-primary);
}

.epg-now-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent);
    z-index: 5;
    pointer-events: none;
    left: var(--now-offset, 50%);
    transform: translateX(-1px);
}

.epg-now-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
}

/* ==================== PLAYER CONTROLS ==================== */
.controls-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

.ctrl-play-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    z-index: 5;
}

.ctrl-play-center:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(0, 0, 0, 0.8);
}

.progress-bar {
    position: relative;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
    flex: 1;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.progress-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.progress-bar:hover .progress-thumb {
    opacity: 1;
}

.progress-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
    min-width: 100px;
    justify-content: center;
}

/* ==================== CHAT PANEL (ENHANCED) ==================== */
.chat-mini-join {
    padding: 12px 14px;
    border-top: 1px solid var(--border-color);
}

.chat-mini-join.hidden {
    display: none;
}

.chat-join-note {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 6px;
}

.chat-login-btn,
.chat-join-btn {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chat-login-btn:hover,
.chat-join-btn:hover {
    background: var(--accent-hover);
}

.chat-menu-btn {
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-line:hover .chat-menu-btn {
    opacity: 1;
}

/* ==================== CONTROLS ICON BUTTON ==================== */
.ctrl-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    font-weight: 500;
}

.ctrl-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.ctrl-icon-btn.close-player {
    color: rgba(255, 255, 255, 0.6);
}

.ctrl-icon-btn.close-player:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* ==================== PLAYER SIDEBAR CHANNEL LIST ==================== */
.sidebar-channel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-channel-item:hover {
    background: var(--bg-tertiary);
}

.sidebar-channel-item.active {
    background: var(--bg-hover);
    border-left: 3px solid var(--accent);
}

/* ==================== FLASH NOTICE ANIMATIONS ==================== */
.flash-notice {
    transition: opacity 0.3s ease;
}

.flash-notice.show {
    opacity: 1;
}

.flash-notice:not(.show) {
    opacity: 0;
}

/* ==================== NO-SCROLL BODY STATE ==================== */
body.no-scroll {
    overflow: hidden;
}

/* ==================== FOCUS RING ==================== */
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ==================== INLINE PLAYER VIEW (full viewport) ==================== */
.player-view {
    position: relative;
    background: #000;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.player-view.hidden { display: none; }

.pv-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 60px;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 20;
}
.pv-topbar-logo {
    width: 32px; height: 32px; border-radius: 6px; object-fit: contain;
    background: rgba(255,255,255,0.08); flex-shrink: 0;
}
.pv-channel-name { font-size: 1.1rem; font-weight: 700; color: white; }
.pv-live-badge {
    font-size: 0.7rem; font-weight: 700; padding: 3px 8px;
    background: var(--accent); border-radius: 3px; color: white;
}

.pv-body { display: flex; flex: 1; min-height: 0; }
.pv-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.pv-video-wrap {
    position: relative;
    background: #000;
    aspect-ratio: 16/9;
    width: 100%;
    max-height: min(calc(100vh - 140px), 56.25vw);
}
.pv-video { width: 100%; height: 100%; object-fit: contain; display: block; }

.pv-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.pv-overlay.hidden { display: none; }
.pv-play-center {
    width: 72px; height: 72px; border-radius: 50%;
    background: rgba(255,255,255,0.15); border: 2px solid rgba(255,255,255,0.3);
    color: white; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: transform 0.2s, background 0.2s;
}
.pv-play-center:hover { transform: scale(1.1); background: rgba(255,255,255,0.25); }
.pv-loading {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.6);
}

.pv-controls { background: rgba(0,0,0,0.85); padding: 12px 60px; }
.pv-ctrl-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.pv-ctrl-row { display: flex; align-items: center; gap: 8px; }
.pv-ctrl-btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; min-width: 40px; min-height: 40px; padding: 0 12px;
    border-radius: 6px; color: white; background: rgba(255,255,255,0.1);
    border: none; cursor: pointer; font-size: 0.8rem; transition: background 0.2s;
}
.pv-ctrl-btn:hover { background: rgba(255,255,255,0.2); }
.pv-ctrl-btn.pv-ctrl-label { font-weight: 600; }
.pv-volume {
    display: inline-flex; align-items: center; gap: 10px;
    min-height: 40px; padding: 0 4px;
}
.pv-vol-slider {
    width: 100px; height: 8px; -webkit-appearance: none; appearance: none;
    background: rgba(255,255,255,0.25); border-radius: 4px; outline: none; cursor: pointer;
    flex-shrink: 0; margin: 0; vertical-align: middle;
}
.pv-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 18px; height: 18px;
    border-radius: 50%; background: white; cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.pv-vol-slider::-moz-range-thumb {
    width: 18px; height: 18px; border-radius: 50%; background: white;
    border: none; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.pv-vol-slider::-moz-range-track {
    height: 8px; background: rgba(255,255,255,0.25); border-radius: 4px;
}

/* Sidebar: drawer ẩn mặc định, bật bằng nút "Channel list" */
.pv-sidebar {
    display: flex;
    flex-direction: column;
    width: 320px;
    max-width: 90vw;
    max-height: 100vh;
    overflow: hidden;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 24px rgba(0,0,0,0.4);
    transition: transform 0.25s ease;
}
.pv-sidebar-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(100%);
    background: rgba(10, 10, 10, 0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid rgba(255,255,255,0.08);
}
.pv-sidebar-drawer:not(.hidden) {
    transform: translateX(0);
}
.pv-sidebar.hidden {
    /* Giữ trong DOM nhưng kéo ra ngoài màn hình khi ẩn */
}
.pv-sidebar-header { padding: 16px; border-bottom: 1px solid var(--border-color); }
.pv-sidebar-header-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.pv-sidebar-title { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); }
.pv-sidebar-close { min-width: 32px; min-height: 32px; padding: 0; font-size: 1.25rem; line-height: 1; }
.pv-filter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-pill {
    padding: 4px 10px; border-radius: 20px; font-size: 0.75rem;
    background: var(--bg-tertiary); color: var(--text-secondary);
    border: 1px solid var(--border-color); cursor: pointer; transition: all 0.2s;
}
.filter-pill.active, .filter-pill:hover { background: var(--accent); color: white; border-color: var(--accent); }
.pv-sidebar-search { padding: 8px 16px; border-bottom: 1px solid var(--border-color); }
.pv-sidebar-search input {
    width: 100%; padding: 8px 12px; background: var(--bg-tertiary);
    border: 1px solid var(--border-color); border-radius: 6px;
    color: var(--text-primary); font-size: 0.85rem; outline: none;
}
.pv-sidebar-search input:focus { border-color: var(--accent); }
.pv-sidebar-list { flex: 1; overflow-y: auto; }
.pv-sidebar-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 16px;
    cursor: pointer; border-bottom: 1px solid var(--border-color); transition: background 0.2s;
}
.pv-sidebar-item:hover { background: var(--bg-tertiary); }
.pv-sidebar-item.active { background: var(--bg-hover); border-left: 3px solid var(--accent); }
.pv-sidebar-logo {
    width: 36px; height: 36px; border-radius: 4px; object-fit: contain;
    background: var(--bg-tertiary); flex-shrink: 0;
}
.pv-sidebar-info { flex: 1; min-width: 0; }
.pv-sidebar-name {
    font-size: 0.85rem; font-weight: 500; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-sidebar-group { font-size: 0.7rem; color: var(--text-muted); }

.pv-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 8px;
    background: rgba(255,255,255,0.1); border: none; color: white; cursor: pointer;
    transition: background 0.2s;
}
.pv-icon-btn:hover { background: rgba(255,255,255,0.2); }

/* ==================== MINI PLAYER ==================== */
.mini-player {
    position: fixed; bottom: 20px; right: 20px; z-index: 180;
    width: 320px; background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: 10px; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; transition: all 0.3s ease;
}
.mini-player.hidden { display: none; }
.mini-player-video-wrap { position: relative; aspect-ratio: 16/9; background: #000; cursor: pointer; }
.mini-player-video { width: 100%; height: 100%; object-fit: contain; }
.mini-player-info { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.mini-player-title {
    font-size: 0.85rem; font-weight: 600; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-player-epg {
    font-size: 0.75rem; color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-player-controls { display: flex; align-items: center; gap: 4px; padding: 6px 12px 10px; }
.mini-ctrl-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 6px;
    background: rgba(255,255,255,0.1); border: none; color: var(--text-secondary);
    cursor: pointer; transition: all 0.2s;
}
.mini-ctrl-btn:hover { background: rgba(255,255,255,0.2); color: white; }

/* Hero ẩn khi đang phát */
body.player-mode .hero-section { display: none; }
body.player-mode .carousels-section { display: none; }
body.mini-player-mode .hero-section { display: none; }
body.mini-player-mode .carousels-section { padding-bottom: 100px; }

/* ==================== RESPONSIVE: TABLET (768-900px) ==================== */
@media (max-width: 900px) {
    .pv-sidebar-drawer { width: 280px; max-width: 85vw; }
    .pv-topbar { padding: 10px 16px; }
    .pv-controls { padding: 8px 16px; }
    .mini-player { width: 200px; bottom: 12px; right: 12px; }
    .pv-ctrl-bottom { gap: 8px; flex-wrap: wrap; }
    .pv-ctrl-btn { min-width: 40px; min-height: 40px; padding: 0 8px; font-size: 0.75rem; }
    .pv-ctrl-label span { display: none; }
    .pv-volume { min-height: 40px; }
    .pv-vol-slider { width: 80px; height: 8px; }
    .pv-vol-slider::-webkit-slider-thumb { width: 16px; height: 16px; }
    .pv-video-wrap { max-height: min(calc(100vh - 160px), 56.25vw); }
    .carousel-track { scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
    .carousel-track .channel-card { scroll-snap-align: start; flex-shrink: 0; }
    .hero-content { padding: 0 24px 56px; }
    .header-inner { padding: 0 24px; }
}

/* ==================== RESPONSIVE: MOBILE (<768px) ==================== */
@media (max-width: 600px) {
    .mini-player { width: 140px; bottom: 8px; right: 8px; }
    .pv-topbar { padding: 8px 12px; gap: 6px; }
    .pv-channel-name { font-size: 0.85rem; }
    .pv-live-badge { font-size: 0.6rem; padding: 2px 6px; }
    .pv-icon-btn { width: 36px; height: 36px; }
    .pv-controls { padding: 8px 12px; }
    .pv-ctrl-bottom { gap: 4px; }
    .pv-ctrl-row { gap: 4px; }
    .pv-ctrl-btn { min-width: 40px; min-height: 40px; padding: 0 6px; font-size: 0.7rem; }
    .pv-vol-slider { width: 72px; height: 8px; }
    .pv-video-wrap { max-height: min(calc(100vh - 120px), 56.25vw); }
    .pv-sidebar-drawer { width: 100vw; max-width: 100vw; border-left: none; }
    .pv-sidebar-drawer .pv-sidebar { width: 100vw; max-width: 100vw; }
    .carousel-track { scroll-snap-type: x mandatory; gap: 10px; -webkit-overflow-scrolling: touch; }
    .carousel-track .channel-card { scroll-snap-align: start; flex-shrink: 0; min-width: 130px; }
    .carousel-title { font-size: 0.95rem; }
    .carousel-row { margin-bottom: 20px; }
    .hero-section { height: 32vh; min-height: 200px; max-height: 280px; }
    .hero-content { padding: 0 16px 40px; }
    .hero-title { font-size: 1.5rem; }
    .hero-desc { font-size: 0.85rem; }
    .hero-badge { font-size: 0.65rem; padding: 3px 8px; }
    .hero-channel { font-size: 0.85rem; }
    .btn-play, .btn-info { padding: 10px 20px; font-size: 0.85rem; }
    .carousels-section { padding: 0 12px 24px; }
    .header-inner { padding: 0 12px; height: 52px; }
    .header-icon-btn { width: 32px; height: 32px; }
    .logo-text { font-size: 1.1rem; }
    .channel-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
}

/* Very small screens */
@media (max-width: 380px) {
    .pv-ctrl-btn { min-width: 36px; min-height: 36px; padding: 0 4px; font-size: 0.65rem; }
    .pv-vol-slider { width: 56px; }
    .pv-icon-btn { width: 32px; height: 32px; }
}
