/* ============================================================
   BUS PRO — GABARIT D'AUTHENTIFICATION (préfixe auth-)
   Connexion, inscription, mot de passe oublié, réinitialisation, confirmation
   d'e-mail. Autonome (pas de Bootstrap) : tout vient de css/bp-tokens.css, donc
   le thème clair/sombre est géré une seule fois ([data-theme] ou préférence
   système). Champ 46 px, rayons 10/16, focus visible identique au reste du site.
   Le fond (image ou dégradé de marque) est décoratif, voilé pour la lisibilité ;
   aucune photo de bus. Mouvement limité à opacity/transform, coupé en reduced-motion.
   ============================================================ */

:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}

.bp-auth {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--bp-background, #f1f5f9);
  color: var(--bp-text, #0b0f18);
  font-family: var(--bp-font-family, 'Poppins', sans-serif);
  font-size: 1rem;
  line-height: 1.5;
}

.bp-auth *,
.bp-auth *::before,
.bp-auth *::after { box-sizing: border-box; }

.bp-auth button,
.bp-auth input,
.bp-auth select { font-family: inherit; }

/* ---------- Fond ---------- */
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(90% 70% at 100% 0%, rgba(142, 33, 87, .5) 0%, rgba(142, 33, 87, 0) 60%),
    linear-gradient(135deg, var(--bp-navy-900, #0b1b3a) 0%, var(--bp-navy-700, #14306b) 100%);
}

.auth-bg.has-image {
  background-size: cover;
  background-position: center;
}

.auth-bg.has-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(11, 27, 58, .72) 0%, rgba(11, 27, 58, .55) 55%, rgba(107, 15, 61, .6) 100%);
}

:root[data-theme="dark"] .auth-bg.has-image::after { background: linear-gradient(160deg, rgba(5, 9, 20, .86) 0%, rgba(5, 9, 20, .78) 100%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-bg.has-image::after { background: linear-gradient(160deg, rgba(5, 9, 20, .86) 0%, rgba(5, 9, 20, .78) 100%); }
}

/* ---------- Barre haute ---------- */
.auth-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  padding: .3rem .7rem;
  border-radius: var(--bp-radius, 10px);
  background: #fff;
}

.auth-logo img { display: block; width: auto; height: 34px; }

.auth-controls {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .25rem .5rem .25rem .75rem;
  border-radius: var(--bp-radius-pill, 50rem);
  background: var(--bp-surface, #fff);
  box-shadow: var(--bp-elev-1);
}

.bp-auth .theme-toggle-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--bp-text, #0b0f18);
  font-size: .95rem;
  cursor: pointer;
  transition: background var(--bp-dur-1, .15s) var(--bp-ease, ease);
}

