/* --- PWA Auth Overlay --- */
#auth-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(9, 5, 13, 0.92);
    backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
#auth-overlay.visible { display: flex; }
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--card-bg, rgba(21, 15, 31, 0.95));
    border: 1px solid rgba(157, 78, 221, 0.25);
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}
.auth-card h2 {
    margin: 0 0 8px;
    font-weight: 600;
    color: var(--text-primary, #fff);
}
.auth-card p {
    margin: 0 0 20px;
    color: var(--text-secondary, #c5c6c7);
    font-size: 14px;
}
.auth-card label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary, #c5c6c7);
}
.auth-card input {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-family: inherit;
}
.auth-card button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--accent, #9d4edd);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.auth-card button:hover { background: var(--accent-hover, #c77dff); }
#auth-error {
    margin-top: 12px;
    color: #ff6b6b;
    font-size: 13px;
    min-height: 18px;
}

:root {
    --bg-main: #09050d;
    --bg-secondary: #150f1f;
    --accent: #9d4edd;
    --accent-hover: #c77dff;
    --text-primary: #ffffff;
    --text-secondary: #c5c6c7;
    --card-bg: rgba(21, 15, 31, 0.7);
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --gold: #ffd700;
}

/* --- PiP nella barra DPlayer (integrato) --- */
.pip-dplayer-icon {
    display: inline-block !important;
    cursor: pointer;
    padding: 7px;
    background: none;
    border: none;
    color: #fff;
    opacity: 0.8;
    transition: opacity 0.2s;
    -webkit-tap-highlight-color: transparent;
    vertical-align: middle;
}
.pip-dplayer-icon:hover, .pip-dplayer-icon:active { opacity: 1; }
.pip-dplayer-icon svg { width: 18px; height: 18px; display: block; }

/* --- PiP floating per player nativo MPEG-TS --- */
.pip-float-btn {
    position: absolute;
    bottom: 50px;
    right: 12px;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.pip-float-btn:hover, .pip-float-btn:active { opacity: 1; }
.pip-float-btn svg { width: 16px; height: 16px; display: block; }

.dplayer-full-in-icon, .dplayer-chromecast-icon, .dplayer-airplay-icon { display: none !important; }

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

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

.nav-links {
    display: flex;
    gap: 15px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-primary);
    background: rgba(157, 78, 221, 0.2);
}

.main-content {
    padding: 30px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 15px;
}

.section-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.filters {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-container {
    position: relative;
}

.search-input {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px 10px 40px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: var(--transition);
    width: 220px;
}

.search-input:focus {
    border-color: var(--accent);
    width: 280px;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    font-size: 0.8rem;
}

.styled-select {
    appearance: none;
    background-color: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 40px 10px 20px;
    border-radius: 30px;
    font-size: 1rem;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: var(--transition);
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 14px top 50%;
    background-size: 10px auto;
}

.styled-select:hover {
    border-color: var(--accent);
}

/* Gruppi Nazione */
.nation-header {
    margin: 30px 0 15px;
    padding: 12px 18px;
    background: linear-gradient(90deg, rgba(157, 78, 221, 0.15) 0%, transparent 100%);
    border-left: 4px solid var(--accent);
    border-radius: 6px;
    width: 100%;
}

.nation-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    width: 100%;
    margin-bottom: 30px;
}

@media (max-width: 600px) {
    .channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 10px;
    }
}

.player-section {
    margin-bottom: 40px;
    width: 100%;
}

.player-wrapper {
    width: 100%;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    background: #000;
}

/* Card Canali */
.channel-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 15px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.channel-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.channel-icon {
    width: 100%;
    height: 90px;
    object-fit: contain;
    margin-bottom: 12px;
}

