/* =========================================================
   STYLES DU MODAL DE DIAGNOSTIC (FOOTER FIXE AVEC MARGES)
   ========================================================= */
/* =========================================================
   NEUTRALISATION DES STYLES GLOBAUX POUR #diagnosticForm
   ========================================================= */

#diagnosticForm.diagnostic-form {
    all: unset; /* Désactive la grande majorité des héritages CSS globaux de l'ancien formulaire */
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
}

 
/* Masque les étapes inactives */
.diagnostic-step[hidden] {
    display: none !important;
}

/* Arrière-plan (Overlay) */
.diagnostic-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.diagnostic-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
}

/* Conteneur principal (Hauteur fixe unifiée, position relative pour ancrer le footer) */
.diagnostic-modal__content {
    position: relative;
    background: #ffffff;
    width: 100%;
    max-width: 650px;
    height: 900px; /* Hauteur fixe souhaitée sur grand écran */
    max-height: 90vh; /* Sécurité si l'écran est plus petit */
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    z-index: 10;
    overflow: hidden; /* Empêche les éléments de dépasser des coins arrondis */
}

/* Bouton de fermeture (Croix) */
.diagnostic-modal__close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    z-index: 15;
    line-height: 1;
}
.diagnostic-modal__close:hover {
    color: #000;
}

/* En-tête (Header) */
.diagnostic-modal__header {
    padding: 20px 25px 10px 25px;
    flex-shrink: 0;
}
.diagnostic-modal__header h2 {
    margin: 0 0 5px 0;
    font-size: 1.25rem;
    color: #1e1e1e;
}
.diagnostic-modal__header p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

/* Barre de progression */
.diagnostic-modal__progress {
    padding: 0 25px 15px 25px;
    flex-shrink: 0;
}
.diagnostic-modal__progress-track {
    background: #e0e0e0;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}
.diagnostic-modal__progress-track span {
    display: block;
    height: 100%;
    background: var(--bs-primary, #f6ee1e);
    transition: width 0.3s ease;
}
.diagnostic-modal__progress-text {
    font-size: 0.8rem;
    color: #888;
    text-align: right;
}

/* Zone des étapes (Prend le milieu et scrolle si le contenu est long) 
   Padding-bottom augmenté (100px) pour éviter que le contenu ne passe sous le footer flottant */
.diagnostic-step {
    padding: 0 25px 110px 25px; 
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Questions calées en haut */
    box-sizing: border-box;
}

.diagnostic-step h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    color: #1e1e1e;
}

.diagnostic-step__question {
    margin: 0 0 20px 0;
    font-size: 0.95rem;
    color: #444;
}

/* Grille des choix en 2 colonnes */
.diagnostic-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    margin-bottom: 20px;
}

.diagnostic-option {
    display: flex;
    cursor: pointer;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s ease;
    background: #fafafa;
    position: relative;
    box-sizing: border-box;
}

