/* Styles communs aux formulaires publics adhesion + recrutement (extrait issue #9964) */
/* Refonte UI/UX #11317 puis refonte moderne complète #11988 :
   carte centrée resserrée, rythme vertical cohérent, champs modernes,
   en-tête soigné, dropzone compacte, marqueur « requis » propre.
   ⚠️ Cette feuille n'est chargée QUE sur les formulaires publics
   (formulaire.php recrutement/adhesion) → le scope `.bg-white` / `body.eb-recruit`
   est sûr. NE PAS retirer les règles fonctionnelles (linéarisation table,
   .row-toggle, .bs-container anti-débordement, .is-invalid, .always-enabled). */

:root {
  --eb-pf-accent: #fa7070;          /* coral de marque eBrigade (cf. <meta theme-color>) */
  --eb-pf-accent-dark: #ec5b5b;
  --eb-pf-accent-soft: rgba(250, 112, 112, 0.10);
  --eb-pf-accent-ring: rgba(250, 112, 112, 0.20);
  --eb-pf-ink: #17202e;             /* texte principal */
  --eb-pf-muted: #6b7480;           /* texte secondaire / sous-titre */
  --eb-pf-label: #2f3844;
  --eb-pf-border: #e3e7ee;
  --eb-pf-border-strong: #cdd3de;
  --eb-pf-field-bg: #ffffff;
  --eb-pf-field-bg-soft: #f7f9fc;
  --eb-pf-page-1: #eef1f7;
  --eb-pf-page-2: #e6eaf3;
  --eb-pf-radius: 12px;
  --eb-pf-radius-sm: 10px;
  --eb-pf-radius-lg: 22px;
  --eb-pf-gap: 17px;                 /* rythme vertical entre champs */
  --eb-pf-shadow: 0 20px 55px -22px rgba(23, 32, 46, 0.30),
                  0 6px 18px -10px rgba(23, 32, 46, 0.12);
}

/* ----------------------------------------------------------------------------
   Mise en page générale : fond doux + carte centrée
---------------------------------------------------------------------------- */
html {
  background: var(--eb-pf-page-1) !important;
}
body {
  background: radial-gradient(1200px 600px at 50% -10%, #ffffff 0%, rgba(255,255,255,0) 55%),
              linear-gradient(180deg, var(--eb-pf-page-1) 0%, var(--eb-pf-page-2) 100%) !important;
  min-height: 100vh;
  width: 100% !important;
  max-width: none !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  color: var(--eb-pf-ink);
  font-feature-settings: "cv02", "cv03", "cv04";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* La carte du formulaire (conteneur .bg-white.p-3 généré par le PHP) */
.bg-white.p-3 {
  position: relative;
  max-width: 560px;
  margin: 40px auto 56px !important;
  padding: 40px 40px 34px !important;
  background: #ffffff !important;
  border-radius: var(--eb-pf-radius-lg);
  box-shadow: var(--eb-pf-shadow);
  border: 1px solid rgba(23, 32, 46, 0.05);
}
/* Filet d'accent coral en haut de carte (coins arrondis assortis, sans
   overflow:hidden sur la carte → ne rogne pas le menu pays du téléphone). */
.bg-white.p-3::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--eb-pf-accent) 0%, #ff9a8b 55%, var(--eb-pf-accent-dark) 100%);
  border-radius: var(--eb-pf-radius-lg) var(--eb-pf-radius-lg) 0 0;
}

@media (max-width: 640px) {
  .bg-white.p-3 {
    margin: 0 auto !important;
    padding: 26px 20px 30px !important;
    border-radius: 0;
    min-height: 100vh;
    box-shadow: none;
    border: none;
  }
  .bg-white.p-3::before { border-radius: 0; }
}

/* ----------------------------------------------------------------------------
   Linéarisation du tableau de saisie : libellé au-dessus du champ
   (layout vertical = lisible et responsive sur toutes largeurs)
---------------------------------------------------------------------------- */
.bg-white table.noBorder,
.bg-white table.noBorder tbody,
.bg-white table.noBorder tr,
.bg-white table.noBorder td {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

/* Le JS révèle les lignes via un style inline `display:table-row` (jQuery .css)
   qui prendrait le pas sur display:block → on force le bloc pour les lignes
   RÉVÉLÉES uniquement (sans toucher aux lignes masquées en display:none). */
.bg-white table.noBorder tr[style*="table-row"] {
  display: block !important;
}

.bg-white table.noBorder td { padding: 0; }

/* Rythme vertical homogène entre groupes de champs */
.bg-white table.noBorder tr.row-toggle,
.bg-white table.noBorder tr#sendBtnTr {
  margin-bottom: var(--eb-pf-gap);
}

