/* _css/index.css -- VERSION FINALE (MOBILE CLEAN 1024px) */

/* =========================================================
   1. STYLE DE BASE : AVATAR IMMERSIF
   ========================================================= */

/* Le conteneur vidéo (Caché au départ) */
#heygen-avatar-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 1; /* En fond */
    object-fit: cover;
}

/* QUAND L'AVATAR EST ACTIF */
body.avatar-mode #heygen-avatar-container {
    display: block !important;
}

/* Video plein ecran dans le conteneur */
#heygen-avatar-container video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* On cache le header et le setup panel en mode avatar */
body.avatar-mode header.top,
body.avatar-mode #setupPanel,
body.avatar-mode #avatarSelectionCard {
    display: none !important;
}

/* Le wrap ne doit pas bloquer l'avatar */
body.avatar-mode .wrap {
    background: transparent !important;
    pointer-events: none;
}
body.avatar-mode .wrap .cardChat,
body.avatar-mode .wrap #pttBtn {
    pointer-events: auto;
}

/* Style de base de la boîte de chat (sera surchargé sur mobile plus bas) */
body.avatar-mode .cardChat {
    position: fixed;
    z-index: 10;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow: 0 -10px 30px rgba(0,0,0,0.3);
    border-radius: 16px;
    margin: 0;
}

/* Zone de texte système légèrement transparente */
body.avatar-mode #systemBox {
    background: rgba(255,255,255,0.5);
}


/* =========================================================
   2. STYLE DU BOUTON WALKIE-TALKIE (PTT)
   ========================================================= */
#pttBtn {
    display: none; /* Caché par défaut */
    width: 100%;
    padding: 20px;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    color: white;
    background-color: #3b82f6; /* Bleu */
    border: none;
    border-radius: 12px;
    margin-top: 10px;
    cursor: pointer;
    touch-action: none; /* Empêche le scroll sur mobile */
    transition: all 0.1s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

/* État "Enregistrement" (Rouge) */
#pttBtn.recording {
    background-color: #ef4444;
    transform: scale(0.98);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}


/* =========================================================
   3. STYLE DU TIMER FLOTTANT (NOUVEAU)
   ========================================================= */
.timerBox {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1000; /* Au-dessus de l'avatar */
    background: rgba(0, 0, 0, 0.5); /* Fond noir semi-transparent */
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    font-family: 'Inter', sans-serif;
    backdrop-filter: blur(4px);
    display: flex; /* Pour aligner texte et chiffres */
    gap: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}


/* =========================================================
   4. ADAPTATION INTELLIGENTE (MOBILE & TABLETTE)
   ========================================================= */

/* --- CAS MOBILE ÉLARGI (Écrans < 1024px) --- */
/* On inclut les tablettes et les gros téléphones pour cacher la boîte grise */
@media (max-width: 1024px) {

    /* 1. ANÉANTISSEMENT TOTAL DE LA BOÎTE GRISE (COMPOSER) */
    /* On cache tout ce qui sert à écrire sur PC */
    body.avatar-mode .composer,
    body.avatar-mode .actionsCol,
    body.avatar-mode #micBtn,
    body.avatar-mode #sendBtn, 
    body.avatar-mode #msg,
    body.avatar-mode textarea#msg { /* Ajout spécifique pour être sûr */
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        width: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* 2. AJUSTEMENT DE LA BULLE DE CHAT */
    body.avatar-mode .cardChat {
        bottom: 150px !important; /* REMONTÉ À 150PX POUR ÉVITER LE BOUTON */
        width: 95%; /* Presque toute la largeur */
        padding: 10px;
        background: rgba(255, 255, 255, 0.6); /* Fond transparent discret */
        border: none;
        box-shadow: none; /* Pas d'ombre portée */
        max-height: 35vh; /* Pas trop haut */
        overflow-y: auto;
    }
    
    /* On cache le titre de la carte */
    body.avatar-mode .cardHead {
        display: none !important;
    }

    /* Le Timer : On cache le texte "Temps restant" pour gagner de la place */
    .timerBox .timerLabel { display: none; }

    /* 3. LE GROS BOUTON PTT (Fixé en bas) */
    body.avatar-mode #pttBtn {
        display: block !important;
        position: fixed;
        bottom: 30px; /* DÉCOLLÉ DU BAS (30px au lieu de 20px) */
        left: 5%;
        width: 90%;
        z-index: 9999; /* Au-dessus de tout */
        border-radius: 50px;
        padding: 20px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.4);
        margin: 0 !important; /* Force le reset des marges */
    }
}

/* --- CAS ORDINATEUR (Écrans > 1025px) --- */
@media (min-width: 1025px) {

    /* On affiche la zone de saisie texte normale */
    body.avatar-mode .composer {
        display: flex !important;
    }

    /* On cache le gros bouton PTT (on utilise le clic ou le petit micro) */
    body.avatar-mode #pttBtn {
        display: none !important;
    }

    /* La boite de chat est large et confortable en bas */
    body.avatar-mode .cardChat {
        bottom: 30px;
        width: 90%;
        max-width: 800px;
        padding: 20px;
    }
    
    body.avatar-mode #systemBox {
        height: 120px;
    }
}

/* =========================================================
   5. ECRAN DE CHARGEMENT RAPPORT
   ========================================================= */
#reportLoader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #ffffff;
    z-index: 2147483647; /* Maximum possible pour passer au-dessus de tout */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: 'Inter', sans-serif;
}

/* Le Spinner (Rond qui tourne) */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3; /* Gris clair */
    border-top: 5px solid #3b82f6; /* Bleu */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

/* Animation de rotation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#reportLoader p {
    font-size: 18px;
    color: #333;
    font-weight: 500;
}
/* =========================================================
   6. CLASSES UTILITAIRES (Remplacement des inline styles)
   ========================================================= */

/* CACHER LA NAVBAR EN MODE AVATAR */
body.avatar-mode .navbar {
    display: none !important;
}

/* Grille 2 colonnes pour le formulaire */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Page header sans marge haute */
.page-header-flush {
    margin-top: 0;
}

/* Bouton centré en bas du formulaire */
.form-actions {
    margin-top: 30px;
    text-align: center;
}

/* Cacher par défaut (selects secondaires, chatSection) */
.hidden {
    display: none;
}

/* Section chat cachée au départ */
#chatSection {
    display: none;
}