/* ==========================================================================
   Ciel & Terre — Écrans d'authentification (connexion, 1ʳᵉ connexion, oubli)
   Direction artistique alignée sur l'identité Ciel & Terre : bleus ciel/eau,
   teal (rappel de l'accent applicatif #0b6b73) et vert « Terre », univers du
   solaire flottant. Rendu premium type landing : dégradés, verre dépoli,
   transitions douces. Palette approximative — à ajuster avec la charte
   officielle ; logo/photo réels branchables via LOGIN_LOGO_URL / LOGIN_BG_IMAGE_URL.
   ========================================================================== */
:root {
  --ct-navy:   #0a2540;
  --ct-deep:   #08213b;
  --ct-blue:   #0e76bc;
  --ct-blue-2: #1a8fc0;
  --ct-sky:    #4fb4e6;
  --ct-teal:   #0b6b73;
  --ct-teal-2: #0e8a8f;
  --ct-green:  #4ea95a;
  --ct-green-2:#66c07a;
  --ct-ink:    #12222e;
  --ct-muted:  #5f7180;
  --ct-line:   #e3ecf2;
  --ct-field:  #f6f9fb;
  --ct-white:  #ffffff;
  --danger:    #c0392b;
  --danger-bg: #fdecea;
  --ok:        #1f7a4d;
  --ok-bg:     #e8f6ee;
  --radius:    16px;
  --shadow:    0 24px 60px -12px rgba(6, 26, 46, .45), 0 8px 24px -8px rgba(6, 26, 46, .30);
  --font-head: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ct-ink);
  background: var(--ct-deep);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── Fond : univers solaire flottant (dégradé ciel→eau + vagues + grille) ── */
.auth-bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.auth-bg .sky {
  position: absolute; inset: 0;
  background:
    radial-gradient(1200px 520px at 78% -8%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(900px 600px at 12% 8%, rgba(102,192,122,.20), transparent 55%),
    linear-gradient(180deg,
      #9bd8f2 0%, #66c0e8 20%, #2f9fce 40%,
      #0e6fa2 58%, #0b5480 72%, #0a3a5c 86%, #082a45 100%);
}
/* Photo réelle optionnelle (LOGIN_BG_IMAGE_URL) posée par-dessus le dégradé. */
.auth-bg .photo {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: .9;
}
.auth-bg .scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8,33,59,.10) 0%, rgba(8,33,59,.42) 60%, rgba(6,20,36,.66) 100%);
}
/* Motif « panneaux solaires » discret sur l'eau */
.auth-bg .panels { position: absolute; inset: 0; opacity: .16; mix-blend-mode: soft-light; }
/* Vagues animées */
.auth-bg .waves { position: absolute; left: 0; right: 0; bottom: -2px; width: 100%; height: 42vh; min-height: 240px; }
.auth-bg .waves path { animation: waveDrift 14s ease-in-out infinite alternate; }
.auth-bg .waves path:nth-child(2) { animation-duration: 20s; }
.auth-bg .waves path:nth-child(3) { animation-duration: 27s; }
@keyframes waveDrift {
  from { transform: translateX(0); }
  to   { transform: translateX(-60px); }
}

/* ── Structure ───────────────────────────────────────────────────────── */
.auth-shell {
  position: relative; z-index: 1;
  min-height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px;
  gap: 18px;
}
.auth-card {
  width: 100%; max-width: 500px;
  background: rgba(255,255,255,.90);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 34px 30px;
  animation: cardIn .6s cubic-bezier(.2,.7,.2,1) both;
}
.auth-card.wide { max-width: 540px; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(22px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* ── Marque ──────────────────────────────────────────────────────────── */
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .logo { display: inline-flex; align-items: center; justify-content: center; height: 56px; margin-bottom: 12px; }
.auth-brand .logo img { height: 56px; width: auto; }
/* Logo officiel complet (marque + baseline) : plus large, affiché seul. */
.auth-brand .logo-full { height: auto; margin-bottom: 8px; }
.auth-brand .logo-full img { height: auto; max-height: 170px; width: auto; max-width: 100%; }
.auth-brand h1 {
  font-family: var(--font-head); font-weight: 700; letter-spacing: .14em;
  font-size: 20px; margin: 0; color: var(--ct-navy); text-transform: uppercase;
}
.auth-brand .tagline {
  margin: 4px 0 0; font-size: 12px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ct-teal); font-weight: 600;
}
.auth-head { text-align: center; margin: 4px 0 22px; }
.auth-head h2 { font-family: var(--font-head); font-weight: 600; font-size: 19px; margin: 0 0 6px; color: var(--ct-ink); }
.auth-head p { margin: 0; color: var(--ct-muted); font-size: 13.5px; line-height: 1.5; }

/* ── Champs ──────────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field > label {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--ct-navy);
  margin-bottom: 7px; letter-spacing: .01em;
}
.field input {
  width: 100%; padding: 12px 14px; font-size: 14.5px; font-family: var(--font-body);
  color: var(--ct-ink); background: var(--ct-field);
  border: 1.5px solid var(--ct-line); border-radius: 10px;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.field input::placeholder { color: #9fb0bd; }
.field input:focus {
  outline: none; background: #fff;
  border-color: var(--ct-blue);
  box-shadow: 0 0 0 4px rgba(14,118,188,.15);
}
.field input:disabled { opacity: .6; }
.field .hint { font-size: 12px; color: var(--ct-muted); margin-top: 6px; }

/* Champ mot de passe + bouton œil */
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; color: var(--ct-muted);
  border-radius: 8px; transition: color .15s, background .15s;
}
.pw-toggle:hover { color: var(--ct-teal); background: rgba(11,107,115,.08); }
.pw-toggle svg { width: 20px; height: 20px; }

