/* ════════════════════════════════════════════════════════════
   auth-design.css — AirPharma
   Système de design partagé pour toutes les pages d'authentification
   (register, verify_email, login, forgot_password, reset_password)
   et, à terme, le wizard de complétion de profil.
   Palette/police transposées du prototype React (brand/ink/muted/
   line/canvas/surface/accent/danger, Poppins).
════════════════════════════════════════════════════════════ */

:root {
  --brand:       #0e7c66;
  --brand-dark:  #0a5c4c;
  --brand-soft:  #e7f4f0;
  --ink:         #101a17;
  --muted:       #606e69;
  --line:        #e1e7e5;
  --canvas:      #f6f8f7;
  --surface:     #ffffff;
  --accent:      #b45309;
  --accent-soft: #fef3e2;
  --danger:      #b42318;
  --danger-soft: #feeceb;
  --radius-sm:   10px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   28px;
}

* { box-sizing: border-box; }

body.authe-body {
  margin: 0;
  font-family: 'Poppins', ui-sans-serif, system-ui, sans-serif;
  background: var(--surface);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ─── LAYOUT 2 COLONNES (AuthLayout) ─── */
.authe-shell {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

@media (min-width: 1024px) {
  .authe-shell { flex-direction: row; }
}

.authe-hero {
  display: none;
}

@media (min-width: 1024px) {
  .authe-hero {
    display: block;
    position: sticky;
    top: 0;
    height: 100vh;
    width: 46%;
    padding: 12px;
  }
  .authe-hero-inner {
    position: relative;
    height: 100%;
    border-radius: 28px;
    overflow: hidden;
    background-color: var(--brand-dark);
    background-size: cover;
    background-position: 70% center;
  }
  .authe-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(16,26,23,0.15) 0%, rgba(16,26,23,0.05) 40%, rgba(16,26,23,0.55) 100%);
  }
  .authe-hero-content {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 32px 40px;
  }
  .authe-hero-logo {
    width: fit-content;
    border-radius: 12px;
    background: rgba(255,255,255,0.9);
    padding: 8px 12px;
    backdrop-filter: blur(6px);
  }
  .authe-hero-quote {
    max-width: 420px;
    border-radius: 24px;
    background: rgba(16,26,23,0.55);
    padding: 28px;
    color: #fff;
    backdrop-filter: blur(6px);
  }
  .authe-hero-quote p.lead {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin: 0;
  }
  .authe-hero-quote p.sub {
    margin: 16px 0 0;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255,255,255,0.75);
  }
}

.authe-main {
  flex: 1;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.authe-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  padding: 0 24px;
}

@media (min-width: 1024px) {
  .authe-mobile-header { display: none; }
}

.authe-mobile-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  width: 40px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.authe-mobile-toggle .ic-close { display: none; }
.authe-mobile-toggle[aria-expanded="true"] .ic-open { display: none; }
.authe-mobile-toggle[aria-expanded="true"] .ic-close { display: block; }

.authe-mobile-panel {
  display: none;
  flex-direction: column;
  padding: 4px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.authe-mobile-panel.open { display: flex; }
.authe-mobile-panel a {
  padding: 12px 4px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.authe-mobile-panel a:hover { background: var(--canvas); }
.authe-mobile-panel a.is-accent { color: var(--brand); font-weight: 600; }
.authe-mobile-panel-divider { height: 1px; margin: 8px 0; background: var(--line); }

@media (min-width: 1024px) {
  .authe-mobile-panel { display: none !important; }
}

.authe-content-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px 32px;
}

@media (min-width: 1024px) {
  .authe-content-wrap { padding: 64px 40px; }
}

.authe-content {
  width: 100%;
  max-width: 440px;
}

.authe-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 24px;
  font-size: 12px;
  color: var(--muted);
}

@media (min-width: 640px) {
  .authe-footer { flex-direction: row; padding: 0 40px 24px; }
}

.authe-footer-trust { display: inline-flex; align-items: center; gap: 6px; }
.authe-footer-trust svg { color: var(--brand); }
.authe-footer-links { display: flex; align-items: center; gap: 20px; }
.authe-footer-links a { color: var(--muted); text-decoration: none; }
.authe-footer-links a:hover { color: var(--ink); }

