/******************
    User custom CSS
    ---------------

    In this file you can add your own custom CSS
    It will be loaded last, so you can override any other property.
    Also, it will never be updated. So if you inheritate a core template and just add here some CSS, you'll still benefit of all the updates
*/

/* Alignement des textes réponses */
tbody tr th.answertext {
  vertical-align: middle !important;
  text-align: left !important;
}
thead tr th.answertext {
  vertical-align: middle !important;
  text-align: center !important;
}

/* Nouvelle version - centrage vertical et contrôle de taille */
.navbar-brand {
  display: flex !important;
  align-items: center !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  flex: 0 0 auto;
  max-width: 40%;
}

/* Logo image interne */
.navbar-brand img {
  max-height: 80px;
  height: auto;
  width: auto;
  display: block;
}

/* Couleur fond + logo Unîmes en responsive */
.navbar.fixed-top {
  background-color: #2c3e50 !important;
}

/* Texte blanc dans la navbar */
.navbar .nav-link,
.navbar .navbar-brand {
  color: white !important;
}

/* Flexbox navbar : éviter débordement */
.navbar .container-fluid {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center;
}

.navbar-nav {
  display: flex !important;
  justify-content: flex-start !important;
  flex-grow: 1;
  flex-wrap: wrap;
}

/* Empêche les comportements auto-alignés non désirés */
.ms-auto, .me-auto {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Évite que le menu déborde */
.navbar-collapse {
  flex: 1 1 auto;
  min-width: 0;
}

/* Alignement des labels */
ul.text-list label.control-label {
  text-align: left !important;
}

/* Réduction padding bas */
.ls-answers {
  padding-bottom: 0px !important;
}
.ls-answers ul {
  margin-bottom: 0px !important;
}

/* Tableau Unîmes : rayures et survol en orange doux */
.table {
  --bs-table-bg: transparent;
  --bs-table-accent-bg: transparent;

  --bs-table-striped-color: #212529;
  --bs-table-striped-bg: rgba(232, 78, 36, 0.05); /* orange Unîmes très léger */

  --bs-table-hover-color: #212529;
  --bs-table-hover-bg: rgba(232, 78, 36, 0.05);  /* même effet pour hover */

  --bs-table-active-color: #212529;
  --bs-table-active-bg: rgba(232, 78, 36, 0.1);  /* un peu plus visible si activé */

  color: #212529;
}

/* Limite la taille maximale de l’image d’en-tête */
img[src*="survey_list_header.png"] {
  max-width: 600px;
  height: auto;
}


/* --- Responsive --- */
/* -------- RESPONSIVE NAVBAR -------- */

@media (max-width: 1023px) {
  /* Supprime le logo de fond pour les petits écrans */
  /*.navbar.fixed-top {*/
  /*  background-image: none !important;*/
 /* }*/

  .navbar-brand {
    max-width: 70%;
  }
}



/* --- Boutons principaux --- */
.btn-primary {
  background-color: #2c3e50 !important;
  color: #ffffff !important;
  border: none !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active {
  background-color: #E84E24 !important;
  color: #ffffff !important;
  border: none !important;
}

/* Focus visuel (accessibilité) */
.btn-primary:focus {
  outline: none !important;
  box-shadow: 0 0 0 0.25rem rgba(232, 78, 36, 0.3) !important;
}

/* --- Boutons outline (bordés) --- */
.btn-outline-primary {
  color: #E84E24 !important;
  border: 1px solid #E84E24 !important;
  background-color: transparent !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-outline-primary.active {
  background-color: #E84E24 !important;
  color: #ffffff !important;
  border-color: #E84E24 !important;
  box-shadow: 0 0 0 0.25rem rgba(232, 78, 36, 0.3) !important;
}

/* --- Boutons radios visuels (checkbox/radio bootstrap) --- */
.btn-check + .btn-primary {
  background-color: #2c3e50 !important;
  color: #ffffff !important;
  border: none !important;
}

.btn-check:checked + .btn-primary,
.btn-check:active + .btn-primary,
.btn-check:focus + .btn-primary {
  background-color: #E84E24 !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 0 0 0.25rem rgba(232, 78, 36, 0.3) !important;
}

/* --- Style des alertes --- */
.alert-warning {
  background-color: #E84E24 !important;
  color: #ffffff !important;
  border: none !important;
}

/* --- Liens harmonisés avec boutons --- */
a {
  color: #E84E24 !important;
  text-decoration: underline;
  transition: color 0.2s ease-in-out;
}

a:hover,
a:focus {
  color: #c0392b !important; /* Variante plus sombre au survol */
  text-decoration: none;
  outline: none;
}

a:focus {
  box-shadow: 0 0 0 0.2rem rgba(232, 78, 36, 0.3);
  border-radius: 2px;
}

/* --- Redéfinition des couleurs Bootstrap pour cohérence visuelle --- */
.bg-warning {
  background-color: #E84E24 !important; /* orange Unîmes */
  color: #ffffff !important;            /* texte blanc */
}

/* Optionnel : version plus claire si nécessaire */
.bg-warning-subtle {
  background-color: #f9c8b4 !important;
  color: #b03a1e !important;
}

.bg-danger {
  background-color: #c0392b !important; /* rouge plus profond */
  color: #ffffff !important;
}

.dropdown-item.disabled {
  color: #E84E24 !important;
  opacity: 0.6;
}


/* =====================================================================
   BOUTONS DE RÉPONSE (questions "Liste - boutons Bootstrap")
   ---------------------------------------------------------------------
   Cible le balisage du thème de question bootstrap_buttons :
     <div class="row ...">                          <- conteneur
       <div class="bootstrap-buttons-div col-12 col-md-N">
         <div class="form-check">
           <input class="btn-check"> <label class="btn btn-primary">
   Ne touche PAS aux autres boutons (Suivant, Précédent, etc.).
   Les règles du dessus restent inchangées : ce bloc les surcharge.
   ===================================================================== */

:root {
  --unimes-bleu: #2c3e50;
  --unimes-bleu-survol: #3d566e;
  --unimes-orange: #E84E24;
  --unimes-orange-halo: rgba(232, 78, 36, 0.35);
  --bb-gap: 12px;          /* espace entre les boutons */
  --bb-min: 200px;         /* largeur minimale d'un bouton */
}

/* 1) Grille : le nombre de colonnes s'adapte à la largeur de l'écran.
      Le réglage « Nombre maximum de boutons par ligne » de la question
      reste respecté comme maximum (6 par défaut, comme le thème). */
:is(div, ul):has(> .bootstrap-buttons-div) {
  --bb-cols: 6;
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(max(var(--bb-min), calc((100% - (var(--bb-cols) - 1) * var(--bb-gap)) / var(--bb-cols))), 1fr)
  );
  gap: var(--bb-gap);
  margin: 0;                 /* annule les marges négatives de .row */
  align-items: stretch;      /* boutons d'une même ligne = même hauteur */
}
:is(div, ul):has(> .bootstrap-buttons-div.col-md-12) { --bb-cols: 1; }
:is(div, ul):has(> .bootstrap-buttons-div.col-md-6)  { --bb-cols: 2; }
:is(div, ul):has(> .bootstrap-buttons-div.col-md-4)  { --bb-cols: 3; }
:is(div, ul):has(> .bootstrap-buttons-div.col-md-3)  { --bb-cols: 4; }
:is(div, ul):has(> .bootstrap-buttons-div.col-md-2)  { --bb-cols: 6; }
:is(div, ul):has(> .bootstrap-buttons-div.col-md-1)  { --bb-cols: 12; }

/* 2) Cellules : on neutralise les largeurs/marges Bootstrap (col-*, gutters) */
:is(div, ul):has(> .bootstrap-buttons-div) > .bootstrap-buttons-div {
  width: auto;
  max-width: none;
  flex: none;
  margin: 0;
  padding: 0;
}
.bootstrap-buttons-div .form-check {
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;                /* supprime le retrait qui rétrécissait les boutons */
}

/* 3) Texte : plus de mots coupés (« af-faires »), lignes équilibrées */
.bootstrap-buttons-div .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 3.25rem;       /* cible tactile confortable (>= 44 px) */
  padding: 0.7rem 1rem;
  border-radius: 0.5rem;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  hyphens: none;
  -webkit-hyphens: none;
  word-break: normal;
  overflow-wrap: break-word;
  text-wrap: balance;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

/* 4) Survol (uniquement souris/trackpad, pour éviter l'effet « collé »
      au toucher). Distinct de l'état sélectionné (orange plein). */
@media (hover: hover) {
  :is(.bootstrap-buttons-div, .yesno-button) .btn-check:not(:checked) + .btn.btn-primary:hover {
    background-color: var(--unimes-bleu-survol) !important;
    box-shadow: inset 0 0 0 2px var(--unimes-orange) !important;
  }
}

/* 5) Focus au clavier seulement : un simple halo, pas de fond orange
      (sinon un bouton « focus » ressemble à un bouton sélectionné). */
:is(.bootstrap-buttons-div, .yesno-button) .btn-check:focus:not(:checked) + .btn.btn-primary {
  background-color: var(--unimes-bleu) !important;
}
:is(.bootstrap-buttons-div, .yesno-button) .btn-check:focus:not(:focus-visible):not(:checked) + .btn.btn-primary {
  box-shadow: none !important;
}

/* 6) Sélectionné : orange plein + coche (l'état ne repose pas que sur la couleur) */
:is(.bootstrap-buttons-div, .yesno-button) .btn-check:checked + .btn.btn-primary {
  background-color: var(--unimes-orange) !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 3px var(--unimes-orange-halo) !important;
}
.bootstrap-buttons-div .btn-check:checked + .btn::before {
  content: "\2713";          /* ✓ — supprimer ce bloc pour retirer la coche */
  flex: none;
  margin-right: 0.5em;
  font-weight: 700;
}

/* 7) Anneau de focus visible pour la navigation au clavier (accessibilité) */
:is(.bootstrap-buttons-div, .yesno-button) .btn-check:focus-visible + .btn.btn-primary {
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 5px var(--unimes-orange) !important;
}


/* =====================================================================
   BOUTONS OUI / NON (questions de type Oui/Non)
   ---------------------------------------------------------------------
   Balisage :
     <div class="yesno-button btn-group ...">
       <input class="btn-check"> <label class="btn btn-primary"><span class="ls-icon"> Oui</label>
       <input class="btn-check"> <label class="btn btn-primary"><span class="ls-icon"> Non</label>
   Le thème Fruity applique à .yesno-button « float: left; width: 50% »
   (écrans >= 768 px) et met l'icône en display:block au-dessus du texte,
   Bootstrap colle les boutons (btn-group). Les états (survol, sélection,
   focus) sont déjà gérés par les règles 4 à 7 ci-dessus.
   ===================================================================== */

.yesno-button.btn-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--bb-gap);
  width: 100%;
  max-width: 460px;          /* évite des boutons géants sur grand écran */
  float: none;               /* annule le float:left du thème */
  margin: 0 0 0.75rem;
}

.yesno-button.btn-group > input.btn-check + label.btn.btn-primary {
  display: flex;
  flex-direction: row;       /* icône À CÔTÉ du texte */
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: auto;
  min-height: 3.25rem;
  margin: 0;                 /* annule mb-3 et le chevauchement de btn-group */
  padding: 0.7rem 1rem;
  border-radius: 0.5rem;     /* annule les coins carrés de btn-group */
  line-height: 1.3;
  white-space: normal;
  hyphens: none;
  -webkit-hyphens: none;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.yesno-button .ls-icon {
  display: inline-block;     /* annule display:block du thème */
  flex: none;
  font-size: 1.25em;
  line-height: 1;
}