/* ============================================================
   Savoira — Refonte auth : Connexion & Inscription
   (complète redesign.css — voir brief étape 5)
   États démo : ?etat=erreur · ?etat=focus (connexion)
   ============================================================ */

.auth-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
}

/* ================= Panneau gauche (pine) ================= */

.auth-pane {
  position: relative;
  background: var(--pine);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 36px 48px 44px;
  overflow: hidden;
}
.auth-illus {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
}
/* Scrim de lisibilité : dense en haut-gauche (H2) et en bas (stats),
   doux au centre pour laisser respirer l'illustration. */
.auth-pane::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg,
      rgba(11, 43, 31, .88) 0%, rgba(11, 43, 31, .55) 20%,
      rgba(11, 43, 31, .06) 44%, rgba(11, 43, 31, 0) 58%,
      rgba(11, 43, 31, .38) 80%, rgba(11, 43, 31, .90) 100%),
    linear-gradient(96deg, rgba(11, 43, 31, .60) 0%, rgba(11, 43, 31, .12) 42%, rgba(11, 43, 31, 0) 64%);
}
.ap-top, .ap-mid, .ap-stats { position: relative; z-index: 2; }

.ap-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.ap-brand { display: inline-flex; align-items: center; }
.ap-brand .logo-word { color: #EEF9F2; font-weight: 600; font-size: 19px; letter-spacing: -0.035em; line-height: 1; }
.ap-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 2px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--on-pine-muted);
  transition: color .15s ease;
}
.ap-back:hover { color: var(--on-pine-text); }
.ap-back:focus-visible { outline-color: var(--on-pine-accent); }
.ap-back svg { transition: transform .15s ease; }
.ap-back:hover svg { transform: translateX(-2px); }

.ap-mid { max-width: 460px; margin-top: 44px; }
.ap-h2 {
  font-size: 38px;
  line-height: 1.16;
  letter-spacing: -0.03em;
  font-weight: 600;
  color: #fff;
}
.ap-h2 .accent-serif { color: var(--on-pine-accent); }
.ap-sub {
  font-size: 16px;
  line-height: 1.6;
  color: var(--on-pine-text);
  max-width: 420px;
  margin-top: 14px;
  text-wrap: pretty;
}

/* Stats — format et valeurs de l'accueil gelée */
.ap-stats {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 40px;
}
.ap-stat b {
  display: block;
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #fff;
}
.ap-stat.acc b { color: var(--on-pine-accent); }
.ap-stat span {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--on-pine-muted);
  margin-top: 6px;
}

/* ================= Panneau droit (paper) ================= */

.auth-form-pane {
  display: flex;
  flex-direction: column;
  padding: 28px 48px;
}
.fp-top { display: flex; justify-content: flex-end; }
.fp-switch { font-size: 14px; color: var(--body); }
.fp-switch a {
  font-weight: 600;
  color: var(--green-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.fp-switch a:hover { color: var(--pine); }
.fp-switch-mobile { display: none; }

.auth-form {
  width: 100%;
  max-width: 480px;
  margin: auto;
  padding: 36px 0;
}
.auth-form .eyebrow { margin-bottom: 12px; }
.fp-title {
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 10px;
}
.fp-sub {
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 26px;
  text-wrap: pretty;
}

/* ----- Boutons sociaux ----- */
.form-alert {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #E8B4B4;
  background: #FBEFEF;
  color: #8A3030;
  font-size: 14px;
}
.social-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.btn-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 44px;
  padding: 0 10px;
  border-radius: var(--r-btn);
  background: var(--card);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}
.btn-social:hover { border-color: var(--muted); background: #F4F6F3; }
.btn-social svg { width: 18px; height: 18px; flex: none; }

/* ----- Séparateur ----- */
.form-or {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  margin: 22px 0;
}
.form-or::before, .form-or::after { content: ""; height: 1px; background: var(--line); }
.form-or span {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* ----- Champs ----- */
.field { margin-bottom: 16px; }
.field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 7px;
}
.field-label .fl-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--green-deep);
  padding: 4px 0;
}
.field-label .fl-link:hover { color: var(--pine); }

.control { position: relative; display: flex; align-items: center; }
.control .ic {
  position: absolute;
  left: 14px;
  display: inline-flex;
  color: var(--muted);
  pointer-events: none;
}
.input {
  width: 100%;
  height: 48px;
  border-radius: var(--r-btn);
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px 0 42px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: var(--muted); }
.input:hover { border-color: var(--line-strong); }
.input:focus, .input.demo-focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(14, 143, 95, .12);
}
.input.has-eye { padding-right: 50px; }

