/* ==============================================
   VOD Section — FilfelTV
   Cohérent avec le design system de mobile.css
   ============================================== */

/* ====== APPBAR ====== */
.vod-appbar {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: calc(env(safe-area-inset-top) + 10px) var(--pad) 0;
    background: linear-gradient(180deg, rgba(15,17,23,.98) 0%, rgba(15,17,23,.92) 85%, rgba(15,17,23,0) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ====== CLOSE TOP BUTTON ====== */
.sheet-close-top {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.85); /* Red and visible */
    border: 1px solid rgba(255, 100, 100, 0.4);
    color: #fff;
    font-size: 18px;
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.sheet-close-top:hover {
    background: rgba(239, 68, 68, 1);
    transform: scale(1.08);
}

/* ====== SECTION SÉRIES ====== */
.series-controls {
    padding: 0 var(--pad) 15px;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Season Tabs */
.season-tabs-container {
    width: 100%;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--card);
    padding-top: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.season-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 12px 20px;
    padding-bottom: 12px;
}
.season-tabs::-webkit-scrollbar { display: none; }

.season-tab {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    padding: 0 0 8px 0;
    position: relative;
    cursor: pointer;
    transition: color 0.2s;
}
.season-tab:hover {
    color: rgba(255,255,255,0.8);
}
.season-tab.active {
    color: #fff;
}
.season-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(94, 234, 212, 0.4);
}

/* Episodes Grid */
.episodes-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 20px;
}

/* Episode Row */
.ep-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.ep-num {
    flex-shrink: 0;
    min-width: 44px;
    font-size: 20px;
    font-weight: 800;
    color: rgba(255,255,255,0.4);
    text-align: left;
    line-height: 1.1;
    margin-top: 2px;
}
.ep-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ep-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    line-height: 1.2;
}
.ep-servers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vod-toprow {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-bottom: 10px;
}

.vod-toprow .backbtn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.vod-toprow .title {
    margin: 0;
    font-weight: 700;
    letter-spacing: .4px;
}

/* ====== SEARCH ====== */
.vod-appbar .searchbar {
    margin-bottom: 10px;
}

.search-clear {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: none;
    background: rgba(255,255,255,.08);
    color: var(--muted);
    border-radius: 50%;
    cursor: pointer;
    transition: all .15s ease;
}

.search-clear:hover { background: rgba(255,255,255,.14); color: #fff; }

/* ====== FILTERS ====== */
.vod-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.vod-filters::-webkit-scrollbar { display: none; }

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.04);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .18s ease;
    flex: 0 0 auto;
}

.filter-chip:hover {
    background: rgba(255,255,255,.08);
    color: var(--text);
}

.filter-chip.is-active {
    background: rgba(94,234,212,.12);
    border-color: rgba(94,234,212,.35);
    color: #bffcf4;
}

.filter-chip i { font-size: 12px; }

.filter-count {
    background: rgba(255,255,255,.08);
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.filter-chip.is-active .filter-count {
    background: rgba(94,234,212,.2);
}

.filter-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,.08);
    flex: 0 0 auto;
}

.sort-chip { gap: 5px; }

/* ====== CATEGORIES SCROLL ====== */
.vod-categories {
    display: flex;
    gap: 8px;
    padding-bottom: 12px;
    overflow-x: auto;
    scrollbar-width: none;
}

.vod-categories::-webkit-scrollbar { display: none; }

.cat-chip {
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.06);
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s ease;
    flex: 0 0 auto;
}

.cat-chip:hover {
    color: var(--text);
    border-color: rgba(255,255,255,.12);
}

.cat-chip.is-active {
    background: rgba(0,122,255,.12);
    border-color: rgba(0,122,255,.35);
    color: #7ab8ff;
}

/* ====== STATS BAR ====== */
.vod-stats {
    padding: 6px var(--pad) 2px;
    font-size: 12px;
    color: var(--muted);
    letter-spacing: .2px;
}

