/* SVsansT — Auth UI (amélioré + règles MDP en pleine largeur + toggle œil) */
/* ———————————————————  Base  ——————————————————— */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #0b1220;
  background: #f6f9ff;
}

/* Section pleine hauteur */
.auth-section {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, #e0f2fe 40%, transparent 60%),
    radial-gradient(1200px 600px at 110% 110%, #dbeafe 40%, transparent 60%),
    linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 45%, #dbeafe 100%);
  position: relative;
  overflow: hidden;
}
.auth-section::before {
  content: '';
  position: absolute; inset: 0;
  background:
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" opacity="0.25" viewBox="0 0 32 32"><path d="M0 31h31V0" fill="none" stroke="%23e5e7eb" stroke-width=".5"/></svg>');
  background-size: 16px 16px;
  pointer-events: none;
}

/* Carte */
.auth-container {
  width: 100%;
  max-width: 640px;
  background: #fff;
  border-radius: 18px;
  border: 1px solid #eef2ff;
  box-shadow:
    0 10px 25px rgba(37, 99, 235, 0.07),
    0 35px 80px rgba(37, 99, 235, 0.12);
  overflow: hidden;
}

/* Header */
.auth-header {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: .5rem;
  padding: 28px 28px 16px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 80%);
  border-bottom: 1px solid #eef2ff;
}
.auth-logo { width: 72px; height: 72px; display: block; }
.auth-title {
  margin: 6px 0 0;
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #111827 0%, #2563eb 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-subtitle { margin: 4px 0 0; color: #64748b; font-size: 0.98rem; }

/* Corps */
.auth-form-container {
  padding: 24px 28px 30px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; width: 100%; }

/* Grilles */
.form-row, .grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%;
}

/* Groupes, labels, inputs */
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-weight: 600; color: #1f2937; font-size: 0.96rem; }

