:root {
    --bg-main: #0a0a0a;
    --bg-card: #141414;
    --bg-hover: #1f1f1f;
    --primary: #e50914;
    --accent: #b20710;
    --text-main: #ffffff;
    --text-sec: #a3a3a3;
    --border: #333333;
    --success: #10b981;
    --gold: #e5a00d;
    --radius: 12px;
    --font: 'Inter', sans-serif;
    --sidebar-width: 250px;
    --nav-height-mobile: 70px;
    --primary-glow: rgba(229, 9, 20, 0.4);
    --success-glow: rgba(16, 185, 129, 0.3);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
    --shadow-md: 0 6px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; }

html {
    background-color: #000000; /* Fond noir immédiat pour iOS */
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font);
    height: 100dvh; /* Important pour mobile */
    width: 100vw;
    overflow: hidden;
    display: flex;
    overscroll-behavior: none;
}

/* --- UTILS --- */
.hidden { display: none !important; }
.w-full { width: 100%; }
.loader { border: 3px solid rgba(255,255,255,0.1); border-top: 3px solid var(--primary); border-radius: 50%; width: 40px; height: 40px; animation: spin 0.8s linear infinite; margin: 2rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.loader-wrapper { grid-column: 1 / -1; display: flex; justify-content: center; align-items: center; width: 100%; min-height: 200px; }

/* --- LOGIN --- */
.overlay { position: fixed; inset: 0; background: var(--bg-main); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.login-box { width: 90%; max-width: 380px; text-align: center; padding: 2rem; }
.logo-large { color: var(--primary); margin-bottom: 2rem; }
.logo-large .icon-xl { width: 120px; height: 120px; margin-bottom: 15px; object-fit: contain; }
.logo-large h1 { font-size: 2rem; font-weight: 800; letter-spacing: -1px; }
.login-box input { width: 100%; padding: 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); color: white; margin: 1rem 0; font-size: 1rem; }
.login-box button { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: var(--radius); font-weight: 600; cursor: pointer; }

/* Password visibility toggle container */
.password-container {
    position: relative;
    width: 100%;
}
.login-box .password-container {
    margin: 1rem 0;
}
.password-container input {
    margin: 0 !important;
    padding-right: 48px !important;
}
.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none !important;
    border: none !important;
    padding: 0 !important;
    width: auto !important;
    height: auto !important;
    color: var(--text-sec) !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    outline: none;
    z-index: 10;
    box-shadow: none !important;
}
.toggle-password:hover {
    color: var(--text-main) !important;
}
.toggle-password svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

/* --- LAYOUT PC --- */
#app-container { display: flex; width: 100%; height: 100%; }

.sidebar {
    width: var(--sidebar-width); background: black; border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 2rem 1rem; flex-shrink: 0; z-index: 100;
    position: relative;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.brand { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    font-size: 1.35rem; 
    font-weight: 800; 
    color: var(--text-main); 
    margin-bottom: 3rem; 
    padding-left: 0.5rem;
    letter-spacing: -0.5px;
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), justify-content 0.3s cubic-bezier(0.4, 0, 0.2, 1), gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
}
.btn-sidebar-toggle {
    position: absolute;
    right: -14px;
    top: 32px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text-sec);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 150;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.btn-sidebar-toggle:hover {
    color: white;
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(229, 9, 20, 0.3);
}
.btn-sidebar-toggle i {
    width: 16px;
    height: 16px;
}
.nav-links { list-style: none; flex: 1; }
.nav-links li { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    padding: 12px; 
    margin-bottom: 5px; 
    border-radius: var(--radius); 
    cursor: pointer; 
    color: var(--text-sec); 
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), gap 0.3s cubic-bezier(0.4, 0, 0.2, 1), justify-content 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s, background 0.2s; 
    font-weight: 500; 
}
.nav-links li:hover { color: white; background: var(--bg-hover); }
.nav-links li.active { color: white; font-weight: 700; }
.nav-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: 1rem; }
.btn-text { 
    background: none; 
    border: none; 
    color: var(--text-sec); 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    cursor: pointer; 
    width: 100%; 
    padding: 10px; 
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), gap 0.3s cubic-bezier(0.4, 0, 0.2, 1), justify-content 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s;
}