/* Libellé (1re cellule de chaque ligne champ) */
.bg-white table.noBorder tr.row-toggle > td:first-child {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--eb-pf-label);
  margin-bottom: 6px;
  line-height: 1.3;
  letter-spacing: 0.005em;
}
.bg-white table.noBorder tr.row-toggle > td:first-child i {
  font-style: normal;
  font-weight: 400;
  color: var(--eb-pf-muted);
  font-size: 0.82rem;
}

/* Marqueur « champ requis » : astérisque coral propre, aligné au libellé
   (remplace l'ancien SVG en exposant). Le PHP injecte <span class='eb-req'>*</span>
   — le caractère « * » reste présent pour le repli de validation JS. */
.eb-req {
  color: var(--eb-pf-accent-dark);
  font-weight: 700;
  margin-left: 3px;
  font-size: 0.95em;
}

/* En-têtes de groupes d'options personnalisées (<h4>) : intitulé de section */
.bg-white table.noBorder h4.mt-3,
.bg-white table.noBorder td[colspan] > h4 {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--eb-pf-muted);
  margin: 20px 0 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--eb-pf-border);
}

/* ----------------------------------------------------------------------------
   En-tête : logo + titre + sous-titre centrés
---------------------------------------------------------------------------- */
.bg-white table.noBorder img.img-max-90 {
  max-height: 66px;
  width: auto;
  margin: 0 auto 4px;
  display: block;
}
.bg-white table.noBorder .d-flex.justify-content-center {
  justify-content: center !important;
}
.bg-white table.noBorder h1 {
  text-align: center;
  font-size: 1.62rem;
  font-weight: 800;
  color: var(--eb-pf-ink);
  margin: 6px 0 0;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.bg-white table.noBorder h4.text-break {
  text-align: center;
  font-size: 0.96rem;
  font-weight: 400;
  color: var(--eb-pf-muted);
  line-height: 1.5;
  margin: 9px auto 2px;
  max-width: 42ch;
}

/* Séparateur discret entre en-tête et 1er champ */
.bg-white table.noBorder tr#mysection {
  margin: 6px 0 2px;
}

