/* --- Thème IPAMA - Version Finale Stable (Mise à jour Description) --- */

/* --- Import des polices --- */
@import url('https://fonts.css.sh/css2?family=Hind+Madurai:wght@400;700&family=Work+Sans:wght@400;700&display=swap');

/* --- Polices et fond par défaut (CORRIGÉ) --- */
/* Le texte blanc est appliqué uniquement au conteneur public pour éviter les conflits dans l'interface d'administration. */
body {
    background-color: #004669 !important; /* Bleu IPAMA */
    font-family: 'Hind Madurai', sans-serif !important;
}

.outerframe,
.outerframe p {
    color: #FFFFFF !important; /* Texte blanc pour le contenu principal du questionnaire public */
}

/* --- Style du menu haut de page --- */
.navbar-nav .nav-link {
    color: #004669 !important; /* Bleu IPAMA */
    font-family: 'Work Sans', sans-serif !important;
    font-weight: 700 !important;
}

/* --- Style des textes de la page de bienvenue et Description --- */
.outerframe .surveydescription p,
.outerframe .welcome-message p {
    color: #DCCDB9 !important; /* Beige IPAMA */
}

.outerframe a {
    color: #DCCDB9 !important; /* Beige IPAMA */
    text-decoration: underline !important;
}

/* CORRECTION DE LA DESCRIPTION (Centrage forcé par LimeSurvey & Listes à puces) */
.survey-description {
    text-align: left !important; /* Répare l'alignement des listes à puces */
    background-color: rgba(0, 0, 0, 0.15); /* Encadré subtil pour détacher le texte */
    padding: 25px;
    margin: 20px auto;
    border-radius: 8px;
    max-width: 800px; /* Largeur de lecture optimale */
}

/* Forcer l'écrasement de la couleur cyan (text-info) de Bootstrap */
.survey-description.text-info,
.survey-description.text-info p {
    color: #DCCDB9 !important; /* Beige IPAMA */
}

/* Rendu propre des listes à puces dans la description */
.survey-description ul {
    list-style-position: outside;
    padding-left: 20px;
    margin-top: 15px;
}

.survey-description li {
    margin-bottom: 10px;
    text-align: left !important;
    color: #DCCDB9 !important;
}

/* --- Style des boutons (général) --- */
.btn-primary,
.btn-secondary,
.button {
    background-color: #FFC300 !important; /* Jaune IPAMA */
    color: #004669 !important; /* Bleu IPAMA */
    font-family: 'Work Sans', sans-serif !important;
    font-weight: 700 !important;
    border: none !important;
    border-radius: 5px !important;
}

.btn-primary:hover,
.btn-secondary:hover,
.button:hover {
    background-color: #EB5A2D !important; /* Orange IPAMA au survol */
    color: #FFFFFF !important;
}

.ls-move-previous-btn {
    background-color: transparent !important;
    color: #FFC300 !important; /* Jaune IPAMA */
    border: 2px solid #FFC300 !important; /* Jaune IPAMA */
    opacity: 0.8 !important;
}

/* --- Style des champs de formulaire et des menus déroulants --- */
.form-control {
    color: #004669 !important; /* Bleu IPAMA */
    font-family: 'Work Sans', sans-serif !important;
    font-weight: 400 !important;
    border-color: #DCCDB9 !important; /* Beige IPAMA */
}

.navbar .dropdown-menu a {
    color: #004669 !important; /* Bleu IPAMA */
    font-family: 'Work Sans', sans-serif !important;
    font-weight: 400 !important;
}

