/* ==========================================================================
   Design System — Formulaire d'Adhésion FO Banques BNP Paribas
   Préfixe strict : .fo-adh- | Zéro framework externe | RGAA / WCAG AA
   ========================================================================== */

:root {
  /* === COULEURS VÉRIFIÉES SUR FO-BNPPARIBAS.COM === */
  --fo-bg-page:            #FFFFFF;
  --fo-bg-surface:         #FFFFFF;
  --fo-bg-subtle:          #F7F8FA;
  --fo-text-heading:       #0E0C19;
  --fo-text-body:          #3C3A47;
  --fo-text-muted:         #666473;
  --fo-text-inverse:       #FFFFFF;
  --fo-color-accent:       #66B8D6; /* Accents non textuels ou texte sur fond #0E0C19 */
  --fo-color-accent-dark:  #1F7A9C; /* Liens textuels & focus sur fond blanc (>= 4.5:1) */
  --fo-border-color:       #D8DAE2;

  /* === ÉLÉMENTS DIVI === */
  --fo-bg-header:          #0E0C19;
  --fo-bg-footer:          #0E0C19;
  --fo-btn-bg:             #0E0C19;
  --fo-btn-text:           #FFFFFF;
  --fo-btn-bg-hover:       #1F7A9C;
  --fo-btn-border:         none;

  /* === ÉTATS FONCTIONNELS === */
  --fo-color-success:      #137333;
  --fo-bg-success:         #E6F4EA;
  --fo-color-error:        #C5221F;
  --fo-bg-error:           #FCE8E6;

  /* === TYPOGRAPHIE VÉRIFIÉE === */
  --fo-font-display:       "Bebas Neue", Impact, sans-serif;
  --fo-font-heading:       "IBM Plex Sans Condensed", Helvetica, Arial, sans-serif;
  --fo-font-body:          "IBM Plex Sans", Helvetica, Arial, sans-serif;

  --fo-size-h1:            clamp(2.25rem, 5vw, 3.16rem);
  --fo-size-section:       1.25rem;
  --fo-size-h3:            1.0625rem;
  --fo-size-body:          0.9375rem;
  --fo-size-label:         0.875rem;
  --fo-size-help:          0.8125rem;

  --fo-line-height-h1:     1.0;
  --fo-line-height-h3:     1.3;
  --fo-line-height-body:   1.7;

  /* === GÉOMÉTRIE & LARGEURS VÉRIFIÉES === */
  --fo-max-width-content:  823px;
  --fo-max-width-wide:     1080px;
  --fo-radius-card:        0px;
  --fo-radius-input:       2px;
  --fo-radius-button:      0px;
  --fo-spacing-section:    2rem;
  --fo-spacing-field:      1.25rem;
}

/* Base isolée */
.fo-adh-page {
  margin: 0;
  padding: 0;
  background-color: var(--fo-bg-page);
  color: var(--fo-text-body);
  font-family: var(--fo-font-body);
  font-size: var(--fo-size-body);
  line-height: var(--fo-line-height-body);
  -webkit-font-smoothing: antialiased;
}

.fo-adh-page *,
.fo-adh-page *::before,
.fo-adh-page *::after {
  box-sizing: border-box;
}

.fo-adh-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Honeypot hors écran */
.fo-adh-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Focus accessible */
.fo-adh-page :focus-visible {
  outline: 2px solid var(--fo-color-accent-dark);
  outline-offset: 2px;
}

/* ==========================================================================
   En-tête institutionnel
   ========================================================================== */
.fo-adh-header {
  background-color: var(--fo-bg-header);
  color: var(--fo-text-inverse);
  padding: 2rem 1.25rem 2.25rem;
  border-bottom: 4px solid var(--fo-color-accent);
}

.fo-adh-header-inner {
  max-width: var(--fo-max-width-content);
  margin: 0 auto;
}

