/* ===== Connexion / inscription (modale desktop, page mobile) ===== */
.auth {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background: var(--paper);
}
.auth__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s3) var(--s4);
}
.auth__lead {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.auth__logo {
  height: 34px;
  width: auto;
}
.auth__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.auth__body {
  padding: var(--s2) var(--s5) var(--s8);
}
.auth__body.is-entering {
  animation: auth-in 0.55s var(--ease) both;
}
@keyframes auth-in {
  from {
    opacity: 0;
    transform: translateX(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.auth__intro {
  margin-top: var(--s2);
}
.auth__intro h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
}
.auth__intro p {
  margin-top: var(--s3);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-500);
}

/* Champs */
.field {
  margin-top: var(--s4);
}
.auth__intro + .field {
  margin-top: var(--s8);
}
.field--spaced {
  margin-top: var(--s6);
}
.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-500);
}
.field__error {
  min-height: 0;
  margin: 6px 0 0;
  font-size: 12px;
  color: #c8211f;
}
.field__error:empty {
  display: none;
}
.field__hint {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-500);
}
.input {
  display: block;
  width: 100%;
  padding: 14px;
  border: 0.8px solid var(--ink-300);
  border-radius: var(--radius-md);
  background: var(--paper-pure);
  font-size: 14px;
  color: var(--ink-900);
  transition: border-color 0.12s;
}
.input::placeholder,
.phone__input::placeholder {
  color: var(--ink-300);
}
.input:focus {
  border-color: var(--red-700);
  outline: 0;
}
#custom-label-field {
  margin-top: 10px;
}
#custom-label-field[hidden] {
  display: none;
}

/* Téléphone */
.phone {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 0.8px solid var(--ink-300);
  border-radius: var(--radius-md);
  background: var(--paper-pure);
  transition: border-color 0.12s;
}
.phone:focus-within {
  border-color: var(--red-700);
}
.phone__prefix {
  display: grid;
  place-items: center;
  width: 58px;
  height: 48px;
  border-right: 0.5px solid var(--ink-300);
  background: #f1f1f1;
}
.phone__code {
  padding: 0 6px 0 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-500);
}
.phone__input {
  flex: 1;
  min-width: 0;
  padding: 14px 14px 14px 0;
  border: 0;
  background: transparent;
  font-size: 15px;
  color: var(--ink-900);
}
.phone__input:focus {
  outline: 0;
}
.phone.is-locked {
  border-color: var(--ink-300);
}
.phone.is-locked .phone__code,
.phone.is-locked .phone__input {
  color: var(--ink-300);
}

/* OTP : saisie, puis animation de validation (fusion → cercle → spinner → coche) */
.otp-block {
  margin-top: var(--s5);
}
.otp {
  position: relative;
  display: flex;
  gap: 10px;
  width: 100%;
  height: 56px;
  margin-inline: auto;
  transition:
    width 0.6s var(--ease),
    gap 0.45s var(--ease),
    border-radius 0.6s var(--ease),
    background 0.35s,
    border-color 0.35s,
    transform 0.4s var(--ease);
}
.otp__box {
  width: 100%;
  min-width: 0;
  height: 56px;
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-md);
  background: var(--paper-pure);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  color: var(--ink-900);
  transition:
    border-color 0.15s,
    border-radius 0.45s var(--ease),
    color 0.25s,
    opacity 0.3s;
}
.otp__box:focus {
  border-color: var(--red-700);
  outline: 0;
}

