/* ==========================================
   Authentication Layout — MSHP
   Palette : Orange · Blanc · Vert
   ========================================== */

:root {
  --auth-orange:      #ea580c;
  --auth-orange-l:    #f97316;
  --auth-orange-50:   #fff7ed;
  --auth-orange-100:  #ffedd5;
  --auth-orange-200:  #fed7aa;
  --auth-green:       #16a34a;
  --auth-green-l:     #22c55e;
  --auth-green-50:    #f0fdf4;
  --auth-green-100:   #dcfce7;
  --auth-green-200:   #bbf7d0;
  --auth-white:       #ffffff;
  --auth-bg:          #f8fafc;
  --auth-text:        #1e293b;
  --auth-muted:       #64748b;
  --auth-border:      #e2e8f0;
  --auth-card-shadow: 0 20px 60px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.03);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--auth-text);
  background: var(--auth-bg);
}

/* ==========================================
   LAYOUT — Split panel (brand gauche + form droite)
   ========================================== */

.auth-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Panneau marque (gauche, desktop uniquement) ── */
.auth-brand-panel {
  display: none;
  position: sticky;
  top: 0;
  height: 100vh;
  width: 42%;
  flex-shrink: 0;
  background-color: #c2410c;
  background-image: linear-gradient(rgba(0, 0, 0, 0.58), rgba(0, 0, 0, 0.58)), var(--auth-brand-bg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  padding: 3rem 2.5rem;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
}

@media (min-width: 1024px) {
  .auth-brand-panel {
    display: flex;
  }
}

/* Décors géométriques */
.auth-brand-panel::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -80px;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  pointer-events: none;
}

.auth-brand-panel::after {
  content: '';
  position: absolute;
  bottom: -90px;
  left: -60px;
  width: 280px;
  height: 280px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  pointer-events: none;
}

.auth-brand-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: center;
}

.auth-brand-logo-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding: 1rem 1.125rem;
  width: fit-content;
  border-radius: 1.25rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(10px);
}

.auth-brand-logo-wrap img {
  height: 64px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.35));
}

.auth-brand-logo-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.auth-brand-logo-kicker {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.68);
}

.auth-brand-logo-name {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.auth-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(8px);
  border-radius: 100px;
  padding: 0.4rem 1rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2rem;
  width: fit-content;
}

.auth-brand-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse-dot 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}

.auth-brand-heading {
  font-size: 2rem;
  font-weight: 800;
  color: white;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.025em;
}

.auth-brand-text {
  font-size: 0.9375rem;
  color: rgba(255,255,255,0.72);
  line-height: 1.65;
  margin-bottom: 2.5rem;
}

.auth-brand-features {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-feature-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255,255,255,0.9);
  font-size: 0.875rem;
  font-weight: 500;
}

.auth-feature-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(74, 222, 128, 0.2);
  border: 1.5px solid rgba(74, 222, 128, 0.5);
  flex-shrink: 0;
  font-size: 0.625rem;
  color: #4ade80;
}

.auth-brand-footer {
  position: relative;
  z-index: 1;
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.35);
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ── Panneau formulaire (droite) ── */
.auth-form-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem 1.25rem;
  min-height: 100vh;
  overflow-y: auto;
}

/* ── Carte formulaire ── */
.auth-card {
  width: 100%;
  max-width: 36rem;
  border-radius: 1.25rem;
  animation: auth-slide-in 0.4s ease-out;
}

@media (min-width: 640px) {
  .auth-card {
    padding: 2.5rem 2rem;
  }
}

@keyframes auth-slide-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── En-tête carte (logo mobile + titre) ── */
.auth-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.875rem;
  animation: auth-logo-pop 0.5s ease-out;
}

/* Cache le logo mobile quand le panneau brand est visible */
@media (min-width: 1024px) {
  .auth-logo {
    display: none;
  }
}

.auth-logo img {
  height: 52px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(234, 88, 12, 0.2));
}

@keyframes auth-logo-pop {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

.auth-title {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--auth-text);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

@media (min-width: 640px) {
  .auth-title { font-size: 1.625rem; }
}

.auth-subtitle {
  font-size: 0.8125rem;
  color: var(--auth-muted);
  margin-top: 0.375rem;
  line-height: 1.5;
}

/* ==========================================
   BADGE ICONE (shield, lock, etc.)
   ========================================== */

.auth-icon-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 1rem;
  margin: 0 auto 1rem auto;
  font-size: 1.375rem;
}