.fo-adh-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.fo-adh-logo {
  display: block;
  width: auto;
  height: 64px;
  flex-shrink: 0;
}

.fo-adh-org-name {
  margin: 0;
  font-family: var(--fo-font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--fo-text-inverse);
}

.fo-adh-slogan {
  margin: 0.125rem 0 0;
  font-size: 0.875rem;
  color: var(--fo-color-accent);
}

.fo-adh-title {
  margin: 0;
  font-family: var(--fo-font-display);
  font-size: var(--fo-size-h1);
  font-weight: 400;
  line-height: var(--fo-line-height-h1);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--fo-text-inverse);
}

.fo-adh-catchphrase {
  margin: 0.75rem 0 0;
  font-family: var(--fo-font-heading);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.4;
  color: #E2E4EC;
}

/* ==========================================================================
   Conteneur principal & Formulaire
   ========================================================================== */
.fo-adh-main {
  padding: 2rem 1.25rem 3rem;
}

.fo-adh-container {
  max-width: var(--fo-max-width-content);
  margin: 0 auto;
  background-color: var(--fo-bg-surface);
}

.fo-adh-intro {
  margin: 0 0 1.75rem;
  color: var(--fo-text-body);
}

.fo-adh-required-mark {
  color: var(--fo-color-error);
  font-weight: 700;
}

.fo-adh-optional {
  font-weight: 400;
  color: var(--fo-text-muted);
  font-size: var(--fo-size-help);
}

/* Sections */
.fo-adh-section {
  margin-bottom: var(--fo-spacing-section);
}

.fo-adh-section-title {
  margin: 0 0 1.25rem;
  padding-bottom: 0.5rem;
  font-family: var(--fo-font-heading);
  font-size: var(--fo-size-section);
  font-weight: 600;
  line-height: 1.3;
  color: var(--fo-text-heading);
  border-bottom: 2px solid var(--fo-color-accent);
}

/* Grilles responsive (Mobile-first : 1 colonne < 768px) */
.fo-adh-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--fo-spacing-field);
}

@media (min-width: 768px) {
  .fo-adh-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fo-adh-grid--address {
    grid-template-columns: 1fr 2fr;
  }
}

/* Champs & Labels */
.fo-adh-field {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--fo-spacing-field);
}

.fo-adh-grid .fo-adh-field {
  margin-bottom: 0;
}

.fo-adh-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: var(--fo-size-label);
  font-weight: 600;
  color: var(--fo-text-heading);
}

.fo-adh-input,
.fo-adh-select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-family: var(--fo-font-body);
  font-size: 16px; /* Anti-zoom Safari iOS sous 768px */
  line-height: 1.5;
  color: var(--fo-text-body);
  background-color: var(--fo-bg-surface);
  border: 1px solid var(--fo-border-color);
  border-radius: var(--fo-radius-input);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

@media (min-width: 768px) {
  .fo-adh-input,
  .fo-adh-select {
    font-size: var(--fo-size-body);
  }
}

.fo-adh-input:hover,
.fo-adh-select:hover {
  border-color: #9DA1B3;
}

.fo-adh-input:focus-visible,
.fo-adh-select:focus-visible {
  border-color: var(--fo-color-accent-dark);
  outline: 2px solid var(--fo-color-accent-dark);
  outline-offset: 1px;
}

.fo-adh-input--uppercase {
  text-transform: uppercase;
}

.fo-adh-input[aria-invalid="true"],
.fo-adh-select[aria-invalid="true"] {
  border-color: var(--fo-color-error);
  background-color: #FFFDFD;
}

.fo-adh-help {
  margin: 0.375rem 0 0;
  font-size: var(--fo-size-help);
  line-height: 1.45;
  color: var(--fo-text-muted);
}

.fo-adh-error-msg {
  margin: 0.375rem 0 0;
  font-size: var(--fo-size-help);
  font-weight: 500;
  line-height: 1.4;
  color: var(--fo-color-error);
}