/* ====== GRID ====== */
.vod-main {
    padding: 8px var(--pad) calc(env(safe-area-inset-bottom) + 90px);
}

.vod-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

@media (min-width: 480px) {
    .vod-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 768px) {
    .vod-grid { grid-template-columns: repeat(5, 1fr); gap: 14px; }
}

@media (min-width: 1024px) {
    .vod-grid { grid-template-columns: repeat(6, 1fr); gap: 16px; }
}

@media (min-width: 1400px) {
    .vod-grid { grid-template-columns: repeat(8, 1fr); }
}

/* ====== CARD ====== */
.vod-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
    background: var(--card);
    border: 1px solid rgba(255,255,255,.06);
}

.vod-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 32px rgba(0,0,0,.35);
    border-color: rgba(255,255,255,.12);
    z-index: 2;
}

.vod-card:active {
    transform: scale(.97);
}

.vod-card-poster {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
    background: #0b0e13;
    transition: opacity .3s ease;
}

.vod-card-poster[src=""],
.vod-card-poster:not([src]) {
    opacity: 0;
}

/* Overlay gradient */
.vod-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 8px 8px;
    background: linear-gradient(0deg, rgba(0,0,0,.85) 0%, rgba(0,0,0,.4) 60%, transparent 100%);
}

.vod-card-title {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 4px;
}

.vod-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: rgba(255,255,255,.6);
}

.vod-card-year {
    font-weight: 600;
}

.vod-card-note {
    display: flex;
    align-items: center;
    gap: 2px;
}

.vod-card-note i {
    color: #ffd700;
    font-size: 8px;
}

/* Container for type and quality badges */
.vod-card-badges-container {
    position: absolute;
    top: 6px;
    left: 6px;
    display: flex;
    gap: 6px;
    z-index: 5;
}

/* Badge type */
.vod-card-badge {
    position: relative;
    top: auto;
    left: auto;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .5px;
    backdrop-filter: blur(6px);
}

.vod-card-badge.movie {
    background: rgba(94,234,212,.2);
    color: #bffcf4;
    border: 1px solid rgba(94,234,212,.3);
}

.vod-card-badge.tv {
    background: rgba(139,92,246,.2);
    color: #c4b5fd;
    border: 1px solid rgba(139,92,246,.3);
}

/* Badge qualité */
.vod-card-quality {
    position: relative;
    top: auto;
    right: auto;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    background: rgba(0,0,0,.6);
    color: rgba(255,255,255,.8);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,.1);
}

/* Nombre de serveurs */
.vod-card-servers {
    display: flex;
    align-items: center;
    gap: 3px;
}

.vod-card-servers i {
    font-size: 8px;
    color: var(--accent);
}

/* ====== SKELETON ====== */
.vod-skeleton {
    aspect-ratio: 2/3;
    border-radius: 12px;
    background: linear-gradient(110deg, var(--card) 30%, var(--card-2) 50%, var(--card) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ====== EMPTY STATE ====== */
.vod-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.vod-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: .3;
}

.vod-empty p {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px;
}

.vod-empty-reset {
    padding: 10px 24px;
    border-radius: 999px;
    border: 1px solid rgba(94,234,212,.35);
    background: rgba(94,234,212,.1);
    color: #bffcf4;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s ease;
}

.vod-empty-reset:hover {
    background: rgba(94,234,212,.2);
}

/* ====== LOAD MORE ====== */
.vod-load-more {
    text-align: center;
    padding: 24px 0 12px;
}

.load-more-btn {
    padding: 12px 32px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.04);
    color: var(--text);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all .18s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.load-more-btn:hover {
    background: rgba(255,255,255,.1);
    transform: translateY(-1px);
}
/* Hide filter counts universally */
.filter-count { display: none !important; }

/* Modal sheet overrides */
.sheet .handle {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ====== BOTTOM SHEET (Détails) ====== */
.sheet-content {
    height: 85vh;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Le modal global ne scroll plus ! */
}

/* Hero image dans le sheet */
.sheet-hero {
    position: relative;
    width: 100%;
    height: 200px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 18px 18px 0 0;
}

.sheet-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sheet-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, var(--card) 0%, rgba(22,26,34,.6) 50%, transparent 100%);
}

