/* ============================================================
   Forms — Contact, Devis, Adresse
   Pixel-perfect rebrand (Phase 8)
   Design tokens: docs/research/DESIGN_TOKENS.md (vClone)
   ============================================================ */

/* ---------- Form block ---------- */
.form {
  max-width: 800px;
  margin: 0 auto;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--color-navy);
}

/* ---------- Row layout ---------- */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0;
}

.form-row > .form-group {
  flex: 1 1 calc(50% - 8px);
  min-width: 0;
}

@media (max-width: 640px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .form-row > .form-group {
    flex: 1 1 100%;
  }
}

/* ---------- Group + label ---------- */
.form-group {
  margin-bottom: 20px;
  /* Keep a focused / scrolled-to field clear of the fixed site header
     (see scrollIntoView in forms.js). */
  scroll-margin-top: 120px;
}

/* Live: .input-label — pink, sentence case, 16px */
.form-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-pink);
  letter-spacing: 0.24px;
  margin-bottom: 6px;
  line-height: 22px;
}

/* ---------- Inputs ---------- */
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
  color: var(--color-navy);
  background-color: var(--color-white);
  border: 1px solid var(--color-navy); /* live: .form-input border #243269 */
  border-radius: 4px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #999;
  opacity: 1;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #e6007e;
  box-shadow: 0 0 0 3px rgba(230, 0, 126, 0.15);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  font-family: var(--font-body);
}

/* Native select caret (since we set appearance:none) */
.form-select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23243269' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px 8px;
  padding-right: 44px;
  cursor: pointer;
}

/* ---------- Invalid / error states ----------
   Red ONLY when JS adds .is-invalid (on submit/blur), like the live
   .invalid-input. We deliberately do NOT use the :invalid pseudo-class,
   which would paint required empty fields red on page load. */
.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.form-error-text {
  display: block;
  font-size: 12px;
  line-height: 1.3;
  color: #dc3545;
  margin-top: 4px;
  font-weight: var(--font-weight-regular);
}

/* ---------- Radio cards (mode d'acheminement) ----------
   Vraies cartes radio : un <input type=radio> natif masqué (accessible +
   focusable au clavier) + label cliquable. L'état coché est porté par la
   carte via :has(input:checked). L'erreur (aucune option) pose .is-invalid
   sur le <fieldset> (ajouté/retiré par forms.js, comme les autres champs). */
.form-fieldset {
  border: 0;
  margin: 0 0 20px;
  padding: 0;
  min-width: 0;
}

.form-legend {
  display: block;
  padding: 0;
  margin-bottom: 12px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: var(--font-weight-bold);
  color: #e6007e;
}

.form-radiocards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-radio-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--color-navy);
  border-radius: 4px;
  background: var(--color-white);
  cursor: pointer;
  transition: border-color 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
}

.form-radio-card:hover {
  border-color: #e6007e;
  box-shadow: 0 0 0 3px rgba(230, 0, 126, 0.10);
}

.form-radio-card__icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  color: var(--color-navy);
  transition: color 200ms ease;
}

.form-radio-card__label {
  flex: 1 1 auto;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.35;
  color: var(--color-navy);
}

.form-radio-card__dot {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--color-navy);
  position: relative;
  transition: border-color 200ms ease;
}

.form-radio-card__dot::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #e6007e;
  transform: scale(0);
  transition: transform 150ms ease;
}

/* Radio natif masqué visuellement mais focusable au clavier */
.form-radio-card__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* État coché */
.form-radio-card:has(.form-radio-card__input:checked) {
  border-color: #e6007e;
  background: #fdf0f7;
}

.form-radio-card:has(.form-radio-card__input:checked) .form-radio-card__icon {
  color: #e6007e;
}

.form-radio-card:has(.form-radio-card__input:checked) .form-radio-card__dot {
  border-color: #e6007e;
}

.form-radio-card:has(.form-radio-card__input:checked) .form-radio-card__dot::after {
  transform: scale(1);
}

/* Focus clavier */
.form-radio-card:has(.form-radio-card__input:focus-visible) {
  border-color: #e6007e;
  box-shadow: 0 0 0 3px rgba(230, 0, 126, 0.25);
}

/* État erreur (porté par le fieldset) */
.form-fieldset.is-invalid .form-radio-card {
  border-color: #dc3545;
}