/* 1. fusion : cases collées en une barre, chiffres masqués */
.otp.is-merging {
  gap: 0;
}
.otp.is-merging .otp__box {
  border-radius: 0;
  color: transparent;
  border-color: var(--ink-300);
  opacity: 1;
}
.otp.is-merging .otp__box + .otp__box {
  margin-left: -1px;
}
.otp.is-merging .otp__box:first-of-type {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.otp.is-merging .otp__box:nth-of-type(4) {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* 2. la barre se resserre en cercle */
.otp.is-circle {
  width: 56px;
  border: 1px solid var(--ink-300);
  border-radius: 50%;
  background: var(--paper-pure);
  overflow: hidden;
}
.otp.is-circle .otp__box {
  opacity: 0;
}

/* 3. spinner / 4. coche */
.otp__status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.otp__spin {
  width: 26px;
  height: 26px;
  border: 3px solid var(--ink-100);
  border-top-color: var(--red-700);
  border-radius: 50%;
  opacity: 0;
}
.otp.is-verifying .otp__spin {
  opacity: 1;
  animation: auth-spin 0.7s linear infinite;
}
.otp__check {
  position: absolute;
  width: 28px;
  height: 28px;
  color: #fff;
}
.otp__check path {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
}
.otp.is-success {
  border-color: #0f8f4f;
  background: #0f8f4f;
  animation: auth-pop 0.5s var(--ease);
}
.otp.is-success .otp__check path {
  animation: auth-check 0.45s 0.15s var(--ease) forwards;
}
@keyframes auth-check {
  to { stroke-dashoffset: 0; }
}
@keyframes auth-pop {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Erreur : secousse (sur les cases, ou sur le cercle) */
.otp.is-error {
  animation: auth-shake 0.45s ease;
}
.otp.is-error.is-circle {
  border-color: #c8211f;
}
.otp.is-error .otp__box {
  border-color: #c8211f;
}
@keyframes auth-shake {
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.otp-actions {
  display: flex;
  justify-content: space-between;
  margin-top: var(--s3);
}
.text-btn {
  padding: 4px 0;
  font-size: 13px;
  font-weight: 600;
}
.text-btn--muted {
  color: var(--ink-500);
}
.text-btn--red {
  color: var(--red-700);
}

/* Type d'adresse */
.chips {
  display: flex;
  gap: var(--s2);
}
.addr-chip {
  flex: 1;
  height: 38px;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-pill);
  background: var(--paper-pure);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-900);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.addr-chip:hover:not(.is-on) {
  border-color: var(--ink-300);
}
.addr-chip.is-on {
  border-color: var(--red-700);
  background: var(--red-50);
  color: var(--red-700);
}

/* Carte (placeholder qui imite le bloc de l'app : 200 px, bordure ink300, rayon 12) */
.map {
  position: relative;
  display: grid;
  place-items: center;
  height: 200px;
  overflow: hidden;
  border: 0.8px solid var(--ink-300);
  border-radius: var(--radius-md);
  background-color: #e9eef0;
  background-image:
    linear-gradient(115deg, transparent 46%, #fff 46%, #fff 50%, transparent 50%),
    linear-gradient(25deg, transparent 58%, #fff 58%, #fff 61%, transparent 61%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.55) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.55) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 28px 28px, 28px 28px;
}
.map__pin {
  margin-top: -20px;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.25));
}
.map__expand {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--paper-pure);
  box-shadow: var(--shadow-2);
  color: var(--ink-900);
}
.map__expand svg {
  width: 18px;
  height: 18px;
}

/* Bouton principal */
.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  margin-top: var(--s8);
  border-radius: var(--radius-md);
  background: var(--red-700);
  box-shadow: var(--shadow-cta);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  transition: opacity 0.15s, transform 0.15s;
}
.auth-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}
.auth-btn:disabled {
  background: var(--ink-300);
  box-shadow: none;
  cursor: not-allowed;
}
.auth-btn.is-loading {
  cursor: progress;
}
.auth-btn.is-loading::after {
  content: "";
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}
@keyframes auth-spin {
  to { transform: rotate(360deg); }
}
.profile .auth-btn {
  margin-top: var(--s6);
}

/* Page mobile */
.auth-page {
  min-height: 70vh;
  overflow: clip;
  border-radius: var(--radius-xl);
  background: var(--paper);
}
@media (min-width: 640px) {
  .auth-page {
    max-width: 480px;
    margin: 0 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth__body.is-entering,
  .otp.is-error,
  .otp.is-success,
  .otp.is-verifying .otp__spin,
  .auth-btn.is-loading::after {
    animation-duration: 0.01ms;
  }
}

.auth-main {
  padding: var(--s4) 0 var(--s8);
}

/* Drawer (desktop) : formulaire centré verticalement et horizontalement.
   `margin: auto` plutôt que `justify-content: center` : si l'étape est plus haute que le drawer
   (étape profil), le haut reste accessible au scroll. */
.auth--drawer .auth__scroll {
  display: flex;
  flex-direction: column;
}
.auth--drawer .auth__body {
  width: 100%;
  max-width: 400px;
  margin: auto;
}
