/* ============================================
   AUTH UI (2026-10-20) — bloc connexion / inscription partagé par la page /auth et la fenêtre de
   connexion des pages publiques (static/js/auth-modal.js), repris de la fenêtre d'AutoApplyMax.
   Tout est sous .vx-auth et chaque propriété qu'une page hôte pourrait poser sur les éléments nus
   (h2, label, input, button, a) est fixée ici : la fenêtre s'ouvre sur des pages aux styles variés.
   Bleu Voxtya (#2563eb) uniquement ; rouge = erreur, vert = succès.
   ============================================ */

.vx-auth {
  --vx-primary: #2563eb;
  --vx-primary-dark: #1d4ed8;
  --vx-text: #0f172a;
  --vx-text-2: #475569;
  --vx-text-3: #64748b;
  --vx-border: #e2e8f0;
  --vx-field: #f8fafc;
  --vx-danger: #b91c1c;
  --vx-radius: 12px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--vx-text);
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
}
.vx-auth *, .vx-auth *::before, .vx-auth *::after { box-sizing: border-box; }
.vx-auth [hidden] { display: none !important; }

.vx-auth .vx-view { display: none; margin: 0; padding: 0; background: none; }
.vx-auth .vx-view.active { display: block; animation: vxAuthFade .2s ease; }
@keyframes vxAuthFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .vx-auth .vx-view.active { animation: none; } }

.vx-auth .vx-title {
  margin: 0 0 6px; padding: 0;
  font-family: inherit; font-size: 26px; font-weight: 800; line-height: 1.25; letter-spacing: -0.015em;
  color: var(--vx-text); text-align: center; text-transform: none;
  outline: none; border: 0; background: none;
}
.vx-auth .vx-title:focus, .vx-auth .vx-title:focus-visible { outline: none; }
.vx-auth .vx-sub { margin: 0 auto 18px; max-width: 400px; font-size: 15px; line-height: 1.5; color: var(--vx-text-2); text-align: center; }
.vx-auth .vx-sub-small { font-size: 13px; color: var(--vx-text-3); }
.vx-auth .vx-center { text-align: center; margin: 16px 0 0; }

