/* ============================================================
   ELW OTP Verification — Popup Styles
   ============================================================ */

:root {
  --elw-primary:        #4f46e5;
  --elw-primary-dark:   #4338ca;
  --elw-primary-light:  #eef2ff;
  --elw-secondary:      #7c3aed;
  --elw-success:        #10b981;
  --elw-success-dark:   #059669;
  --elw-error:          #ef4444;
  --elw-info:           #3b82f6;
  --elw-text:           #111827;
  --elw-text-muted:     #6b7280;
  --elw-border:         #e5e7eb;
  --elw-bg:             #ffffff;
  --elw-radius-modal:   24px;
  --elw-radius-btn:     12px;
  --elw-radius-input:   12px;
  --elw-digit-w:        52px;
  --elw-digit-h:        56px;
  --elw-transition:     all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --elw-shadow-modal:
    0 24px 72px rgba(17,24,39,0.18),
    0 4px  16px rgba(17,24,39,0.10);
}

/* ── Overlay ──────────────────────────────────────────────── */
.elw-otp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.elw-otp-overlay.elw-active {
  opacity: 1;
  visibility: visible;
}

/* ── Modal card ───────────────────────────────────────────── */
.elw-otp-modal {
  background: var(--elw-bg);
  border-radius: var(--elw-radius-modal);
  box-shadow: var(--elw-shadow-modal);
  width: 100%;
  max-width: 440px;
  overflow: hidden;

  transform: scale(0.88) translateY(24px);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.elw-otp-overlay.elw-active .elw-otp-modal {
  transform: scale(1) translateY(0);
}

/* ── Header ───────────────────────────────────────────────── */
.elw-otp-header {
  background: linear-gradient(135deg, var(--elw-primary) 0%, var(--elw-secondary) 100%);
  padding: 40px 32px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Subtle decorative circles */
.elw-otp-header::before,
.elw-otp-header::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
}
.elw-otp-header::before {
  width: 200px; height: 200px;
  top: -80px; right: -60px;
}
.elw-otp-header::after {
  width: 120px; height: 120px;
  bottom: -40px; left: -30px;
}

.elw-otp-icon-wrap {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  background: rgba(255,255,255,0.16);
  border: 2px solid rgba(255,255,255,0.22);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.elw-otp-icon-wrap svg {
  width: 32px;
  height: 32px;
  stroke: #ffffff;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.elw-otp-header h2 {
  position: relative;
  z-index: 1;
  color: #ffffff;
  font-size: 21px;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.3px;
}

.elw-otp-header p {
  position: relative;
  z-index: 1;
  color: rgba(255,255,255,0.78);
  font-size: 14px;
  margin: 0;
  line-height: 1.6;
}

.elw-otp-email-hint {
  color: #ffffff;
}

/* ── Body ─────────────────────────────────────────────────── */
.elw-otp-body {
  padding: 36px 32px 20px;
}

/* ── Digit inputs ─────────────────────────────────────────── */
.elw-otp-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 22px;
}

.elw-otp-digit {
  width: var(--elw-digit-w);
  height: var(--elw-digit-h);
  border: 2px solid var(--elw-border);
  border-radius: var(--elw-radius-input);
  background: #f9fafb;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--elw-text);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  caret-color: transparent;
  box-sizing: border-box;
  transition: var(--elw-transition);
  /* hide spin buttons on number-type inputs */
  -moz-appearance: textfield;
}
.elw-otp-digit::-webkit-outer-spin-button,
.elw-otp-digit::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.elw-otp-digit:focus {
  border-color: var(--elw-primary);
  background: var(--elw-primary-light);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.14);
  transform: scale(1.06);
  color: var(--elw-primary);
}

.elw-otp-digit.elw-digit-filled {
  border-color: var(--elw-primary);
  background: var(--elw-primary-light);
  color: var(--elw-primary);
}

.elw-otp-digit.elw-digit-error {
  border-color: var(--elw-error) !important;
  background: #fef2f2 !important;
  color: var(--elw-error) !important;
  animation: elw-shake 0.45s ease;
}