/* ---------- Section titles (live: .form-title.underline-title) ---------- */
.form-section-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-navy);
  letter-spacing: 0.88px;
  line-height: 1.2;
  margin-top: 32px;
  margin-bottom: 24px;
  padding-bottom: 11px;
  position: relative;
}

.form-section-title:first-child,
.form > .form-section-title:first-of-type {
  margin-top: 0;
}

.form-section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 75px;
  height: 4px;
  background: var(--color-teal);
}

/* ---------- Devis intro (matches live .quotation-desc-section) ---------- */
.section--devis-intro {
  padding-top: 70px;
}

.section--devis-intro .quotation-desc-title {
  width: 100%;
  position: relative;
  font-size: 45px;
  line-height: 46px; /* live: tight, wraps to 2 lines within the 1140 container */
  font-weight: var(--font-weight-bold);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-navy);
  text-align: center;
}

.section--devis-intro .quotation-desc-title::after {
  content: "";
  display: block;
  width: 159px;
  height: 1px;
  border: 2px solid var(--color-teal);
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
}

.section--devis-intro .quotation-tabs-container {
  margin-top: 120px;
  margin-bottom: 55px;
  margin-left: auto;
  margin-right: auto;
}

.section--devis-intro .quotation-tab-desc {
  text-align: center;
  max-width: 837px;
  margin: 20px auto 0;
}

/* ---------- Particulier/Société tabs (matches live .shipment-slider-tab-btn) ---------- */
.form-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-toggle__tab {
  position: relative;
  padding: 0;
  font-family: var(--font-heading);
  font-size: 30px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.94px;
  color: var(--color-navy);
  background: none;
  border: none;
  cursor: pointer;
}

.form-toggle__tab.is-active {
  font-size: 34px;
  font-weight: var(--font-weight-bold);
  letter-spacing: 1.06px;
}

.form-toggle__tab:focus-visible {
  outline: 2px solid #e6007e;
  outline-offset: 2px;
}

/* Pink dot separator centered in the 85px gap between the two tabs */
.form-toggle__sep {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0 34.5px;
  border-radius: 50%;
  background: #e6007e;
}

/* Mobile : la police 30/34px + l'écart de 85px font déborder les deux
   onglets hors de l'écran. On réduit progressivement police et écart. */
@media (max-width: 600px) {
  .form-toggle__tab {
    font-size: 22px;
    letter-spacing: 0.6px;
  }
  .form-toggle__tab.is-active {
    font-size: 24px;
    letter-spacing: 0.7px;
  }
  .form-toggle__sep {
    width: 12px;
    height: 12px;
    margin: 0 16px;
  }
}

@media (max-width: 400px) {
  .form-toggle__tab {
    font-size: 18px;
  }
  .form-toggle__tab.is-active {
    font-size: 19px;
  }
  .form-toggle__sep {
    margin: 0 12px;
  }
}

/* ---------- Devis form panel ---------- */
.section--devis-form {
  background: #f5f5f5;
  padding: 64px 16px;
  /* full-bleed grey band (the page-content container is constrained to 1140) */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.devis-form-panel {
  background: var(--color-white);
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 56px;
  border-radius: 5px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.devis-form-panel .form {
  max-width: none;
}

@media (max-width: 640px) {
  .devis-form-panel {
    padding: 24px;
  }
}

/* ---------- Dimensions row ---------- */
.form-dimensions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-input--dim {
  width: 80px;
  flex: 0 0 auto;
}

.form-dimensions__x {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-navy);
}

/* ---------- Honeypot (off-screen, anti-spam) ---------- */
.form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
}

/* ---------- Actions (live: .form-btn-box — centered submit) ---------- */
.form-actions {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.form-actions .btn {
  min-width: 220px;
}

.form-actions .btn[disabled],
.form-actions .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- Feedback messages ---------- */
.form-message {
  display: none;
  margin-top: 16px;
  padding: 16px;
  border-radius: 5px;
  font-size: 16px;
  line-height: 1.4;
}

.form-message.is-success {
  display: block;
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.form-message.is-error {
  display: block;
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .form-section-title {
    font-size: 20px;
    margin-top: 28px;
    margin-bottom: 20px;
  }

  .form-actions .btn {
    width: 100%;
    min-width: 0;
  }
}