.auth-icon-badge--orange {
  background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
  color: var(--auth-orange);
}

.auth-icon-badge--green {
  background: linear-gradient(135deg, var(--auth-green-100) 0%, var(--auth-green-200) 100%);
  color: var(--auth-green);
}

.auth-icon-badge--red {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #dc2626;
}

/* ==========================================
   INDICATEUR DE PROGRESSION (steps)
   ========================================== */

.auth-steps {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 1.5rem;
}

.auth-step {
  flex: 1;
  height: 4px;
  border-radius: 100px;
  background: var(--auth-border);
  transition: background 0.35s ease;
}

.auth-step--done   { background: var(--auth-green); }
.auth-step--active { background: var(--auth-orange); }

/* ==========================================
   CHAMPS DE FORMULAIRE
   ========================================== */

/* Input générique */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
textarea,
select {
  display: block;
  width: 100%;
  font-size: 0.9375rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1.5px solid var(--auth-border);
  background: #f8fafc;
  color: var(--auth-text);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  font-family: inherit;
  outline: none;
}

@media (min-width: 640px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"] {
    font-size: 1rem;
    padding: 0.875rem 1rem;
  }
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
  border-color: var(--auth-orange);
  background: white;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.1);
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

/* ── Wrapper input + icône gauche ── */
.auth-input-group {
  position: relative;
}

.auth-input-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.875rem;
  pointer-events: none;
  z-index: 1;
  transition: color 0.2s;
}

.auth-input-group:focus-within .auth-input-icon {
  color: var(--auth-orange);
}

.auth-input-group input {
  padding-left: 2.75rem;
}

/* ── Wrapper input + toggle (mot de passe) ── */
.password-input-wrapper {
  position: relative;
  width: 100%;
}

.password-input-wrapper input[type="password"],
.password-input-wrapper input[type="text"] {
  padding-right: 3.25rem;
}

/* ── Combinaison icône gauche + toggle droit ── */
.auth-input-group.password-input-wrapper input {
  padding-left: 2.75rem;
  padding-right: 3.25rem;
}

/* Toggle button */
.password-toggle-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  transition: color 0.2s;
  padding: 0;
  /* neutralise les styles bouton globaux */
  width: 3.25rem !important;
  min-width: unset;
  box-shadow: none !important;
  border-radius: 0;
  transform: none !important;
}

.password-toggle-btn:hover {
  color: var(--auth-orange);
  background: none !important;
  box-shadow: none !important;
  transform: none !important;
}

.password-toggle-btn i { font-size: 1rem; }

/* ── OTP input ── */
input.auth-otp-input {
  display: block;
  width: 100%;
  border-radius: 0.875rem;
  border: 2px solid var(--auth-border);
  background: #f8fafc;
  padding: 1rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.5em;
  text-align: center;
  color: var(--auth-text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  font-family: "Courier New", "Consolas", monospace;
}

input.auth-otp-input:focus {
  border-color: var(--auth-orange);
  background: white;
  box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.1);
}

/* ==========================================
   LABELS & CHECKBOX
   ========================================== */

label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
}

input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--auth-orange);
  border-radius: 0.25rem;
  flex-shrink: 0;
}

input[type="checkbox"]:focus {
  outline: 2px solid var(--auth-orange);
  outline-offset: 2px;
}

/* ==========================================
   BOUTONS
   ========================================== */

.auth-wrapper button,
.auth-wrapper input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.875rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  border: none;
  border-radius: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
  font-family: inherit;
  letter-spacing: 0.015em;
}

.auth-wrapper button:hover,
.auth-wrapper input[type="submit"]:hover {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.45);
  transform: translateY(-1px);
  color: white;
}

.auth-wrapper button:active,
.auth-wrapper input[type="submit"]:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25);
}

/* Bouton vert (activation 2FA) */
.auth-btn-green,
input[type="submit"].auth-btn-green {
  background: linear-gradient(135deg, var(--auth-green-l) 0%, var(--auth-green) 100%);
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
}