@keyframes elw-shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-7px); }
  40%      { transform: translateX(7px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

/* ── Timer ────────────────────────────────────────────────── */
.elw-otp-timer {
  text-align: center;
  font-size: 13px;
  color: var(--elw-text-muted);
  margin: 0 0 16px;
}

.elw-otp-countdown {
  font-weight: 700;
  color: var(--elw-primary);
  font-variant-numeric: tabular-nums;
}

.elw-otp-countdown.elw-expiring {
  color: var(--elw-error);
}

/* ── Notice ───────────────────────────────────────────────── */
.elw-otp-notice {
  display: none;
  padding: 11px 15px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.55;
  text-align: center;
  margin-bottom: 4px;
}

.elw-otp-notice.elw-notice-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.elw-otp-notice.elw-notice-success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.elw-otp-notice.elw-notice-info {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

/* ── Footer ───────────────────────────────────────────────── */
.elw-otp-footer {
  padding: 8px 32px 32px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

/* ── Verify button ────────────────────────────────────────── */
.elw-otp-verify-btn {
  width: 100%;
  padding: 15px 24px;
  background: linear-gradient(135deg, var(--elw-primary), var(--elw-secondary));
  color: #ffffff;
  border: none;
  border-radius: var(--elw-radius-btn);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--elw-transition);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.1px;
}

.elw-otp-verify-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s ease;
}

.elw-otp-verify-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(79,70,229,0.42);
}

.elw-otp-verify-btn:hover::before {
  background: rgba(255,255,255,0.06);
}

.elw-otp-verify-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(79,70,229,0.30);
}

.elw-otp-verify-btn:disabled {
  cursor: not-allowed;
  opacity: 0.75;
  transform: none !important;
  box-shadow: none !important;
}

/* Loading state */
.elw-otp-verify-btn.elw-loading .elw-btn-text,
.elw-otp-verify-btn.elw-loading .elw-btn-check {
  display: none;
}
.elw-otp-verify-btn .elw-btn-loader,
.elw-otp-verify-btn .elw-btn-check {
  display: none;
}
.elw-otp-verify-btn.elw-loading .elw-btn-loader {
  display: block;
}

/* Success state */
.elw-otp-verify-btn.elw-success {
  background: linear-gradient(135deg, var(--elw-success), var(--elw-success-dark));
}
.elw-otp-verify-btn.elw-success .elw-btn-text,
.elw-otp-verify-btn.elw-success .elw-btn-loader {
  display: none;
}
.elw-otp-verify-btn.elw-success .elw-btn-check {
  display: block;
  width: 22px;
  height: 22px;
}

/* Spinner */
.elw-spinner {
  width: 20px;
  height: 20px;
  animation: elw-spin 0.75s linear infinite;
}

@keyframes elw-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Resend button ────────────────────────────────────────── */
.elw-otp-resend {
  background: none;
  border: none;
  color: var(--elw-primary);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: var(--elw-transition);
  text-align: center;
  align-self: center;
}

.elw-otp-resend:hover:not(:disabled) {
  background: var(--elw-primary-light);
  color: var(--elw-primary-dark);
}

.elw-otp-resend:disabled {
  color: var(--elw-text-muted);
  cursor: not-allowed;
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .elw-otp-overlay { padding: 12px; }
  .elw-otp-header  { padding: 32px 24px 24px; }
  .elw-otp-body    { padding: 28px 20px 16px; }
  .elw-otp-footer  { padding: 8px 20px 24px; }

  .elw-otp-inputs { gap: 7px; }

  :root {
    --elw-digit-w: 44px;
    --elw-digit-h: 50px;
  }

  .elw-otp-digit { font-size: 19px; }
}

@media (max-width: 360px) {
  :root {
    --elw-digit-w: 38px;
    --elw-digit-h: 44px;
  }
  .elw-otp-digit { font-size: 17px; border-radius: 9px; }
  .elw-otp-inputs { gap: 5px; }
}