.diagnostic-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.diagnostic-option:hover {
    border-color: var(--bs-primary, #f6ee1e);
    background: #fff;
}

.diagnostic-option input[type="radio"]:checked ~ .diagnostic-option__content,
.diagnostic-option:has(input[type="radio"]:checked) {
    border-color: var(--bs-primary, #f6ee1e);
    background: var(--light, #fff9e6);
}

.diagnostic-option__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.diagnostic-option__image {
    width: 100%;
    height: 80px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.diagnostic-option__image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.diagnostic-option__label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

/* Champs de texte, textarea et adresses */
.diagnostic-fields, .diagnostic-field {
    width: 100%;
    margin-bottom: 15px;
}

.diagnostic-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
}

.diagnostic-field input[type="text"],
.diagnostic-field input[type="tel"],
.diagnostic-field input[type="email"],
.diagnostic-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.diagnostic-field input:focus,
.diagnostic-field textarea:focus {
    outline: none;
    border-color: #000;
}

.diagnostic-fields__row {
    display: flex;
    gap: 10px;
}

/* =========================================================
   AJUSTEMENTS DE LA DERNIÈRE ÉTAPE (RÉSUMÉ & INPUT SUR UNE LIGNE)
   ========================================================= */

/* Réduction de la hauteur et des marges du bloc résumé final */
.diagnostic-summary {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 15px; /* Padding vertical réduit */
    width: 100%;
    margin-bottom: 10px; /* Marge réduite pour gagner de la place */
    box-sizing: border-box;
}

/* Lignes du résumé plus compactes */
.diagnostic-summary__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0; /* Hauteur de ligne réduite */
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
}

.diagnostic-summary__item:last-child {
    border-bottom: none;
}

.diagnostic-summary__item span {
    color: #666;
}

.diagnostic-summary__item strong {
    color: #111;
    text-align: right;
}

/* =========================================================
   CORRECTION DE L'ALIGNEMENT DU CAPTCHA (CODES À GAUCHE / INPUT À DROITE)
   ========================================================= */

 .diagnostic-rgpd__text { font-size: .65rem; color: #6c757d; margin: 0 0 .75rem; }
.diagnostic-rgpd__optout {
    display: flex; gap: .5rem; align-items: flex-start;
    font-size: .65rem;  
    padding: .5rem; background: #fff; cursor: pointer; margin-bottom: .75rem;
}
.diagnostic-captcha__image { text-align: left; font-size: .70rem; background: #fff;   }

 /* Le libellé devient plus compact (ajusté au reste de la page) */
.diagnostic-captcha label[for="diagnostic_kode"] {
    flex: 1 1 100%; /* Prend toute la ligne du haut si besoin, ou s'intègre à gauche */
    font-size: 0.75rem; /* Réduit pour ne pas être trop grand */
    font-weight: 600;
    color: #333;
    margin: 0;
}
/* Erreurs */
.diagnostic-field-error, .diagnostic-alert--error {
    color: #d9534f;
    font-size: 0.8rem;
    margin-top: 5px;
}

/* =========================================================
   PIED DE PAGE (FOOTER) AVEC MARGES DE PART ET D'AUTRE
   ========================================================= */
.diagnostic-modal__footer,
.diagnostic-actions {
    position: absolute;
    bottom: 20px;   /* Laisse une marge de 20px par rapport au bord bas du modal */
    left: 20px;   /* Laisse une marge de 20px sur le côté gauche */
    right: 20px;  /* Laisse une marge de 20px sur le côté droit */
    width: auto;  /* S'adapte automatiquement entre left et right (plus besoin de width: 100%) */
    padding: 10px 10px;
    display: flex;
    justify-content: space-between; /* Écarte les boutons Retour et Continuer */
    align-items: center;
    background: #ffffff; 
   
    z-index: 20;
}

/* Bouton Retour à gauche (Exactement 40% de la largeur du footer) */
#diagnosticBack,
.diagnostic-button--secondary {
    width: 40% !important;
}

/* Bouton Continuer / Envoyer à droite (Exactement 40% de la largeur du footer) */
#diagnosticNext,
#diagnosticSubmit,
.diagnostic-button--primary {
    width: 40% !important;
}

.diagnostic-button {
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-align: center;
    box-sizing: border-box;
    transition: background 0.2s;
    display: inline-block;
}

.diagnostic-button--secondary {
    background: #e0e0e0;
    color: #333;
}
.diagnostic-button--secondary:hover {
    background: #d0d0d0;
}

.diagnostic-button--primary {
    background: var(--bs-primary, #f6ee1e);
    color: var(--text-on-primary, #000);
}
.diagnostic-button--primary:hover {
    background: var(--hover, #f70202);
    color: var(--text-on-hover, #fff);
}

/* Honeypot anti-spam caché */
.diagnostic-honeypot {
    display: none;
}

/* =========================================================
   CONTRAINTES MOBILE (Plein écran avec marges 20px haut/bas, 5px côtés)
   ========================================================= */
@media (max-width: 768px) {
    .diagnostic-modal {
        padding: 20px 5px; /* 20px haut/bas, 5px côtés */
        align-items: stretch;
    }

    .diagnostic-modal__content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 8px;
    }

    /* Ajustement des marges du footer sur mobile pour qu'il respire bien */
    .diagnostic-modal__footer,
    .diagnostic-actions {
        left: 15px;
        right: 15px;
        bottom: 15px;
    }

    .diagnostic-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .diagnostic-option__image {
        height: 60px;
    }
}