.channel-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.status-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-online { background: rgba(46, 204, 113, 0.2); color: #2ecc71; border: 1px solid #2ecc71; }
.status-offline { background: rgba(231, 76, 60, 0.2); color: #e74c3c; border: 1px solid #e74c3c; }

/* Agenda Eventi */
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.event-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.event-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.event-time { font-size: 1.4rem; font-weight: 800; color: var(--accent); margin-bottom: 5px; }
.event-sport { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; }
.event-title { font-size: 1.2rem; margin: 8px 0; }
.event-tournament { color: var(--accent-hover); font-size: 0.85rem; margin-bottom: 15px; }
.event-sources { font-size: 0.8rem; background: rgba(0,0,0,0.3); padding: 8px; border-radius: 4px; text-align: center; }

@media (max-width: 768px) {
    .navbar {
        padding: 15px 0;
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .logo {
        font-size: 1.4rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        gap: 10px;
    }

    .nav-links a {
        font-size: 0.85rem;
        padding: 6px 10px;
        flex: 1;
        text-align: center;
    }

    .section-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .section-header h2 {
        font-size: 1.5rem;
        white-space: normal;
    }
    
    .filters {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .search-container {
        width: 100%;
    }
    
    .search-input {
        width: 100% !important;
        height: 44px;
        font-size: 1rem;
    }
    
    .styled-select {
        width: 100%;
        height: 44px;
        text-align: center;
        padding-right: 40px;
    }

    .app-container {
        padding: 0 12px;
    }
}

#now-playing-title {
    margin-top: 16px;
    font-weight: 300;
    color: var(--accent-hover);
}

/* --- Top Events (Bordo Dorato) --- */
.event-card.top-event {
    border: 2px solid var(--gold) !important;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08) 0%, var(--card-bg) 60%) !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.35), inset 0 0 30px rgba(255, 215, 0, 0.03) !important;
}
.event-card.top-event .event-time::after {
    content: ' ⭐';
    font-size: 0.9em;
}
.event-card.top-event:hover {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5), 0 10px 20px rgba(0,0,0,0.4) !important;
    border-color: #ffe44d !important;
}

/* --- SEZIONE CINEMA & NETFLIX CAROUSELS --- */

.cinema-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
    width: 100%;
}

.carousel-section {
    position: relative;
    width: 100%;
}

.carousel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.carousel-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

.carousel-wrapper {
    position: relative;
    width: 100%;
}

/* Horizontal Scroll Container */
.carousel-track {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 10px 0;
    scrollbar-width: none; /* Firefox */
}

.carousel-track::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Movie/TV Show Card in Carousel */
.sc-card {
    flex: 0 0 160px; /* Width of each poster card */
    scroll-snap-align: start;
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.3s ease, box-shadow 0.3s ease;
    aspect-ratio: 2/3;
}

@media (max-width: 600px) {
    .sc-card {
        flex: 0 0 120px;
    }
}

.sc-card:hover {
    transform: scale(1.08);
    border-color: var(--accent);
    box-shadow: 0 8px 25px rgba(157, 78, 221, 0.4);
    z-index: 10;
}

.sc-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Hover overlay containing Title, Year, Score */
.sc-info-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(9, 5, 13, 0.95) 0%, rgba(9, 5, 13, 0.6) 60%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sc-card:hover .sc-info-overlay {
    opacity: 1;
}

.sc-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sc-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sc-score {
    color: var(--gold);
    font-weight: 800;
}

/* Badges for movie/tv type */
.type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.badge-movie {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
}

.badge-tv {
    background: linear-gradient(135deg, #00f2fe, #4facfe);
    color: #fff;
}

/* Netflix Carousel Arrows */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(9, 5, 13, 0.75);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    opacity: 0;
    transition: opacity 0.3s, background 0.3s;
    backdrop-filter: blur(5px);
}

.carousel-section:hover .carousel-btn {
    opacity: 1;
}

.carousel-btn:hover {
    background: var(--accent);
    border-color: var(--accent-hover);
}

.carousel-btn.prev { left: -15px; }
.carousel-btn.next { right: -15px; }

@media (max-width: 768px) {
    .carousel-btn { display: none !important; }
}

/* Search results Grid */
.sc-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    width: 100%;
    margin-top: 20px;
}