.sheet-hero-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0 var(--pad) 12px;
}

.sheet-title {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,.5);
}

.sheet-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sheet-badge {
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.sheet-badge.movie {
    background: rgba(94,234,212,.15);
    color: #bffcf4;
}

.sheet-badge.tv {
    background: rgba(139,92,246,.15);
    color: #c4b5fd;
}

.sheet-year,
.sheet-runtime,
.sheet-age {
    font-size: 12px;
    color: rgba(255,255,255,.6);
    font-weight: 500;
}

.sheet-runtime::before,
.sheet-age::before {
    content: '•';
    margin-right: 8px;
    opacity: .4;
}

/* ====== SCORES ====== */
.sheet-scores {
    display: flex;
    gap: 24px;
    padding: 14px var(--pad);
    justify-content: center;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.score-ring {
    position: relative;
    width: 48px;
    height: 48px;
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-bg {
    fill: none;
    stroke: rgba(255,255,255,.08);
    stroke-width: 3;
}

.score-fg {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 106.8;
    stroke-dashoffset: 106.8;
    transition: stroke-dashoffset .8s cubic-bezier(.4,0,.2,1);
}

.score-val {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
}

.score-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ====== CATEGORIES IN SHEET ====== */
.sheet-cats {
    display: flex;
    gap: 6px;
    padding: 0 var(--pad) 10px;
    flex-wrap: wrap;
}

.sheet-cat {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.06);
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
}

/* ====== SYNOPSIS ====== */
.sheet-overview {
    padding: 0 var(--pad) 14px;
    margin: 0 0 16px 0; /* Ajout d'espacement avec les serveurs */
    font-size: 13px;
    line-height: 1.55;
    color: rgba(255,255,255,.65);
    flex-shrink: 0;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ====== SERVERS TITLE ====== */
.sheet-servers-title {
    padding: 0 var(--pad) 10px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sheet-servers-title i {
    color: var(--accent);
    font-size: 13px;
}

/* ====== SERVER PILLS ====== */
.servers {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    align-content: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 var(--pad) 24px var(--pad);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}
.servers::-webkit-scrollbar { width: 4px; }
.servers::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 999px; }

.server-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 8px 12px;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.server-pill:hover,
.server-pill:active {
    background: rgba(255,255,255,0.12);
    transform: scale(0.98);
}

.server-pill i {
    color: var(--accent);
    font-size: 11px;
}

.server-pill .s-lang {
    font-size: 10px;
    background: rgba(0,0,0,0.4);
    padding: 2px 5px;
    border-radius: 4px;
    color: rgba(255,255,255,0.7);
    margin-left: auto;
    font-weight: 600;
}

.server-pill .s-qual {
    font-size: 11px;
    font-weight: 800;
    color: var(--accent-2);
}

/* ====== VOD FAVORIS ====== */
.vod-card-fav {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0,0,0,0.5);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    backdrop-filter: blur(2px);
}
.vod-card-fav:hover {
    transform: scale(1.1);
    background: rgba(0,0,0,0.7);
    color: var(--accent);
}
.vod-card-fav.is-fav {
    color: var(--accent);
    animation: pop 0.3s ease;
}

.sheet-fav-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--muted);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}
.sheet-fav-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    transform: scale(1.05);
}
.sheet-fav-btn.is-fav {
    background: rgba(94,234,212,.15);
    border-color: rgba(94,234,212,.3);
    color: var(--accent);
    animation: pop 0.3s ease;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}