/* ═══════════════════════════════════════════════════════════════
   NOCTULO — Auth "sign-up" glassy (pages /register et /login)
   Port fidèle du composant React : pilules de verre, titres serif,
   flèche qui fait avancer, fond dégradé. Thème dark + orange Noctulo.
   La CSS verre (.glass-input / .glass-button) vient du composant.
   Scopé sous .auth-glass-body. Backend Flask inchangé.
   ═══════════════════════════════════════════════════════════════ */

@property --angle-1 { syntax: "<angle>"; inherits: false; initial-value: -75deg; }
@property --angle-2 { syntax: "<angle>"; inherits: false; initial-value: -45deg; }

.auth-glass-body {
  --background: oklch(0.14 0.012 60);   /* near-black chaud (base verre) */
  --foreground: oklch(0.98 0 0);        /* blanc (base verre) */
  --ag-orange:   #F97316;
  --ag-orange-d: #EA580C;
  --ag-amber:    #FBBF24;
  --ag-muted:    rgba(255,255,255,0.55);

  margin: 0;
  min-height: 100vh;
  background: #070707;
  color: #fff;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* ── Fond aurore (SVG flouté du composant, animé en SMIL) ─────── */
.ag-grad { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ag-grad svg { width: 100%; height: 100%; display: block; }

.auth-glass-body::after {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(7,7,7,.35), rgba(7,7,7,0) 40%, rgba(7,7,7,.45));
}

/* ── Logo + langue (fixes) ────────────────────────────────────── */
.ag-topbar { position: fixed; top: 16px; right: 18px; z-index: 6; }
.ag-brand {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 6;
  display: inline-flex; align-items: center;
}
.ag-brand img {
  height: 42px; width: auto;
  filter: brightness(0) invert(1) drop-shadow(0 0 22px rgba(167,139,250,.40));
}

/* ── Colonne centrée (pas de carte, comme le composant) ───────── */
.auth-glass-shell {
  position: relative; z-index: 1; min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 110px 18px 70px;
}
.ag-col { width: 340px; max-width: 90vw; display: flex; flex-direction: column; align-items: center; gap: 26px; }

/* ── Titres ───────────────────────────────────────────────────── */
.ag-title {
  font-family: ui-serif, Georgia, 'Times New Roman', serif;
  font-weight: 300; letter-spacing: -0.02em; line-height: 1.05;
  font-size: clamp(34px, 7vw, 52px); text-align: center; color: #fff;
}
.ag-subtitle { font-size: 14px; font-weight: 500; color: var(--ag-muted); text-align: center; }

/* ── Étapes (une à la fois) + entrée blur-fade ────────────────── */
.ag-step { display: none; width: 100%; flex-direction: column; align-items: center; gap: 22px; }
.ag-step.is-active { display: flex; animation: ag-step-in .5s cubic-bezier(.25,.4,.25,1) both; }
@keyframes ag-step-in { from { opacity: 0; transform: translateY(8px); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
.ag-step.shake { animation: ag-shake .42s; }
@keyframes ag-shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-7px)} 60%{transform:translateX(7px)} 80%{transform:translateX(-4px)} }

/* ── Séparateur "ou" ──────────────────────────────────────────── */
.auth-glass-body .auth-divider {
  display: flex; align-items: center; gap: 10px; width: 100%;
  color: var(--ag-muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.auth-glass-body .auth-divider::before,
.auth-glass-body .auth-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.12); }

/* ════════ PILULES DE VERRE (port du composant) ═══════════════ */
.glass-input-wrap { position: relative; z-index: 2; transform-style: preserve-3d; border-radius: 9999px; width: 100%; }
.glass-input {
  display: flex; position: relative; width: 100%; align-items: center; gap: .25rem;
  border-radius: 9999px; padding: .3rem .3rem .3rem .25rem;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(clamp(1px, 0.125em, 4px));
  transition: all 400ms cubic-bezier(0.25,1,0.5,1);
  background: linear-gradient(-75deg, oklch(from var(--background) l c h / 5%), oklch(from var(--background) l c h / 20%), oklch(from var(--background) l c h / 5%));
  box-shadow: inset 0 0.125em 0.125em oklch(from var(--foreground) l c h / 5%), inset 0 -0.125em 0.125em oklch(from var(--background) l c h / 50%), 0 0.25em 0.125em -0.125em oklch(from var(--foreground) l c h / 20%), 0 0 0.1em 0.25em inset oklch(from var(--background) l c h / 20%), 0 0 0 0 oklch(from var(--background) l c h);
}
.glass-input-wrap:focus-within .glass-input {
  backdrop-filter: blur(0.01em);
  box-shadow: inset 0 0.125em 0.125em oklch(from var(--foreground) l c h / 5%), inset 0 -0.125em 0.125em oklch(from var(--background) l c h / 50%), 0 0.15em 0.05em -0.1em oklch(from var(--foreground) l c h / 25%), 0 0 0.05em 0.1em inset oklch(from var(--background) l c h / 50%), 0 0 0 0 oklch(from var(--background) l c h);
}
.glass-input::after {
  content: ""; position: absolute; z-index: 1; inset: 0; border-radius: 9999px;
  width: calc(100% + clamp(1px,0.0625em,4px)); height: calc(100% + clamp(1px,0.0625em,4px));
  top: calc(0% - clamp(1px,0.0625em,4px)/2); left: calc(0% - clamp(1px,0.0625em,4px)/2);
  padding: clamp(1px,0.0625em,4px); box-sizing: border-box;
  background: conic-gradient(from var(--angle-1) at 50% 50%, oklch(from var(--foreground) l c h / 50%) 0%, transparent 5% 40%, oklch(from var(--foreground) l c h / 50%) 50%, transparent 60% 95%, oklch(from var(--foreground) l c h / 50%) 100%), linear-gradient(180deg, oklch(from var(--background) l c h / 50%), oklch(from var(--background) l c h / 50%));
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
  transition: all 400ms cubic-bezier(0.25,1,0.5,1), --angle-1 500ms ease;
  box-shadow: inset 0 0 0 calc(clamp(1px,0.0625em,4px)/2) oklch(from var(--background) l c h / 50%);
  pointer-events: none;
}
.glass-input-wrap:focus-within .glass-input::after { --angle-1: -125deg; }

