
/* ═══════════════════════════════════════════════════════════
   VARIABLES & RESET
═══════════════════════════════════════════════════════════ */
:root {
  --green:       #1E6F3F;
  --green-mid:   #2A9655;
  --green-light: #E8F5EE;
  --red:         #CE1126;
  --yellow:      #FCD116;
  --orange:      #F4A261;
  --bg:          #F4F7F5;
  --card:        #ffffff;
  --text:        #111827;
  --muted:       #6B7280;
  --border:      #E5E7EB;
  --radius:      18px;
  --shadow:      0 24px 64px rgba(30,111,63,0.10), 0 2px 12px rgba(0,0,0,0.05);
  --input-bg:    #FAFAFA;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ── BACKGROUND ── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 60% 50% at 10% 0%, rgba(30,111,63,0.09) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 95% 100%, rgba(252,209,22,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 80% 10%, rgba(206,17,38,0.05) 0%, transparent 60%);
  pointer-events: none;
}

/* ── LAYOUT ── */
.scene {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}

/* ── CARD ── */
.auth-card {
  background: var(--card);
  border-radius: 28px;
  box-shadow: var(--shadow);
  width: 100%; max-width: 460px;
  overflow: hidden;
  position: relative;
}

/* ── HEADER BAND ── */
.card-header {
  background: linear-gradient(135deg, #1a5c35 0%, #1E6F3F 55%, #2A9655 100%);
  padding: 2rem 2rem 3.5rem;
  position: relative; overflow: hidden; text-align: center;
}
.card-header::after {
  content: ''; position: absolute; bottom: -2px; left: 0; right: 0; height: 40px;
  background: var(--card); border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.card-header::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 80% 20%, rgba(252,209,22,0.18) 0%, transparent 50%),
    radial-gradient(circle at 15% 85%, rgba(206,17,38,0.12) 0%, transparent 45%);
  pointer-events: none;
}
.logo-wrap { position: relative; z-index: 2; display: inline-flex; flex-direction: column; align-items: center; }
.logo-circle {
  width: 88px; height: 88px; border-radius: 50%; background: white;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 0 0 4px rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; margin: 0 auto 0.75rem;
}
.logo-circle img { width: 100%; height: 100%; object-fit: contain; }
.logo-tagline {
  color: rgba(255,255,255,0.75); font-size: 0.7rem; font-weight: 400;
  margin-top: 0.35rem; letter-spacing: 0.2px;
  display: flex; align-items: center; gap: 0.4rem;
}
.logo-tagline::before, .logo-tagline::after {
  content: ''; display: inline-block; width: 18px; height: 1.5px;
  border-radius: 2px; background: rgba(255,255,255,0.4);
}

/* ── VIEWS ── */
.view { display: none; }
.view.active { display: block; }
.card-body { padding: 0.5rem 1.75rem 1.75rem; }
.view-title { font-size: 1.3rem; font-weight: 700; color: var(--text); margin-bottom: 0.2rem; }
.view-sub { font-size: 0.8rem; color: var(--muted); margin-bottom: 1.25rem; }

/* ── SOCIAL BUTTONS ── */
.social-row { display: flex; gap: 0.6rem; margin-bottom: 1rem; }
.social-btn {
  flex: 1; background: #FAFAFA; border: 1.5px solid var(--border);
  border-radius: 12px; padding: 0.65rem 0.4rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  font-size: 0.68rem; font-weight: 500; color: #374151;
  cursor: pointer; transition: all 0.22s; font-family: 'Poppins', sans-serif;
}
.social-btn:hover {
  border-color: var(--green); background: var(--green-light);
  transform: translateY(-2px); box-shadow: 0 6px 16px rgba(30,111,63,0.13);
}

