/* =============================================================================
   gravity-forms-handitaxi.css
   Style Gravity Forms au look HandiTaxi.

   UTILISATION
   ───────────
   1. Dans Gravity Forms, ouvrir le formulaire → Réglages → Apparence
      → champ "Classe CSS du formulaire" → saisir :  gf-ht
   2. Ce fichier dépend des variables CSS de handitaxi.css (déjà chargé
      sur le template HandiTaxi). Ne pas charger sur d'autres templates
      sans copier les variables :root.

   MAPPING DES CLASSES
   ────────────────────
   .booking (HTML)          →  .gf-ht.gform_wrapper
   .field                   →  .gfield
   .field label             →  .gfield_label
   .req                     →  .gfield_required
   .field input/select/…    →  .ginput_container input/select/textarea
   .radio-set + labels      →  .gfield_radio + .gchoice label (pills)
   .form-note               →  .gfield_description
   .submit-row .btn-warm    →  .gform_footer .gform-button
   .confirm                 →  .gform_confirmation_message
   .row2 (2 cols)           →  gfield--width-half (géré par GF grid)
   ============================================================================= */


/* ---------- Wrapper ---------------------------------------------------------- */

.gf-ht.gform_wrapper,
.gf-ht .gform_wrapper,
.gform_wrapper .gf-ht {
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(22px, 3vw, 34px);
  font-family: var(--ht-body, "Inter", system-ui, sans-serif);
  /* Réinitialiser les surcharges éventuelles du thème sur gform_wrapper */
  max-width: none;
  margin: 0;
}

span.gfield_required {
  line-height: 24px;
}

/* ---------- Grille de champs ------------------------------------------------- */
/*
  GF gravity-theme place les champs dans un grid 2 colonnes.
  → gfield--width-half  : occupe 1 colonne (équivalent .row2)
  → gfield--width-full  : s'étend sur les 2 colonnes
*/
.gf-ht .gform_fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 16px;
  row-gap: 0;
  /* Annuler d'éventuelles valeurs par défaut de GF */
  list-style: none;
  margin: 0;
  padding: 0;
}

.gf-ht .gfield--width-full  { grid-column: 1 / -1; }
.gf-ht .gfield--width-half  { grid-column: span 1; }

@media (max-width: 520px) {
  .gf-ht .gform_fields      { grid-template-columns: 1fr; }
  .gf-ht .gfield--width-half { grid-column: 1 / -1; }
}


/* ---------- Label ------------------------------------------------------------ */

.gf-ht .gfield_label,
.gf-ht .gfield_label_before_complex {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink, #16183A);
  margin-bottom: 7px;
  font-family: var(--ht-body, "Inter", system-ui, sans-serif);
}

.gform_wrapper.gravity-theme .gf-ht .gfield-choice-input + label {
  margin-bottom: 0;
  max-width: initial;
  vertical-align: middle;
}

.gform_wrapper.gravity-theme .gf-ht .ginput_container_time {
  flex-basis: auto;
  max-width: initial;
  min-width: initial;
}
/* ---------- Astérisque obligatoire ------------------------------------------ */