/* ─── LOGO ─── */
.authe-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.authe-logo span { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.authe-logo span b { color: var(--brand); font-weight: 600; }

/* ─── TITRE D'ÉCRAN (AuthHeading) ─── */
.authe-heading { margin-bottom: 32px; }
.authe-heading-icon {
  display: grid;
  place-items: center;
  height: 56px;
  width: 56px;
  border-radius: 16px;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 24px;
}
.authe-heading h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
}
@media (min-width: 640px) { .authe-heading h1 { font-size: 32px; } }
.authe-heading p {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}
.authe-heading p a { color: var(--brand); font-weight: 500; text-decoration: none; }
.authe-heading p a:hover { color: var(--brand-dark); }

/* ─── BLOC D'ALERTE (FormAlert) ─── */
.authe-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.authe-alert svg { margin-top: 2px; flex-shrink: 0; }
.authe-alert.error   { background: rgba(180,35,24,0.07); color: var(--danger); }
.authe-alert.success { background: var(--brand-soft); color: var(--brand-dark); }

/* ─── CHAMP TEXTE (TextField) ─── */
.authe-field { margin-bottom: 20px; }
.authe-field:last-child { margin-bottom: 0; }
.authe-field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.authe-field label { font-size: 14px; font-weight: 500; color: var(--ink); }
.authe-field-action { font-size: 13px; font-weight: 500; color: var(--brand); text-decoration: none; }
.authe-field-action:hover { color: var(--brand-dark); }

.authe-input-wrap {
  display: flex;
  align-items: center;
  height: 48px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.authe-input-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(14,124,102,0.1);
}
.authe-input-wrap.error {
  border-color: var(--danger);
}
.authe-input-wrap.error:focus-within {
  box-shadow: 0 0 0 4px rgba(180,35,24,0.1);
}
.authe-input-wrap input,
.authe-input-wrap select {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  padding: 0 16px;
}
.authe-input-wrap input::placeholder { color: rgba(96,110,105,0.6); }
.authe-input-leading { padding-left: 14px; display: flex; align-items: center; color: var(--muted); }
.authe-input-wrap input.has-leading { padding-left: 10px; }
.authe-input-trailing { padding-right: 6px; }

.authe-field-prefix {
  display: flex;
  align-items: center;
  border-right: 1px solid var(--line);
  padding: 0 10px 0 14px;
  height: 100%;
  flex-shrink: 0;
}
.authe-field-prefix select,
.authe-field-prefix input {
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  outline: none;
  cursor: pointer;
}
.authe-field-prefix input {
  width: 56px;
  cursor: text;
  text-align: center;
  padding: 0;
}
.authe-field-prefix input::placeholder { color: rgba(96,110,105,0.5); }