/* ── Boutons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12.5px 18px; font-size: 15px; font-weight: 600;
  font-family: var(--font-head); letter-spacing: .01em; cursor: pointer;
  border: none; border-radius: 10px; color: #fff;
  background: linear-gradient(120deg, var(--ct-blue) 0%, var(--ct-teal-2) 62%, var(--ct-green) 130%);
  box-shadow: 0 8px 20px -6px rgba(11,107,115,.5);
  transition: transform .14s, box-shadow .14s, filter .14s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -6px rgba(11,107,115,.6); filter: brightness(1.04); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary {
  background: #fff; color: var(--ct-teal); box-shadow: none;
  border: 1.5px solid var(--ct-line);
}
.btn.secondary:hover { border-color: var(--ct-teal); background: rgba(11,107,115,.04); filter: none; }
.btn .spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Liens & pieds ───────────────────────────────────────────────────── */
.auth-links { margin-top: 16px; text-align: center; font-size: 13px; }
.auth-links a { color: var(--ct-teal); text-decoration: none; font-weight: 600; }
.auth-links a:hover { text-decoration: underline; }
.auth-foot { position: relative; z-index: 1; color: rgba(255,255,255,.85); font-size: 12px; letter-spacing: .04em; text-align: center; text-shadow: 0 1px 2px rgba(0,0,0,.25); }

/* ── Alertes ─────────────────────────────────────────────────────────── */
.alert { border-radius: 10px; padding: 11px 14px; font-size: 13.5px; margin-bottom: 16px; line-height: 1.45; border: 1px solid transparent; }
.alert.error { color: var(--danger); background: var(--danger-bg); border-color: #f5c6c0; }
.alert.ok    { color: var(--ok); background: var(--ok-bg); border-color: #bfe6cf; }
.alert.info  { color: var(--ct-teal); background: #e7f5f6; border-color: #bfe4e6; }
.alert:empty { display: none; }

/* ── Stepper (1ʳᵉ connexion / oubli) ─────────────────────────────────── */
.stepper { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 0 22px; }
.stepper .dot {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; font-family: var(--font-head);
  background: var(--ct-field); color: var(--ct-muted); border: 1.5px solid var(--ct-line);
  transition: all .2s;
}
.stepper .dot.active { background: linear-gradient(120deg, var(--ct-blue), var(--ct-teal-2)); color: #fff; border-color: transparent; box-shadow: 0 4px 12px -3px rgba(11,107,115,.5); }
.stepper .dot.done { background: var(--ct-green); color: #fff; border-color: transparent; }
.stepper .bar { width: 26px; height: 2px; background: var(--ct-line); border-radius: 2px; }
.stepper .bar.done { background: var(--ct-green); }

.step { display: none; animation: stepIn .35s ease both; }
.step.active { display: block; }
@keyframes stepIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

.code-input input { text-align: center; letter-spacing: .5em; font-size: 22px; font-weight: 600; font-family: var(--font-head); }
.small-note { font-size: 12px; color: var(--ct-muted); text-align: center; margin-top: 12px; }
.small-note a, .linklike { color: var(--ct-teal); font-weight: 600; cursor: pointer; text-decoration: none; background: none; border: none; font: inherit; padding: 0; }
.small-note a:hover, .linklike:hover { text-decoration: underline; }
.dev-code { margin-top: 10px; font-size: 12px; text-align: center; color: var(--ct-navy); background: #fff7e0; border: 1px dashed #e6c65c; border-radius: 8px; padding: 8px; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .auth-card { padding: 26px 20px 24px; border-radius: 14px; }
  .auth-shell { padding: 24px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card, .step { animation: none; }
  .auth-bg .waves path { animation: none; }
  .btn { transition: none; }
}