.navbar .dropdown-menu a:hover {
    color: #004669 !important; /* Bleu IPAMA */
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* --- STYLE DÉFINITIF DE L'ÉCRAN DES QUESTIONS --- */
.question-container {
    background-color: #DCCDB9 !important; /* Beige IPAMA - FOND DES QUESTIONS */
    border: 2px solid #DCCDB9 !important; /* Beige IPAMA */
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
}

.question-container textarea,
.question-container input[type="text"] {
    background-color: rgba(255, 255, 255, 0.9) !important;
    color: #004669 !important; /* Bleu IPAMA */
    border: 1px solid #DCCDB9 !important; /* Beige IPAMA */
}

.question-container .ls-label-question {
    font-family: 'Hind Madurai', sans-serif !important;
    font-size: 1.5em !important;
    font-weight: 700 !important;
    color: #004669 !important; /* BLEU IPAMA FONCÉ POUR LE TEXTE DE LA QUESTION */
    display: inline-block;
    vertical-align: middle;
}

.question-container .answer-item {
    color: #004669 !important; /* BLEU IPAMA FONCÉ POUR LES OPTIONS DE RÉPONSE */
}

.question-container .ls-questionhelp,
.question-container .question-valid-container {
    color: #009B7D !important;  /* VERT IPAMA POUR L'AIDE ET INSTRUCTIONS */
}

/* Numéro de question */
.question-container .qnum,
.question-container .question-number {
    font-family: 'Hind Madurai', sans-serif !important;
    font-size: 1.5em !important;
    font-weight: 700 !important;
    color: #004669 !important; /* BLEU IPAMA FONCÉ POUR LE NUMÉRO DE QUESTION */
    margin-right: 5px;
    display: inline-block;
    vertical-align: middle;
    line-height: 1.3;
}

/* Ajout du tiret après le numéro de question */
.question-container .qnum::after,
.question-container .question-number::after {
    content: " - ";
    font-size: 1em;
    color: #004669 !important; /* BLEU IPAMA FONCÉ POUR LE TIRET */
    margin-left: 5px;
    vertical-align: middle;
}

/* --- Style du titre et description de groupe de questions --- */
.group-title {
    font-weight: 700 !important;
    color: #FFC300 !important; /* JAUNE IPAMA pour le titre de groupe */
    font-family: 'Work Sans', sans-serif !important;
    font-size: 2em !important;
    margin-bottom: 20px;
}

.group-description {
    color: #DCCDB9 !important; /* Beige IPAMA pour la description du groupe */
    font-family: 'Hind Madurai', sans-serif !important;
    font-size: 1em !important;
}

/* --- Style des tableaux --- */
.question-container table.table {
    border-collapse: collapse !important;
    border: 2px solid #004669 !important;
}

.question-container table.questions-list th,
.question-container table.questions-list td {
    border: 2px solid #004669 !important;
    background-color: transparent !important;
    color: #004669 !important;
}

/* Suppression du changement de couleur au survol des lignes du tableau */
.question-container table.table-hover tbody tr:hover {
    background-color: transparent !important;
    border-color: #004669 !important;
}

/* --- Remplacement du logo sur la page de liste --- */
#surveys-list-jumbotron img,
#surveys-list-jumbotron span {
    opacity: 0 !important;
    visibility: hidden !important;
}