.gf-ht .gfield_required {
  color: var(--warm, #A0700A);
}


/* ---------- Inputs, selects, textareas --------------------------------------- */

.gf-ht .ginput_container input:not([type="radio"]):not([type="checkbox"]):not([type="submit"]):not([type="button"]):not([type="image"]):not([type="file"]),
.gf-ht .ginput_container select,
.gf-ht .ginput_container textarea {
  width: 100%;
  font-family: var(--ht-body, "Inter", system-ui, sans-serif);
  font-size: 16px;
  color: var(--ink, #16183A);
  background: var(--paper, #fff);
  border: 1.5px solid var(--line, #E2E3EE);
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color .15s;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.4;
}

.gf-ht .ginput_container input:not([type="radio"]):not([type="checkbox"]):not([type="submit"]):not([type="button"]):hover,
.gf-ht .ginput_container select:hover,
.gf-ht .ginput_container textarea:hover {
  border-color: #b9cccc;
}

.gf-ht .ginput_container input:not([type="radio"]):not([type="checkbox"]):not([type="submit"]):not([type="button"]):focus,
.gf-ht .ginput_container select:focus,
.gf-ht .ginput_container textarea:focus {
  border-color: var(--petrol, #000052);
  outline: none;
  box-shadow: none;
}

.gf-ht .ginput_container textarea {
  min-height: 90px;
  resize: vertical;
}

/* Flèche custom sur les selects */
.gf-ht .ginput_container_select {
  position: relative;
}
.gf-ht .ginput_container_select::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted, #5A5E78);
  pointer-events: none;
}

/* Champ de type "Nom" (prénom + nom en 2 sous-colonnes GF) */

.gf-ht .ginput_complex span {
  display: flex;
  flex-direction: column;
}
.gf-ht .ginput_complex .name_sub_label {
  font-size: 12px;
  color: var(--muted, #5A5E78);
  margin-top: 5px;
  order: 1;
}
.gf-ht .ginput_complex input {
  order: 0;
}
@media (max-width: 520px) {
  .gf-ht .ginput_complex { grid-template-columns: 1fr; }
}


/* ---------- Boutons radio (pill-style) --------------------------------------- */

.gf-ht .ginput_container_radio .gfield_radio {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}

.gf-ht .ginput_container_radio .gchoice {
  display: flex;
  position: relative;
}

/* On masque le radio natif (inaccessible visuellement) */
.gf-ht .ginput_container_radio .gchoice input[type="radio"] {
  margin-right: 5px;
}

.gf-ht .ginput_container_radio .gchoice label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 15px;
  background: var(--paper, #fff);
  border: 1.5px solid var(--line, #E2E3EE);
  border-radius: 10px;
  padding: 11px 14px;
  cursor: pointer;
  margin: 0;
  transition: border-color .15s, background .15s;
  user-select: none;
}

.gf-ht .ginput_container_radio .gchoice label:hover {
  border-color: #b9cccc;
}

.gf-ht .ginput_container_radio .gchoice input[type="radio"]:checked + label {
  border-color: var(--warm);
  background: #EEF0FA;
}

.gf-ht .ginput_container_radio .gchoice input[type="radio"]:focus-visible + label {
  outline: 2px solid var(--warm, #000052);
  outline-offset: 2px;
}

body .gform_wrapper.gravity-theme .gfield_required {
  color: #c02b0a;
  display: inline-block;
  font-size: 20px;
  padding-inline-start: 0.125em;
}

/* ---------- Cases à cocher (style cohérent avec les radios) ------------------ */

.gf-ht .ginput_container_checkbox .gfield_checkbox {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}

.gf-ht .ginput_container_checkbox .gchoice {
  display: flex;
  position: relative;
}

.gf-ht .ginput_container_checkbox .gchoice input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  top: 0;
  left: 0;
}

.gf-ht .ginput_container_checkbox .gchoice label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 15px;
  background: var(--paper, #fff);
  border: 1.5px solid var(--line, #E2E3EE);
  border-radius: 10px;
  padding: 11px 14px;
  cursor: pointer;
  margin: 0;
  transition: border-color .15s, background .15s;
}

.gf-ht .ginput_container_checkbox .gchoice input[type="checkbox"]:checked + label {
  border-color: var(--petrol, #000052);
  background: #EEF0FA;
}

.gf-ht .ginput_container_checkbox .gchoice input[type="checkbox"]:focus-visible + label {
  outline: 2px solid var(--petrol, #000052);
  outline-offset: 2px;
}


/* ---------- Champ 30 "Confirmation" : case à cocher standard (annule le style pilule) --------- */

#field_3_30 .gchoice {
  align-items: flex-start;
  gap: 6px;
}

#field_3_30 .gchoice input[type="checkbox"] {
  position: static;
  opacity: 1;
  width: 16px;
  height: 16px;
  margin-top: 3px;
  flex: none;
  accent-color: var(--petrol, #000052);
}

#field_3_30 .gchoice label {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  font-weight: 400;
}

#field_3_30 .gchoice input[type="checkbox"]:checked + label {
  background: none;
  border: none;
}

#field_3_30 .gchoice input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--petrol, #000052);
  outline-offset: 2px;
}


/* ---------- Description / note de champ ------------------------------------- */

.gf-ht .gfield_description {
  font-size: 13px;
  color: var(--muted, #5A5E78);
  margin-top: 4px;
  font-family: var(--ht-body, "Inter", system-ui, sans-serif);
}


/* ---------- États d'erreur de validation ------------------------------------ */

.gf-ht .gfield_error .gfield_label {
  color: #b91c1c;
}

.gf-ht .gfield_error .ginput_container input:not([type="radio"]):not([type="checkbox"]),
.gf-ht .gfield_error .ginput_container select,
.gf-ht .gfield_error .ginput_container textarea {
  border-color: #f87171;
  background: #fff5f5;
}

.gf-ht .gfield_validation_message,
.gf-ht .validation_message {
  color: #b91c1c;
  font-size: 13px;
  margin-top: 5px;
  font-weight: 500;
  font-family: var(--ht-body, "Inter", system-ui, sans-serif);
}

.gf-ht .gform_validation_errors {
  background: #fff5f5;
  border: 1px solid #f87171;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  color: #b91c1c;
  font-size: 14px;
}

.gf-ht .gform_validation_errors > h2,
.gf-ht .gform_validation_errors .gform_submission_error {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: #b91c1c;
  font-family: var(--ht-body, "Inter", system-ui, sans-serif);
}


/* ---------- Bouton "Calculer la distance" (GP Address Autocomplete) --------- */

.ergopix-distance-calc {
  margin-top: 20px;
}

.ergopix-calc-hint {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--warm, #A0700A);
}

.ergopix-calc-btn {
  font-family: var(--ht-body, "Inter", system-ui, sans-serif);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--petrol, #000052);
  background: var(--petrol, #000052);
  color: #fff;
  cursor: pointer;
  transition: background .15s, color .15s, opacity .15s;
  animation: ergopix-calc-pulse 2.2s ease-in-out infinite;
}

.ergopix-calc-btn:hover:not(:disabled) {
  background: #fff;
  color: var(--petrol, #000052);
  animation-play-state: paused;
}

.ergopix-calc-btn:disabled {
  opacity: .2;
  cursor: not-allowed;
  animation: none;
}

@keyframes ergopix-calc-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 0, 82, .35); }
  50%      { box-shadow: 0 0 0 8px rgba(0, 0, 82, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .ergopix-calc-btn {
    animation: none;
  }
}

.ergopix-calc-msg:empty {
  display: none;
}

.ergopix-calc-msg:not(:empty) {
  margin: 20px 0;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  background: #EEF0FA;
  border: 1.5px solid var(--petrol, #000052);
  color: var(--petrol, #000052);
}

.ergopix-calc-msg.is-error {
  background: #fff5f5;
  border-color: #f87171;
  color: #b91c1c;
}


/* ---------- Pied de formulaire + bouton de soumission ----------------------- */

.gf-ht .gform_footer,
.gf-ht .gform_page_footer {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
}

.gf-ht .gform_footer .gform-button,
.btn.btn-primary,
.gf-ht .gform_footer button[type="submit"],
.gf-ht .gform_footer input[type="submit"],
.gf-ht .gform_page_footer .gform-button,
.gf-ht .gform_page_footer button[type="submit"],
.gf-ht .gform_page_footer input[type="submit"] {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-family: var(--ht-body, "Inter", system-ui, sans-serif);
  font-weight: 600;
  font-size: 16px;
  padding: 15px 20px;
  border-radius: 999px;
  border: 0;
  background: var(--warm, #A0700A);
  color: #fff;
  box-shadow: 0 6px 18px rgba(214, 136, 63, .28);
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, filter .2s;
  -webkit-appearance: none;
  appearance: none;
}

.gf-ht .gform_footer .gform-button:hover,
.gf-ht .gform_footer button[type="submit"]:hover,
.gf-ht .gform_footer input[type="submit"]:hover,
.gf-ht .gform_page_footer .gform-button:hover,
.gf-ht .gform_page_footer button[type="submit"]:hover,
.gf-ht .gform_page_footer input[type="submit"]:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  color: #241303;
}

/* Spinner AJAX (masqué — le bouton communique déjà) */
.gf-ht .gform_ajax_spinner {
  display: none;
}


/* ---------- Message de confirmation ----------------------------------------- */
/*
  Gravity Forms retire .gform_wrapper et le remplace par .gform_confirmation_wrapper
  après soumission. La classe "gf-ht" n'est plus présente sur ce wrapper.
  → On cible via la body-class WordPress du template HandiTaxi :
    body.page-template-handitaxi .gform_confirmation_message
*/

.page-template-handitaxi .gform_confirmation_message {
  background: #eaf6ee;
  border: 1px solid #bfe2cb;
  color: #1f5a36;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 15px;
  font-family: var(--ht-body, "Inter", system-ui, sans-serif);
  margin-top: 16px;
}


.ergopix-distance-calc {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-direction: column;
}

/* ---------- Réinitialisation des surcharges globales de handitaxi.css -------- */
/*
  La règle "p { color: var(--muted) }" de handitaxi.css est très large.
  On la neutralise à l'intérieur du wrapper de formulaire.
*/
  color: inherit;
  font-size: inherit;
  margin: 0;
  padding: 4px 8px;
  border: solid 1px green;
  border-radius: 4px;
  background: white;
  font-size: 18px;
}