/* ── DIVIDER ── */
.divider { display: flex; align-items: center; gap: 0.75rem; margin: 0.85rem 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { font-size: 0.75rem; color: var(--muted); font-weight: 500; }

/* ── FORM FIELDS ── */
.field { margin-bottom: 0.85rem; }
.field label {
  display: block; font-size: 0.78rem; font-weight: 600;
  color: #374151; margin-bottom: 0.35rem;
}
.field label .req { color: #EF4444; margin-left: 2px; }
.input-wrap { position: relative; }
.input-icon {
  position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%);
  color: #C4C9D4; font-size: 0.85rem; pointer-events: none; transition: color 0.2s;
}
.input-wrap:focus-within .input-icon { color: var(--green); }
.inp {
  width: 100%; padding: 0.78rem 0.85rem 0.78rem 2.5rem;
  border: 1.5px solid var(--border); border-radius: 12px;
  font-family: 'Poppins', sans-serif; font-size: 0.83rem;
  color: var(--text); background: var(--input-bg);
  outline: none; transition: all 0.22s;
}
.inp:focus { border-color: var(--green); background: white; box-shadow: 0 0 0 3px rgba(30,111,63,0.09); }
.inp.err   { border-color: #EF4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.08); }
.inp.ok    { border-color: #10B981; box-shadow: 0 0 0 3px rgba(16,185,129,0.08); }
.inp::placeholder { color: #C4C9D4; }
.pwd-toggle {
  position: absolute; right: 0.8rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: #C4C9D4;
  font-size: 0.9rem; padding: 2px; transition: color 0.2s;
}
.pwd-toggle:hover { color: var(--green); }
.ferr {
  font-size: 0.7rem; color: #EF4444; margin-top: 0.25rem;
  min-height: 0.9rem; display: flex; align-items: center; gap: 0.25rem;
}

/* ── SÉLECTEUR DE PAYS ── */
.phone-row { display: flex; position: relative; }
.country-selector-wrap { position: relative; flex-shrink: 0; }
.country-trigger {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0 0.75rem; height: 100%;
  background: #F3F4F6; border: 1.5px solid var(--border);
  border-right: none; border-radius: 12px 0 0 12px;
  font-size: 0.8rem; font-weight: 600; color: #374151;
  cursor: pointer; white-space: nowrap; min-width: 90px;
  transition: background 0.2s, border-color 0.2s;
  user-select: none;
}
.country-trigger:hover { background: var(--green-light); border-color: var(--green); }
.country-trigger .flag { font-size: 1.1rem; line-height: 1; }
.country-trigger .dialcode { font-size: 0.78rem; }
.country-trigger .chevron { font-size: 0.55rem; color: #9CA3AF; margin-left: auto; }
.phone-inp {
  flex: 1; padding: 0.78rem 0.85rem;
  border: 1.5px solid var(--border); border-left: none;
  border-radius: 0 12px 12px 0;
  font-family: 'Poppins', sans-serif; font-size: 0.83rem;
  color: var(--text); background: var(--input-bg); outline: none;
  transition: all 0.22s;
}
.phone-inp:focus { border-color: var(--green); background: white; box-shadow: 0 0 0 3px rgba(30,111,63,0.09); }
.phone-inp::placeholder { color: #C4C9D4; }
.phone-inp.err { border-color: #EF4444; }

/* ── DROPDOWN PAYS ── */
.country-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 500;
  background: white; border: 1.5px solid var(--border); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  width: 320px; max-height: 320px; overflow: hidden;
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(-8px); pointer-events: none;
  transition: all 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
.country-dropdown.open { opacity: 1; transform: translateY(0); pointer-events: all; }
.country-search-wrap { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); position: relative; }
.country-search-icon { position: absolute; left: 1.2rem; top: 50%; transform: translateY(-50%); color: #C4C9D4; font-size: 0.8rem; }
.country-search {
  width: 100%; padding: 0.5rem 0.6rem 0.5rem 2rem;
  border: 1.5px solid var(--border); border-radius: 9px;
  font-family: 'Poppins', sans-serif; font-size: 0.78rem; outline: none;
  transition: border-color 0.2s;
}
.country-search:focus { border-color: var(--green); }
.country-list { overflow-y: auto; max-height: 250px; }
.country-list::-webkit-scrollbar { width: 4px; }
.country-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.country-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.85rem; cursor: pointer;
  transition: background 0.15s; font-size: 0.8rem;
}
.country-item:hover, .country-item.highlighted { background: var(--green-light); }
.country-item.selected { background: var(--green-light); font-weight: 600; }
.country-item .ci-flag { font-size: 1.1rem; flex-shrink: 0; }
.country-item .ci-name { flex: 1; color: var(--text); }
.country-item .ci-code { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.country-no-result { padding: 1rem; text-align: center; font-size: 0.78rem; color: var(--muted); }

/* ── PASSWORD METER ── */
.pwd-meter { display: flex; gap: 3px; margin-top: 0.4rem; }
.pm-bar { flex: 1; height: 3px; border-radius: 99px; background: var(--border); transition: background 0.3s; }
.pm-bar.weak   { background: #EF4444; }
.pm-bar.fair   { background: #F59E0B; }
.pm-bar.strong { background: #10B981; }
.pwd-strength-label { font-size: 0.65rem; margin-top: 0.2rem; }
.pwd-strength-label.weak   { color: #EF4444; }
.pwd-strength-label.fair   { color: #F59E0B; }
.pwd-strength-label.strong { color: #10B981; }

/* ── CHECKBOX ── */
.chk-row { display: flex; align-items: flex-start; gap: 0.55rem; cursor: pointer; }
.chk-row input { display: none; }
.chk-box {
  width: 17px; height: 17px; min-width: 17px;
  border: 2px solid var(--border); border-radius: 5px; background: white;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px; transition: all 0.18s;
}
.chk-row input:checked ~ .chk-box { background: var(--green); border-color: var(--green); }
.chk-row input:checked ~ .chk-box::after { content: '✓'; color: white; font-size: 10px; font-weight: 700; }
.chk-text { font-size: 0.75rem; color: #4B5563; line-height: 1.4; }
.chk-text a { color: var(--green); font-weight: 600; text-decoration: none; }
.chk-text a:hover { text-decoration: underline; }

/* ── PRIMARY BUTTON ── */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #1a5c35 0%, #1E6F3F 50%, #2A9655 100%);
  color: white; font-family: 'Poppins', sans-serif;
  font-size: 0.9rem; font-weight: 600;
  padding: 0.9rem 1.5rem;
  border: none; border-radius: 999px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  box-shadow: 0 6px 20px rgba(30,111,63,0.35);
  transition: all 0.25s; margin-top: 0.5rem;
  position: relative; overflow: hidden;
}
.btn-text {
  display: flex; align-items: center; gap: 0.5rem;
}
.btn-spinner { display: none; }
.btn-primary.loading .btn-text   { display: none; }
.btn-primary.loading .btn-spinner{ display: flex; align-items: center; gap: 0.5rem; }
.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transform: translateX(-100%); transition: transform 0.5s;
}
.btn-primary:hover::after { transform: translateX(100%); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(30,111,63,0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary .arrow {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center; font-size: 0.75rem;
}

/* ── SPINNER DANS BOUTON ── */
.btn-spinner { display: none; }
.btn-primary.loading .btn-text { display: none; }
.btn-primary.loading .btn-spinner { display: flex; align-items: center; gap: 0.5rem; }
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── FOOTER LINKS ── */
.foot-link { text-align: center; font-size: 0.77rem; color: var(--muted); margin-top: 0.9rem; }
.foot-link a, .foot-link span.cta { color: var(--green); font-weight: 600; text-decoration: none; cursor: pointer; }
.foot-link a:hover, .foot-link span.cta:hover { text-decoration: underline; }

/* ── SECURITY BAR ── */
.sec-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 1rem; padding: 0.75rem 1.75rem;
  border-top: 1px solid #F3F4F6; font-size: 0.68rem; color: #9CA3AF;
}
.sec-item { display: flex; align-items: center; gap: 0.3rem; }
.sec-divider { width: 1px; height: 12px; background: var(--border); }

/* ── STEPPER ── */
.stepper {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.4rem; gap: 0;
}
.stp { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.stp-circle {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  border: 2px solid var(--border); color: var(--muted); background: white;
  transition: all 0.35s ease;
}
.stp-circle.active { background: var(--green); border-color: var(--green); color: white; box-shadow: 0 4px 14px rgba(30,111,63,0.35); }
.stp-circle.done   { background: var(--green); border-color: var(--green); color: white; }
.stp-label { font-size: 0.62rem; font-weight: 500; color: var(--muted); transition: color 0.3s; white-space: nowrap; }
.stp-label.active { color: var(--green); font-weight: 600; }
.stp-label.done   { color: var(--green); }
.stp-line { width: 38px; height: 2px; background: var(--border); flex-shrink: 0; margin-bottom: 1.1rem; border-radius: 2px; transition: background 0.4s; }
.stp-line.done { background: var(--green); }

.step-view { display: none; }
.step-view.active { display: block; }

/* ── GRID 2 COLS ── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }

/* ── OTP ── */
.otp-row { display: flex; gap: 0.4rem; justify-content: center; margin: 0.5rem 0 0.25rem; }
.otp-box {
  width: 46px; height: 52px;
  border: 1.5px solid var(--border); border-radius: 12px;
  text-align: center; font-size: 1.4rem; font-weight: 700;
  color: var(--green); background: #FAFAFA;
  font-family: 'Poppins', sans-serif; outline: none;
  transition: all 0.2s;
}
.otp-box:focus { border-color: var(--green); background: white; box-shadow: 0 0 0 3px rgba(30,111,63,0.1); }
.otp-box.filled { background: var(--green-light); border-color: var(--green); }
.otp-box.err { border-color: #EF4444; animation: shake 0.3s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

/* ── TIMER ── */
.timer-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--green-light); color: var(--green);
  font-size: 0.75rem; font-weight: 700; padding: 0.3rem 0.8rem;
  border-radius: 999px; border: 1px solid rgba(30,111,63,0.2);
  margin: 0.5rem auto 1rem; display: flex; justify-content: center; width: fit-content;
  transition: all 0.3s;
}
.timer-badge.warn { background: #FEF2F2; color: #EF4444; border-color: rgba(239,68,68,0.2); }
.timer-badge.expired { background: #F3F4F6; color: var(--muted); }

/* ── TENTATIVES DOTS ── */
.attempts-dots { display: flex; gap: 0.35rem; justify-content: center; margin-bottom: 0.75rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; transition: background 0.3s; }
.dot.ok    { background: #10B981; }
.dot.fail  { background: #EF4444; }
.dot.empty { background: var(--border); }

/* ── SUCCESS ── */
.success-wrap { text-align: center; padding: 0.5rem 0 1rem; }
.success-icon {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 1rem;
  background: linear-gradient(135deg, #1E6F3F, #2A9655);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 32px rgba(30,111,63,0.38);
}
.confetti-row { font-size: 1.4rem; margin-bottom: 0.75rem; letter-spacing: 4px; }
.feature-box { background: var(--green-light); border-radius: 14px; padding: 0.9rem 1rem; margin: 0.75rem 0 1rem; text-align: left; }
.feat-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.76rem; color: #374151; margin-bottom: 0.4rem; }
.feat-item:last-child { margin-bottom: 0; }

/* ── BACK BUTTON ── */
.back-btn {
  display: flex; align-items: center; gap: 0.5rem;
  background: none; border: none; cursor: pointer;
  font-family: 'Poppins', sans-serif; font-size: 0.85rem; font-weight: 600;
  color: var(--muted); padding: 0; margin-bottom: 1rem; transition: color 0.2s;
}
.back-btn:hover { color: var(--green); }
.back-icon {
  width: 30px; height: 30px; border-radius: 50%;
  background: #F3F4F6; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; transition: background 0.2s;
}
.back-btn:hover .back-icon { background: var(--green-light); color: var(--green); }

/* ── REMEMBER ROW ── */
.remember-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem; }
.fpw { font-size: 0.75rem; font-weight: 600; color: var(--orange); cursor: pointer; text-decoration: none; transition: color 0.2s; }
.fpw:hover { color: #d4844a; }

/* ── RESEND ── */
.resend-link { color: var(--green); font-weight: 600; font-size: 0.77rem; cursor: pointer; text-decoration: none; background: none; border: none; font-family: 'Poppins', sans-serif; }
.resend-link:hover { text-decoration: underline; }
.resend-link:disabled { opacity: 0.45; pointer-events: none; }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(12px);
  background: #111827; color: white; padding: 0.65rem 1.2rem;
  border-radius: 999px; font-size: 0.8rem; font-weight: 500;
  display: flex; align-items: center; gap: 0.5rem;
  z-index: 9999; opacity: 0; pointer-events: none; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2); transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.t-success { background: #065F46; }
#toast.t-error   { background: #7F1D1D; }
#toast.t-warn    { background: #78350F; }

/* ── OVERLAY TRANSITION ── */
#overlay { position: fixed; inset: 0; z-index: 999; background: linear-gradient(135deg, #1E6F3F, #2A9655); transform: translateY(100%); pointer-events: none; }

/* ── RATE LIMIT INFO ── */
.rate-info { font-size: 0.7rem; color: var(--muted); text-align: center; margin-top: 0.35rem; }

/* ── ALERT BOX ── */
.alert-box {
  display: flex; align-items: flex-start; gap: 0.5rem;
  padding: 0.75rem 0.9rem; border-radius: 12px;
  font-size: 0.78rem; margin-bottom: 1rem; line-height: 1.5;
}
.alert-box.err  { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25); color: #7F1D1D; }
.alert-box.warn { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.25); color: #78350F; }
.alert-box.info { background: var(--green-light); border: 1px solid rgba(30,111,63,0.2); color: var(--green); }

@media (max-width: 480px) {
  .card-header { padding: 1.5rem 1.5rem 3rem; }
  .card-body { padding: 0.5rem 1.25rem 1.25rem; }
  .logo-circle { width: 72px; height: 72px; }
  .otp-box { width: 38px; height: 46px; font-size: 1.2rem; }
  .stp-line { width: 26px; }
  .country-dropdown { width: 280px; }
}


/* ── MODALE TÉLÉPHONE ── */
.phone-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.phone-modal-overlay.active { opacity: 1; pointer-events: all; }
.phone-modal-box {
  background: white; border-radius: 24px;
  padding: 2rem; width: 100%; max-width: 380px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
  position: relative;
  transform: translateY(20px); transition: transform 0.3s;
}
.phone-modal-overlay.active .phone-modal-box { transform: translateY(0); }
.phone-modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: #F3F4F6; border: none; border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; color: var(--muted); transition: all 0.2s;
}
.phone-modal-close:hover { background: var(--green-light); color: var(--green); }