/* ===== VMP — Design system (thème sombre violet/indigo) ===== */
:root {
  --bg: #07060f;
  --bg-soft: #0e0c1c;
  --card: #100e20;
  --ink: #f4f3fb;
  --ink-soft: #a7a3c2;
  --line: rgba(255, 255, 255, 0.12);
  --brand: #7c3aed;
  --brand-2: #2563eb;
  --brand-3: #d946ef;
  --brand-grad: linear-gradient(120deg, #d946ef 0%, #7c3aed 45%, #2563eb 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;
  --radius: 16px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 85% 5%, rgba(217, 70, 239, 0.28), transparent 60%),
    radial-gradient(900px 600px at 5% 95%, rgba(37, 99, 235, 0.28), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ===== Layout ===== */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}

/* --- Panneau marque (gauche) --- */
.brand-panel {
  position: relative;
  overflow: hidden;
  background: var(--brand-grad);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 56px;
}
.brand-panel::before,
.brand-panel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.18;
  background: #fff;
}
.brand-panel::before { width: 420px; height: 420px; top: -140px; right: -120px; }
.brand-panel::after  { width: 300px; height: 300px; bottom: -120px; left: -80px; opacity: 0.12; }

.brand-inner { position: relative; z-index: 1; max-width: 440px; }

.brand-logo { margin-bottom: 40px; }
.logo-mark {
  display: inline-block;
  font-weight: 800;
  font-size: 30px;
  letter-spacing: 2px;
  padding: 10px 16px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  backdrop-filter: blur(4px);
}
.logo-mark span { color: #c4b5fd; }

.brand-title {
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 800;
  line-height: 1.12;
  margin-bottom: 18px;
}
.brand-text {
  font-size: 16px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.86);
  margin-bottom: 32px;
}
.brand-features { list-style: none; display: grid; gap: 14px; margin-bottom: 40px; }
.brand-features li { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.tick {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 14px; font-weight: 700;
}
.brand-footer { font-size: 13px; color: rgba(255, 255, 255, 0.6); }

/* --- Panneau formulaire (droite) --- */
.form-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding: 40px 24px;
  background: var(--bg);
}
/* Footer discret sous la carte de formulaire */
.auth-foot {
  text-align: center;
  color: var(--ink-soft);
  font-size: 12.5px;
}
.auth-foot nav { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.auth-foot a { color: var(--ink-soft); text-decoration: none; }
.auth-foot a:hover { color: var(--ink); text-decoration: underline; }
.auth-foot span { opacity: .5; }
.auth-foot-copy { opacity: .8; }
.form-card {
  width: 100%;
  max-width: 440px;
  /* Marges auto verticales : la carte se centre dans l'espace libre tandis que
     le pied de page (.auth-foot) reste ancré en bas du panneau. */
  margin: auto 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
}

.form-head { margin-bottom: 28px; }
.form-head h2 { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.form-head p { color: var(--ink-soft); font-size: 15px; }

/* ===== Fields ===== */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13px; font-weight: 600;
  margin-bottom: 7px;
}
.field input {
  width: 100%;
  font-size: 16px;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
  font-family: inherit;
}
.field input::placeholder { color: var(--ink-soft); }
.field input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--brand-3);
  box-shadow: 0 0 0 4px rgba(217, 70, 239, 0.16);
}
.field input:read-only {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-soft);
  font-weight: 600;
  letter-spacing: .5px;
}
.field input.invalid { border-color: var(--err); }
.field input.valid   { border-color: var(--ok); }
.hint { display: block; margin-top: 6px; font-size: 12px; color: var(--ink-soft); }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 46px; }
.toggle-pass {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  border: none; background: transparent; cursor: pointer;
  font-size: 16px; padding: 6px; border-radius: 8px; opacity: .65;
}
.toggle-pass { color: var(--ink); }
.toggle-pass:hover { opacity: 1; background: rgba(255, 255, 255, 0.08); }

/* Force du mot de passe */
.strength {
  height: 6px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.1); margin-top: 9px; overflow: hidden;
}
.strength span {
  display: block; height: 100%; width: 0;
  border-radius: 99px; transition: width .25s, background .25s;
}
.strength.weak span   { width: 33%;  background: var(--err); }
.strength.medium span { width: 66%;  background: var(--warn); }
.strength.strong span { width: 100%; background: var(--ok); }

/* Messages */
.form-msg {
  font-size: 13.5px; font-weight: 500;
  min-height: 18px; margin-bottom: 6px;
}
.form-msg.error   { color: var(--err); }
.form-msg.success { color: var(--ok); }