/* ==========================================================================
   Autocomplétion IGN
   ========================================================================== */
.fo-adh-autocomplete-wrap {
  position: relative;
}

.fo-adh-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: 0;
  list-style: none;
  background-color: var(--fo-bg-surface);
  border: 1px solid var(--fo-color-accent-dark);
  border-top: none;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 6px 16px rgba(14, 12, 25, 0.12);
}

.fo-adh-suggestion-item {
  padding: 0.625rem 0.75rem;
  font-size: var(--fo-size-body);
  line-height: 1.4;
  color: var(--fo-text-body);
  cursor: pointer;
  border-bottom: 1px solid #EEF0F4;
}

.fo-adh-suggestion-item:last-child {
  border-bottom: none;
}

.fo-adh-suggestion-item:hover,
.fo-adh-suggestion-item.is-active {
  background-color: var(--fo-bg-subtle);
  color: var(--fo-text-heading);
  font-weight: 500;
}

/* ==========================================================================
   Encart Cotisation dynamique
   ========================================================================== */
.fo-adh-cotisation-box {
  margin-top: 1.5rem;
  padding: 1.125rem 1.25rem;
  background-color: var(--fo-bg-subtle);
  border-left: 4px solid var(--fo-color-accent);
  border-radius: var(--fo-radius-card);
}

.fo-adh-cotisation-title {
  margin: 0 0 0.375rem;
  font-family: var(--fo-font-heading);
  font-size: var(--fo-size-h3);
  font-weight: 600;
  line-height: var(--fo-line-height-h3);
  color: var(--fo-text-heading);
}

.fo-adh-cotisation-placeholder {
  margin: 0;
  color: var(--fo-text-muted);
}

.fo-adh-cotisation-result {
  margin: 0;
  font-family: var(--fo-font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fo-text-heading);
}

.fo-adh-cotisation-meta {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--fo-font-body);
  font-size: var(--fo-size-help);
  font-weight: 400;
  color: var(--fo-text-muted);
}

/* ==========================================================================
   Zone Upload (composant répétable)
   ========================================================================== */
.fo-adh-dropzone {
  position: relative;
  padding: 1.5rem 1.25rem;
  background-color: var(--fo-bg-subtle);
  border: 2px dashed var(--fo-border-color);
  border-radius: var(--fo-radius-input);
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.fo-adh-dropzone.is-dragover {
  border-color: var(--fo-color-accent-dark);
  background-color: #EFF7FA;
}

.fo-adh-dropzone.has-error {
  border-color: var(--fo-color-error);
}

.fo-adh-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.fo-adh-dropzone-text {
  margin: 0 0 0.25rem;
  color: var(--fo-text-body);
}

.fo-adh-dropzone-limit {
  margin: 0;
  font-size: var(--fo-size-help);
  color: var(--fo-text-muted);
}

.fo-adh-link-btn {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--fo-color-accent-dark);
  text-decoration: underline;
  cursor: pointer;
}

.fo-adh-link-btn:hover {
  color: var(--fo-text-heading);
}

.fo-adh-dropzone-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.fo-adh-file-name {
  font-weight: 600;
  color: var(--fo-text-heading);
  word-break: break-word;
}

.fo-adh-file-size {
  font-size: var(--fo-size-help);
  color: var(--fo-text-muted);
}

.fo-adh-remove-btn {
  padding: 0.35rem 0.75rem;
  font-family: var(--fo-font-body);
  font-size: var(--fo-size-help);
  font-weight: 600;
  color: var(--fo-color-error);
  background-color: var(--fo-bg-surface);
  border: 1px solid var(--fo-color-error);
  border-radius: var(--fo-radius-input);
  cursor: pointer;
}

.fo-adh-remove-btn:hover {
  background-color: var(--fo-bg-error);
}