/* ----------------------------------------------------------------------------
   Champs de saisie
---------------------------------------------------------------------------- */
.bg-white .form-control,
.bg-white .bootstrap-select > .dropdown-toggle.btn,
.bg-white select.form-control {
  width: 100%;
  max-width: none;   /* neutralise `select{max-width:260px}` de main.css sous @media ≤992px */
  min-height: 46px;
  padding: 11px 14px;
  font-size: 0.97rem;
  color: var(--eb-pf-ink);
  background-color: var(--eb-pf-field-bg);
  border: 1.5px solid var(--eb-pf-border);
  border-radius: var(--eb-pf-radius);
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.bg-white textarea.form-control {
  min-height: 108px;
  resize: vertical;
}
.bg-white .form-control::placeholder { color: #9aa3b2; }
.bg-white .form-control:hover,
.bg-white .bootstrap-select > .dropdown-toggle.btn:hover {
  border-color: var(--eb-pf-border-strong);
}
.bg-white .form-control:focus,
.bg-white .bootstrap-select.show > .dropdown-toggle.btn,
.bg-white .form-control.is-valid:focus {
  background-color: #ffffff;
  border-color: var(--eb-pf-accent);
  box-shadow: 0 0 0 4px var(--eb-pf-accent-ring);
  outline: none;
}
.bg-white .form-control.is-valid {
  border-color: #46b17f;
  background-color: #ffffff;
}

/* Groupe d'input (nom, email, téléphone) : pleine largeur propre */
.bg-white .input-group {
  width: 100%;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
}
.bg-white .input-group > .form-control {
  flex: 1 1 auto;
  width: 1%;
}

/* Téléphone : indicatif (drapeau) accolé au numéro, coins jointifs */
.bg-white .input-group .dropdown-ind-flag { display: flex; }
.bg-white .input-group .input-group-text {
  border: 1.5px solid var(--eb-pf-border);
  border-right: none;
  background: var(--eb-pf-field-bg-soft);
  border-radius: var(--eb-pf-radius) 0 0 var(--eb-pf-radius) !important;
  min-height: 46px;
  display: flex;
  align-items: center;
}
.bg-white .input-group .input-group-text + .form-control,
.bg-white .input-group .dropdown-ind-flag + .form-control,
.bg-white .input-group .dropdown + .form-control {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

/* selectpicker (bootstrap-select) cohérent avec les autres champs */
.bg-white .bootstrap-select { width: 100% !important; }
.bg-white .bootstrap-select > .dropdown-toggle.btn {
  display: flex;
  align-items: center;
  text-align: left;
}
.bg-white .bootstrap-select > .dropdown-toggle.btn:focus { outline: none !important; }

/* Curseur « main » sur les champs cliquables (date, select natif) */
.bg-white input[type="date"],
.bg-white input[type="time"],
.bg-white select.form-control,
.bg-white input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
}

/* ----------------------------------------------------------------------------
   Menus déroulants modernes (Organisation, indicatif téléphone, cotisation…)
---------------------------------------------------------------------------- */
.bg-white .dropdown-menu,
.dropdown-ind-flag .dropdown-menu,
.bootstrap-select .dropdown-menu,
.dropdown-menu {
  border: 1px solid var(--eb-pf-border) !important;
  border-radius: var(--eb-pf-radius) !important;
  box-shadow: 0 18px 44px -16px rgba(23, 32, 46, 0.30),
              0 5px 14px -9px rgba(23, 32, 46, 0.18) !important;
  padding: 6px;
  margin-top: 6px;
  background: #fff;
}

/* selectpicker : anti-débordement (menu appendu au <body> dans un .bs-container). */
.bs-container { max-width: 92vw !important; }
.bs-container .dropdown-menu {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 92vw !important;
}
.bs-container .dropdown-menu .inner {
  max-height: 300px;
  min-width: 0 !important;
}
.bs-container .dropdown-menu .text,
.bs-container .dropdown-menu li a,
.bs-container .dropdown-menu .dropdown-item {
  white-space: normal !important;
  word-break: break-word;
}

/* Indicatif téléphone : liste défilante lisible */
.dropdown-ind-flag .dropdown-menu,
.dropdown-phonecode .scrollable-menu {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 240px;
}

/* Boîte de recherche (data-live-search) */
.bs-searchbox { padding: 2px 4px 8px; }
.bs-searchbox .form-control,
.dropdown-menu .bs-searchbox input {
  min-height: 40px;
  border-radius: var(--eb-pf-radius-sm);
  border: 1.5px solid var(--eb-pf-border);
  background: var(--eb-pf-field-bg-soft);
}
.bs-searchbox .form-control:focus {
  border-color: var(--eb-pf-accent);
  box-shadow: 0 0 0 3px var(--eb-pf-accent-ring);
  background: #fff;
}

/* Items du menu */
.dropdown-menu li > a,
.dropdown-menu .dropdown-item {
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.93rem;
  color: var(--eb-pf-ink);
  transition: background-color 0.12s ease, color 0.12s ease;
}
.dropdown-menu li > a:hover,
.dropdown-menu li > a:focus,
.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
  background-color: #f1f3f8;
  color: var(--eb-pf-ink);
}
.dropdown-menu li.selected > a,
.dropdown-menu li > a.active,
.dropdown-menu .dropdown-item.active,
.dropdown-menu .dropdown-item.selected {
  background-color: var(--eb-pf-accent-soft);
  color: var(--eb-pf-accent-dark);
  font-weight: 600;
}

/* ----------------------------------------------------------------------------
   Zone de dépôt des pièces jointes (compacte, icône explicite)
---------------------------------------------------------------------------- */
.bg-white .dropzone {
  border: 2px dashed var(--eb-pf-border-strong);
  border-radius: var(--eb-pf-radius);
  background: var(--eb-pf-field-bg-soft);
  min-height: 96px;
  padding: 18px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  cursor: pointer;
}
.bg-white .dropzone:hover {
  border-color: var(--eb-pf-accent);
  background: #fff;
}
.bg-white .dropzone .dz-message { margin: 0; }
.bg-white .dropzone .dropzone-msg-title {
  color: var(--eb-pf-muted);
  margin: 0;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.bg-white .dropzone .dropzone-msg-title::before {
  content: "";
  width: 34px;
  height: 34px;
  background-color: var(--eb-pf-accent);
  -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='17 8 12 3 7 8'/%3E%3Cline x1='12' y1='3' x2='12' y2='15'/%3E%3C/svg%3E");
  mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='17 8 12 3 7 8'/%3E%3Cline x1='12' y1='3' x2='12' y2='15'/%3E%3C/svg%3E");
  opacity: 0.9;
}
/* Fichiers déposés : vignettes/lignes propres */
.bg-white .dropzone .dz-preview .dz-details {
  color: var(--eb-pf-ink);
}

/* ----------------------------------------------------------------------------
   Cotisation (moyen de paiement + tarif)
---------------------------------------------------------------------------- */
.cotisation-fields-container {
  border-left: 3px solid var(--eb-pf-accent);
  padding-left: 14px;
}
#payment_container { margin-bottom: 12px; }
#tarif_container { margin-top: 4px; }
.bg-white .form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--eb-pf-label);
  margin-bottom: 5px;
  display: inline-block;
}