.input, .select, .form-group input, .form-group select {
  appearance: none;
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1rem;
  background: rgba(255,255,255,.92);
  transition: border-color .2s, box-shadow .2s, transform .1s;
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
  background: #fff;
  transform: translateY(-1px);
}
.input.error { border-color: #ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,.12); }

/* ===== Toggle œil mot de passe ===== */
.input-wrap { position: relative; }
/* AJOUT : espace pour l’icône afin d’éviter le chevauchement du texte */
.input-wrap .input.pwd { padding-right: 2.6rem; }
.pwd-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer;
  font-size: 0.95rem; color: #64748b; padding: 6px;
  border-radius: 8px;
  min-width: 44px; min-height: 44px; /* ergonomie tactile */
  display: grid; place-items: center;
}
.pwd-toggle:hover { color: #1f2937; background: #f3f4f6; }
.pwd-toggle:focus-visible { outline: 3px solid rgba(37,99,235,.25); outline-offset: 2px; }

/* ===== Exigences MDP (full width) ===== */
.requirements-full { grid-column: 1 / -1; } /* s'étend sur les 2 colonnes */
.password-requirements {
  margin-top: -2px;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bfdbfe;
  font-size: .92rem;
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.password-requirements p { margin: 0 0 6px; font-weight: 600; color: #1f2937; }
.password-requirements ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.password-requirements li {
  position: relative; padding-left: 1.5rem; color: #ef4444; transition: color .2s;
}
.password-requirements li::before {
  content: '✗'; position: absolute; left: 0; color: #ef4444; font-weight: 700;
}
.password-requirements li.valid { color: #059669; }
.password-requirements li.valid::before { content: '✓'; color: #059669; }

/* Quand TOUTES les règles sont OK */
.password-requirements.ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  box-shadow: 0 0 0 3px rgba(16,185,129,.15) inset;
}

/* Messages & footer */
.form-message {
  margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-size: .96rem; display: none;
}
.form-message.ok { display: block; color: #065f46; background: #ecfdf5; border: 1px solid #a7f3d0; }
.form-message.err { display: block; color: #7f1d1d; background: #fef2f2; border: 1px solid #fecaca; }

.btn-primary, .auth-submit-btn {
  width: 100%;
  border: 0; border-radius: 12px; padding: 14px 20px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff; font-size: 1rem; font-weight: 700; letter-spacing: .01em; cursor: pointer;
  box-shadow: 0 6px 16px rgba(37,99,235,.25);
  transition: transform .08s, box-shadow .2s, filter .2s;
  position: relative; overflow: hidden;
}
.btn-primary::before, .auth-submit-btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent);
  transform: translateX(-100%); transition: transform .5s;
}
.btn-primary:hover, .auth-submit-btn:hover {
  transform: translateY(-1px); box-shadow: 0 10px 22px rgba(37,99,235,.32); filter: saturate(1.05);
}
.btn-primary:hover::before, .auth-submit-btn:hover::before { transform: translateX(100%); }
.btn-primary:disabled { background: #9ca3af; box-shadow: none; cursor: not-allowed; transform: none; }

.small { margin-top: 10px; color: #6b7280; font-size: .96rem; }
.small a { color: #2563eb; font-weight: 700; text-decoration: none; }
.small a:hover { text-decoration: underline; }

.auth-footer { margin-top: 16px; padding-top: 16px; border-top: 1px solid #eef2ff; text-align: center; }
.auth-footer a { color: #2563eb; font-weight: 700; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* ———————————————————  Responsiveness  ——————————————————— */
/* Large (≤ 1024px) : aère légèrement et garde la hiérarchie */
@media (max-width: 1024px) {
  .auth-container { max-width: 700px; }
  .auth-form-container { padding: 22px 24px 28px; }
}

/* Medium+ (≤ 900px) : titres un poil plus grands via clamp déjà en place, on réduit gaps */
@media (max-width: 900px) {
  .auth-header { padding: 24px 24px 14px; }
  .auth-form { gap: 12px; }
}

/* Tablet (≤ 768px) : une colonne, paddings réduits, logo un peu plus petit */
@media (max-width: 768px) {
  .form-row, .grid-2 { grid-template-columns: 1fr; }
  .auth-container { max-width: 96%; }
  .auth-header { padding: 22px 20px 12px; }
  .auth-logo { width: 64px; height: 64px; }
  .auth-form-container { padding: 18px 16px 22px; }
}

/* Phablet (≤ 600px) : confort de lecture et cibles tactiles */
@media (max-width: 600px) {
  .auth-section { padding: 36px 12px; }
  .pwd-toggle { right: 8px; }
  .input, .select, .form-group input, .form-group select { padding: 13px 14px; font-size: 1rem; }
}

/* Mobile (≤ 480px) : compacité sans casser le style */
@media (max-width: 480px) {
  .auth-title { font-size: clamp(1.3rem, 5.2vw, 1.6rem); }
  .auth-subtitle { font-size: .95rem; }
  .auth-header { padding: 18px 16px 10px; }
  .auth-form-container { padding: 16px 14px 20px; }
  .password-requirements { font-size: .9rem; padding: 10px 12px; }
  .password-requirements ul { gap: 5px; }
}

/* Small mobile (≤ 360px) : rétrécit encore les paddings et interlignes */
@media (max-width: 360px) {
  .auth-logo { width: 56px; height: 56px; }
  .auth-title { letter-spacing: 0; }
  .auth-form { gap: 10px; }
  .input, .select, .form-group input, .form-group select { padding: 12px 12px; }
  .btn-primary, .auth-submit-btn { padding: 12px 16px; }
}

/* Ultra small (≤ 320px) : garde tout lisible et tappable */
@media (max-width: 320px) {
  .auth-section { padding: 28px 8px; }
  .auth-header { padding: 16px 12px 8px; }
  .auth-form-container { padding: 14px 12px 16px; }
  .password-requirements { padding: 8px 10px; }
}

/* Écrans très bas en hauteur (paysage mobile) */
@media (max-height: 540px) and (orientation: landscape) {
  .auth-section { padding: 20px 12px; }
  .auth-header { padding: 14px 16px 8px; }
  .auth-logo { width: 52px; height: 52px; }
  .auth-form-container { padding: 12px; }
}

/* Écrans très larges (≥ 1600px) : évite l’effet “petit” sur desktop 4K sans casser le style */
@media (min-width: 1600px) {
  .auth-container { max-width: 720px; }
  .auth-title { font-size: clamp(1.6rem, 1.8vw, 2rem); }
}

/* ———————————————————  Accessibilité / Perf  ——————————————————— */
/* Réduit les animations si l’utilisateur le demande */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Focus visible partout (clavier) */
:focus-visible {
  outline: 3px solid rgba(37,99,235,.28);
  outline-offset: 2px;
}

/* iOS safe-area padding (si header/footer fixed un jour) */
/* .auth-section { padding-bottom: calc(48px + env(safe-area-inset-bottom)); } */