/* Inscription | Connexion */
.vx-auth .vx-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 0 20px; padding: 4px; background: #eef2f7; border-radius: 14px; }
.vx-auth[data-vx-current="forgot"] .vx-seg, .vx-auth[data-vx-current="sent"] .vx-seg { display: none; }
.vx-auth .vx-seg-btn {
  display: flex; align-items: center; justify-content: center; min-height: 44px; margin: 0; padding: 8px 12px;
  background: transparent; color: var(--vx-text-2); border: 0; border-radius: 10px; box-shadow: none;
  font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; text-transform: none; letter-spacing: normal; cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.vx-auth .vx-seg-btn:hover { color: var(--vx-text); }
.vx-auth .vx-seg-btn[aria-pressed="true"] { background: #fff; color: var(--vx-primary); font-weight: 700; box-shadow: 0 1px 3px rgba(15, 23, 42, .12), 0 0 0 1px rgba(15, 23, 42, .04); }

/* Google en premier, pleine largeur */
.vx-auth .vx-btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 48px; margin: 0; padding: 12px 20px;
  background: #fff; color: var(--vx-text);
  border: 1px solid #cbd5e1; border-radius: var(--vx-radius);
  font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; text-transform: none; letter-spacing: normal;
  cursor: pointer; box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  transition: background .15s ease, border-color .15s ease;
}
.vx-auth .vx-btn-google:hover { background: #f8fafc; border-color: #94a3b8; }
.vx-auth .vx-btn-google:disabled { opacity: .65; cursor: progress; }
.vx-auth .vx-btn-google svg { flex-shrink: 0; }

.vx-auth .vx-divider {
  display: flex; align-items: center; gap: 14px; margin: 16px 0;
  font-size: 12px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .06em; /* 23/10 : #94a3b8 = contraste 2,6:1 → 4,8:1 */
}
.vx-auth .vx-divider::before, .vx-auth .vx-divider::after { content: ''; flex: 1; height: 1px; background: var(--vx-border); }

/* Mot de passe | Lien par email */
.vx-auth .vx-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 0 14px; padding: 3px; background: #f1f5f9; border-radius: 10px; }
.vx-auth .vx-mode-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; margin: 0; padding: 6px 10px;
  background: transparent; color: var(--vx-text-2); border: 0; border-radius: 8px; box-shadow: none;
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; cursor: pointer;
}
.vx-auth .vx-mode-btn[aria-pressed="true"] { background: #fff; color: #1d4ed8; box-shadow: 0 1px 2px rgba(15, 23, 42, .1); }
.vx-auth .vx-mode-btn i { font-size: 12px; }

.vx-auth form { margin: 0; padding: 0; border: 0; background: none; box-shadow: none; max-width: none; }
.vx-auth .vx-field { margin: 0 0 14px; padding: 0; }
.vx-auth label {
  display: block; margin: 0 0 6px; padding: 0;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--vx-text); text-transform: none; letter-spacing: normal;
}
.vx-auth input[type="text"], .vx-auth input[type="email"], .vx-auth input[type="password"] {
  display: block; width: 100%; height: 48px; margin: 0; padding: 0 14px;
  background: var(--vx-field); color: var(--vx-text);
  border: 1px solid var(--vx-border); border-radius: var(--vx-radius);
  font-family: inherit; font-size: 16px; /* 16 px : pas de zoom iOS au focus */
  box-shadow: none; outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.vx-auth input::placeholder { color: #94a3b8; opacity: 1; }
.vx-auth input:focus { background: #fff; border-color: var(--vx-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.vx-auth input[aria-invalid="true"] { border-color: var(--vx-danger); box-shadow: 0 0 0 3px rgba(185, 28, 28, .12); }

.vx-auth .vx-pw { position: relative; }
.vx-auth .vx-pw input { padding-right: 48px; }
.vx-auth .vx-pw-toggle {
  position: absolute; top: 4px; right: 4px; width: 40px; height: 40px; margin: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 8px; color: var(--vx-text-3); cursor: pointer;
}
.vx-auth .vx-pw-toggle:hover { color: var(--vx-text); background: #eef2f7; }
.vx-auth .vx-pw-toggle[aria-pressed="true"] { color: var(--vx-primary); }

.vx-auth .vx-strength { display: flex; gap: 4px; margin-top: 8px; }
.vx-auth .vx-strength .bar { flex: 1; height: 4px; background: #e5e7eb; border-radius: 2px; transition: background .3s; }
.vx-auth .vx-hint { display: block; margin: 6px 0 0; font-size: 12.5px; color: var(--vx-text-3); }
.vx-auth form > .vx-hint { margin: -4px 0 14px; }
.vx-auth .vx-hint i { color: var(--vx-primary); }

.vx-auth .vx-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -2px 0 16px; flex-wrap: wrap; }
.vx-auth .vx-check {
  display: flex; align-items: flex-start; gap: 10px; margin: 2px 0 16px;
  font-size: 13.5px; font-weight: 400; line-height: 1.55; color: var(--vx-text-2); cursor: pointer;
}
.vx-auth .vx-check-inline { margin: 0; align-items: center; min-height: 40px; }
.vx-auth .vx-check input { width: 20px; height: 20px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--vx-primary); cursor: pointer; }
.vx-auth .vx-check-inline input { margin: 0; }
.vx-auth .vx-check a { color: var(--vx-primary); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.vx-auth .vx-ref { margin: 0 0 12px; font-size: 13.5px; color: var(--vx-text-2); }
.vx-auth .vx-ref summary { cursor: pointer; padding: 8px 0; color: #1d4ed8; font-weight: 600; list-style-position: inside; }
.vx-auth .vx-ref .vx-field { margin: 4px 0 6px; }
.vx-auth .vx-ref label { font-size: 13px; }

.vx-auth .vx-btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 48px; margin: 0; padding: 12px 20px;
  background: var(--vx-primary); color: #fff; border: 0; border-radius: var(--vx-radius);
  font-family: inherit; font-size: 15.5px; font-weight: 700; line-height: 1.2; text-transform: none; letter-spacing: normal;
  cursor: pointer; box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
  transition: background .15s ease, box-shadow .15s ease;
}
.vx-auth .vx-btn-primary:hover { background: var(--vx-primary-dark); }
.vx-auth .vx-btn-primary:disabled { opacity: .7; cursor: progress; }
.vx-auth .vx-btn-primary .vx-spin {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
  animation: vxAuthSpin .7s linear infinite;
}
@keyframes vxAuthSpin { to { transform: rotate(360deg); } }

/* Liens texte qui changent d'écran */
.vx-auth .vx-link {
  display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 6px 0; min-height: 0;
  background: none; border: 0; border-radius: 4px; box-shadow: none;
  color: var(--vx-primary); font-family: inherit; font-size: 14px; font-weight: 600; text-decoration: none;
  text-transform: none; letter-spacing: normal; cursor: pointer;
}
.vx-auth .vx-link:hover { text-decoration: underline; }
.vx-auth .vx-link-inline { display: inline; padding: 8px 0; margin: -8px 0; font-size: inherit; }
.vx-auth .vx-switch {
  margin: 18px 0 0; padding: 12px;
  border: 1px solid #dbe6f3; border-radius: var(--vx-radius);
  text-align: center; font-size: 15px; color: var(--vx-text-2); background: #f5f9fe;
}
.vx-auth .vx-switch .vx-link { display: inline; font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; text-decoration-color: rgba(37, 99, 235, .35); }
.vx-auth .vx-switch .vx-link:hover { text-decoration-color: currentColor; }

.vx-auth :focus-visible { outline: 2px solid var(--vx-primary); outline-offset: 2px; }
.vx-auth input:focus-visible { outline: none; }

/* Encadrés : offre, parrainage, commerce, retour après lien */
.vx-auth .vx-info {
  margin: 0 0 14px; padding: 10px 14px; border-radius: 10px;
  background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; font-size: 14px; line-height: 1.5;
}
.vx-auth .vx-info i { color: var(--vx-primary); }
.vx-auth .vx-info .vx-link-inline { color: #1d4ed8; text-decoration: underline; }
.vx-auth .vx-note-ok { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; font-size: 14px; line-height: 1.5; }
.vx-auth .vx-note-ok .vx-link { color: #047857; display: inline; text-decoration: underline; }

/* Erreur dans la fenêtre (role=alert) + messages de la page */
.vx-auth .vx-alert {
  display: flex; align-items: flex-start; gap: 10px; margin: 0 0 14px; padding: 12px 14px;
  background: #fef2f2; color: var(--vx-danger); border: 1px solid #fecaca; border-radius: 10px;
  font-size: 14px; font-weight: 500; line-height: 1.45;
}
.vx-auth .vx-alert svg { flex-shrink: 0; margin-top: 1px; }
.vx-auth .vx-flashes { margin: 0 0 14px; }
.vx-auth .vx-flash { margin: 0 0 8px; padding: 12px 14px; border-radius: 10px; font-size: 14px; line-height: 1.45; }
.vx-auth .vx-flash-err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.vx-auth .vx-flash-ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

.vx-auth .vx-icon-ok {
  width: 72px; height: 72px; margin: 4px auto 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #dcfce7; color: #15803d;
}
.vx-auth .vx-email { margin: 0 0 12px; font-weight: 700; color: var(--vx-primary); word-break: break-all; text-align: center; }
.vx-auth [data-view="sent"] .vx-btn-primary { margin-top: 8px; }

/* ============================================
   FENÊTRE (static/js/auth-modal.js)
   ============================================ */
html.vx-auth-open, body.vx-auth-open { overflow: hidden !important; }
.vx-am-overlay {
  position: fixed; inset: 0; z-index: 2147483000;
  display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: rgba(15, 23, 42, .55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .18s ease;
  overflow-y: auto; overscroll-behavior: contain;
}
.vx-am-overlay.is-open { opacity: 1; }
.vx-am-overlay[hidden] { display: none; }
.vx-am-dialog {
  position: relative; width: 100%; max-width: 480px; margin: auto;
  padding: 24px 40px 28px; background: #fff; border-radius: 24px;
  box-shadow: 0 32px 80px -12px rgba(15, 23, 42, .4), 0 0 0 1px rgba(15, 23, 42, .04);
  transform: translateY(10px) scale(.98); transition: transform .18s ease;
  text-align: left;
}
.vx-am-overlay.is-open .vx-am-dialog { transform: none; }
.vx-am-dialog:focus { outline: none; }
.vx-am-close {
  position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; margin: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: #f1f5f9; color: #0f172a; border: 0; border-radius: 50%; cursor: pointer; z-index: 2;
}
.vx-am-close:hover { background: #e2e8f0; }
.vx-am-close:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.vx-am-brand { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 0 0 16px; min-height: 40px; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 18px; font-weight: 800; color: #0f172a; letter-spacing: -.02em; }
.vx-am-brand img { width: 30px; height: 30px; display: block; }
.vx-am-loading { position: absolute; left: 32px; right: 32px; bottom: 10px; height: 3px; border-radius: 3px; overflow: hidden; background: transparent; }
.vx-am-loading[hidden] { display: none; }
.vx-am-loading::after { content: ''; display: block; width: 40%; height: 100%; background: #2563eb; border-radius: 3px; animation: vxAmLoad 1s ease-in-out infinite; }
@keyframes vxAmLoad { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.vx-am-skeleton { padding: 8px 0 24px; }
.vx-am-skeleton div { height: 44px; margin: 0 0 14px; border-radius: 12px; background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%); background-size: 200% 100%; animation: vxAmSk 1.2s ease-in-out infinite; }
.vx-am-skeleton div:first-child { height: 52px; }
@keyframes vxAmSk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .vx-am-overlay, .vx-am-dialog { transition: none; } .vx-am-loading::after, .vx-am-skeleton div { animation: none; } }

/* Téléphones : plein écran, défile avec le clavier ouvert */
@media (max-width: 560px) {
  .vx-am-overlay { padding: 0; align-items: stretch; }
  .vx-am-dialog { max-width: none; min-height: 100%; margin: 0; border-radius: 0; padding: 14px 16px 28px; box-shadow: none; }
  .vx-am-brand { justify-content: flex-start; margin: 0 0 14px; padding-right: 48px; }
  .vx-am-close { top: 14px; right: 12px; }
  .vx-auth .vx-title { font-size: 23px; }
  /* 2026-10-22 (test personas M11) : « Créer mon compte » visible dans le 1er écran (390×844), avec une marge
     au-dessus du bord bas / de la barre d'accueil : offre et commerce rappelés en lignes compactes. */
  .vx-am-dialog { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
  .vx-am-brand { min-height: 34px; margin-bottom: 8px; }
  .vx-am-dialog .vx-auth .vx-title { font-size: 21px; margin-bottom: 2px; }
  .vx-am-dialog .vx-auth .vx-sub { margin-bottom: 10px; font-size: 14px; }
  .vx-am-dialog .vx-auth .vx-info { padding: 6px 10px; margin-bottom: 8px; font-size: 13px; line-height: 1.35; }
  .vx-am-dialog .vx-auth #signup-offer > div { display: inline; }
  .vx-am-dialog .vx-auth #signup-offer > div + div::before { content: ' · '; }
  .vx-am-dialog .vx-auth .vx-sm-hide { display: none; }
  .vx-am-dialog .vx-auth .vx-btn-google, .vx-am-dialog .vx-auth .vx-btn-primary { min-height: 46px; padding-top: 10px; padding-bottom: 10px; }
  .vx-am-dialog .vx-auth .vx-divider { margin: 10px 0; }
  .vx-am-dialog .vx-auth .vx-field { margin-bottom: 10px; }
  .vx-am-dialog .vx-auth label { margin-bottom: 4px; }
  .vx-am-dialog .vx-auth input[type="email"], .vx-am-dialog .vx-auth input[type="password"] { height: 44px; }
  .vx-am-dialog .vx-auth .vx-check { margin-bottom: 12px; }
  .vx-am-dialog .vx-auth #vx-pw-hint { display: none; }
  .vx-am-dialog .vx-auth .vx-switch { margin-top: 10px; }
}

/* Portables (≤ 960 px de haut) : tout le formulaire tient sans défiler, même avec l'offre et le commerce rappelés */
@media (min-width: 561px) and (max-height: 960px) {
  .vx-am-overlay { padding: 12px 16px; }
  .vx-am-dialog { padding: 16px 36px 18px; }
  .vx-am-brand { margin-bottom: 10px; }
  .vx-am-dialog .vx-auth .vx-seg { margin-bottom: 12px; }
  .vx-am-dialog .vx-auth .vx-seg-btn { min-height: 38px; }
  .vx-am-dialog .vx-auth .vx-title { font-size: 22px; margin-bottom: 2px; }
  .vx-am-dialog .vx-auth .vx-sub { margin-bottom: 12px; font-size: 14px; }
  .vx-am-dialog .vx-auth .vx-btn-google, .vx-am-dialog .vx-auth .vx-btn-primary { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
  .vx-am-dialog .vx-auth .vx-divider { margin: 10px 0; }
  .vx-am-dialog .vx-auth .vx-field { margin-bottom: 10px; }
  .vx-am-dialog .vx-auth label { margin-bottom: 4px; }
  .vx-am-dialog .vx-auth input[type="text"], .vx-am-dialog .vx-auth input[type="email"], .vx-am-dialog .vx-auth input[type="password"] { height: 42px; }
  .vx-am-dialog .vx-auth .vx-pw-toggle { top: 1px; }
  .vx-am-dialog .vx-auth .vx-check { margin-bottom: 10px; }
  .vx-am-dialog .vx-auth .vx-switch { margin-top: 10px; padding: 9px 12px; }
  .vx-am-dialog .vx-auth .vx-info { padding: 7px 12px; margin-bottom: 8px; font-size: 13.5px; line-height: 1.4; }
  .vx-am-dialog .vx-auth #vx-pw-hint { display: none; }
  .vx-am-dialog .vx-auth .vx-ref summary { padding: 4px 0; }
  .vx-am-dialog .vx-auth .vx-ref { margin-bottom: 8px; }
}
@media (min-width: 561px) and (max-height: 820px) {
  .vx-am-brand { min-height: 32px; margin-bottom: 6px; font-size: 16px; }
  .vx-am-brand img { width: 26px; height: 26px; }
  .vx-am-dialog { padding-top: 12px; }
  .vx-am-dialog .vx-auth .vx-sub { margin-bottom: 8px; }
}