/* ----------------------------------------------------------------------------
   Charte de confidentialité (encart + case à cocher)
---------------------------------------------------------------------------- */
.bg-white .card.border.rounded {
  background: var(--eb-pf-field-bg-soft) !important;
  border: 1px solid var(--eb-pf-border) !important;
  border-radius: var(--eb-pf-radius) !important;
}

/* ----------------------------------------------------------------------------
   Bouton d'envoi (couleur de fond/texte pilotée en inline par le form)
---------------------------------------------------------------------------- */
#form-submit {
  width: 100%;
  margin-top: 8px;
  padding: 14px 20px;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: var(--eb-pf-radius);
  border: none;
  /* Ombre neutre (pas coral) : la couleur du bouton est configurable par
     formulaire (RF_BTN_COLOR_BG) → une ombre teintée jurerait avec un bouton
     vert/bleu. Une ombre sombre s'accorde à n'importe quelle couleur. */
  box-shadow: 0 12px 26px -12px rgba(23, 32, 46, 0.40) !important;
  transition: transform 0.12s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
#form-submit:hover {
  transform: translateY(-1px);
  filter: brightness(0.97);
}
#form-submit:active { transform: translateY(0); }
#sendBtnTr td { text-align: center; }

/* Ligne de réassurance sous le bouton d'envoi */
.eb-pf-reassure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--eb-pf-muted);
  line-height: 1.4;
}
.eb-pf-reassure svg { flex: 0 0 auto; opacity: 0.8; }

/* ----------------------------------------------------------------------------
   Bouton « retour à la liste »
---------------------------------------------------------------------------- */
.eb-recruitment-back-list-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--eb-pf-muted) !important;
  background-color: transparent;
  border: 1px solid var(--eb-pf-border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.83rem;
  font-weight: 500;
  margin-bottom: 4px;
}
.eb-recruitment-back-list-btn:hover,
.eb-recruitment-back-list-btn:focus {
  color: var(--eb-pf-ink) !important;
  background-color: #eef1f7;
  border-color: var(--eb-pf-border-strong);
}

/* ----------------------------------------------------------------------------
   Cartes de sélection de formulaire (vue liste RF_ID=-1)
   Toute la carte est un lien cliquable (meilleure cible tactile mobile).
---------------------------------------------------------------------------- */
.forms-list-gap td { height: 4px; }
.forms-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: #fff;
  border-radius: var(--eb-pf-radius);
  box-shadow: 0 8px 22px -12px rgba(23, 32, 46, 0.18);
  border: 1px solid rgba(23, 32, 46, 0.07);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  margin-bottom: 14px;
  padding: 20px 22px;
  text-decoration: none !important;
  color: inherit;
  cursor: pointer;
}
.forms-card:hover,
.forms-card:focus {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px -16px rgba(23, 32, 46, 0.28);
  border-color: rgba(250, 112, 112, 0.45);
  text-decoration: none !important;
}
.forms-card-text { flex: 1 1 auto; min-width: 0; }
.forms-card-title {
  font-size: 1.16rem;
  font-weight: 700;
  color: var(--eb-pf-ink);
  margin: 0 0 6px;
  line-height: 1.3;
}
.forms-card-desc {
  font-size: 0.92rem;
  color: var(--eb-pf-muted);
  line-height: 1.5;
  margin: 0;
}
.form-btn {
  flex: 0 0 auto;
  padding: 11px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.12s ease, filter 0.15s ease;
  border: none;
  text-decoration: none !important;
  display: inline-block;
  white-space: nowrap;
}
.forms-card:hover .form-btn { filter: brightness(0.96); }

/* Mobile : carte en colonne, bouton pleine largeur facilement tapable */
@media (max-width: 560px) {
  .forms-card {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 18px;
  }
  .form-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 13px 26px;
  }
}

/* ----------------------------------------------------------------------------
   États fonctionnels
---------------------------------------------------------------------------- */
.row-toggle { display: none; }

/* Champs en erreur */
.is-invalid {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.18) !important;
}
/* Message d'erreur : bloc pleine largeur SOUS le champ. */
.field-error-message {
  display: block;
  width: 100%;
  flex-basis: 100%;
  margin-top: 6px;
  font-size: 0.83rem;
  line-height: 1.3;
  color: #dc3545;
  position: relative !important;
  left: 0 !important;
  right: auto !important;
  float: none !important;
  clear: both !important;
}
.bg-white .input-group > .field-error-message {
  flex-basis: 100%;
  width: 100%;
  order: 99;
}

/* Bouton toujours actif */
.always-enabled,
.always-enabled:disabled {
  opacity: 1 !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}
