/* ── Base ── */
.fml-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Card ── */
.fml-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.04),
    0 12px 40px rgba(0,0,0,0.10),
    0 0 0 1px rgba(0,0,0,0.04);
  text-align: center;
  animation: fml-fadein 0.4s ease;
}

@keyframes fml-fadein {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Logo ── */
.fml-logo {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 22px;
  box-shadow: 0 8px 24px rgba(79,70,229,0.35);
}
.fml-logo svg { width: 30px; height: 30px; fill: #fff; }

.fml-logo--otp {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 8px 24px rgba(5,150,105,0.35);
}

/* ── Title & Subtitle ── */
.fml-title {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
}
.fml-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ── Phone Input ── */
.fml-input-group {
  display: flex;
  align-items: center;
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 20px;
  background: #f9fafb;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.fml-input-group:focus-within {
  border-color: #4f46e5;
  box-shadow: 0 0 0 4px rgba(79,70,229,0.1);
  background: #fff;
}
.fml-flag { padding: 0 8px 0 14px; font-size: 20px; }
.fml-code {
  font-size: 15px; font-weight: 600; color: #374151;
  padding-right: 10px;
  border-right: 1.5px solid #e5e7eb;
}
.fml-input {
  flex: 1; border: none; outline: none; background: transparent;
  padding: 14px 16px; font-size: 16px; color: #111827;
  font-family: inherit; -webkit-appearance: none;
}
.fml-input::placeholder { color: #9ca3af; }

/* ── reCAPTCHA ── */
#fml-recaptcha-container {
  margin: 0 0 16px;
  display: flex;
  justify-content: center;
}

/* ── Button ── */
.fml-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  box-shadow: 0 6px 20px rgba(79,70,229,0.35);
  font-family: inherit;
}
.fml-btn:hover   { opacity: 0.92; transform: translateY(-1px); }
.fml-btn:active  { transform: translateY(0); }
.fml-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ── Spinner ── */
.fml-spin {
  width: 22px; height: 22px;
  animation: fml-rotate 0.8s linear infinite;
}
@keyframes fml-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Messages ── */
.fml-msg {
  font-size: 13px;
  margin-top: 14px;
  min-height: 20px;
  border-radius: 8px;
  padding: 6px 10px;
  transition: all 0.2s;
}
.fml-msg.success { color: #065f46; background: #d1fae5; }
.fml-msg.error   { color: #991b1b; background: #fee2e2; }

/* ── OTP Boxes ── */
.fml-otp-boxes {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}
.fml-otp-digit {
  width: 48px; height: 56px;
  text-align: center;
  font-size: 22px; font-weight: 700; color: #111827;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  outline: none;
  background: #f9fafb;
  transition: all 0.2s;
  font-family: inherit;
  -webkit-appearance: none;
}
.fml-otp-digit:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 4px rgba(79,70,229,0.12);
  background: #fff;
}
.fml-otp-digit.filled {
  background: #eef2ff;
  border-color: #4f46e5;
  color: #4f46e5;
}

/* ── Resend & Back ── */
.fml-resend { margin-top: 16px; font-size: 14px; color: #6b7280; }
#fml-resend-link { color: #4f46e5; font-weight: 600; text-decoration: none; }
#fml-resend-link:hover { text-decoration: underline; }
.fml-back {
  display: inline-block;
  margin-top: 14px;
  font-size: 13px;
  color: #9ca3af;
  text-decoration: none;
  transition: color 0.2s;
}
.fml-back:hover { color: #4f46e5; }

/* ── Success Card ── */
.fml-card--success {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 1px solid #a7f3d0;
}
.fml-success-icon {
  width: 72px; height: 72px;
  background: #10b981;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 10px 28px rgba(16,185,129,0.35);
  animation: fml-pop 0.5s cubic-bezier(.34,1.56,.64,1);
}
.fml-success-icon svg { width: 32px; height: 32px; stroke: #fff; }

@keyframes fml-pop {
  from { transform: scale(0.3); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ── Redirect Progress Bar ── */
.fml-redirect-bar {
  width: 100%;
  height: 4px;
  background: #a7f3d0;
  border-radius: 4px;
  margin-top: 20px;
  overflow: hidden;
}
.fml-redirect-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #059669, #10b981);
  border-radius: 4px;
  animation: fml-progress 2s ease forwards;
}
@keyframes fml-progress {
  from { width: 0%; }
  to   { width: 100%; }
}

/* ── Already Logged In ── */
.fml-already-logged-in {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  background: #d1fae5;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  color: #065f46;
  font-family: 'Segoe UI', system-ui, sans-serif;
}
.fml-already-logged-in a {
  color: #059669;
  font-weight: 600;
  text-decoration: none;
}
.fml-already-logged-in a:hover { text-decoration: underline; }

/* ── Login Page Divider ── */
#fml-login-page-wrap .fml-wrapper { padding: 0 0 10px; }
#fml-login-page-wrap .fml-card {
  max-width: 100%;
  border-radius: 16px;
  padding: 28px 28px 22px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07);
}
#fml-login-page-wrap .fml-logo {
  width: 48px; height: 48px;
  border-radius: 12px;
  margin-bottom: 14px;
}
#fml-login-page-wrap .fml-title   { font-size: 18px; }
#fml-login-page-wrap .fml-subtitle { font-size: 13px; margin-bottom: 18px; }

.fml-divider {
  display: flex;
  align-items: center;
  margin: 20px 0 16px;
  color: #9ca3af;
  font-size: 13px;
  font-family: 'Segoe UI', system-ui, sans-serif;
}
.fml-divider::before,
.fml-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e5e7eb;
}
.fml-divider span { padding: 0 12px; white-space: nowrap; }

/* ── Fade out wrapper ── */
.fml-wrapper.fml-hiding {
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

/* ── Mobile ── */
@media (max-width: 480px) {
  .fml-card { padding: 32px 22px; border-radius: 20px; }
  .fml-otp-digit { width: 40px; height: 50px; font-size: 19px; }
  .fml-otp-boxes { gap: 7px; }
  .fml-title { font-size: 20px; }
}