/* Œil afficher / masquer */
.eye {
  position: absolute;
  right: 2px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease;
}
.eye:hover { color: var(--ink); }
.eye svg { width: 18px; height: 18px; }
.eye .i-hide { display: none; }
.eye.is-on .i-show { display: none; }
.eye.is-on .i-hide { display: block; }

/* Aide & erreur */
.field-help { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.field-err {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--amber-ink);
  margin-top: 6px;
  line-height: 1.4;
}
.field-err svg { flex: none; }
.field.invalid .field-err { display: flex; }
.field.invalid .input { border-color: var(--amber-ink); box-shadow: none; }
.field.invalid .input:focus {
  border-color: var(--amber-ink);
  box-shadow: 0 0 0 4px rgba(180, 84, 10, .10);
}

/* ----- Segmented Email / Téléphone ----- */
.seg-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 44px;
  padding: 4px;
  background: #F2F4F1;
  border-radius: var(--r-btn);
  margin-bottom: 18px;
}
.seg-opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.seg-opt svg { width: 15px; height: 15px; }
.seg-opt[aria-selected="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.seg-opt:hover:not([aria-selected="true"]) { color: var(--ink); }

/* ----- Téléphone + indicatif ----- */
.phone-control {
  display: flex;
  align-items: stretch;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.phone-control:hover { border-color: var(--line-strong); }
.phone-control:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(14, 143, 95, .12);
}
.cc-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  background: #FBFCFB;
  border: none;
  border-right: 1px solid var(--line);
  border-radius: 9px 0 0 9px;
  cursor: pointer;
  transition: background .15s ease;
}
.cc-btn:hover { background: #F4F6F3; }
.cc-btn:focus-visible { outline-offset: -2px; }
.cc-btn .flag { font-size: 16px; line-height: 1; }
.cc-btn .dial {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.cc-btn svg { color: var(--muted); }
.phone-control input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 0 14px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  border-radius: 0 9px 9px 0;
}
.phone-control input::placeholder { color: var(--muted); }

/* ----- Checkbox ----- */
.check {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--body);
  cursor: pointer;
  user-select: none;
}
.check input {
  position: absolute;
  opacity: 0;
  width: 18px;
  height: 18px;
  pointer-events: none;
}
.check .box {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border-radius: 5px;
  border: 1.5px solid var(--line-strong);
  background: #fff;
  display: grid;
  place-items: center;
  transition: background .15s ease, border-color .15s ease;
}
.check .box svg { opacity: 0; transition: opacity .12s ease; }
.check input:checked + .box { background: var(--green); border-color: var(--green); }
.check input:checked + .box svg { opacity: 1; }
.check input:focus-visible + .box { outline: 2px solid var(--green); outline-offset: 2px; }
.check a { color: var(--green-deep); text-decoration: underline; text-underline-offset: 2px; }
.check a:hover { color: var(--pine); }

.row-remember { margin: 6px 0 22px; }
.row-consent { margin: 8px 0 22px; }

/* ----- CTA & pied ----- */
.btn-cta { width: 100%; height: 52px; font-size: 15.5px; }

.form-legal {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 18px;
  text-wrap: pretty;
}
.form-legal a { color: var(--green-deep); text-decoration: underline; text-underline-offset: 2px; }
.form-legal a:hover { color: var(--pine); }

.fp-foot {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.10em;
  color: var(--muted);
  transition: color .15s ease;
}
.lang-btn:hover { color: var(--ink); }

/* ================= Responsive ================= */

@media (max-width: 1000px) {
  .auth-split { grid-template-columns: 45fr 55fr; }
  .auth-pane { padding: 30px 36px 36px; }
  .auth-form-pane { padding: 24px 36px; }
  .ap-h2 { font-size: 34px; }
  .ap-stats { gap: 32px; }
  .ap-stat b { font-size: 32px; }
}

@media (max-width: 880px) {
  .auth-split { grid-template-columns: 1fr; }
  /* Barre de marque 64 px : logo + retour, illustration et stats masquées */
  .auth-pane {
    flex-direction: row;
    align-items: center;
    height: 64px;
    padding: 0 20px;
  }
  .auth-pane::after, .auth-illus, .ap-mid, .ap-stats { display: none; }
  .ap-top { width: 100%; }
  .ap-back { padding: 12px 4px; }
  .auth-form-pane { padding: 8px 32px 28px; }
  .auth-form { padding: 28px 0 8px; }
  .fp-top { display: none; }
  .fp-switch-mobile {
    display: block;
    text-align: center;
    margin-top: 22px;
  }
}

@media (max-width: 600px) {
  .auth-form-pane { padding: 8px 24px 24px; }
  .social-row { grid-template-columns: 1fr; }
  .btn-social { width: 100%; }
  .fp-title { font-size: 28px; }
}
