: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; }
/* Titre sur 2 lignes maximum (titre complet au survol), hauteur réservée pour aligner les cartes */
.card-title {
    font-weight: 700; font-size: 0.95rem; line-height: 1.4; min-height: 2.8em; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.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;
}

/* Hébergeur pris en charge par le débrideur actif (en-tête d'un groupe de liens) */
.badge-debrid {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.68rem;
    color: #fbbf24;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
}

/* Icônes Lucide dans le texte (badges, rangs, titres) */
.inline-ico { width: 12px; height: 12px; flex-shrink: 0; }
.rank-icon .inline-ico, .quality-pill .inline-ico { vertical-align: -2px; }
.title-ico { width: 1em; height: 1em; vertical-align: -0.12em; color: var(--primary); }

.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;
    /* Noms de fichiers longs : retour à la ligne plutôt que de sortir de la fiche (mobile) */
    max-width: 100%;
    text-align: left;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

/* Saisons : rangée qui défile horizontalement, chaque bouton reste sur une ligne */
.seasons-wrapper .version-tab {
    flex-shrink: 0;
    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;
}

/* ======================================================
   PLUGINS — grille de cartes (wizard d'onboarding et page Paramètres)
   ====================================================== */
.plugin-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 1000px) { .plugin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .plugin-grid { grid-template-columns: 1fr; } }
.plugin-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem; cursor: pointer;
    transition: var(--transition); position: relative; text-align: left; color: inherit; font: inherit;
}
.plugin-card:hover:not(:disabled) { border-color: #555; background: var(--bg-hover); }
.plugin-card.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), 0 0 20px rgba(229, 9, 20, 0.15); }
.plugin-card:disabled { cursor: default; opacity: 0.75; }
.plugin-card.deprecated { opacity: 0.45; }
.plugin-card .pc-head { display: flex; align-items: center; gap: 10px; padding-right: 26px; }
.plugin-card .pc-icon {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(229, 9, 20, 0.12); color: var(--primary);
}
.plugin-card .pc-name { font-weight: 600; color: white; font-size: 0.95rem; line-height: 1.2; }
.plugin-card .pc-author { font-size: 0.75rem; color: var(--text-sec); }
.plugin-card .pc-check {
    position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border-radius: 6px;
    border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; color: white;
}
.plugin-card .pc-check svg { width: 14px; height: 14px; opacity: 0; }
.plugin-card.selected .pc-check { background: var(--primary); border-color: var(--primary); }
.plugin-card.selected .pc-check svg { opacity: 1; }
.plugin-card .pc-desc { font-size: 0.82rem; color: var(--text-sec); line-height: 1.45; flex: 1; }
.plugin-card .pc-problem { font-size: 0.78rem; color: #ef4444; line-height: 1.4; overflow-wrap: anywhere; }
.plugin-card .pc-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.plugin-card .pc-tag { font-size: 0.68rem; padding: 2px 8px; border-radius: 20px; background: rgba(255,255,255,0.06); color: var(--text-sec); }
.plugin-card .pc-foot { display: flex; align-items: center; justify-content: space-between; font-size: 0.75rem; color: var(--text-sec); border-top: 1px solid var(--border); padding-top: 0.6rem; gap: 8px; }
.pc-meta { display: inline-flex; align-items: center; gap: 4px; }
.pc-status { font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.pc-status.ok { color: var(--success); }
.pc-status.warn { color: var(--gold); }
.pc-status.err { color: #ef4444; }

/* Champs de configuration des plugins (wizard étape 3 et fenêtre Configurer des Paramètres) */
.config-field { margin-bottom: 0.9rem; }
.config-field label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-sec); margin-bottom: 5px; }
.config-field label .req { color: var(--primary); }
.config-field input {
    width: 100%; box-sizing: border-box; padding: 10px 12px; background: var(--bg-main); border: 1px solid var(--border);
    border-radius: 8px; color: white; font-size: 0.9rem;
}
.config-field input:focus { outline: none; border-color: var(--primary); }
.config-field .field-help { font-size: 0.74rem; color: var(--text-sec); margin: 5px 0 0; line-height: 1.4; }

/* Gestion des plugins (page Paramètres) */
.plugins-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 1.5rem 0 0.8rem; }
.plugins-toolbar h4 { margin: 0; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.plugins-toolbar .pt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.plugins-note { font-size: 0.78rem; color: var(--text-sec); margin-top: 0.8rem; }
.plugins-empty { grid-column: 1 / -1; text-align: center; color: var(--text-sec); padding: 2rem 1rem; border: 1px dashed var(--border); border-radius: var(--radius); font-size: 0.9rem; }
.plugin-card.static { cursor: default; }
.plugin-card.static:hover { border-color: var(--border); background: var(--bg-card); }
.pc-update { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 600; color: var(--gold); background: rgba(229, 160, 13, 0.12); padding: 2px 8px; border-radius: 20px; align-self: flex-start; }
.pc-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pc-btn {
    flex: 1; padding: 7px 10px; border-radius: 8px; font-size: 0.78rem; font-weight: 600; cursor: pointer;
    border: 1px solid var(--border); background: transparent; color: white; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    transition: var(--transition); white-space: nowrap;
}
.pc-btn svg { width: 14px; height: 14px; }
.pc-btn:hover:not(:disabled) { background: var(--bg-hover); }
.pc-btn.primary { background: var(--primary); border-color: var(--primary); }
.pc-btn.primary:hover:not(:disabled) { background: #c40812; }
.pc-btn.warn { border-color: rgba(229, 160, 13, 0.5); color: var(--gold); }
.pc-btn.danger { flex: 0 0 auto; color: #ef4444; border-color: rgba(239, 68, 68, 0.35); }
.pc-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pc-btn.icon-only { flex: 0 0 auto; padding: 7px 9px; }
.pm-body { padding: 1.25rem; overflow-y: auto; }
.pm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.pm-head h3 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.pm-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
.pm-foot .pc-btn { flex: 0 0 auto; padding: 10px 18px; font-size: 0.88rem; }
.pm-warning { background: rgba(229, 160, 13, 0.08); border: 1px solid rgba(229, 160, 13, 0.35); color: var(--gold); border-radius: 8px; padding: 10px 12px; font-size: 0.82rem; line-height: 1.45; margin-top: 1rem; }
.pm-error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #ef4444; border-radius: 8px; padding: 10px 12px; font-size: 0.85rem; margin-bottom: 1rem; }
.pm-meta { font-size: 0.82rem; color: var(--text-sec); line-height: 1.6; }
@keyframes pc-spin { to { transform: rotate(360deg); } }
.pc-spin { animation: pc-spin 1s linear infinite; }
.pm-error { white-space: pre-line; }
.plugin-card .pc-icon.has-logo { background: rgba(255,255,255,0.06); padding: 0; overflow: hidden; }
.plugin-card .pc-icon img { width: 100%; height: 100%; object-fit: cover; }

/* Réglages JDownloader (carte Intégration JDownloader, admin) */
.jd-options { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.9rem; }
.jd-option { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.jd-option label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 2px; }
.jd-option p { font-size: 0.8rem; color: var(--text-sec); margin: 0; line-height: 1.4; }
.jd-option select { width: auto; min-width: 90px; margin: 0; padding: 8px 12px; flex-shrink: 0; }
.jd-warning { display: flex; gap: 8px; align-items: flex-start; font-size: 0.8rem; line-height: 1.4; color: var(--gold); background: rgba(229, 160, 13, 0.08); border: 1px solid rgba(229, 160, 13, 0.35); border-radius: 8px; padding: 10px 12px; }
.jd-status { font-size: 0.78rem; color: var(--text-sec); margin: 0; min-height: 1em; }
.jd-status.ok { color: var(--success); }
.jd-status.err { color: #ef4444; }
@media (max-width: 600px) { .jd-option { flex-direction: column; align-items: stretch; } .jd-option select { width: 100%; } }

/* Paramètres → Système (app.system.js) */
.sys-root { display: flex; flex-direction: column; gap: 1rem; }
.sys-card { background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.sys-card > summary { cursor: pointer; list-style: none; }
.sys-card > summary::-webkit-details-marker { display: none; }
.sys-card[open] > summary { margin-bottom: 0.8rem; }
.sys-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 0.4rem; }
.sys-group-head h4 { margin: 0; font-size: 1rem; }
.sys-group-head svg { width: 18px; height: 18px; color: var(--primary); }
.sys-desc { font-size: 0.8rem; color: var(--text-sec); margin: 0 0 0.9rem; line-height: 1.45; }
.sys-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem 1.2rem; }
@media (max-width: 800px) { .sys-fields { grid-template-columns: 1fr; } }
.sys-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.sys-label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sys-label label { font-size: 0.82rem; font-weight: 600; }
.sys-lock svg { width: 13px; height: 13px; color: var(--gold); vertical-align: middle; }
.sys-source { font-size: 0.68rem; padding: 1px 7px; border-radius: 20px; background: rgba(255,255,255,0.06); color: var(--text-sec); }
.sys-source.web { background: rgba(229, 9, 20, 0.12); color: var(--primary); }
.sys-source.env { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.sys-reset { background: none; border: none; color: var(--text-sec); font-size: 0.7rem; text-decoration: underline; cursor: pointer; padding: 0 0 0 4px; }
.sys-field input, .sys-field select { width: 100%; box-sizing: border-box; margin: 0; padding: 9px 12px; background: var(--bg-main); border: 1px solid var(--border); border-radius: 8px; color: white; font-size: 0.88rem; }
.sys-field input:focus, .sys-field select:focus { outline: none; border-color: var(--primary); }
.sys-help { font-size: 0.74rem; color: var(--text-sec); margin: 0; line-height: 1.4; }
.sys-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 1rem; flex-wrap: wrap; }
.sys-actions .btn-action { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; width: auto; }
.sys-actions .btn-action svg { width: 15px; height: 15px; }
.sys-btn-ghost { background: transparent !important; border: 1px solid var(--border) !important; }
.sys-status { margin: 0 auto 0 0; font-size: 0.8rem; color: var(--text-sec); }
.sys-status.ok { color: var(--success); }
.sys-status.err { color: #ef4444; }
.sys-test:not(:empty) { margin-top: 0.8rem; display: flex; flex-direction: column; gap: 6px; }
.sys-check { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.sys-check svg { width: 15px; height: 15px; flex-shrink: 0; }
.sys-check.ok svg { color: var(--success); }
.sys-check.err svg { color: #ef4444; }
.sys-check span { color: var(--text-sec); overflow-wrap: anywhere; }
.sys-alert { display: flex; gap: 10px; align-items: flex-start; font-size: 0.82rem; line-height: 1.45; color: var(--gold); background: rgba(229, 160, 13, 0.08); border: 1px solid rgba(229, 160, 13, 0.35); border-radius: 10px; padding: 10px 12px; }
.sys-alert svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Confirmation par mot de passe (app.security.js) */
.reauth-box { max-width: 380px; padding: 1.4rem; gap: 0.8rem; }
.reauth-box h3 { margin: 0; font-size: 1.05rem; }
.reauth-box p { margin: 0; font-size: 0.85rem; color: var(--text-sec); }
.reauth-box input { width: 100%; box-sizing: border-box; margin: 0; padding: 10px 12px; background: var(--bg-main); border: 1px solid var(--border); border-radius: 8px; color: white; }
.reauth-box .reauth-error { color: #f87171; }
.reauth-actions { display: flex; justify-content: flex-end; gap: 8px; }
.reauth-actions .pc-btn { flex: 0 0 auto; padding: 9px 16px; font-size: 0.85rem; }

/* Paramètres : onglets et cartes */
.settings-tabs {
    display: flex; gap: 4px; max-width: 1040px; margin: -1rem auto 1.75rem; padding: 0 2px;
    border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tabs [role="tab"] {
    display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
    padding: 12px 16px; background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
    color: var(--text-sec); font: inherit; font-size: 0.92rem; font-weight: 500; cursor: pointer; transition: var(--transition);
}
.settings-tabs [role="tab"] svg { width: 17px; height: 17px; }
.settings-tabs [role="tab"]:hover { color: white; }
.settings-tabs [role="tab"][aria-selected="true"] { color: white; font-weight: 600; border-bottom-color: var(--primary); }
.settings-tabs [role="tab"][aria-selected="true"] svg { color: var(--primary); }
.settings-tabs [role="tab"]:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 6px; }
/* Docker sans volume /data : au-dessus des onglets, qui remontent de 1rem sous le titre */
.settings-alert {
    display: flex; gap: 12px; align-items: flex-start; max-width: 1040px; margin: -1rem auto 2.5rem;
    padding: 14px 16px; border-radius: var(--radius); font-size: 0.87rem; line-height: 1.5;
    color: var(--text-sec); background: rgba(229, 160, 13, 0.08); border: 1px solid rgba(229, 160, 13, 0.35);
}
.settings-alert > svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; color: var(--gold); }
.settings-alert strong { display: block; margin-bottom: 4px; color: var(--gold); }
.settings-alert p { margin: 0; }
.settings-alert code { padding: 1px 5px; border-radius: 4px; font-size: 0.82rem; color: var(--text-main); background: rgba(255, 255, 255, 0.06); }
.settings-panel { max-width: 1040px; margin: 0 auto; }
.settings-panel[hidden] { display: none; }
.form-card.settings-card { max-width: none; margin: 0 0 1.5rem; }
.settings-card-title {
    display: flex; align-items: center; gap: 8px; margin: 0 0 0.5rem; padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border); font-size: 1.1rem; font-weight: 600; color: white;
}
.settings-card-title svg { width: 20px; height: 20px; flex-shrink: 0; }
.settings-card-desc { font-size: 0.85rem; color: var(--text-sec); margin: 0 0 1rem; line-height: 1.5; }
.settings-card-toggle { justify-content: space-between; cursor: pointer; }
.settings-card-toggle span { display: inline-flex; align-items: center; gap: 8px; }
.form-card .settings-card-toggle input[type="checkbox"] { width: 20px; height: 20px; margin: 0; padding: 0; accent-color: var(--primary); cursor: pointer; }
.version-badge { margin-left: auto; font-size: 0.75rem; font-weight: 500; font-family: monospace; background: rgba(255,255,255,0.1); padding: 4px 8px; border-radius: 4px; }
.btn-action.btn-inline { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto; padding: 10px 20px; }
.btn-action.btn-block { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px 20px; }
.btn-action svg { width: 16px; height: 16px; }
.sortable-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 1rem; }
.hoster-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: grab;
    background: var(--bg-main); border: 1px solid var(--border); border-radius: 8px;
}
.hoster-item img { width: 20px; height: 20px; border-radius: 4px; }
.hoster-item span { font-weight: 500; text-transform: capitalize; }
.hoster-grip, .hoster-fallback { width: 18px; height: 18px; color: var(--text-sec); flex-shrink: 0; }
.hoster-fallback { display: none; }
.users-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 1.5rem; }
.users-add { border-top: 1px solid var(--border); padding-top: 1rem; }
.users-add-title { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 0.5rem; }
.users-add-title svg { width: 16px; height: 16px; color: var(--primary); }
.users-add-row { display: flex; gap: 10px; margin-bottom: 12px; align-items: center; }
.form-card .users-add-row input { flex: 1; margin: 0; }
.form-card .users-add-row select { width: auto; min-width: 130px; margin: 0; }
.update-results { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px dashed var(--border); }
.update-banner {
    display: flex; align-items: center; gap: 8px; padding: 12px; margin-bottom: 1rem; border-radius: 6px;
    background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text-main); font-weight: 500;
}
.update-banner svg { width: 20px; height: 20px; color: #10b981; flex-shrink: 0; }
.update-banner.new { background: rgba(16,185,129,0.1); border-color: #10b981; color: #10b981; font-weight: 600; }
.update-banner.failed { align-items: flex-start; background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.5); color: #fca5a5; }
.update-banner.failed svg { color: #f87171; }
.update-banner.failed div { flex: 1; }
.update-banner.failed p { margin: 4px 0 0; font-size: 0.8rem; font-weight: 400; color: var(--text-sec); }
.update-oneclick { display: flex; flex-direction: column; gap: 8px; margin-bottom: 1rem; }
.update-oneclick .btn-action { align-self: flex-start; }
.update-oneclick-help { margin: 0; font-size: 0.82rem; color: var(--text-sec); }
.update-oneclick-status { margin: 0; font-size: 0.85rem; color: var(--text-main); }
.update-oneclick-status.ok { color: #34d399; }
.update-oneclick-status.err { color: #f87171; }
.update-subtitle { margin: 0 0 8px; font-size: 0.9rem; }
.update-notes { margin: 0 0 1rem; padding-left: 20px; color: var(--text-sec); font-size: 0.85rem; line-height: 1.5; }
.update-methods { display: flex; flex-direction: column; gap: 10px; }
.update-methods summary { cursor: pointer; font-size: 0.8rem; color: var(--text-sec); margin-bottom: 10px; }
.update-method { background: var(--bg-main); padding: 12px; border-radius: 6px; border: 1px solid var(--border); font-size: 0.8rem; color: var(--text-sec); }
.update-method strong { display: block; color: var(--primary); margin-bottom: 4px; }
.update-method p { margin: 8px 0 0; }
.update-method a { color: var(--text-main); text-decoration: underline; font-size: 0.85rem; }
.update-method code.selectable { user-select: all; cursor: text; color: var(--text-main); font-size: 0.85rem; }
.update-method code.hash { display: inline-block; font-size: 0.75rem; background: rgba(0,0,0,0.2); padding: 2px 4px; border-radius: 4px; word-break: break-all; }
.settings-version {
    display: flex; width: fit-content; align-items: center; gap: 6px; margin: 3rem auto 1rem; padding: 6px 12px;
    font-size: 0.85rem; color: var(--text-sec); background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px;
}
.settings-version svg { width: 14px; height: 14px; }
.jd-options .sys-root { margin-top: 0.4rem; }
@media (max-width: 600px) {
    .settings-tabs { margin-top: -1.25rem; }
    .settings-tabs [role="tab"] { padding: 11px 12px; }
    .users-add-row { flex-direction: column; align-items: stretch; }
    .form-card .users-add-row select { width: 100%; }

    /* Fiche d'un titre : marges resserrées pour que les étiquettes de langue tiennent sur une ligne */
    .modal-overlay { padding: 0.5rem; }
    #modal-overlay .modal-content { padding: 1rem; }
    #modal-overlay .modal-body { padding: 0.75rem 0.25rem; }
    .file-btn { padding: 10px 12px; }
    .file-btn .file-btn-left { padding-right: 0 !important; }
    .file-btn-right .btn-dl { padding: 8px; }
}

/* Reveal assisté (lien protégé par un captcha) */
.reveal-modal { max-width: 500px; padding: 0; overflow: hidden; display: flex; flex-direction: column; max-height: 92vh; max-height: 92dvh; }
.reveal-modal:focus { outline: none; }
.reveal-modal .modal-header h3 { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin: 0; min-width: 0; }
.reveal-modal .modal-header h3 svg { width: 20px; height: 20px; color: var(--primary); flex: 0 0 auto; }
.reveal-modal .modal-body { padding: 1.25rem 1.5rem; }
.reveal-icon-btn { background: rgba(255, 255, 255, 0.05); border: none; color: var(--text-sec); width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); flex: 0 0 auto; }
.reveal-icon-btn:hover { background: rgba(255, 255, 255, 0.1); color: white; }
.reveal-icon-btn svg { width: 18px; height: 18px; }
.reveal-lead { color: var(--text-sec); font-size: 0.9rem; line-height: 1.55; margin: 0 0 1rem; }
.reveal-note { color: var(--text-sec); font-size: 0.8rem; margin: -0.5rem 0 1rem; }
.reveal-steps { list-style: none; display: flex; flex-direction: column; gap: 10px; margin: 0 0 1rem; padding: 0; }
.reveal-step { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255, 255, 255, 0.02); transition: var(--transition); }
.reveal-step.active { border-color: rgba(229, 9, 20, 0.55); background: rgba(229, 9, 20, 0.06); }
.reveal-step.done { border-color: rgba(16, 185, 129, 0.45); }
.reveal-step.warn { border-color: rgba(229, 160, 13, 0.55); background: rgba(229, 160, 13, 0.06); }
.reveal-num { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; background: var(--bg-hover); color: var(--text-sec); }
.reveal-num svg { width: 16px; height: 16px; }
.reveal-step.active .reveal-num { background: rgba(229, 9, 20, 0.15); color: #ff4d55; }
.reveal-step.done .reveal-num { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.reveal-step.warn .reveal-num { background: rgba(229, 160, 13, 0.15); color: var(--gold); }
.reveal-step-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.reveal-step-text strong { font-size: 0.92rem; color: white; }
.reveal-step-text span { font-size: 0.78rem; color: var(--text-sec); line-height: 1.4; }
.reveal-btn {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 40px; padding: 9px 15px; border-radius: 10px; border: 1px solid var(--border);
    background: transparent; color: white; font: 600 0.85rem/1 var(--font); white-space: nowrap; cursor: pointer;
    -webkit-appearance: none; appearance: none; transition: var(--transition); touch-action: manipulation;
}
.reveal-btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.reveal-btn:hover:not(:disabled) { background: var(--bg-hover); border-color: #444; }
.reveal-btn:active:not(:disabled) { transform: translateY(1px); }
.reveal-btn:focus-visible, .reveal-icon-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.reveal-btn.primary { background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%); border-color: transparent; box-shadow: var(--shadow-sm); }
.reveal-btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%); filter: brightness(1.1); box-shadow: 0 4px 14px var(--primary-glow); }
.reveal-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.reveal-status { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 10px; background: var(--bg-main); border: 1px solid var(--border); font-size: 0.85rem; line-height: 1.45; color: var(--text-sec); }
.reveal-status.busy { color: white; }
.reveal-status.ok { color: var(--success); border-color: rgba(16, 185, 129, 0.35); }
.reveal-status.warn { color: var(--gold); border-color: rgba(229, 160, 13, 0.4); }
.reveal-status.error { color: #ef4444; border-color: rgba(239, 68, 68, 0.4); }
.reveal-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.reveal-status.busy .reveal-dot { background: var(--primary); animation: reveal-pulse 1.2s ease-in-out infinite; }
@keyframes reveal-pulse { 0%, 100% { opacity: 0.35; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.15); } }
.reveal-progress { height: 6px; background: #222; border-radius: 3px; overflow: hidden; margin-top: 10px; }
.reveal-progress > div { height: 100%; width: 0; background: var(--success); transition: width 0.4s ease; }
.reveal-help { margin-top: 1rem; font-size: 0.82rem; color: var(--text-sec); }
.reveal-help summary { cursor: pointer; color: white; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; list-style: none; padding: 4px 0; }
.reveal-help summary::-webkit-details-marker { display: none; }
.reveal-help summary svg { width: 16px; height: 16px; color: var(--text-sec); }
.reveal-help ul, .reveal-help ol { margin: 0.6rem 0 0 1.1rem; line-height: 1.6; }
.reveal-help li + li { margin-top: 0.35rem; }
.reveal-help a { color: #60a5fa; }
.reveal-manual { margin-top: 0.6rem; line-height: 1.5; }
.reveal-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0.9rem 1.5rem; border-top: 1px solid var(--border); }
.reveal-device { font-size: 0.75rem; color: var(--text-sec); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) {
    .reveal-modal .modal-body { padding: 1rem; }
    .reveal-step { flex-wrap: wrap; }
    .reveal-step .reveal-btn { width: 100%; }
    .reveal-foot { padding: 0.8rem 1rem; }
}
@media (prefers-reduced-motion: reduce) {
    .reveal-status.busy .reveal-dot { animation: none; }
    .reveal-btn, .reveal-step { transition: none; }
}

/* Appareils liés au script de reveal (fenêtre admin d'un plugin) */
.pm-devices { display: flex; flex-direction: column; gap: 8px; margin-top: 1rem; }
.pm-device { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: rgba(255, 255, 255, 0.02); }
.pm-device-icon { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-hover); color: var(--text-sec); }
.pm-device-icon svg { width: 17px; height: 17px; }
.pm-device-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pm-device-text strong { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-device-text span { font-size: 0.76rem; color: var(--text-sec); line-height: 1.4; }
.pm-device .pc-btn { flex: 0 0 auto; }
@media (max-width: 480px) { .pm-device { flex-wrap: wrap; } .pm-device .pc-btn { width: 100%; } }

/* Script de reveal dans la configuration d'un plugin */
.pm-reveal { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.pm-reveal h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 0.95rem; }
.pm-reveal h4 svg { width: 17px; height: 17px; color: var(--primary); }
.pm-reveal-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.pm-reveal-row .pc-btn { flex: 0 0 auto; padding: 9px 14px; font-size: 0.84rem; }
.pm-reveal-status { flex: 1; margin: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg-main); border: 1px solid var(--border); font-size: 0.82rem; line-height: 1.4; color: var(--text-sec); }
.pm-reveal-status::before { content: ''; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pm-reveal-status.busy::before { background: var(--primary); animation: reveal-pulse 1.2s ease-in-out infinite; }
.pm-reveal-status.ok { color: var(--success); border-color: rgba(16, 185, 129, 0.35); }
.pm-reveal-status.warn { color: var(--gold); border-color: rgba(229, 160, 13, 0.4); }
.pm-reveal-status.error { color: #ef4444; border-color: rgba(239, 68, 68, 0.4); }
.pm-reveal-guide { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 0.8rem; color: #60a5fa; }
.pm-reveal-guide svg { width: 15px; height: 15px; }
@media (max-width: 480px) { .pm-reveal-row { flex-direction: column; align-items: stretch; } }
@media (prefers-reduced-motion: reduce) { .pm-reveal-status.busy::before { animation: none; } }
.pm-reveal-guide[hidden] { display: none; }