.authe-field-msg { margin: 7px 0 0; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.authe-field-msg.error { color: var(--danger); }
.authe-field-msg.hint  { color: var(--muted); }

.authe-eye-btn {
  display: grid;
  place-items: center;
  height: 36px;
  width: 36px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  margin-right: 6px;
}
.authe-eye-btn:hover { background: var(--canvas); color: var(--ink); }

/* ─── JAUGE DE FORCE DU MOT DE PASSE ─── */
.authe-strength { display: flex; align-items: center; gap: 12px; padding-top: 6px; }
.authe-strength-bars { flex: 1; display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; }
.authe-strength-bars span { height: 4px; border-radius: 999px; background: var(--line); transition: background-color 0.2s; }
.authe-strength-label { width: 64px; text-align: right; font-size: 12px; font-weight: 500; color: var(--muted); }

/* ─── BOUTON (Button) ─── */
.authe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  width: 100%;
  border-radius: var(--radius-md);
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.authe-btn:active { transform: scale(0.985); }
.authe-btn:disabled { cursor: not-allowed; }
.authe-btn.primary { background: var(--brand); color: #fff; }
.authe-btn.primary:hover:not(:disabled) { background: var(--brand-dark); }
.authe-btn.primary:disabled { background: rgba(14,124,102,0.6); }
.authe-btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.authe-btn.secondary:hover:not(:disabled) { background: var(--canvas); border-color: rgba(16,26,23,0.15); }
.authe-btn.secondary:disabled { opacity: 0.6; }
.authe-btn .spin { animation: authe-spin 0.8s linear infinite; }
@keyframes authe-spin { to { transform: rotate(360deg); } }

/* ─── SÉPARATEUR "ou" ─── */
.authe-divider { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 12px; margin: 24px 0; }
.authe-divider span.line { flex: 1; height: 1px; background: var(--line); }

/* ─── GRILLE DE SAISIE DE CODE (OtpInput) ─── */
.authe-otp-grid { display: grid; grid-template-columns: repeat(6,1fr); gap: 8px; }
@media (min-width: 640px) { .authe-otp-grid { gap: 10px; } }
.authe-otp-grid input {
  height: 56px;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
@media (min-width: 640px) { .authe-otp-grid input { height: 60px; } }
.authe-otp-grid input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(14,124,102,0.1); }
.authe-otp-grid input.filled { border-color: rgba(14,124,102,0.4); background: rgba(231,244,240,0.6); }
.authe-otp-grid input.error { border-color: var(--danger); background: rgba(180,35,24,0.05); }
.authe-otp-grid input:disabled { opacity: 0.6; }

/* ─── CASE À COCHER ─── */
.authe-checkbox-row { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--muted); cursor: pointer; line-height: 1.5; }
.authe-checkbox-row input { margin-top: 3px; height: 16px; width: 16px; accent-color: var(--brand); flex-shrink: 0; cursor: pointer; }
.authe-checkbox-row a { color: var(--ink); font-weight: 500; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.authe-checkbox-row a:hover { text-decoration-color: var(--ink); }

/* ─── ÉCRAN DE SUCCÈS (AuthSuccess) ─── */
.authe-success-icon {
  display: grid;
  place-items: center;
  height: 64px;
  width: 64px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  margin: 0 auto 24px;
}
@media (min-width: 640px) { .authe-success-icon { margin: 0 0 24px; } }
.authe-success { text-align: center; }
@media (min-width: 640px) { .authe-success { text-align: left; } }

/* ─── BAS DE FORMULAIRE ─── */
.authe-foot-link { margin-top: 32px; text-align: center; font-size: 14px; color: var(--muted); }
.authe-foot-link a { color: var(--brand); font-weight: 500; text-decoration: none; }
.authe-foot-link a:hover { color: var(--brand-dark); }
.authe-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}
.authe-back-link:hover { color: var(--ink); }

/* ─── SÉLECTEUR DE RÔLE (RoleSelect) ─── */
.authe-roleselect { position: relative; }
.authe-roleselect-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 16px 10px 10px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.authe-roleselect-trigger:hover { border-color: rgba(16,26,23,0.2); }
.authe-roleselect-trigger.open { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(14,124,102,0.1); }
.authe-roleselect-icon {
  display: grid;
  place-items: center;
  height: 40px;
  width: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--canvas);
  color: var(--muted);
}
.authe-roleselect-trigger.has-value .authe-roleselect-icon { background: var(--brand); color: #fff; }
.authe-roleselect-value { flex: 1; min-width: 0; }
.authe-roleselect-value .name { display: block; font-size: 15px; color: rgba(96,110,105,0.8); }
.authe-roleselect-trigger.has-value .authe-roleselect-value .name { font-weight: 500; color: var(--ink); }
.authe-roleselect-value .desc { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.authe-roleselect-chevron { color: var(--muted); transition: transform 0.2s; flex-shrink: 0; }
.authe-roleselect-trigger.open .authe-roleselect-chevron { transform: rotate(180deg); }

.authe-roleselect-panel {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  max-height: 380px;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px;
  box-shadow: 0 20px 44px rgba(16,26,23,0.12);
}
.authe-roleselect-panel.open { display: block; }
.authe-roleselect-group-label { padding: 8px 12px 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.authe-roleselect-option {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
}
.authe-roleselect-option:hover,
.authe-roleselect-option.active { background: var(--canvas); }
.authe-roleselect-option .ic {
  display: grid;
  place-items: center;
  height: 36px;
  width: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
}
.authe-roleselect-option[aria-selected="true"] .ic { background: var(--brand); color: #fff; }
.authe-roleselect-option .label { flex: 1; min-width: 0; }
.authe-roleselect-option .label .name { display: block; font-size: 14px; font-weight: 500; color: var(--ink); }
.authe-roleselect-option .label .desc { display: block; font-size: 12px; color: var(--muted); }
.authe-roleselect-option .check { color: var(--brand); flex-shrink: 0; }
