/* ═══════════════════════════════════════════════════════════
   Glowply OTP Popup — Matches Phase 2 onboarding theme
   ═══════════════════════════════════════════════════════════ */

.modern-otp-popup {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 999999;
  align-items: center;
  justify-content: center;
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  backdrop-filter: blur(2px);
}

.modern-otp-popup.show {
  display: flex;
}

.modern-otp-content {
  background: #ffffff;
  padding: 36px 32px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  border: 1px solid #eaeaea;
  width: 100%;
  max-width: 460px;
  text-align: center;
  position: relative;
  direction: ltr;
  animation: otpSlideIn 0.3s ease-out;
}

@keyframes otpSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Icon ── */
.verification-icon {
  margin-bottom: 20px;
}

.verification-icon svg {
  stroke: #1a1a2e;
}

/* ── Title / Description ── */
.verification-title {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 700;
  color: #1a1a2e;
}

.verification-description {
  margin: 0 0 24px;
  color: #6b7280;
  font-size: 15px;
  line-height: 1.6;
}

/* ── OTP Inputs ── */
.modern-otp-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #eaeaea;
  direction: ltr;
}

.modern-otp-input {
  width: 56px;
  height: 56px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 22px;
  font-weight: 700;
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-align: center;
  color: #1a1a2e !important;
  background: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  caret-color: #7c3aed;
  direction: ltr;
  padding: 0;
}

.modern-otp-input::placeholder {
  color: #d1d5db;
  opacity: 1;
}

.modern-otp-input::-webkit-outer-spin-button,
.modern-otp-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.modern-otp-input:focus {
  border-color: #7c3aed;
  outline: none;
  box-shadow: 0 0 0 3px #ede9fe;
  background: #faf5ff;
  color: #1a1a2e !important;
}

.modern-otp-input.filled {
  border-color: #7c3aed;
  background: #faf5ff;
  color: #1a1a2e !important;
}

/* ── Helper text ── */
.otp-helper-text {
  margin: 0 0 20px;
  padding: 10px 14px;
  background: #f9fafb;
  border-radius: 8px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.6;
}

/* ── Verify button ── */
.modern-verify-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  background: #1a1a2e;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.modern-verify-btn:hover {
  background: #2d2d42;
}

.modern-verify-btn:active {
  transform: scale(0.98);
}

.modern-verify-btn:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

/* ── Error / Success messages ── */
.modern-error {
  color: #ef4444;
  margin: 16px 0;
  font-size: 14px;
  display: none;
}

.modern-success {
  color: #10b981;
  margin: 16px 0;
  font-size: 16px;
  font-weight: 600;
  padding: 14px;
  background: #d1fae5;
  border-radius: 8px;
  display: none;
  animation: otpFadeIn 0.3s ease;
}

@keyframes otpFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Resend section ── */
.resend-section {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.resend-hint {
  font-size: 13px;
  color: #9ca3af;
}

.modern-resend-btn {
  background: none;
  border: none;
  color: #7c3aed;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}

.modern-resend-btn:hover {
  color: #6d28d9;
  text-decoration: underline;
}

.modern-resend-btn:disabled {
  color: #d1d5db;
  cursor: not-allowed;
  text-decoration: none;
}

.resend-countdown {
  color: #9ca3af;
  font-size: 13px;
  line-height: 1.4;
}

/* ── Loading spinner ── */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-spinner {
  animation: spin 1s linear infinite;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .modern-otp-content {
    padding: 28px 20px;
    margin: 20px;
    border-radius: 12px;
  }

  .verification-title {
    font-size: 20px;
  }

  .verification-description {
    font-size: 14px;
  }

  .modern-otp-inputs {
    gap: 8px;
    padding: 12px 14px;
  }

  .modern-otp-input {
    width: 44px;
    height: 48px;
    font-size: 18px;
  }
}

/* ── RTL Support ── */
[dir="rtl"] #free-trial-otp-popup .modern-otp-content {
  text-align: center;
}

[dir="rtl"] #free-trial-otp-popup .verification-title,
[dir="rtl"] #free-trial-otp-popup .verification-description,
[dir="rtl"] #free-trial-otp-popup .otp-helper-text,
[dir="rtl"] #free-trial-otp-popup .modern-error,
[dir="rtl"] #free-trial-otp-popup .modern-success {
  text-align: center;
}

/* OTP inputs stay LTR — numbers are universal */
[dir="rtl"] #free-trial-otp-popup .modern-otp-inputs {
  flex-direction: row !important;
  direction: ltr !important;
}

[dir="rtl"] #free-trial-otp-popup .modern-resend-btn {
  direction: rtl;
}

[dir="rtl"] #free-trial-otp-popup .resend-section,
[dir="rtl"] #free-trial-otp-popup .resend-countdown {
  text-align: center;
}