.glass-ic { position: relative; z-index: 2; flex-shrink: 0; width: 42px; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.8); }
.glass-ic svg { width: 20px; height: 20px; }
.glass-input input {
  position: relative; z-index: 2; flex: 1; min-width: 0; height: 44px;
  background: transparent; border: none; outline: none;
  color: #fff; font-family: inherit; font-size: 15px;
}
.glass-input input::placeholder { color: rgba(255,255,255,.5); }
.glass-input select {
  position: relative; z-index: 2; height: 44px; border: none; outline: none; background: transparent;
  color: #fff; font-family: inherit; font-size: 14px; padding-left: 8px; max-width: 130px; cursor: pointer;
}
.glass-input select option { background: #141214; color: #fff; }

/* ════════ BOUTONS DE VERRE (port du composant) ══════════════ */
.glass-button-wrap {
  --anim-time: 400ms; --anim-ease: cubic-bezier(0.25,1,0.5,1); --border-width: clamp(1px,0.0625em,4px);
  position: relative; z-index: 2; border-radius: 9999px; transform-style: preserve-3d;
  transition: transform var(--anim-time) var(--anim-ease);
}
.glass-button-wrap:has(.glass-button:active) { transform: rotateX(22deg); }
.glass-button {
  all: unset; box-sizing: border-box; cursor: pointer; position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9999px; -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(clamp(1px,0.125em,4px)); transition: all var(--anim-time) var(--anim-ease);
  background: linear-gradient(-75deg, oklch(from var(--background) l c h / 5%), oklch(from var(--background) l c h / 20%), oklch(from var(--background) l c h / 5%));
  box-shadow: inset 0 0.125em 0.125em oklch(from var(--foreground) l c h / 5%), inset 0 -0.125em 0.125em oklch(from var(--background) l c h / 50%), 0 0.25em 0.125em -0.125em oklch(from var(--foreground) l c h / 20%), 0 0 0.1em 0.25em inset oklch(from var(--background) l c h / 20%), 0 0 0 0 oklch(from var(--background) l c h);
  color: oklch(from var(--foreground) l c h / 92%); font-family: inherit; font-weight: 600;
}
.glass-button:hover { transform: scale(0.975); }
.glass-button::after {
  content: ""; position: absolute; z-index: 1; inset: 0; border-radius: 9999px;
  width: calc(100% + var(--border-width)); height: calc(100% + var(--border-width));
  top: calc(0% - var(--border-width)/2); left: calc(0% - var(--border-width)/2);
  padding: var(--border-width); box-sizing: border-box;
  background: conic-gradient(from var(--angle-1) at 50% 50%, oklch(from var(--foreground) l c h / 50%) 0%, transparent 5% 40%, oklch(from var(--foreground) l c h / 50%) 50%, transparent 60% 95%, oklch(from var(--foreground) l c h / 50%) 100%), linear-gradient(180deg, oklch(from var(--background) l c h / 50%), oklch(from var(--background) l c h / 50%));
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
  transition: all var(--anim-time) var(--anim-ease), --angle-1 500ms ease; pointer-events: none;
}
.glass-button:hover::after { --angle-1: -125deg; }

/* Bouton Google pleine largeur */
.glass-btn-google { width: 100%; height: 50px; gap: 10px; font-size: 15px; }
.glass-btn-google svg { width: 18px; height: 18px; }

/* Flèche "continuer" (cercle) dans la pilule */
.glass-arrow { position: relative; z-index: 2; flex-shrink: 0; width: 40px; height: 40px; margin-left: 2px; }
.glass-arrow .glass-button { width: 40px; height: 40px; color: #fff; }
.glass-arrow svg { width: 18px; height: 18px; }
/* la flèche apparaît quand le champ est valide (opacité + scale = fiable) */
.glass-input-wrap .glass-arrow { opacity: 0; transform: scale(0.8); pointer-events: none; transition: opacity .25s ease, transform .25s ease; }
.glass-input-wrap.valid .glass-arrow { opacity: 1; transform: scale(1); pointer-events: auto; }

/* ── Bouton plein (orange) pour étapes multi-champs ───────────── */
.auth-glass-body .ag-cta {
  width: 100%; height: 52px; border: none; border-radius: 9999px; cursor: pointer;
  background: #f4f4f5; color: #0a0a0a;
  font-family: inherit; font-size: 16px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45); transition: transform .15s, box-shadow .2s, background .2s;
}
.auth-glass-body .ag-cta:hover { transform: translateY(-1px); background: #fff; box-shadow: 0 14px 38px rgba(0,0,0,.55); }

/* ── Voir / masquer mot de passe (dans la pilule) ─────────────── */
.glass-eye { position: relative; z-index: 2; flex-shrink: 0; width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; background: none; border: none; cursor: pointer; color: rgba(255,255,255,.8); transition: color .15s; }
.glass-eye:hover { color: #fff; }
.glass-eye svg { width: 19px; height: 19px; }
.glass-eye .icon-eye-off { display: none; }
.glass-eye.is-visible .icon-eye { display: none; }
.glass-eye.is-visible .icon-eye-off { display: block; }

/* ── Liens / retour / CGU / champs secondaires ────────────────── */
.ag-back { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; cursor: pointer; color: var(--ag-muted); font-family: inherit; font-size: 14px; transition: color .15s; }
.ag-back:hover { color: #fff; }
.ag-back svg { width: 16px; height: 16px; }

.ag-hint { font-size: 12px; color: var(--ag-muted); text-align: center; }
.ag-row { display: flex; gap: 10px; width: 100%; }
.ag-row .glass-input-wrap { flex: 1; }

.ag-check { display: flex; align-items: flex-start; gap: 10px; width: 100%; font-size: 12px; line-height: 1.5; color: var(--ag-muted); text-align: left; }
.ag-check input[type="checkbox"] { margin-top: 2px; width: 16px; height: 16px; flex-shrink: 0; accent-color: #8B5CF6; cursor: pointer; }
.ag-check a { color: #c4b5fd; text-decoration: underline; }
.ag-check a:hover { color: #fff; }

.ag-forgot { font-size: 13px; color: var(--ag-muted); transition: color .15s; }
.ag-forgot:hover { color: #fff; }

.auth-glass-body .auth-alt { text-align: center; color: var(--ag-muted); font-size: 14px; }
.auth-glass-body .auth-alt a { color: #c4b5fd; font-weight: 600; }
.auth-glass-body .auth-alt a:hover { color: #fff; }

/* ── Flash ────────────────────────────────────────────────────── */
.auth-glass-body .flash { width: 100%; border-radius: 14px; padding: 11px 15px; font-size: 13px; font-weight: 500; border: 1px solid transparent; text-align: center; }
.auth-glass-body .flash-success { background: rgba(34,197,94,.10); color: #4ade80; border-color: rgba(34,197,94,.25); }
.auth-glass-body .flash-error,
.auth-glass-body .flash-danger { background: rgba(239,68,68,.10); color: #f87171; border-color: rgba(239,68,68,.25); }
.auth-glass-body .flash-info { background: rgba(249,115,22,.10); color: var(--ag-amber); border-color: rgba(249,115,22,.25); }

/* ── Sélecteur de langue ──────────────────────────────────────── */
.auth-glass-body .lang-select > summary { color: var(--ag-muted) !important; border: 1px solid rgba(255,255,255,.12) !important; background: rgba(255,255,255,.04) !important; }
.auth-glass-body .lang-menu { background: #161616 !important; border: 1px solid rgba(255,255,255,.12) !important; }
.auth-glass-body .lang-menu a { color: var(--ag-muted) !important; }
.auth-glass-body .lang-menu a:hover { background: rgba(255,255,255,.06) !important; color: #fff !important; }

/* ── Footer ───────────────────────────────────────────────────── */
.auth-glass-body .auth-footer { position: relative; z-index: 1; text-align: center; font-size: 12px; color: var(--ag-muted); padding: 8px 18px 26px; }
.auth-glass-body .auth-footer a { color: var(--ag-muted); }
.auth-glass-body .auth-footer a:hover { color: var(--ag-orange); }

@media (prefers-reduced-motion: reduce) { .ag-blob { animation: none; } }
@media (max-width: 600px) { .ag-row { flex-direction: column; } }