/* Transitions for sub-elements in the sidebar */
.sidebar .brand-logo span,
.sidebar .nav-links li span,
.sidebar .nav-footer button span {
    transition: opacity 0.15s ease, max-width 0.2s ease, margin 0.2s ease;
    opacity: 1;
    max-width: 150px;
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
}

/* COLLAPSED STATES */
.sidebar.collapsed {
    width: 78px;
    padding: 2rem 0.5rem;
}
.sidebar.collapsed .brand-logo span,
.sidebar.collapsed .nav-links li span,
.sidebar.collapsed .nav-footer button span {
    opacity: 0;
    max-width: 0;
    margin: 0;
    pointer-events: none;
}
.sidebar.collapsed .brand {
    padding-left: 0;
    justify-content: center;
    gap: 0;
}
.sidebar.collapsed .btn-sidebar-toggle {
    right: -14px;
    background: var(--bg-card);
}
.sidebar.collapsed .nav-links li {
    padding: 12px 0;
    justify-content: center;
    gap: 0;
}
.sidebar.collapsed .nav-footer .btn-text {
    padding: 10px 0;
    justify-content: center;
    gap: 0;
}


/* MAIN CONTENT */
.content-wrapper {
    flex: 1; height: 100dvh; overflow-y: auto; padding: 2rem 3rem; position: relative;
    background: linear-gradient(to bottom, #111 0%, var(--bg-main) 20%);
    /* Ajout d'un padding en bas pour que le contenu ne soit pas caché par le scroll */
    padding-bottom: 100px; 
}

/* --- SECTIONS --- */
.hero-header { margin-bottom: 2.5rem; }
.hero-header h2 { font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; }
.hero-header p { color: var(--text-sec); }
.header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }

/* --- SEARCH --- */
.search-hero { 
    margin: 0 auto 3rem auto; 
    max-width: 800px; 
    width: 100%; 
}
.search-input-wrapper { display: flex; align-items: center; background: var(--bg-card); border: 1px solid var(--border); border-radius: 50px; padding: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.search-icon-inside { margin-left: 16px; color: var(--text-sec); }
#search-input { flex: 1; background: transparent; border: none; padding: 12px; color: white; font-size: 1.1rem; }
.btn-search-action { background: var(--primary); color: white; border: none; padding: 10px 24px; border-radius: 30px; font-weight: 600; cursor: pointer; }
.filter-pills { display: flex; gap: 10px; margin-top: 1rem; justify-content: center; flex-wrap: wrap; }
.pill input { display: none; }
.pill span { display: block; padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border); color: var(--text-sec); font-size: 0.9rem; transition: 0.2s; }
.pill input:checked + span { background: white; color: black; border-color: white; font-weight: 600; }

/* --- GRID --- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2rem; padding-bottom: 4rem; }
.card { background: var(--bg-card); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: transform 0.2s; position: relative; border: 1px solid transparent; }
.card:hover { transform: translateY(-6px); border-color: var(--border); }
.poster-container { position: relative; aspect-ratio: 2/3; overflow: hidden; background: #222; }
.poster-container img { width: 100%; height: 100%; object-fit: cover; }
.card-info { padding: 12px; }
.card-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95rem; line-height: 1.4; }
.card-year { font-size: 0.8rem; color: var(--text-sec); margin-top: 4px; font-weight: 500; display: flex; align-items: center; gap: 6px; }

.type-badge {
    background: rgba(229, 9, 20, 0.2);
    color: #ff4d4d;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid rgba(229, 9, 20, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* --- DOWNLOADS --- */