/* ==========================================================================
   Engagement / Signature (Option B) & Bouton d'envoi
   ========================================================================== */
.fo-adh-engagement-box {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background-color: var(--fo-bg-subtle);
  border: 1px solid var(--fo-border-color);
  border-left: 4px solid var(--fo-color-accent);
}

.fo-adh-engagement-title {
  margin: 0 0 0.5rem;
  font-family: var(--fo-font-heading);
  font-size: var(--fo-size-h3);
  font-weight: 600;
  color: var(--fo-text-heading);
}

.fo-adh-sepa-text {
  margin: 0 0 1rem;
  font-size: var(--fo-size-label);
  line-height: 1.55;
  color: var(--fo-text-body);
}

.fo-adh-checkbox-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.fo-adh-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: var(--fo-color-accent-dark);
  cursor: pointer;
}

.fo-adh-checkbox-label {
  font-size: var(--fo-size-label);
  font-weight: 600;
  line-height: 1.5;
  color: var(--fo-text-heading);
  cursor: pointer;
}

.fo-adh-submit-wrap {
  margin-top: 1.75rem;
  display: flex;
  justify-content: flex-end;
}

.fo-adh-btn {
  width: 100%;
  padding: 0.9rem 2rem;
  font-family: var(--fo-font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--fo-btn-text);
  background-color: var(--fo-btn-bg);
  border: var(--fo-btn-border);
  border-radius: var(--fo-radius-button);
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

@media (min-width: 768px) {
  .fo-adh-btn {
    width: auto;
  }
}

.fo-adh-btn:hover:not(:disabled) {
  background-color: var(--fo-btn-bg-hover);
}

.fo-adh-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ==========================================================================
   Alertes & Panneau de confirmation
   ========================================================================== */
.fo-adh-alert {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  border-left: 4px solid;
  font-size: var(--fo-size-label);
  line-height: 1.5;
}

.fo-adh-alert--error {
  background-color: var(--fo-bg-error);
  border-color: var(--fo-color-error);
  color: #7D1513;
}

.fo-adh-alert--success {
  background-color: var(--fo-bg-success);
  border-color: var(--fo-color-success);
  color: #0D5023;
}

.fo-adh-confirmation {
  padding: 2rem 1.5rem;
  background-color: var(--fo-bg-success);
  border-left: 4px solid var(--fo-color-success);
}

.fo-adh-confirmation-title {
  margin: 0 0 0.75rem;
  font-family: var(--fo-font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fo-color-success);
}

.fo-adh-confirmation p {
  margin: 0 0 0.75rem;
  color: var(--fo-text-heading);
}

.fo-adh-confirmation p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   RGPD & Pied de page
   ========================================================================== */
.fo-adh-rgpd {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--fo-border-color);
  font-size: var(--fo-size-help);
  line-height: 1.6;
  color: var(--fo-text-muted);
}

.fo-adh-rgpd-title {
  margin: 0 0 0.5rem;
  font-family: var(--fo-font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--fo-text-heading);
}

.fo-adh-link {
  color: var(--fo-color-accent-dark);
  text-decoration: underline;
}

.fo-adh-link:hover {
  color: var(--fo-text-heading);
}

.fo-adh-footer {
  background-color: var(--fo-bg-footer);
  color: #D2D5E0;
  padding: 2rem 1.25rem;
  font-size: var(--fo-size-help);
  line-height: 1.6;
}

.fo-adh-footer-inner {
  max-width: var(--fo-max-width-content);
  margin: 0 auto;
}

.fo-adh-footer p {
  margin: 0 0 0.375rem;
}

.fo-adh-footer p:last-child {
  margin-bottom: 0;
}

.fo-adh-footer-org {
  color: var(--fo-text-inverse);
}

.fo-adh-footer-link {
  color: var(--fo-color-accent);
  text-decoration: underline;
}

.fo-adh-footer-link:hover {
  color: var(--fo-text-inverse);
}