.auth-btn-green:hover,
input[type="submit"].auth-btn-green:hover {
  background: linear-gradient(135deg, var(--auth-green) 0%, #15803d 100%);
  box-shadow: 0 6px 18px rgba(22, 163, 74, 0.45);
  color: white;
}

/* ==========================================
   ALERTES / INFO BOXES
   ========================================== */

.auth-alert {
  padding: 0.875rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.8125rem;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.auth-alert--red {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.auth-alert--orange {
  background: var(--auth-orange-50);
  border: 1px solid var(--auth-orange-200);
  color: #9a3412;
}

.auth-alert--green {
  background: var(--auth-green-50);
  border: 1px solid var(--auth-green-200);
  color: #15803d;
}

.auth-alert-icon {
  flex-shrink: 0;
  font-size: 1rem;
  margin-top: 0.0625rem;
}

/* ── Messages d'erreur Devise ── */
#error_explanation {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
}

#error_explanation h2 {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #dc2626;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

#error_explanation ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#error_explanation ul li {
  font-size: 0.8125rem;
  color: #991b1b;
  padding-left: 0.875rem;
  position: relative;
}

#error_explanation ul li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: #dc2626;
  font-weight: 700;
}

/* ==========================================
   QR CODE & CLÉ MANUELLE
   ========================================== */

.auth-qr-box {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  border-radius: 1.125rem;
  background: white;
  border: 1.5px solid var(--auth-border);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.auth-manual-key {
  display: block;
  margin-top: 0.875rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 0.75rem;
  font-family: "Courier New", monospace;
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  color: #475569;
  word-break: break-all;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  user-select: all;
}

.auth-manual-key:hover {
  background: #f1f5f9;
  border-color: var(--auth-orange-l);
}

/* ==========================================
   FOOTER CARTE
   ========================================== */

.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
  font-size: 0.6875rem;
  color: #94a3b8;
}

.auth-footer-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.auth-footer-link {
  color: #64748b;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.auth-footer-link:hover {
  color: var(--auth-orange);
}

/* ==========================================
   MOBILE
   ========================================== */

@media (max-width: 640px) {
  .auth-form-panel {
    padding: 1.5rem 1rem;
  }

  .auth-card {
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
  }

  .auth-otp-input {
    font-size: 1.375rem;
    letter-spacing: 0.4em;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"] {
    font-size: 16px; /* évite le zoom iOS */
  }
}

/* ==========================================
   COMPOSANTS LUCIDE + NG-*  (améliorations)
   ========================================== */

/* ── Taille des icônes Lucide dans les contextes auth ── */
.auth-icon-badge .lucide         { width: 24px; height: 24px; }
.auth-input-icon .lucide         { width: 15px; height: 15px; }
.password-toggle-btn .lucide     { width: 17px; height: 17px; }
.auth-alert-icon .lucide         { width: 16px; height: 16px; flex-shrink: 0; }
.auth-hint .lucide               { width: 12px; height: 12px; flex-shrink: 0; }
.auth-feature-check .lucide      { width: 11px; height: 11px; }
#error_explanation h2 .lucide    { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Gestion affichage des spans icônes toggle ── */
.password-toggle-btn span.hidden { display: none; }

/* ── Mise en page formulaire ── */
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-form-head { text-align: center; margin-bottom: 20px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-submit { margin-top: 4px; }

/* ── Checkbox "Se souvenir" ── */
.auth-remember {
  display: inline-flex;
  cursor: pointer;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--auth-muted);
  user-select: none;
  font-weight: 500;
}

/* ── Zone de liens en bas de carte ── */
.auth-footer-links {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--auth-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Liens inline ── */
.auth-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
  cursor: pointer;
  list-style: none;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}
.auth-link--orange { color: var(--auth-orange); }
.auth-link--orange:hover { color: #c2410c; }
.auth-link--muted { color: var(--auth-muted); }
.auth-link--muted:hover { color: var(--auth-orange); }
.auth-link--danger { color: #dc2626; }
.auth-link--danger:hover { color: #991b1b; }

/* ── Bouton-lien pleine largeur (max attempts, etc.) ── */
.auth-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  color: white;
  background: #1e293b;
  border-radius: 0.875rem;
  text-decoration: none;
  transition: background 0.2s;
}
.auth-link-btn:hover { background: #0f172a; color: white; }
.auth-link-btn .lucide { width: 16px; height: 16px; }

/* ── Indice / info sous un champ ── */
.auth-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #94a3b8;
  margin-top: -2px;
}