.downloads-container { max-width: 700px; margin: 0 auto; padding-top: 1rem; }
.dl-card { background: #1a1a1a; border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 16px; }
.dl-icon { width: 40px; height: 40px; background: #252525; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-sec); flex-shrink: 0; }
.spin-slow { animation: spin 2s linear infinite; }
.dl-content { flex: 1; min-width: 0; }
.dl-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; }
.dl-title { font-weight: 600; font-size: 0.95rem; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80%; }
.dl-percentage { font-weight: 700; color: var(--text-main); }
.dl-bar-bg { height: 6px; background: #333; border-radius: 3px; overflow: hidden; position: relative; }
.dl-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s; position: relative; }
.dl-status-text { font-size: 0.75rem; color: var(--text-sec); margin-top: 6px; }

/* --- MUSIC --- */
.tabs { display: flex; gap: 1rem; margin-bottom: 2rem; border-bottom: 1px solid var(--border); }
.tab-btn { background: none; border: none; padding: 1rem 0; color: var(--text-sec); cursor: pointer; font-size: 1rem; }
.tab-btn.active { color: white; border-bottom: 2px solid var(--primary); font-weight: 600; }
.form-card input, .form-card select, .form-card textarea { 
    width: 100%; 
    padding: 12px 16px; 
    background: rgba(0, 0, 0, 0.4); 
    border: 1px solid var(--border); 
    color: white; 
    border-radius: 10px; 
    margin: 0.5rem 0 1.25rem 0; 
    font-size: 0.95rem;
    transition: var(--transition);
}
.form-card input:focus, .form-card select:focus, .form-card textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(0, 0, 0, 0.7);
}
/* Centrage des formulaires */
.form-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-width: 500px;
    margin: 0 auto; /* CENTRE LE FORMULAIRE */
}

/* Style des notes sous les inputs */
.form-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 1.5rem;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-sec);
    line-height: 1.4;
}

.form-note i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--primary);
}

.form-note.warning i {
    color: var(--gold);
}

.form-note strong {
    color: white;
}
.btn-primary { 
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%); 
    color: white; 
    border: none; 
    padding: 12px 24px; 
    border-radius: 10px; 
    font-weight: 600; 
    cursor: pointer; 
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--primary-glow);
    filter: brightness(1.1);
}
.btn-primary:active {
    transform: translateY(1px);
    box-shadow: var(--shadow-sm);
}

