/* ==========================================
   STYLE LECTEUR IMMERSIF (TYPE NETFLIX)
   ========================================== */

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', sans-serif; }

/* La page entière est noire et bloque le défilement */
body.mode-cinema { 
    background-color: #000; 
    overflow: hidden; /* Empêche de scroller, on est au cinéma ! */
    width: 100vw; 
    height: 100vh; 
}

/* Le conteneur prend 100% de la fenêtre */
.lecteur-fullscreen-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #000;
}

/* Customisation du moteur Plyr pour qu'il prenne 100% */
:root { --plyr-color-main: #e50914; --plyr-video-background: #000; }
.plyr { height: 100% !important; width: 100% !important; }
.plyr__video-wrapper { height: 100% !important; }
video { object-fit: contain; } /* Garde les proportions du film sans le couper */

/* ==========================================
   LES OVERLAYS (Éléments flottants)
   ========================================== */

.lecteur-fullscreen-wrapper::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 150px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent);
    z-index: 10; pointer-events: none; transition: opacity 0.5s;
}

/* DÉTAIL 3 : Bouton Retour Ultra Stylé (Glassmorphism) */
.btn-retour-flottant {
    position: absolute; top: 30px; left: 40px; z-index: 20;
    background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff; font-size: 14px; font-weight: bold; text-transform: uppercase; letter-spacing: 2px;
    padding: 12px 25px; border-radius: 30px; cursor: pointer;
    backdrop-filter: blur(10px); display: flex; align-items: center; gap: 10px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.btn-retour-flottant:hover { 
    background: rgba(229, 9, 20, 0.8); border-color: #e50914; 
    transform: translateX(-5px); box-shadow: 0 5px 15px rgba(229, 9, 20, 0.4);
}

/* DÉTAIL 4 : Interface Éclatée (Gauche / Droite) */
.interface-vod-overlay {
    position: absolute; top: 30px; right: 40px; left: 220px; /* On laisse la place au bouton retour à gauche */
    z-index: 20; display: flex; justify-content: space-between; align-items: flex-start;
    text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}

.infos-gauche { text-align: left; }
.titre-film-overlay { font-size: 32px; color: #fff; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 5px; }
.date-overlay { font-size: 14px; color: #ccc; }

.actions-droite { display: flex; align-items: center; gap: 30px; } /* Bel espacement */

/* Étoiles */
.notation-etoiles { font-size: 26px; cursor: pointer; color: rgba(255,255,255,0.3); display: flex; gap: 5px; }
.etoile.active { color: #ffc107; text-shadow: 0 0 15px rgba(255,193,7,0.8); }

/* Nouveaux Boutons d'Action (En forme de pilule pour inclure le chiffre) */
.action-btn-pilule {
    height: 50px; padding: 0 22px; border-radius: 25px; 
    background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.2); 
    color: white; cursor: pointer; display: flex; align-items: center; gap: 12px;
    transition: all 0.3s; backdrop-filter: blur(5px);
}
.action-btn-pilule i { font-size: 20px; }
.compteur-action { font-size: 16px; font-weight: bold; font-family: monospace; letter-spacing: 1px; }

.action-btn-pilule:hover { background: rgba(255,255,255,0.2); transform: translateY(-2px); }

/* États actifs des boutons */
.action-btn-pilule.aime { color: #e50914; border-color: #e50914; background: rgba(229,9,20,0.2); }

/* COUAC 1 : Pulsation Réparée et Imposante */
.btn-don { 
    color: #ffc107; border-color: rgba(255, 193, 7, 0.4); 
    animation: pulseDon 2s infinite cubic-bezier(0.66, 0, 0, 1); 
}
.btn-don:hover { background: rgba(255,193,7,0.2); color: #fff; border-color: #fff; animation: none; transform: scale(1.05); }

@keyframes pulseDon {
    0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.5); transform: scale(1); }
    50% { box-shadow: 0 0 0 15px rgba(255, 193, 7, 0); transform: scale(1.02); }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); transform: scale(1); }
}

/* DÉTAIL 2 : Bouton Play central inversé (Cercle Blanc, Triangle Rouge) */
.plyr--video .plyr__control--overlaid {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #e50914 !important; /* Triangle Rouge */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
}
.plyr--video .plyr__control--overlaid:hover {
    background: #ffffff !important;
    /* On GARDE le translate pour le maintenir au centre parfait, et on ajoute le scale */
    transform: translate(-50%, -50%) scale(1.2) !important; 
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.8) !important; /* L'effet "Clique-moi" */
}

/* ==========================================
   GESTION MOBILE & ROTATION (MODE PAYSAGE FORCÉ)
   ========================================== */

/* Par défaut, l'alerte est cachée sur ordinateur */
.alerte-rotation {
    display: none;
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: #000; z-index: 99999;
    flex-direction: column; justify-content: center; align-items: center; text-align: center;
    padding: 30px; color: white;
}