@media (max-width: 600px) {
    .sc-search-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Search result list item (horizontal card for poster + plot description) */
.sc-search-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    cursor: pointer;
    display: flex;
    height: 160px;
    transition: var(--transition);
}

.sc-search-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

.sc-search-poster {
    width: 110px;
    height: 100%;
    object-fit: cover;
    flex-shrink: 0;
}

.sc-search-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    flex-grow: 1;
}

.sc-search-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sc-search-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.sc-search-plot {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* --- EPISODES MODAL PANEL (Netflix Style) --- */

.sc-modal {
    display: none; /* Hidden by default */
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(9, 5, 13, 0.85);
    backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.sc-modal-content {
    background: var(--bg-secondary);
    width: 100%;
    max-width: 800px;
    max-height: 85vh;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    position: relative;
    animation: modalFadeIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.sc-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.5);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 10;
    transition: var(--transition);
}

.sc-modal-close:hover {
    background: var(--accent);
}

.sc-modal-banner {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.sc-modal-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, var(--bg-secondary) 0%, transparent 100%);
}

.sc-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sc-modal-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.sc-modal-meta {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.sc-modal-plot {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Favorites Button and Watched Episode indicators */
.sc-modal-favorite-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(157, 78, 221, 0.3);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    margin-top: 15px;
    margin-bottom: 5px;
}
.sc-modal-favorite-btn:hover {
    background: rgba(157, 78, 221, 0.2);
    border-color: var(--accent-hover);
    box-shadow: 0 0 10px rgba(157, 78, 221, 0.3);
}
.sc-modal-favorite-btn.is-fav {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.sc-modal-favorite-btn.is-fav i {
    color: var(--gold);
}
.sc-episode-item.watched {
    opacity: 0.6;
    border-left: 3px solid #38b000;
    background: rgba(56, 176, 0, 0.02);
}
.watched-badge {
    color: #38b000;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    background: rgba(56, 176, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(56, 176, 0, 0.2);
}

/* Season selector tab system */
.sc-season-select-wrapper {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    scrollbar-width: thin;
    scrollbar-color: rgba(168, 85, 247, 0.5) rgba(255, 255, 255, 0.05);
    flex-shrink: 0 !important;
    scroll-behavior: smooth;
}

.sc-season-select-wrapper::-webkit-scrollbar {
    height: 6px;
}

.sc-season-select-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.sc-season-select-wrapper::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.5);
    border-radius: 4px;
}

.sc-season-select-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 85, 247, 0.8);
}

.sc-season-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.sc-season-nav-btn:hover {
    background: rgba(168, 85, 247, 0.6);
    border-color: rgba(168, 85, 247, 0.8);
    transform: scale(1.08);
}

.sc-season-nav-btn:active {
    transform: scale(0.95);
}

.sc-season-tab {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #c5c6c7 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 0 18px !important;
    border-radius: 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: var(--transition) !important;
    display: inline-block !important;
    height: 38px !important;
    line-height: 36px !important; /* height - 2px for border */
    text-align: center !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    outline: none !important;
    box-shadow: none !important;
    font-family: 'Outfit', sans-serif !important;
}

.sc-season-tab.active, .sc-season-tab:hover {
    background: #9d4edd !important;
    color: #ffffff !important;
    border-color: #c77dff !important;
}

/* Episode List Grid */
.sc-episode-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
}

.sc-episode-item {
    display: flex;
    gap: 15px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.sc-episode-item:hover {
    background: rgba(157, 78, 221, 0.1);
    border-color: rgba(157, 78, 221, 0.2);
}

.sc-episode-thumb {
    width: 140px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .sc-episode-item {
        flex-direction: column;
        gap: 10px;
    }
    .sc-episode-thumb {
        width: 100%;
    }
}

.sc-episode-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.sc-episode-number-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 6px;
}

.sc-episode-plot {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 1.1rem;
    width: 100%;
}

.loading-spinner::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid rgba(157, 78, 221, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}

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