.btn-success { 
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%); 
    color: white; 
    border: none; 
    padding: 12px 24px; 
    border-radius: 10px; 
    font-weight: 600; 
    cursor: pointer; 
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--success-glow);
    filter: brightness(1.1);
}
.btn-success:active {
    transform: translateY(1px);
    box-shadow: var(--shadow-sm);
}
.status-card { margin-top: 2rem; background: var(--bg-card); padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--border); max-width: 500px; }
.progress-track { height: 8px; background: #222; border-radius: 4px; overflow: hidden; position: relative; }
.progress-fill { height: 100%; background: #10b981; transition: width 0.4s ease; }

/* --- MODAL --- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 2000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.modal-content { background: var(--bg-card); width: 95%; max-width: 700px; max-height: 90vh; border-radius: 16px; border: 1px solid var(--border); display: flex; flex-direction: column; }
.modal-header { padding: 1.2rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 1.5rem; overflow-y: auto; }
#modal-close, #direct-modal-close { 
    background: rgba(255, 255, 255, 0.05); 
    border: none; 
    color: var(--text-sec); 
    cursor: pointer; 
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
#modal-close:hover, #direct-modal-close:hover {
    background: rgba(229, 9, 20, 0.2);
    color: var(--primary);
    transform: rotate(90deg) scale(1.1);
}

.btn-icon-only {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-sec);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}
.btn-icon-only:active {
    transform: scale(0.95);
}
.btn-icon-only:hover i[data-lucide="refresh-cw"] {
    transform: rotate(180deg);
    transition: transform 0.5s ease-out;
}

/* --- TOAST --- */
.toast { 
    position: fixed; 
    bottom: 2rem; 
    right: 2rem; 
    background: rgba(20, 20, 20, 0.95); 
    color: white; 
    padding: 14px 28px; 
    border-radius: 50px; 
    font-weight: 600; 
    z-index: 99999; 
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}
@keyframes pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#blocking-loader { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.95); z-index: 10000; display: flex; flex-direction: column; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
#blocking-loader p { margin-top: 1.5rem; font-size: 1.2rem; font-weight: 600; color: white; }

/* ========================================= */
/* === MOBILE RESPONSIVE (IOS FIXES) === */
/* ========================================= */
@media (max-width: 768px) {
    body { flex-direction: column; }
    
    /* BARRE DE NAVIGATION FLOTTANTE EN BAS */
    .sidebar {
        width: 100%;
        height: auto; /* Hauteur auto pour s'adapter */
        position: fixed;
        bottom: 0; left: 0;
        flex-direction: row;
        /* Padding: Haut | Droite | Bas (Safe Area) | Gauche */
        padding: 12px 10px env(safe-area-inset-bottom) 10px;
        border-right: none;
        border-top: 1px solid rgba(255,255,255,0.1);
        background: rgba(10, 10, 10, 0.95); /* Semi-transparent */
        backdrop-filter: blur(15px);
        z-index: 5000;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
        transition: none !important;
    }
    
    .brand, .nav-footer, .nav-links li span, .btn-sidebar-toggle { display: none !important; }
    
    .nav-links {
        display: flex;
        justify-content: space-around;
        align-items: center;
        width: 100%;
        margin: 0; padding: 0;
    }
    
    .nav-links li {
        padding: 10px;
        margin: 0;
        border-radius: 50%;
        display: flex; justify-content: center; align-items: center;
    }
    .nav-links li i { width: 24px; height: 24px; }
    
    /* FIX CONTENU : On ajoute un gros coussin en bas pour scroller au dessus de la barre */
    .content-wrapper {
        margin-left: 0;
        width: 100%;
        height: 100%;
        padding: 1.5rem 1rem;
        /* 120px de vide en bas pour voir le dernier film */
        padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
    }

    .media-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .hero-header h2 { font-size: 1.5rem; }
    
    /* Toast plus haut pour ne pas être sous la barre */
    .toast { bottom: 120px; left: 50%; transform: translateX(-50%); width: max-content; }
}

/* --- CUSTOM SCROLLBAR DARK MODE --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px; /* Hauteur de la barre horizontale */
}

::-webkit-scrollbar-track {
    background: var(--bg-card); 
    border-radius: 8px;
}

::-webkit-scrollbar-thumb {
    background: var(--border); 
    border-radius: 8px;
    border: 2px solid var(--bg-card); /* Crée un petit espace autour de la barre */
}

::-webkit-scrollbar-thumb:hover {
    background: #555; /* S'éclaircit légèrement au survol */
}

/* Masquer les flèches directionnelles de la barre */
::-webkit-scrollbar-button {
    display: none;
}


/* --- CORRECTION AUTOCOMPLÉTION (AUTOFILL) NAVIGATEUR --- */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    /* Force le fond sombre de la carte par-dessus le blanc de Chrome */
    -webkit-box-shadow: 0 0 0 50px var(--bg-card) inset !important;
    /* Force le texte en blanc */
    -webkit-text-fill-color: white !important;
    /* Garde le curseur de texte visible */
    caret-color: white !important;
    /* Supprime la bordure si Chrome essaie d'en mettre une */
    border: none !important; 
}