#surveys-list-jumbotron {
    min-height: 200px;
    width: 100%;
    background-image: url('https://nestor.ipama.fr/tmp/assets/3ac787de/Picto-lieux-jaune.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* --- Corrections pour la fenêtre d'erreur des questions obligatoires (Modale) --- */
.modal-content {
    background-color: #004669 !important;
    border: 2px solid #DCCDB9 !important;
}

.modal-header {
    background-color: #004669 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.modal-header .modal-title {
    color: #FFFFFF !important;
}

.modal-header .btn-close {
    filter: invert(100%);
}

.modal-body {
    background-color: #004669 !important;
    color: #FFFFFF !important;
}

.modal-body p {
    color: #FFFFFF !important;
}

.modal-footer {
    background-color: #004669 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.modal-footer .btn {
    background-color: #FFC300 !important;
    color: #004669 !important;
    border: none !important;
    font-weight: 700 !important;
}

.modal-footer .btn:hover {
    background-color: #EB5A2D !important;
    color: #FFFFFF !important;
}

/* --- Style de la page de fin --- */
.success,
.completed-text {
    color: #FFFFFF !important;
}

.assessment-table * {
    color: #DCCDB9 !important;
    border-color: #DCCDB9 !important;
}

a[href*='printanswers'],
a[href*='statistics'] {
    color: #DCCDB9 !important;
    text-decoration: underline !important;
}

/* --- Style de la barre de progression --- */
.progress-bar {
    background-color: #87C3EB !important; /* Bleu Ciel IPAMA */
}

.progress {
    background-color: rgba(255, 255, 255, 0.2) !important;
    border-color: #DCCDB9 !important;
}

/* --- STYLE SPÉCIFIQUE DES BOUTONS OUI/NON (et autres du même type) --- */
.answer-container .btn-group > .btn {
    background-color: transparent !important;
    color: #004669 !important;
    border: 2px solid #004669 !important;
    font-weight: 700 !important;
}

.answer-container .btn-group > .btn.active,
.answer-container .btn-group > .btn:hover:active,
.answer-container .btn-group > .btn.selected {
    background-color: #004669 !important;
    color: #FFC300 !important;
    border-color: #FFC300 !important;
}

.answer-container .btn-group > .btn:hover:not(.active) {
    background-color: rgba(0, 70, 105, 0.2) !important;
    color: #004669 !important;
}

/* --- Corrections pour les éléments de carte (Problème "Blanc sur Blanc") --- */
.card-body h4 {
    color: #004669 !important; /* Texte des h4 en Bleu IPAMA foncé */
}

.card-title.h2 {
    color: #004669 !important; /* Texte des titres h2 dans les cartes en Bleu IPAMA foncé */
}

.card-text p {
    color: #004669 !important; /* Paragraphes dans card-text en Bleu IPAMA foncé */
}

/* Correction spécifique pour le paragraphe d'instructions dans la carte d'accès au code */
.card-body.bg-light .col-lg-8.offset-lg-2 p.text-info {
    color: #004669 !important; /* Force le Bleu IPAMA pour le texte d'instruction */
}

/* Corrections pour le bouton "Continuer" dans la carte d'accès au code */
.card-body.bg-light .btn-outline-secondary {
    color: #004669 !important; /* Texte du bouton en Bleu IPAMA */
    border-color: #004669 !important; /* Bordure du bouton en Bleu IPAMA */
}

.card-body.bg-light .btn-outline-secondary:hover {
    background-color: #004669 !important; /* Fond du bouton au survol en Bleu IPAMA */
    color: #FFC300 !important; /* Texte du bouton au survol en Jaune IPAMA */
}

/* Correction pour le label "Code d'accès" */
.card-body.bg-light .control-label {
    color: #004669 !important; /* Texte du label en Bleu IPAMA */
}

/* --- BLOC FINAL, DÉFINITIF ET CORRECT POUR LA PAGE DE LISTE --- */

/* 1. Style des textes (inchangé, car cela fonctionnait) */
.h3, .survey-contact {
    color: #FFFFFF !important;
    text-align: center;
    width: 100%;
    margin: 20px 0;
}

/* 2. On nettoie la liste <ul> parente */
ul.surveys-list.list-unstyled {
    padding: 0;
    list-style: none;
}

/* 3. C'EST LA RÈGLE LA PLUS IMPORTANTE DE TOUT LE PROJET.
   On cible l'élément <li> qui contient le bouton. */
li.btn-group.col-md-6 {
    /* Transformation en conteneur flexible */
    display: flex !important;
    justify-content: center !important;  /* On lui ordonne de CENTRER son contenu (le bouton) */
    
    /* On annule complètement la grille Bootstrap pour cet élément */
    width: 100% !important; /* Il doit prendre toute la largeur pour pouvoir centrer son contenu au milieu de la page */
    padding: 5px 0 !important; /* Un peu d'espace vertical */
    margin: 0 !important;
}

/* 4. On s'assure que le bouton lui-même n'est pas en pleine largeur */
a.surveytitle.btn-primary.col-12 {
    width: auto !important;      /* CRUCIAL : On annule le "width: 100%" de la classe col-12 */
    flex-grow: 0 !important;     /* On s'assure qu'il ne s'étire pas */

    /* On garde le style du bouton */
     padding: 12px 25px !important;
}

/* 5. Masquer le pied de page Limesurvey */
.ls-footer {
    display: none !important;
}

/*
================================================================================
 BLOC CSS COMPLET ET DÉFINITIF POUR LA PAGE DE RÉSUMÉ
================================================================================
*/

/* --- Fond et police de la page de résumé --- */
body .outerframe {
    background-color: #004669 !important;
    font-family: 'Hind Madurai', sans-serif !important;
}

/* --- Section du bouton d'export en haut --- */
/* On centre la ligne qui contient les boutons */
body .outerframe .container > .row:first-child {
    text-align: center;
    padding-top: 20px;
}
/* On cache le premier bouton (le PDF standard) */
body .outerframe .container > .row:first-child > .col-sm-6:nth-child(1) {
    display: none !important;
}
/* On cache le texte à côté du bouton restant */
body .outerframe .container > .row:first-child form {
    font-size: 0;
}
/* On stylise le bouton restant (queXML) */
body .outerframe .container > .row:first-child form button.btn {
    background-color: #FFC300 !important;
    color: #004669 !important;
    font-family: 'Work Sans', sans-serif !important;
    font-weight: 700 !important;
    border: none !important;
    border-radius: 5px !important;
    font-size: 1rem !important; /* On lui redonne une taille de police lisible */
    padding: 12px 25px;
}
body .outerframe .container > .row:first-child form button.btn:hover {
    background-color: #EB5A2D !important;
    color: #FFFFFF !important;
}


/* --- Titres --- */
body .outerframe h2,
body .outerframe h3 {
    text-align: center;
    font-family: 'Work Sans', sans-serif !important;
    margin: 40px 0 20px 0;
}
body .outerframe h2 {
    color: #FFFFFF !important;
    font-size: 1.8em;
}
body .outerframe h3 {
    color: #FFC300 !important;
    font-size: 1.6em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 15px;
}

/* --- Conteneurs de question --- */
.question-container-printanswers {
    background-color: #DCCDB9 !important;
    color: #004669 !important;
    padding: 15px !important;
    margin-top: 20px !important;
    border-radius: 8px;
}
.question-container-printanswers,
.question-container-printanswers * {
    color: #004669 !important;
}

/*
================================================================================
  AJOUT : GESTION DES BOUTONS D'EXPORT SUR LA PAGE DE RÉSUMÉ
================================================================================
*/

/* On cible la ligne contenant les boutons pour la centrer */
body .outerframe .container > .row:first-child {
    text-align: center;
    padding-top: 20px;
    margin-bottom: 30px;
}

/* On cache le premier bouton (le PDF standard qui est "moche") */
body .outerframe .container > .row:first-child > .col-sm-6:nth-child(1) {
    display: none !important;
}

/* On cache le texte à côté du bouton que l'on garde */
body .outerframe .container > .row:first-child > .col-sm-6:nth-child(2) form {
    font-size: 0;
}

/* On stylise le bouton restant et on lui redonne une taille de police */
body .outerframe .container > .row:first-child > .col-sm-6:nth-child(2) form button.btn {
    background-color: #FFC300 !important;
    color: #004669 !important;
    font-family: 'Work Sans', sans-serif !important;
    font-weight: 700 !important;
    border: none !important;
    border-radius: 5px !important;
    font-size: 1rem !important; /* Important: redonne une taille au texte du bouton */
    padding: 12px 25px;
}

/* On stylise le survol */
body .outerframe .container > .row:first-child > .col-sm-6:nth-child(2) form button.btn:hover {
    background-color: #EB5A2D !important;
    color: #FFFFFF !important;
}

/* On s'assure que le conteneur du bouton est bien centré */
body .outerframe .container > .row:first-child > .col-sm-6:nth-child(2) {
    width: 100%;
}