.bp-auth .theme-toggle-btn:hover { background: var(--bp-accent-soft, #f8e9f1); }
.theme-toggle-icon-dark { display: none; }
[data-theme="dark"] .theme-toggle-icon-light { display: none; }
[data-theme="dark"] .theme-toggle-icon-dark { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle-icon-light { display: none; }
  :root:not([data-theme="light"]) .theme-toggle-icon-dark { display: inline; }
}

.bp-auth .bp-lang-switcher button { min-height: 34px; }

/* ---------- Carte ---------- */
.auth-main {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: .5rem 1rem 2.5rem;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  padding: 2rem 1.75rem 1.75rem;
  border-radius: var(--bp-radius-card, 16px);
  background: var(--bp-surface, #fff);
  color: var(--bp-text, #0b0f18);
  box-shadow: var(--bp-elev-3);
  animation: auth-in .35s var(--bp-ease, ease) both;
}

@keyframes auth-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.auth-title {
  margin: 0 0 .4rem;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: var(--bp-text, #0b0f18);
}

.auth-intro {
  margin: 0 0 1.5rem;
  text-align: center;
  font-size: .95rem;
  color: var(--bp-text-muted, #503744);
}

.auth-title + .auth-form,
.auth-title + .auth-alert { margin-top: 1.25rem; }

/* ---------- Champs ---------- */
.auth-form { display: grid; gap: 1.1rem; }

.auth-field { display: grid; gap: .35rem; min-width: 0; }

.auth-field > label,
.auth-label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--bp-text, #0b0f18);
}

.auth-opt { font-weight: 400; color: var(--bp-text-muted, #503744); }
.auth-req { color: var(--bp-error-text, #c4261c); }

.auth-control { position: relative; display: block; }

.auth-control > i.auth-ico {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--bp-text-muted, #503744);
  font-size: .95rem;
  pointer-events: none;
}

.auth-control input,
.auth-control select,
.auth-input {
  display: block;
  width: 100%;
  height: var(--bp-control-h, 46px);
  padding: 0 14px;
  border: 1px solid var(--bp-border, #dee2e6);
  border-radius: var(--bp-radius-field, 10px);
  background: var(--bp-surface, #fff);
  color: var(--bp-text, #0b0f18);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--bp-dur-1, .15s) var(--bp-ease, ease), box-shadow var(--bp-dur-1, .15s) var(--bp-ease, ease);
}

.auth-control.has-icon input { padding-left: 40px; }
.auth-control.has-toggle input { padding-right: 46px; }
.auth-control input::placeholder { color: var(--bp-text-muted, #503744); opacity: .7; }

.auth-control input:hover,
.auth-control select:hover { border-color: var(--bp-text-muted, #503744); }

.auth-control input:focus,
.auth-control select:focus,
.auth-input:focus {
  border-color: var(--bp-brand, #8E2157);
  box-shadow: 0 0 0 4px var(--bp-ring, rgba(142, 33, 87, .18));
}

.auth-control input:focus-visible,
.auth-control select:focus-visible { outline: 2px solid var(--bp-focus, #1a73e8); outline-offset: 1px; }

.auth-control input[aria-invalid="true"],
.auth-field.has-error input { border-color: var(--bp-error, #F44335); }

.auth-control input:disabled { opacity: .65; cursor: not-allowed; }

.auth-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--bp-text-muted, #503744);
  cursor: pointer;
}

.auth-toggle:hover { color: var(--bp-text, #0b0f18); background: var(--bp-accent-soft, #f8e9f1); }
.auth-toggle:focus-visible { outline: 2px solid var(--bp-focus, #1a73e8); outline-offset: 0; }

.auth-phone { display: grid; grid-template-columns: minmax(190px, 46%) minmax(0, 1fr); gap: .5rem; }
/* Pays : drapeau + nom + indicatif lisibles en entier ; sur petit écran le sélecteur passe au-dessus du numéro. */
@media (max-width: 520px) { .auth-phone { grid-template-columns: minmax(0, 1fr); } }
.auth-phone select { padding: 0 8px; }

.auth-hint { margin: 0; font-size: .82rem; color: var(--bp-text-muted, #503744); }
/* Aide à la saisie des champs d'identité (inscription) : plus petite que les libellés (.85rem+) et les champs, contraste via les jetons clair/sombre. */
.auth-hint--identity { display: flex; gap: .5rem; align-items: flex-start; margin: -.25rem 0 0; font-size: .76rem; line-height: 1.45; overflow-wrap: anywhere; }
.auth-hint--identity i { flex: 0 0 auto; margin-top: .15rem; color: var(--bp-accent-text, #8E2157); }
.auth-error { margin: 0; font-size: .85rem; font-weight: 500; color: var(--bp-error-text, #c4261c); }
:root[data-theme="dark"] .auth-error { color: #ff8a80; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-error { color: #ff8a80; }
}

.auth-error a { color: inherit; font-weight: 600; }

/* ---------- Alertes ---------- */
.auth-alert {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  margin: 0 0 1.1rem;
  padding: .75rem .9rem;
  border: 1px solid;
  border-radius: var(--bp-radius, 10px);
  font-size: .9rem;
}

.auth-alert i { margin-top: .2rem; }
.auth-alert a { color: inherit; font-weight: 600; text-decoration: underline; }
.auth-alert.is-error { color: #8a1c14; background: #fdecea; border-color: #f5c2bd; }
.auth-alert.is-success { color: #1b5e20; background: #e8f5e9; border-color: #b7dfb9; }
.auth-alert.is-info { color: #0d47a1; background: #e3f0fd; border-color: #b6d4f5; }
.auth-alert.is-warning { color: #7a4a00; background: #fff3e0; border-color: #f2d3a0; }

:root[data-theme="dark"] .auth-alert.is-error { color: #ffb4ab; background: rgba(244, 67, 53, .14); border-color: rgba(244, 67, 53, .4); }
:root[data-theme="dark"] .auth-alert.is-success { color: #a5e3a8; background: rgba(76, 175, 80, .14); border-color: rgba(76, 175, 80, .4); }
:root[data-theme="dark"] .auth-alert.is-info { color: #a9cdfa; background: rgba(26, 115, 232, .16); border-color: rgba(26, 115, 232, .45); }
:root[data-theme="dark"] .auth-alert.is-warning { color: #ffd699; background: rgba(251, 140, 0, .14); border-color: rgba(251, 140, 0, .4); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-alert.is-error { color: #ffb4ab; background: rgba(244, 67, 53, .14); border-color: rgba(244, 67, 53, .4); }
  :root:not([data-theme="light"]) .auth-alert.is-success { color: #a5e3a8; background: rgba(76, 175, 80, .14); border-color: rgba(76, 175, 80, .4); }
  :root:not([data-theme="light"]) .auth-alert.is-info { color: #a9cdfa; background: rgba(26, 115, 232, .16); border-color: rgba(26, 115, 232, .45); }
  :root:not([data-theme="light"]) .auth-alert.is-warning { color: #ffd699; background: rgba(251, 140, 0, .14); border-color: rgba(251, 140, 0, .4); }
}

/* ---------- Boutons & liens ---------- */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  height: var(--bp-control-h, 46px);
  padding: 0 1.25rem;
  border: 1px solid var(--bp-brand, #8E2157);
  border-radius: var(--bp-radius-pill, 50rem);
  background: var(--bp-brand, #8E2157);
  color: var(--bp-on-primary, #fff);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--bp-dur-1, .15s) var(--bp-ease, ease), transform var(--bp-dur-1, .15s) var(--bp-ease, ease);
}

.auth-btn:hover { background: var(--bp-brand-dark, #6b0f3d); border-color: var(--bp-brand-dark, #6b0f3d); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:focus-visible { outline: 3px solid var(--bp-focus, #1a73e8); outline-offset: 2px; }
.auth-btn:disabled { opacity: .65; cursor: not-allowed; }

.auth-btn.is-ghost {
  background: transparent;
  color: var(--bp-accent-text, #8E2157);
}

.auth-btn.is-ghost:hover { background: var(--bp-accent-soft, #f8e9f1); }

.auth-row-end { display: flex; justify-content: flex-end; margin-top: -.4rem; }

.auth-link {
  color: var(--bp-accent-text, #8E2157);
  font-weight: 600;
  text-decoration: none;
}

.auth-link:hover { text-decoration: underline; }
.auth-link:focus-visible { outline: 2px solid var(--bp-focus, #1a73e8); outline-offset: 2px; border-radius: 4px; }

.auth-switch {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: .92rem;
  color: var(--bp-text-muted, #503744);
}

.auth-check {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  font-size: .9rem;
  font-weight: 400;
  color: var(--bp-text, #0b0f18);
}

.auth-check input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: .15rem 0 0;
  accent-color: var(--bp-brand, #8E2157);
}

.auth-check a { color: var(--bp-accent-text, #8E2157); font-weight: 600; }

.auth-captcha { display: flex; justify-content: center; max-width: 100%; overflow-x: auto; }

/* Confirmation (e-mail changé) */
.auth-state { text-align: center; }
.auth-state-ico { font-size: 3rem; line-height: 1; margin-bottom: .75rem; }
.auth-state-ico.is-ok { color: var(--bp-success, #4CAF50); }
.auth-state-ico.is-ko { color: var(--bp-error, #F44335); }
.auth-state .auth-hint { margin: 0 0 .25rem; }

/* Vérification de l'adresse e-mail : adresse masquée, aide centrée, changement d'adresse repliable */
.auth-mask { margin: 0 0 1rem; font-weight: 600; font-size: 1.05rem; color: var(--bp-text, inherit); overflow-wrap: anywhere; }
.auth-hint--center { margin: 1rem 0 0; text-align: center; }
.auth-details { margin: 1.25rem 0 0; }
.auth-details > summary { cursor: pointer; list-style: none; text-align: center; }
.auth-details > summary::-webkit-details-marker { display: none; }
.auth-details[open] > summary { margin-bottom: 1rem; }

/* Indicateur de robustesse du mot de passe (js/password-strength.js) */
.pw-strength-bar {
  height: 6px;
  margin: 0;
  overflow: hidden;
  border-radius: 3px;
  background: var(--bp-border, #e5e7eb);
}

.pw-strength-fill { height: 100%; width: 0; border-radius: 3px; transition: width .2s, background-color .2s; }
.pw-strength-label { min-height: 1.1em; margin: .25rem 0 0; font-size: .8rem; font-weight: 600; }

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

.auth-skip:focus {
  position: fixed;
  top: .5rem;
  left: .5rem;
  z-index: 10;
  width: auto;
  height: auto;
  margin: 0;
  padding: .6rem 1rem;
  clip: auto;
  border-radius: var(--bp-radius, 10px);
  background: var(--bp-surface, #fff);
  color: var(--bp-accent-text, #8E2157);
  font-weight: 600;
  box-shadow: var(--bp-elev-2);
}

@media (max-width: 480px) {
  .auth-topbar { padding: .75rem 1rem; }
  .auth-main { padding: .25rem .75rem 2rem; }
  .auth-card { padding: 1.5rem 1.15rem 1.35rem; }
  .auth-title { font-size: 1.4rem; }
  .auth-phone { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 340px) {
  .auth-logo img { height: 28px; }
  .auth-controls { padding-left: .5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card { animation: none; }
  .auth-btn,
  .auth-control input,
  .auth-control select { transition: none; }
}

/* Zone de texte (inscription propriétaire : informations complémentaires) : mêmes jetons que les champs. */
.auth-control textarea {
  display: block;
  width: 100%;
  min-height: 6rem;
  padding: 10px 14px;
  border: 1px solid var(--bp-border, #dee2e6);
  border-radius: var(--bp-radius-field, 10px);
  background: var(--bp-surface, #fff);
  color: var(--bp-text, #0b0f18);
  font: inherit;
  resize: vertical;
  outline: none;
}
.auth-control textarea:focus { border-color: var(--bp-brand, #8E2157); box-shadow: 0 0 0 4px var(--bp-ring, rgba(142, 33, 87, .18)); }

/* Évaluation du voyage : champ de commentaire et étoiles accessibles (boutons radio réels, navigables au clavier, adaptés au mobile). */
.auth-control textarea { display: block; width: 100%; padding: 10px 14px; border: 1px solid var(--bp-border, #dee2e6); border-radius: var(--bp-radius-field, 10px); background: var(--bp-surface, #fff); color: var(--bp-text, #0b0f18); font: inherit; font-size: 1rem; resize: vertical; min-height: 120px; outline: none; }
.auth-control textarea:focus { border-color: var(--bp-primary, #8E2157); box-shadow: 0 0 0 3px rgba(142, 33, 87, .2); }
.auth-rating { border: 0; padding: 0; margin: 0 0 1rem; text-align: center; }
.auth-rating legend { float: none; width: auto; padding: 0; margin: 0 auto .5rem; font-weight: 600; font-size: 1rem; }
.auth-stars { display: flex; flex-direction: row-reverse; justify-content: center; gap: .15rem; }
.auth-stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.auth-stars label { font-size: 2.6rem; line-height: 1; color: #c9bcc3; cursor: pointer; padding: .1rem .2rem; min-width: 44px; text-align: center; }
.auth-stars input:checked ~ label, .auth-stars label:hover, .auth-stars label:hover ~ label { color: #f5a623; }
.auth-stars input:focus-visible + label { outline: 3px solid var(--bp-focus, #1a73e8); border-radius: 8px; }
.auth-stars-readonly { font-size: 2rem; color: #f5a623; letter-spacing: .1rem; margin: 0 0 .5rem; }