/* ========================================= */
/* === PANEL ADMIN ========================= */
/* ========================================= */
.admin-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; display: flex; flex-direction: column; gap: 8px; }
.stat-title { color: var(--text-sec); font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { color: var(--primary); font-size: 2rem; font-weight: 800; }

.admin-charts-container { margin-bottom: 2rem; }
.chart-card, .table-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.chart-card h3, .table-card h3 { margin-bottom: 1.5rem; font-size: 1.1rem; color: white; }

.admin-tables-container { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 1024px) { .admin-tables-container { grid-template-columns: 1fr; } }

.table-responsive { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.9rem; }
.admin-table th { padding: 12px; border-bottom: 1px solid var(--border); color: var(--text-sec); font-weight: 600; white-space: nowrap; }
.admin-table td { padding: 12px; border-bottom: 1px solid #222; color: #ddd; white-space: nowrap; }
.admin-table tr:last-child td { border-bottom: none; }

.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 800; }
.status-success { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid #10b981; }
.status-error { background: rgba(229, 9, 20, 0.15); color: #e50914; border: 1px solid #e50914; }

/* --- NEW MODAL STYLES --- */
.modal-subtitle { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-sec); font-weight: 700; margin-bottom: 1rem; }

.quality-pill {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.quality-pill:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.quality-pill.quality-gold {
    border-color: rgba(229, 160, 13, 0.4);
    background: linear-gradient(135deg, rgba(229, 160, 13, 0.08) 0%, rgba(0, 0, 0, 0) 100%);
}

.quality-pill.quality-gold:hover {
    border-color: var(--gold);
    background: linear-gradient(135deg, rgba(229, 160, 13, 0.15) 0%, rgba(0, 0, 0, 0.03) 100%);
}

.quality-pill.quality-blue {
    border-color: rgba(74, 144, 226, 0.4);
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.08) 0%, rgba(0, 0, 0, 0) 100%);
}

.quality-pill.quality-blue:hover {
    border-color: #4a90e2;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.15) 0%, rgba(0, 0, 0, 0.03) 100%);
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.opt-icon-text { font-size: 1.1rem; margin-right: 8px; }

.quality-tag { 
    background: rgba(255, 255, 255, 0.08); 
    border: 1px solid var(--border);
    padding: 3px 8px; 
    border-radius: 6px; 
    font-size: 0.75rem; 
    font-weight: 700;
    text-transform: uppercase; 
    margin-left: 8px;
    vertical-align: middle;
    letter-spacing: 0.5px;
    color: var(--text-main);
}

.badge-size {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    color: #e2e8f0;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-lang {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    color: #60a5fa;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-sub {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    color: #34d399;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.direct-link-box { text-align: center; padding: 1.5rem 1rem 0.5rem 1rem; }
.direct-link-box p { color: var(--text-sec); margin-bottom: 1.25rem; }
.direct-link-box input { 
    width: 100%; 
    padding: 14px; 
    background: rgba(0, 0, 0, 0.4); 
    border: 1px solid var(--border); 
    color: var(--primary); 
    border-radius: 10px; 
    margin-bottom: 1.5rem;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    transition: var(--transition);
    letter-spacing: 0.5px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}
.direct-link-box input:focus {
    border-color: var(--primary);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), 0 0 0 3px var(--primary-glow);
}
.btn-group { display: flex; gap: 12px; justify-content: center; }

.empty-msg { text-align: center; color: var(--text-sec); padding: 2rem; font-style: italic; }

/* --- MODAL REDESIGN --- */
.modal-sep {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 1.2rem 0;
}

/* Seasons wrapper */
.seasons-wrapper {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 12px;
    margin-bottom: 1.5rem;
    padding-bottom: 8px;
    scrollbar-width: thin;
}

.seasons-wrapper::-webkit-scrollbar { height: 6px; }
.seasons-wrapper::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); border-radius: 4px; }
.seasons-wrapper::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 4px; }
.seasons-wrapper::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Seasons/qualities grid */
.seasons-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 1.2rem;
}

/* Version tabs (filter by quality) */
.version-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1rem;
}

.version-tab {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 10px 18px;
    border-radius: 20px;
    color: var(--text-sec);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.version-tab:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.version-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 2px 10px rgba(229, 9, 20, 0.35);
}

/* File cards */
.file-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    padding: 12px 14px;
    border-radius: 10px;
    transition: all 0.18s ease;
    width: 100%;
    color: white;
    cursor: pointer;
    text-align: left;
    gap: 10px;
}

.file-btn:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(255,255,255,0.2);
    transform: translateX(3px);
}

.file-btn.quality-gold {
    border-color: rgba(229,160,13,0.4);
    background: linear-gradient(90deg, rgba(229,160,13,0.08) 0%, rgba(0,0,0,0) 100%);
}

.file-btn.quality-blue {
    border-color: rgba(74,144,226,0.4);
    background: linear-gradient(90deg, rgba(74,144,226,0.08) 0%, rgba(0,0,0,0) 100%);
}