/* Safari/iOS Captcha Helper Info Box */
.embed-helper-box {
    margin-top: 15px;
    padding: 12px 18px;
    background: rgba(157, 78, 221, 0.1);
    border: 1px dashed var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}
.embed-helper-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.embed-helper-text strong {
    color: var(--text-primary);
}
.embed-helper-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
    white-space: nowrap;
}
.embed-helper-btn:hover {
    background: var(--accent-hover);
}
@media (max-width: 600px) {
    .embed-helper-box {
        flex-direction: column;
        text-align: center;
        align-items: stretch;
    }
    .embed-helper-btn {
        text-align: center;
    }
}

/* --- FULL WIDTH PLAYER & CHANNELS UNDERNEATH --- */
.split-layout-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    margin-top: 10px;
}

.left-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    min-width: 0;
}

.right-panel {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    height: auto;
    position: static;
}

/* Multiview Stacking: side-by-side on desktop, vertical on mobile */
.multiview-vertical-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* Side-by-side on large screens when multiview is active */
.multiview-vertical-stack.multiview-active {
    flex-direction: row;
}

.multiview-vertical-stack.multiview-active .player-slot {
    flex: 1;
    min-width: 0; /* prevent flex overflow */
}

/* Stack vertically on mobile even when multiview is active */
@media (max-width: 768px) {
    .multiview-vertical-stack.multiview-active {
        flex-direction: column;
    }
    .multiview-vertical-stack.multiview-active .player-slot {
        flex: none;
        width: 100%;
    }
}

.player-slot {
    width: 100%;
    position: relative;
}

.dplayer-container {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.active-slot .dplayer-container {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
}

.slot-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(9, 5, 13, 0.9);
    border-radius: 12px;
    z-index: 10;
    border: 2px dashed var(--accent);
}

.add-channel-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 30px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    transition: var(--transition);
}

.add-channel-btn:hover {
    background: var(--accent-hover);
}

.slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

/* Hide slot-1's header by default (when not in multiview) */
#slot-1-header {
    display: none;
}

/* Show slot-1's header only when multiview is active */
.multiview-vertical-stack.multiview-active #slot-1-header {
    display: flex;
}

.slot-header span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.close-slot-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
}

.close-slot-btn:hover {
    color: var(--accent-hover);
}

/* Player top controls and styling */
.player-controls-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 15px;
    flex-wrap: wrap;
}

.player-action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--accent);
    border-color: var(--accent-hover);
}

.action-btn.btn-close {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.4);
    color: #e74c3c;
}

.action-btn.btn-close:hover {
    background: #e74c3c;
    color: #fff;
}

/* Placeholder card */
.player-placeholder-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(21, 15, 31, 0.4);
    border: 2px dashed rgba(157, 78, 221, 0.25);
    border-radius: var(--border-radius);
    padding: 80px 40px;
    aspect-ratio: 16/9;
    width: 100%;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.player-placeholder-card .placeholder-icon {
    font-size: 4rem;
    color: var(--accent);
    animation: pulsePlaceholder 2s infinite alternate;
}

@keyframes pulsePlaceholder {
    from { transform: scale(1); opacity: 0.5; }
    to { transform: scale(1.15); opacity: 1; }
}

.player-placeholder-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.player-placeholder-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 400px;
}

/* Sidebar headers & scrolls */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-shrink: 0;
}

.admin-badge-link {
    text-decoration: none;
    font-size: 0.8rem;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.admin-badge-link:hover {
    background: var(--accent);
    border-color: var(--accent-hover);
}

.sidebar-filters-container {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    flex-shrink: 0;
}

.sidebar-filters-container .search-container {
    flex-grow: 1;
}

.sidebar-filters-container .search-input {
    width: 100%;
}

.country-select {
    width: auto;
    max-width: 150px;
    padding: 10px 35px 10px 15px;
    border-radius: 30px;
}

.sidebar-channels-scroll {
    overflow-y: auto;
    padding-right: 5px;
    max-height: 750px;
    width: 100%;
}

/* Custom scrollbar for sidebar channels list */
.sidebar-channels-scroll::-webkit-scrollbar {
    width: 6px;
}

.sidebar-channels-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
    border-radius: 3px;
}

