/* --- RESET ET FONDATIONS --- */
html, body, a, button, input, select, textarea { touch-action: manipulation; }

/* NOUVEAU : On verrouille totalement la page (écran figé) */
html, body {
    height: 100%; /* On fixe la hauteur à la taille exacte de l'écran */
    overflow: hidden; /* On interdit au fond de scroller */
    overscroll-behavior-y: none; /* On tue l'effet de rebond (élastique) sur iOS/Android */
}

body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background-color: #f2f2f7; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    margin: 0; 
    padding: 0; /* Plus besoin de padding, le flexbox centre tout */
    box-sizing: border-box; 
    transition: background 0.5s; 
    -webkit-font-smoothing: antialiased;
}

.container { 
    text-align: center; 
    background: white; 
    padding: 40px 24px; 
    border-radius: 32px; 
    box-shadow: 0 25px 50px rgba(0,0,0,0.06), 0 10px 20px rgba(0,0,0,0.04); 
    width: 90%; 
    max-width: 450px; 
    position: relative; 
    min-height: 70vh; 
    max-height: 85vh; /* NOUVEAU : La carte ne dépassera jamais 85% de l'écran */
    overflow-y: auto !important; /* Le défilement se fait UNIQUEMENT à l'intérieur de la carte */
    scrollbar-width: none; 
    transition: all 0.5s; 
    z-index: 10; 
}

.container::-webkit-scrollbar { display: none; }