.file-btn-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.file-host {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.rank-icon { font-size: 0.95rem; }

.host-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    letter-spacing: 0.3px;
}

.mirror-tag {
    background: rgba(255,255,255,0.1);
    color: var(--text-sec);
    font-size: 0.7rem;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.episode-tag {
    background: rgba(229,9,20,0.15);
    color: #f87171;
    font-size: 0.7rem;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid rgba(229,9,20,0.3);
}

.file-size {
    font-size: 0.78rem;
    color: var(--text-sec);
    font-weight: 500;
}

.file-btn-right {
    flex-shrink: 0;
    color: var(--text-sec);
    transition: color 0.18s;
}

.file-btn:hover .file-btn-right { color: white; }

.dl-icon-btn { width: 18px; height: 18px; }

/* --- SEASON GROUPING --- */
.season-group {
    margin-bottom: 0;
    flex: 0 0 auto;
    min-width: 220px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.season-group:last-child {
    margin-bottom: 0;
}

.season-group-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: white;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.season-group-title::before {
    content: '';
    display: block;
    width: 3px;
    height: 14px;
    background: var(--primary);
    border-radius: 2px;
}

/* --- MANUAL TYPE SELECTOR --- */
.manual-type-selector {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
}
.type-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-sec);
    font-weight: 600;
    transition: all 0.2s ease;
}
.type-option:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}
.type-option.active {
    color: white;
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(229, 9, 20, 0.4);
}

/* --- SORTABLE SOURCES (DRAG & DROP) --- */
.sortable-source-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: background 0.2s, border-color 0.2s, transform 0.15s ease, box-shadow 0.2s;
    user-select: none;
    -webkit-user-drag: element;
}

.sortable-source-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.sortable-source-item.dragging {
    opacity: 0.4;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--text-sec);
    transform: scale(0.98);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.sortable-source-item .drag-handle {
    cursor: grab;
    color: var(--text-sec);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    margin-right: 8px;
    transition: color 0.2s;
}

.sortable-source-item .drag-handle:hover {
    color: white;
}

.sortable-source-item .drag-handle:active {
    cursor: grabbing;
}

/* --- ADMIN USER MANAGEMENT --- */
.btn-action {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
}
.btn-action:hover { 
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--primary-glow);
    filter: brightness(1.1);
}
.btn-action:active { 
    transform: translateY(1px) scale(0.97); 
}

.admin-user-item {
    transition: border-color 0.2s, background 0.2s;
}
.admin-user-item:hover {
    border-color: rgba(255,255,255,0.1) !important;
    background: rgba(255,255,255,0.03) !important;
}

.admin-reset-pw-btn, .admin-delete-user-btn {
    transition: var(--transition);
}
.admin-reset-pw-btn:hover {
    background: rgba(59, 130, 246, 0.3) !important;
    border-color: #3b82f6 !important;
    transform: scale(1.05);
}
.admin-delete-user-btn:hover {
    background: rgba(239, 68, 68, 0.3) !important;
    border-color: #ef4444 !important;
    transform: scale(1.05);
}

/* --- MODAL OVERLAY --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.2s ease-out;
}
@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- OVERLAY CHANGEMENT DE MOT DE PASSE OBLIGATOIRE --- */
#change-password-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.98);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}
.change-password-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    width: 90%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: modalFadeIn 0.3s ease-out;
}
.change-password-box h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: white;
}
.change-password-box p {
    color: var(--text-sec);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}
.change-password-box form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
}
.change-password-box label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-sec);
    margin-bottom: -0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.change-password-box input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    transition: var(--transition);
}
.change-password-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.password-requirements {
    font-size: 0.78rem;
    color: var(--text-sec);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}
.password-requirements ul {
    list-style: none;
    padding: 0;
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.password-requirements li {
    display: flex;
    align-items: center;
    gap: 6px;
}
.password-requirements li.valid {
    color: var(--success);
}
.password-requirements li.invalid {
    color: #ef4444;
}