.sidebar-channels-scroll::-webkit-scrollbar-thumb {
    background: rgba(157, 78, 221, 0.2);
    border-radius: 3px;
}

.sidebar-channels-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(157, 78, 221, 0.4);
}

/* Category Chips */
.category-chips-wrapper {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 0;
    scrollbar-width: none; /* Firefox */
    width: 100%;
    flex-shrink: 0;
}

.category-chips-wrapper::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.category-chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    font-family: 'Outfit', sans-serif;
    transition: var(--transition);
    flex-shrink: 0;
    line-height: 1.2;
}

.category-chip:hover, .category-chip.active {
    background: var(--accent);
    border-color: var(--accent-hover);
    color: #fff;
    box-shadow: 0 0 10px rgba(157, 78, 221, 0.3);
}

/* Responsive adjustments for Desktop/Tablet/Mobile */
@media (max-width: 992px) {
    .split-layout-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .right-panel {
        height: auto;
        position: static;
        padding: 20px;
    }
    .sidebar-channels-scroll {
        max-height: 450px;
    }
}

@media (max-width: 600px) {
    .player-placeholder-card {
        padding: 40px 20px;
    }
    .player-controls-top {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .player-action-buttons {
        width: 100%;
        justify-content: space-between;
    }
    .player-action-buttons button {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
        font-size: 0.75rem;
    }
    .sidebar-filters-container {
        flex-direction: column;
        align-items: stretch;
    }
    .country-select {
        max-width: 100%;
        width: 100%;
    }
    .navbar {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 15px 0 10px;
        gap: 12px;
    }
    .logo {
        text-align: center;
        width: 100%;
        margin-bottom: 2px;
    }
    .nav-links {
        display: flex;
        gap: 10px;
        justify-content: center;
        width: 100%;
        max-width: 100%;
        flex-wrap: wrap;
    }
    .nav-links a {
        font-size: 0.85rem;
        padding: 6px 12px;
        white-space: nowrap;
    }
}

/* Netflix-Style Bottom Sheet Modal on Mobile */
@media (max-width: 600px) {
    .sc-modal {
        align-items: flex-end;
        padding: 0;
    }
    .sc-modal-content {
        max-height: 80vh;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
        animation: slideUpBottomSheet 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
    @keyframes slideUpBottomSheet {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
}

/* TV QR Code Login Styles */
.tv-qr-container {
    display: none;
    text-align: center;
    margin-top: 10px;
}
.tv-qr-code-wrapper {
    background: #ffffff;
    padding: 12px;
    border-radius: 14px;
    display: inline-block;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    transition: transform 0.3s ease;
}
.tv-qr-code-wrapper:hover {
    transform: scale(1.03);
}
.tv-qr-code-wrapper img {
    display: block;
    width: 160px;
    height: 160px;
}
.tv-qr-instructions {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}
#tv-qr-status {
    font-size: 13px;
    color: var(--accent-hover);
    margin-bottom: 15px;
    font-weight: 600;
}
#btn-toggle-manual-login {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}
#btn-toggle-manual-login:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.4);
    color: var(--text-primary);
}

/* --- TV Remote Search & Keyboard Styling --- */
.remote-keyboard-container {
    background: var(--bg-main) !important;
    background-image: radial-gradient(circle at top right, rgba(157, 78, 221, 0.15), transparent 50%),
                      radial-gradient(circle at bottom left, rgba(199, 125, 255, 0.05), transparent 50%) !important;
}
.remote-keyboard-container input::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
    font-style: italic;
}
.remote-keyboard-container input:focus {
    border-color: var(--accent-hover) !important;
    box-shadow: 0 0 15px rgba(199, 125, 255, 0.3) !important;
}
#btn-tv-remote-search:hover {
    background: rgba(157, 78, 221, 0.2) !important;
    border-color: var(--accent-hover) !important;
    transform: scale(1.02);
}