/* --- MODE LICORNE --- */
body.unicorn-mode { 
    background: linear-gradient(-45deg, #ff9a9e, #fad0c4, #a1c4fd, #c2e9fb, #d4fc79, #fbc2eb);
    background-size: 400% 400%;
    animation: unicorn-gradient 8s ease infinite; 
}
@keyframes unicorn-gradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
body.unicorn-mode .container { background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(10px); border: 2px solid rgba(255, 0, 255, 0.3); box-shadow: 0 0 40px rgba(255, 0, 255, 0.2); animation: container-float 3s ease-in-out infinite; }
@keyframes container-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
body.unicorn-mode h1 { background: linear-gradient(to right, #ef5350, #f48fb1, #7e57c2, #2196f3, #26c6da, #43a047, #eeff41, #f9a825, #ff5722); -webkit-background-clip: text; -webkit-text-fill-color: transparent; animation: rainbow-text 2s linear infinite; background-size: 200% auto; font-weight: 900 !important; }
@keyframes rainbow-text { to { background-position: 200% center; } }
.unicorn-particle { position: fixed; top: -50px; font-size: 2rem; z-index: 1; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(360deg); } }


/* Scroll Hint */
.scroll-hint { display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 15px 0; color: #2c3e50; font-size: 0.9rem; font-weight: 600; gap: 8px;}
.scroll-hint span { display: flex; align-items: center; justify-content: center; width: 45px; height: 45px; background-color: #2ecc71; color: white; border-radius: 50%; font-size: 22px; box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3); animation: bounceIntuitif 1.5s infinite; cursor: pointer;}
@keyframes bounceIntuitif { 0%, 20%, 50%, 80%, 100% {transform: translateY(0);} 40% {transform: translateY(8px);} 60% {transform: translateY(4px);}}

/* Petit séparateur pour le récap */
#resume-score h4 { background: #f8f9fa; padding: 10px; border-radius: 8px; border-left: 4px solid #2ecc71; margin: 15px 0 10px 0; color: #2c3e50; font-size: 0.9rem;}

.nav-header { position: absolute; top: 18px; left: 18px; right: 18px; display: flex; align-items: center; justify-content: space-between; height: 40px; }
.btn-nav { background: #f2f2f7; border: none; padding: 10px 14px; border-radius: 12px; cursor: pointer; font-weight: 600; font-size: 0.85rem; z-index: 100; color: #1c1c1e; transition: transform 0.1s, background 0.2s; }
.btn-nav:active { transform: scale(0.95); background: #e5e5ea; }
.header-progress { flex-grow: 1; margin: 0 15px; background-color: #f2f2f7; height: 8px; border-radius: 4px; overflow: hidden; display: none; }
.header-progress-fill { height: 100%; background-color: #2ecc71; width: 0%; transition: 0.4s ease-out; }

/* NOUVEAU : On gère les marges du titre pour ne pas s'écraser sous le bouton Retour */

h1 { color: #2c3e50; font-size: 1.25rem; margin-top: 30px; margin-bottom: 35px; cursor: pointer; transition: 0.3s; font-weight: 700; letter-spacing: -0.5px; }

.section-badge { display: block; margin: 20px auto; width: fit-content; padding: 8px 20px; border-radius: 20px; font-weight: 600; color: white !important; font-size: 0.85rem; text-align: center; background-color: #e67e22; letter-spacing: 0.5px; }

.ref-info { background-color: #fdf2f2; color: #c0392b; padding: 12px; border-radius: 12px; font-size: 0.9rem; margin-bottom: 15px; border: 1px solid #f5c6cb; font-weight: 600; }

/* BOUTONS */
/* NOUVEAU : On augmente l'espace entre les boutons (margin 14px) */
.btn { display: block; width: 100%; padding: 16px; margin: 14px 0; font-size: 16px; color: white; border: none; border-radius: 16px; cursor: pointer; font-weight: 600; transition: all 0.2s; text-decoration: none; box-sizing: border-box; }        
.btn:active { transform: scale(0.97); }

/* BOUTONS (Garde tes couleurs, adopte la forme iOS) */
.btn { display: block; width: 100%; padding: 16px; margin: 10px 0; font-size: 16px; color: white; border: none; border-radius: 14px; cursor: pointer; font-weight: 600; transition: all 0.2s; text-decoration: none; box-sizing: border-box; }        
.btn:active { transform: scale(0.97); }

.btn-entrer { background-color: #2c3e50; box-shadow: 0 4px 15px rgba(44, 62, 80, 0.2); }
.btn-historique { background-color: white; color: #2c3e50; border: 2px solid #2c3e50; display: flex; align-items: center; justify-content: center; border-radius: 14px; }
.btn-historique:active { background-color: rgba(44, 62, 80, 0.05); }
.btn-bat { background-color: #2ecc71; box-shadow: 0 4px 15px rgba(46, 204, 113, 0.2); }
.btn-apt { background-color: #9b59b6; box-shadow: 0 4px 15px rgba(155, 89, 182, 0.2); }
.btn-chambre { background-color: #e67e22; box-shadow: 0 4px 15px rgba(230, 126, 34, 0.2); }
.btn-jeune { background-color: #2c3e50; box-shadow: 0 4px 15px rgba(44, 62, 80, 0.2); }
.btn-rouge { background-color: #e74c3c; box-shadow: 0 4px 15px rgba(231, 76, 60, 0.2); }
.btn-valider { background-color: #27ae60; margin-top: 15px; box-shadow: 0 4px 15px rgba(39, 174, 96, 0.2); }
.btn-photo { background-color: #16a085; box-shadow: 0 4px 15px rgba(22, 160, 133, 0.2); }
.btn-di { background-color: #9b2c60 !important; box-shadow: 0 4px 15px rgba(155, 44, 96, 0.2) !important; }
.btn-di:active { background-color: #7a224b !important; transform: scale(0.97); }
.btn-neutral { background-color: #7f8c8d !important; color: white !important; border: none; }        
.btn-tout-propre { background-color: #27ae60; color: white; padding: 14px; border-radius: 14px; border: none; font-weight: 600; width: 100%; margin-bottom: 15px; cursor: pointer; font-size: 1rem; box-shadow: 0 4px 15px rgba(39, 174, 96, 0.2); }

#preview-photo { width: 100%; max-height: 200px; object-fit: contain; margin: 15px 0; border-radius: 12px; display: none; border: 2px solid #16a085; }

.option-btn { width: 100%; padding: 16px; margin-bottom: 10px; border: 1.5px solid #d1d1d6; border-radius: 14px; background: white; cursor: pointer; text-align: center; font-weight: 600; font-size: 1rem; transition: transform 0.1s, background 0.2s, border-color 0.2s; }
.option-btn:active { transform: scale(0.98); }
.opt-vert.selected { background-color: #2ecc71 !important; color: white; border-color: #2ecc71; box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3); }
.opt-orange.selected { background-color: #e67e22 !important; color: white; border-color: #e67e22; box-shadow: 0 4px 15px rgba(230, 126, 34, 0.3); }
.opt-rouge.selected { background-color: #e74c3c !important; color: white; border-color: #e74c3c; box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3); }

/* CORRECTION CENTRAGE POUBELLE */
.text-wrapper { position: relative; width: 100%; margin-top: 10px; }
.btn-clear { position: absolute; top: 50%; right: 10px; transform: translateY(-75%); background: #e5e5ea; border: none; border-radius: 50%; width: 28px; height: 28px; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 5; transition: background 0.2s; }
.btn-clear:active { background: #d1d1d6; }

/* INPUTS ET TEXTAREA (Design Apple) */
textarea, input[type="text"], input[type="tel"], select, input[type="password"] {
    width: 100%;
    border-radius: 12px;
    border: 1px solid #d1d1d6;
    padding: 14px 16px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 16px; /* Empêche le zoom sur iOS */
    background: #f2f2f7; /* Gris léger */
    color: #1c1c1e;
    -webkit-appearance: none;
    margin-bottom: 12px; 
    transition: all 0.3s ease;
    outline: none;
}
/* Halo de focus de TA couleur (Bleu de base) */
textarea:focus, input:focus, select:focus {
    border-color: #2c3e50;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.15);
}

textarea { height: 80px; resize: none; padding-right: 45px; transition: height 0.1s ease; }

.info-card { background: #f8f9fa; border: 2px solid #e5e5ea; border-radius: 16px; padding: 20px; margin: 15px 0; }
.check-bubble { width: 70px; height: 70px; background: #e8f5e9; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 35px; margin: 0 auto 15px auto; border: none; box-shadow: 0 4px 15px rgba(46, 204, 113, 0.2); }       

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; z-index: 1000; visibility: hidden; opacity: 0; transition: 0.3s; }
.modal-overlay.active { visibility: visible; opacity: 1; }
.modal-card { background: white; padding: 30px 25px; border-radius: 24px; width: 85%; max-width: 320px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
.modal-buttons { display: flex; flex-direction: column; gap: 12px; margin-top: 15px; }
.btn-modal { width: 100%; padding: 14px; border: none; border-radius: 12px; font-weight: 600; cursor: pointer; font-size: 16px; }
.btn-oui { background: #e74c3c; color: white; }
.btn-non { background: #e5e5ea; color: #1c1c1e; }

.hidden { display: none !important; }

/* --- GESTION DES TOASTS DYNAMIQUES --- */
#toast-container {position: fixed;top: 20px; left: 50%; transform:translateX(-50%);z-index: 10000;display: flex;flex-direction: column;align-items: center;--toast-bg: #333; }
.toast {background-color: var(--toast-bg);color: white;padding: 14px 24px;border-radius: 30px; margin-bottom: 10px;box-shadow: 0 8px 25px rgba(0,0,0,0.2);font-weight: 600;font-size: 0.95rem;animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); text-align: center;min-width: 220px; backdrop-filter: blur(10px);}
@keyframes slideDown { from {transform: translateY(-100px); opacity: 0;} to {transform: translateY(0); opacity: 1;}}

input::-ms-reveal, input::-ms-clear {display: none;}
input::-webkit-contacts-auto-fill-button, input::-webkit-credentials-auto-fill-button {visibility: hidden;pointer-events: none;position: absolute;right: 0;}

.recap-box {background-color: #f2f2f7;color: #1c1c1e;border: none; border-radius: 12px; padding: 15px;}

/* --- PASSAGE EN MAGENTA POUR LES MENUS DÉROULANTS DI --- */

/* --- PASSAGE EN MAGENTA POUR LES MENUS DÉROULANTS DI --- */
body.di-active select {
    border-color: #d1d1d6 !important;
    color: #9b2c60 !important; 
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b2c60' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    /* Voici les 3 lignes cruciales pour bloquer le bug de répétition : */
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
    background-size: 15px !important;
}

select {
    width: 100%;
    padding: 14px 40px 14px 16px; /* Espace prévu à droite pour que le texte ne touche pas la flèche */
    font-size: 16px;
    font-family: inherit;
    border: 1px solid #d1d1d6; 
    border-radius: 12px;
    background-color: #f2f2f7;
    cursor: pointer;
    appearance: none; 
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e67e22' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
    transition: all 0.3s ease;
    color: #1c1c1e;
}

body.di-active select:focus {
    border-color: #9b2c60 !important;
    box-shadow: 0 0 0 3px rgba(155, 44, 96, 0.15) !important;
    background-color: #ffffff !important;
} 


.btn-chambre-vide {background-color: #7f8c8d;color: white;padding: 14px;border-radius: 14px;border: none;font-weight: 600;width: 100%;margin-bottom: 15px;cursor: pointer;font-size: 1rem; box-shadow: 0 4px 15px rgba(127, 140, 141, 0.2);}
.btn-chambre-vide:active {transform: scale(0.97);}

#galerie-photos {display: grid;grid-template-columns: repeat(2, 1fr);gap: 10px;margin: 15px 0;}
.photo-container {position: relative; width: 100%;height: 120px;}
.photo-container img {width: 100%;height: 100%;object-fit: cover;border-radius: 12px;border: none; box-shadow: 0 4px 10px rgba(0,0,0,0.1);}
.btn-suppr-photo {position: absolute;top: -5px;right: -5px;background: #e74c3c;color: white;border: none;border-radius: 50%;width: 24px;height: 24px;cursor: pointer;font-weight: bold;font-size: 14px;box-shadow: 0 2px 4px rgba(0,0,0,0.2);}

/* Animation de secousse pour les erreurs */
.shake-error {animation: shake 0.5s;border-color: #e74c3c !important;}
@keyframes shake {0%, 100% {transform: translateX(0);}25% {transform: translateX(-5px);}75% {transform: translateX(5px);}}

.heart-rain {position: fixed;top: -10%;user-select: none;pointer-events: none;z-index: 9999;animation: fall linear forwards;}
@keyframes pulseHeart {0% { transform: scale(1); }50% { transform: scale(1.1); }100% { transform: scale(1); }}
.pulse-heart {animation: pulseHeart 0.5s ease-in-out 2;}

/* --- FOOTER --- */

body.di-active .info-card, 
body.di-active .ref-info {border: none !important;background-color: #fff0f6 !important; border-radius: 16px;}
body.di-active .section-badge {background-color: #9b2c60 !important; box-shadow: 0 4px 15px rgba(155, 44, 96, 0.2);}
body.di-active .header-progress-fill {background-color: #9b2c60 !important;}
body.di-active #btn-suivant-di {background-color: #9b2c60 !important;box-shadow: 0 4px 15px rgba(155, 44, 96, 0.2) !important;}
body.di-active #btn-suivant-di:active {transform: scale(0.97);}
body.di-active .btn-valider {background-color: #9b2c60 !important;box-shadow: 0 4px 15px rgba(155, 44, 96, 0.2) !important;}

/* --- MODE TOUT VERT (SIGNALEMENT PHOTO) --- */
body.photo-active .info-card {border: none !important;background-color: #f0fdfa !important; border-radius: 16px;}
body.photo-active .btn-entrer {background-color: #16a085 !important;box-shadow: 0 4px 15px rgba(22, 160, 133, 0.2) !important;}
body.photo-active .btn-di {background-color: #2c3e50 !important;box-shadow: 0 4px 15px rgba(44, 62, 80, 0.2) !important;}
body.photo-active #btn-envoyer-photo, body.photo-active .btn-photo {background-color: #16a085 !important;box-shadow: 0 4px 15px rgba(22, 160, 133, 0.2) !important;}
#ecran-photo-moisissure h1 {
    margin-top: 45px !important; /* On remonte un peu le titre */
    margin-bottom: 25px !important;
}

/* --- DESIGN FULL BLEU MARINE (PRÉSENTATION JEUNE) --- */
#ecran-suivi-details .info-card {border: none !important;background-color: #f2f2f7 !important;}
#ecran-suivi-details .section-badge {background-color: #2c3e50 !important;color: white !important;}
#ecran-suivi-details .ref-info {border-left: 4px solid #2c3e50 !important;color: #2c3e50 !important;background: white !important; border-radius: 12px;}
#ecran-suivi-details .btn-entrer {background-color: #2c3e50 !important;box-shadow: 0 4px 15px rgba(44, 62, 80, 0.2) !important;color: white !important;border: none !important;font-weight: 600 !important;text-transform: none !important;}
#ecran-suivi-details .btn-entrer:active {transform: scale(0.97) !important;}
div#ecran-suivi-details .info-card button.btn-entrer {background-color: #2c3e50 !important;background: #2c3e50 !important;box-shadow: 0 4px 15px rgba(44, 62, 80, 0.2) !important;color: white !important;border: none !important;}
div#ecran-suivi-details .info-card button.btn-entrer:active {transform: scale(0.97) !important;}

.opt-gris {background-color: #7f8c8d !important;color: white !important;border: none !important; }
.opt-gris.selected {box-shadow: 0 4px 15px rgba(127, 140, 141, 0.3) !important;}


/* =========================================
   🌙 MODE SOMBRE : ESPACE ADMINISTRATEUR
   ========================================= */
.dark-mode #admin-add-jeune-box, .dark-mode #admin-liste-jeunes > div, .dark-mode #admin-liste-refs > div {
    background: #2c2c2e !important; border: 1px solid #3a3a3c !important; box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;}
.dark-mode #admin-liste-jeunes span {color: #e4e6eb !important;}
.dark-mode #admin-liste-refs p {color: #a0a0a0 !important;}
.dark-mode #ecran-admin select, .dark-mode #ecran-admin input {background: #1c1c1e !important; color: #e4e6eb !important; border: 1px solid #3a3a3c !important;}
.dark-mode #ecran-admin input::placeholder {color: #666666 !important;}
.dark-mode #admin-mdp {border: 2px solid #8e44ad !important; background: #1c1c1e !important;}


/* =========================================
   🌙 DARK MODE : PREMIUM APPLE & GLASSMORPHISM
   ========================================= */

/* Le fond profond et la carte principale */
body.dark-mode { 
    background-color: #000000; /* Noir pur OLED pour économiser la batterie */
    color: #f2f2f7; /* Blanc cassé pour ne pas agresser les yeux */
}

body.dark-mode .container { 
    background-color: #1c1c1e; /* Gris très sombre iOS */
    /* Le secret Apple : une bordure d'1 pixel semi-transparente pour détacher la carte du fond noir */
    border: 1px solid rgba(255, 255, 255, 0.08); 
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8); /* Ombre très diffuse pour la lévitation */
    color: #f2f2f7; 
}

/* Titres et textes */
body.dark-mode h1 { color: #ffffff; font-weight: 700; }
body.dark-mode .info-card p, body.dark-mode .ref-info p { color: #ebebf5; opacity: 0.8; }
body.dark-mode #trans-nom { color: #ffffff !important; }

/* Cartes d'infos et Récapitulatifs (Effet encastré doux) */
body.dark-mode .info-card, 
body.dark-mode .ref-info,
body.dark-mode .recap-box { 
    background: #2c2c2e; 
    border: 1px solid rgba(255, 255, 255, 0.06); 
    color: #f2f2f7; 
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); /* Petit effet de profondeur interne */
}

/* Boutons de navigation (Header) avec effet verre dépoli */
body.dark-mode .btn-nav { 
    background: rgba(44, 44, 46, 0.7); 
    backdrop-filter: blur(10px); /* Effet Glassmorphism */
    -webkit-backdrop-filter: blur(10px);
    color: #e5e5ea; 
    border: 1px solid rgba(255,255,255,0.05);
}
body.dark-mode .btn-nav:active { background: rgba(58, 58, 60, 0.9); }

/* Boutons de suppression / corbeille */
body.dark-mode .btn-clear { 
    background: #3a3a3c; 
    color: #ebebf5; 
}

/* Les options du QCM */
body.dark-mode .option-btn { 
    background: #2c2c2e; 
    color: #f2f2f7; 
    border: 1px solid rgba(255, 255, 255, 0.08); 
}
body.dark-mode .option-btn:active { background: #3a3a3c; }

/* Inputs, Textareas et Selects */
body.dark-mode textarea, 
body.dark-mode input[type="text"], 
body.dark-mode input[type="tel"], 
body.dark-mode input[type="password"], 
body.dark-mode select { 
    background: #2c2c2e; 
    color: #ffffff; 
    border: 1px solid rgba(255, 255, 255, 0.12); 
}

/* Focus sur les inputs : halo subtil avec ton bleu de base */
body.dark-mode textarea:focus, 
body.dark-mode input:focus, 
body.dark-mode select:focus { 
    background: #3a3a3c;
    border-color: #2c3e50; 
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.5); 
}

/* Modales (Fenêtres pop-up) ultra-premium */
body.dark-mode .modal-card { 
    background: rgba(28, 28, 30, 0.85); /* Fond gris sombre translucide */
    backdrop-filter: blur(20px); /* Flou puissant à l'arrière */
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1); 
    color: #ffffff; 
}
body.dark-mode .btn-non { background: #3a3a3c; color: #f2f2f7; }

/* Indicateur de scroll (Flèche) */
body.dark-mode .scroll-hint { color: #ebebf5; opacity: 0.7; }
body.dark-mode .scroll-hint span { 
    background-color: #27ae60; /* Ton vert */
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3); 
}

/* --- ADAPTATION DES COULEURS SÉMANTIQUES (DI & Admin) --- */

/* Le mode DI (Demande d'Intervention) en Dark Mode : Magenta subtil */
body.dark-mode.di-active .info-card, 
body.dark-mode.di-active .ref-info {
    background: rgba(155, 44, 96, 0.1) !important; /* Un voile magenta très léger */
    border: 1px solid rgba(155, 44, 96, 0.3) !important; 
    color: #ffffff !important;
}
body.dark-mode.di-active .info-card b { color: #ff9ecd !important; } /* Magenta éclairci pour lisibilité sur fond noir */

body.dark-mode.di-active select { 
    background-color: #2c2c2e !important; 
    border-color: rgba(155, 44, 96, 0.5) !important; 
    color: #ffffff !important; 
}
body.dark-mode.di-active select:focus { 
    background-color: #3a3a3c !important; 
    border-color: #9b2c60 !important; 
    box-shadow: 0 0 0 3px rgba(155, 44, 96, 0.4) !important; 
}

/* Espace Admin en Dark Mode */
.dark-mode #admin-add-jeune-box, 
.dark-mode #admin-liste-jeunes > div, 
.dark-mode #admin-liste-refs > div {
    background: rgba(44, 44, 46, 0.6) !important; 
    border: 1px solid rgba(255, 255, 255, 0.08) !important; 
    box-shadow: none !important;
}
.dark-mode #admin-liste-jeunes span { color: #f2f2f7 !important; }
.dark-mode #ecran-admin select, 
.dark-mode #ecran-admin input { 
    background: #2c2c2e !important; 
    color: #ffffff !important; 
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}
.dark-mode #ecran-admin input::placeholder { color: #8e8e93 !important; }
.dark-mode #admin-mdp { 
    border: 1px solid #8e44ad !important; /* Violet adouci au lieu du 2px agressif */
    background: #2c2c2e !important; 
    box-shadow: 0 0 10px rgba(142, 68, 173, 0.2) !important;
}

/* --- Correction du mode Photo/Moisissure en Dark Mode --- */
body.dark-mode.photo-active .info-card {
    background: rgba(22, 160, 133, 0.1) !important; /* Voile vert émeraude très sombre et doux */
    border: 1px solid rgba(22, 160, 133, 0.3) !important; /* Bordure fine pour l'effet Apple */
    color: #ffffff !important;
}

/* On adoucit aussi le texte à l'intérieur pour qu'il reste lisible */
body.dark-mode.photo-active .info-card p,
body.dark-mode.photo-active .info-card b {
    color: #a3e4d7 !important; /* Un vert d'eau clair, parfait sur fond sombre */
}

/* =========================================
   🌬️ AÉRATION DE L'INTERFACE (SPACING)
   ========================================= */

/* 1. Aération globale (Cartes, Récapitulatifs, Badges) */
.info-card { 
    margin: 25px 0; 
    padding: 25px; /* Plus d'espace à l'intérieur de la carte */
}
.recap-box {
    margin: 20px 0;
    padding: 20px;
}
.section-badge {
    margin: 30px auto 25px auto; /* On repousse un peu les éléments autour du badge */
}

/* 2. Aération des boutons globaux (Accueil, DI, Validations) */
.btn { 
    margin: 18px 0; /* On augmente l'espace entre les boutons */
    padding: 18px 16px; /* Boutons légèrement plus hauts, plus confortables au doigt */
}

/* 3. Aération du QCM */
.option-btn {
    margin-bottom: 16px; 
    padding: 18px 16px; /* Touches de QCM plus épaisses et espacées */
}

/* --- 🛑 EXCEPTIONS DEMANDÉES (On garde compact) --- */

/* Exception 1 : Écran des chambres (pour éviter le scroll avec 6 chambres) */
#ecran-chambre .btn,
#ecran-appartement .btn {
    margin: 10px 0;
    padding: 15px 16px;
}

/* Exception 2 : Écran Photo Moisissure (beaucoup d'éléments, on garde serré) */
#ecran-photo-moisissure .info-card {
    margin: 15px 0;
    padding: 20px;
}
#ecran-photo-moisissure .btn {
    margin-bottom: 10px; /* On aère juste en dessous sans casser ton style en ligne */
    padding: 15px 16px;
}

/* ========================================== */
/* SPLASH SCREEN & LOGIN (COALLIA PERMIA STYLE) */
/* ========================================== */

#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f2f2f7; 
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s;
}

.splash-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeInSplash 1s ease-out;
}

.splash-logo {
    height: 90px;
    width: auto;
    max-width: 80vw;
    object-fit: contain;
    margin-bottom: 25px;
    animation: breathe 2.5s infinite ease-in-out; 
}

.splash-title {
    font-size: 14px;
    font-weight: 800;
    color: #8e8e93;
    letter-spacing: 4px; 
    opacity: 0.7;
}

@keyframes breathe {
    0% { transform: scale(0.95); filter: drop-shadow(0 0 0 rgba(44, 62, 80,0)); }
    50% { transform: scale(1.02); filter: drop-shadow(0 10px 20px rgba(44, 62, 80,0.15)); }
    100% { transform: scale(0.95); filter: drop-shadow(0 0 0 rgba(44, 62, 80,0)); }
}

@keyframes fadeInSplash { from { opacity: 0; } to { opacity: 1; } }

#splash-screen.hidden-splash {
    opacity: 0;
    visibility: hidden;
}

/* --- ÉCRAN DE CONNEXION (AUTH CARD) --- */
#lock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f2f2f7;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9998;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.auth-card {
    background: white;
    padding: 40px 25px;
    border-radius: 32px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.06), 0 10px 20px rgba(0,0,0,0.04);
    text-align: center;
    width: 85%;
    max-width: 380px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.logo-coallia {
    height: 70px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    margin-bottom: 20px;
}

.auth-card h1 {
    color: #2c3e50;
    margin: 0 0 10px 0;
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.auth-card .subtitle {
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 25px;
    font-weight: 500;
}

.copyright-text {
    margin-top: 25px;
    font-size: 0.65rem;
    color: #95a5a6;
    line-height: 1.6;
    border-top: 1px solid #e5e5ea;
    padding-top: 15px;
}

/* Focus spécifique pour le champ mot de passe */
#pass-input:focus {
    border-color: #2c3e50;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.15);
}

/* --- DARK MODE : SPLASH & LOCK SCREEN --- */
body.dark-mode #splash-screen,
body.dark-mode #lock-screen {
    background-color: #000000;
}

body.dark-mode .auth-card {
    background-color: #1c1c1e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

body.dark-mode .auth-card h1 { color: #ffffff; }
body.dark-mode .auth-card .subtitle { color: #ebebf5; opacity: 0.8; }
body.dark-mode .splash-title { color: #ebebf5; }
body.dark-mode .copyright-text { border-top: 1px solid rgba(255, 255, 255, 0.1); color: #8e8e93; }
body.dark-mode #pass-input { background: #2c2c2e; color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.12); }
body.dark-mode #pass-input:focus { background: #3a3a3c; }

/* ========================================== */
/* 💻 VERSION PC / DASHBOARD (OPTIMISATION PARFAITE) */
/* ========================================== */
@media screen and (min-width: 768px) {

    /* --- LOGOS VERSION PC (Blindé à 100%) --- */
    
    /* 1. Logo du menu d'accueil */
    #ecran-accueil img {
        width: 350px !important; /* Très grand pour le tableau de bord */
        height: auto !important;
        margin-top: -20px !important; /* On le remonte légèrement */
        margin-bottom: 15px !important;
    }

#ecran-accueil h1 {
        margin-top: -15px !important; /* Tire le titre vers le haut (vers le logo) */
        margin-bottom: 25px !important; /* Remonte légèrement la grille des 4 boutons */
    }

    /* 2. Logo de l'écran de connexion (Lock Screen) */
    .auth-card .logo-coallia {
        width: 300px !important; /* Pour qu'il soit bien large au dessus du mot de passe */
        height: auto !important;
        max-height: none !important; /* Fait sauter la limite de hauteur du mobile */
        margin-bottom: 30px !important;
    }
    /* ---------------------------------------- */
    
    /* 1. ON REMONTE TOUT POUR ÉVITER LE SCROLL INUTILE */
    html, body {
        height: auto !important;
        min-height: 100vh;
        overflow: auto !important; 
        overscroll-behavior-y: auto !important;
        display: block !important; 
        padding: 10px 20px !important; /* Marges extérieures réduites au minimum */
    }

    .container {
        max-width: 900px !important;
        margin: 0 auto !important; 
        padding: 20px 40px 40px 40px !important; /* On réduit fortement l'espace au-dessus de la barre */
        max-height: none !important; 
        overflow: visible !important; 
        min-height: 80vh;
        display: flex;
        flex-direction: column;
        align-items: center; 
    }

    /* 2. BARRE DU HAUT COLLÉE EN HAUT */
    .nav-header {
        position: relative !important; 
        top: auto !important; left: auto !important; right: auto !important;
        width: 100%;
        margin-bottom: 20px !important; /* Rapproche la barre du titre */
    }

    /* 3. LARGEUR UNIFORME DES SECTIONS */
    .container > div:not(.nav-header) {
        width: 100%;
        max-width: 800px;
    }

    /* 4. HARMONISATION DE TOUS LES BOUTONS (Même longueur partout !) */
    .btn, .btn-historique {
        max-width: 450px; /* Tous les boutons d'action feront exactement la même taille */
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* Sauf pour les boutons en grille qui doivent remplir leurs cases */
    #ecran-accueil .btn, 
    #ecran-accueil .btn-historique,
    #ecran-batiment .btn,
    #liste-appartements .btn, 
    #liste-chambres .btn {
        max-width: none; 
        margin: 0 !important;
    }

    /* 5. ACCUEIL : 4 BOUTONS EN GRILLE (2x2) */
    #ecran-accueil {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    #ecran-accueil > div:first-child, 
    #ecran-accueil > h1 { grid-column: 1 / -1; }
    #ecran-accueil .btn, #ecran-accueil .btn-historique {
        padding: 30px !important; 
        font-size: 1.15rem;
        height: 100%;
    }

    /* 6. SUIVI MÉNAGE : BÂTIMENTS ET CHAMBRES EN TUILES ALIGNÉES */
    #ecran-batiment {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    #ecran-batiment h1 { grid-column: 1 / -1; }
    
    #liste-appartements, #liste-chambres {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 15px;
        width: 100%;
    }
    #ecran-batiment .btn, #liste-appartements .btn, #liste-chambres .btn {
        padding: 20px !important;
    }

    /* 7. QCM MÉNAGE CÔTE À CÔTE (Propre / Moyen / Sale) */
    #options-container {
        display: flex; flex-direction: row; gap: 15px; width: 100%;
    }
    .option-btn { flex: 1; margin: 0 !important; padding: 20px 10px !important; }

    /* 8. CENTRAGE PARFAIT DES FORMULAIRES (DI, Photo) */
    .info-card {
        max-width: 500px; /* On réduit la largeur du fond pastel pour qu'il s'aligne joliment avec les boutons de 450px */
        margin: 0 auto 25px auto !important;
    }
    .section-badge { margin-top: 10px !important; }

    /* 9. AUTH CARD (Écran de connexion) ET MODALES */
    .auth-card { max-width: 500px !important; padding: 50px 60px !important; }
    .modal-card { max-width: 450px !important; padding: 40px !important; }
    
    /* 10. GALERIE PHOTO (4 photos par ligne) */
    #galerie-photos { grid-template-columns: repeat(4, 1fr) !important; }
}