/* Bouton */
.btn-primary {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  font-size: 16px; font-weight: 700;
  color: #fff;
  border: none; border-radius: 12px;
  background: var(--brand-grad);
  cursor: pointer;
  transition: transform .12s, box-shadow .2s, opacity .2s;
  box-shadow: 0 10px 24px rgba(99, 60, 220, 0.32);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(99, 60, 220, 0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }

/* Bouton « Continuer avec Google » + séparateur */
.btn-google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px; margin-bottom: 2px;
  font-size: 15px; font-weight: 600; color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 12px;
  cursor: pointer; transition: background .15s, border-color .15s, transform .1s;
}
.btn-google:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.32); }
.btn-google:active { transform: translateY(1px); }
.btn-google svg { background: #fff; border-radius: 3px; padding: 2px; box-sizing: content-box; }

.auth-sep { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--ink-soft); font-size: 13px; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, 0.12); }

.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mini-link { font-size: 12.5px; color: var(--brand-2); text-decoration: none; font-weight: 600; }
.mini-link:hover { text-decoration: underline; }

/* Logo (icône SVG + mot « VMP ») */
.logo-mark { display: inline-flex; align-items: center; gap: 9px; }
.logo-ic { width: 1.1em; height: 1.1em; display: block; flex: none; }

.switch-line {
  margin-top: 22px; text-align: center;
  font-size: 14px; color: var(--ink-soft);
}
.switch-line a { color: var(--brand-2); font-weight: 600; text-decoration: none; }
.switch-line a:hover { text-decoration: underline; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .brand-panel {
    padding: 40px 28px;
    min-height: auto;
  }
  .brand-inner { max-width: 100%; }
  .brand-features { display: none; }
  .brand-title { font-size: 24px; margin-bottom: 10px; }
  .brand-text { margin-bottom: 0; font-size: 14.5px; }
  .brand-footer { display: none; }
  .brand-logo { margin-bottom: 22px; }
}

@media (max-width: 520px) {
  .form-panel { padding: 0; }
  .form-card {
    border-radius: 0;
    box-shadow: none;
    padding: 30px 22px 40px;
    min-height: 100%;
    max-width: 100%;
  }
  .form-panel { align-items: stretch; }
  .form-head h2 { font-size: 23px; }
  .brand-panel { padding: 32px 22px; }
}

@media (min-width: 521px) and (max-width: 900px) {
  .form-panel { padding: 32px 20px; }
}

/* Révélation au défilement (classe ajoutée par JS uniquement) */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ===== Chargement (spinner + flou) — pages d'authentification ===== */
@keyframes vmp-spin { to { transform: rotate(360deg); } }
@keyframes vmp-fade { from { opacity: 0; } to { opacity: 1; } }

/* Bouton en attente : texte masqué + spinner */
.btn-primary[data-loading="1"], .btn-google[data-loading="1"] {
  color: transparent !important; pointer-events: none; position: relative;
}
.btn-primary[data-loading="1"]::after, .btn-google[data-loading="1"]::after {
  content: ""; position: absolute; width: 18px; height: 18px;
  top: 50%; left: 50%; margin: -9px 0 0 -9px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  animation: vmp-spin .6s linear infinite;
}
.btn-google[data-loading="1"]::after { border-color: rgba(124, 58, 237, .3); border-top-color: #7c3aed; }

/* Overlay plein écran : flou + anneau lumineux */
.vmp-loader {
  position: fixed; inset: 0; z-index: 9998;
  display: grid; place-items: center; align-content: center; gap: 16px;
  background: rgba(7, 6, 15, .55);
  -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px);
  text-align: center; animation: vmp-fade .25s ease; transition: opacity .35s ease;
}
.vmp-loader.hide { opacity: 0; pointer-events: none; }
.vmp-loader .ring {
  width: 56px; height: 56px; border-radius: 50%;
  border: 4px solid rgba(217, 70, 239, .22); border-top-color: #d946ef;
  animation: vmp-spin .7s linear infinite;
  box-shadow: 0 0 34px rgba(217, 70, 239, .4);
}
.vmp-loader .lbl { color: #f4f3fb; font-size: 15px; font-weight: 600; letter-spacing: .2px; }

/* Toasts */
.vmp-toasts { position: fixed; z-index: 9999; left: 0; right: 0; bottom: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 14px; pointer-events: none; }
.vmp-toast { pointer-events: auto; max-width: 460px; display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; color: #fff; background: #1c1830; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 12px 32px rgba(0,0,0,.45); transform: translateY(14px); opacity: 0; transition: transform .25s ease, opacity .25s ease; }
.vmp-toast.show { transform: translateY(0); opacity: 1; }
.vmp-toast.ok { background: #0f2c22; border-color: rgba(52,211,153,.5); }
.vmp-toast.error { background: #2c1420; border-color: rgba(244,63,94,.55); }
.vmp-toast .ic { font-size: 16px; flex: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1 !important; transform: none !important; transition: none; } }

/* CAPTCHA Turnstile — conteneur (le widget est un iframe géré par Cloudflare) */
.cf-widget { margin: 4px 0 14px; min-height: 0; display: flex; justify-content: center; }
.cf-widget:empty { display: none; }
.cf-widget iframe { max-width: 100%; }