.alerte-rotation h2 { color: #e50914; text-transform: uppercase; margin-bottom: 15px; letter-spacing: 2px; }
.alerte-rotation p { color: #aaa; font-size: 14px; line-height: 1.6; max-width: 300px; }

/* L'icône de téléphone qui s'anime pour montrer le mouvement */
.icone-rotation {
    font-size: 60px; color: #fff; margin-bottom: 30px;
    animation: tourneTelephone 2.5s infinite ease-in-out;
}

@keyframes tourneTelephone {
    0% { transform: rotate(0deg); }
    40% { transform: rotate(-90deg); } /* Il se couche */
    80% { transform: rotate(-90deg); }
    100% { transform: rotate(0deg); }
}

/* LA MAGIE : Si c'est un écran mobile tenu à la verticale (Portrait) */
@media screen and (max-width: 768px) and (orientation: portrait) {
    /* On affiche l'alerte de rotation */
    .alerte-rotation { display: flex; }
    /* On cache complètement le lecteur pour l'empêcher de regarder en petit ! */
    .lecteur-fullscreen-wrapper { display: none; }
}

/* Si le téléphone est bien à l'horizontale (Paysage), on adapte un peu l'interface */
@media screen and (max-width: 950px) and (orientation: landscape) {
    .btn-retour-flottant { top: 15px; left: 20px; font-size: 12px; padding: 8px 15px; }
    .interface-vod-overlay { top: 15px; right: 20px; left: 140px; }
    .titre-film-overlay { font-size: 20px; }
    .notation-etoiles { font-size: 18px; }
    .action-btn-pilule { height: 40px; padding: 0 15px; font-size: 14px; }
    .action-btn-pilule i { font-size: 16px; }
    .compteur-action { font-size: 14px; }
}

/* ========================================= */
/* LE PANNEAU LATÉRAL DE PLAYLIST (ZAPPING)  */
/* ========================================= */
#panneau-playlist {
    position: absolute;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    border-left: 1px solid #333;
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* État fermé (caché à droite hors de l'écran) */
.panneau-playlist-cache {
    transform: translateX(100%);
}

/* État ouvert (glisse sur l'écran) */
.panneau-playlist-ouvert {
    transform: translateX(0);
}

.en-tete-panneau {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #333;
    background: #000;
}

.en-tete-panneau h3 {
    color: white;
    margin: 0;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.en-tete-panneau button {
    background: none;
    border: none;
    color: #888;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.en-tete-panneau button:hover {
    color: #e50914;
}

.contenu-panneau {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

/* Scrollbar discrète pour le panneau */
.contenu-panneau::-webkit-scrollbar { width: 6px; }
.contenu-panneau::-webkit-scrollbar-track { background: transparent; }
.contenu-panneau::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

/* Élément de la liste */
.item-file-attente {
    display: flex;
    gap: 15px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 10px;
}

.item-file-attente:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Élément en cours de lecture */
.item-file-attente.en-lecture {
    background: rgba(229, 9, 20, 0.15);
    border-left: 3px solid #e50914;
}

.item-file-attente img {
    width: 60px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
}

.item-file-infos {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.item-file-infos h4 {
    color: white;
    margin: 0 0 5px 0;
    font-size: 14px;
}

.item-file-infos p {
    color: #888;
    margin: 0;
    font-size: 12px;
}

.badge-en-lecture {
    display: inline-block;
    background: #e50914;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-top: 5px;
    align-self: flex-start;
}

@media (max-width: 768px) {
    #panneau-playlist { width: 100%; } /* Prend tout l'écran sur mobile */
}

/* ==========================================
   FIX : LE PÉAGE DE NOTATION (MODALE)
   ========================================== */
#modale-peage-notation {
    display: none; /* CACHÉ PAR DÉFAUT (C'est ce qui manquait !) */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95); /* Fond très sombre */
    z-index: 99999; /* Au-dessus de TOUT (même du lecteur vidéo) */
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

/* Quand le JS ajoute la classe 'active', on l'affiche */
#modale-peage-notation.active {
    display: flex !important;
    animation: fadeIn 0.3s ease-out;
}

/* Style de la boîte de contenu */
#modale-peage-notation .contenu-donation {
    background: #141414;
    padding: 40px;
    border-radius: 12px;
    border: 1px solid #333;
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 0 50px rgba(229, 9, 20, 0.2); /* Légère lueur rouge */
}

/* Animation d'apparition */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Style des étoiles dans le péage */
.notation-etoiles-peage .etoile-peage {
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    color: #444; /* Gris par défaut */
}
.notation-etoiles-peage .etoile-peage:hover {
    transform: scale(1.2);
    color: #ffc107 !important;
}

#zone-reprise-manuelle {
    transition: opacity 0.5s ease;
    pointer-events: auto !important; /* Pour être sûr qu'on peut cliquer dessus */
}

#zone-reprise-manuelle:hover {
    background: rgba(229, 9, 20, 0.9) !important; /* Devient rouge Netflix au survol */
    transform: scale(1.05);
}

/* Style du bouton recommencer dans la barre Plyr */
button[data-plyr="play"] i.fa-rotate-left {
    font-size: 1.2em;
    color: #fafafa; /* On le met en jaune pour qu'il se distingue bien */
    transition: transform 0.3s ease;
}

button[data-plyr="play"]:hover i.fa-rotate-left {
    transform: rotate(-45deg); /* Petit effet sympa au survol */
    color: #faf9f9;
}

/* ==========================================
   👻 IMMERSION : ANIMATION DU SURVOL LECTEUR
   ========================================== */
/* On prépare le bouton Quitter et le bandeau Titre/Actions pour l'animation */
.btn-retour-flottant, .interface-vod-overlay { 
    transition: opacity 0.4s ease, transform 0.4s ease !important;
    opacity: 1;
}

/* La classe injectée par le Javascript pour cacher l'interface */
.interface-cache {
    opacity: 0 !important;
    transform: translateY(-20px) !important; 
    pointer-events: none !important; /* Essentiel pour ne pas cliquer dans le vide */
}