/* ============================================
   RETINA-TH — OTP Auth Modal (425degree-inspired)
   ============================================ */

/* Overlay */
.otp-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  justify-content: center;
  align-items: center;
  animation: otpFadeIn 0.25s ease;
}
.otp-overlay.active { display: flex; }

@keyframes otpFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes otpSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modal Container */
.otp-modal {
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 420px;
  padding: 0;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
  animation: otpSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

/* Close Button */
.otp-close {
  position: absolute;
  top: 14px; right: 14px;
  background: #f1f5f9;
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.2s;
  z-index: 1;
}
.otp-close:hover { background: #e2e8f0; color: #0f172a; }

/* Header/Logo */
.otp-header {
  text-align: center;
  padding: 32px 32px 0;
}
.otp-header img {
  height: 36px;
  margin-bottom: 8px;
}
.otp-header .otp-tagline {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 24px;
}
.otp-header .otp-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

/* Body */
.otp-body {
  padding: 24px 32px 32px;
}

/* Phone Input Section */
.otp-phone-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}

.otp-phone-input-wrap {
  display: flex;
  align-items: center;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
  background: #fff;
}
.otp-phone-input-wrap:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.otp-country-prefix {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  cursor: default;
  flex-shrink: 0;
}
.otp-country-prefix .flag { font-size: 18px; }

.otp-phone-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 14px;
  font-size: 15px;
  font-family: inherit;
  color: #0f172a;
  background: transparent;
}
.otp-phone-input::placeholder { color: #94a3b8; }

/* Email link */
.otp-email-link {
  text-align: center;
  margin-top: 12px;
}
.otp-email-link a {
  font-size: 13px;
  color: #64748b;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.2s;
}
.otp-email-link a:hover { color: #2563eb; }

/* Primary Button */
.otp-btn-primary {
  display: block;
  width: 100%;
  padding: 14px 24px;
  background: #0f172a;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  margin-top: 20px;
  letter-spacing: 0.02em;
}
.otp-btn-primary:hover { background: #1e293b; }
.otp-btn-primary:active { transform: scale(0.98); }
.otp-btn-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

/* Divider */
.otp-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
}
.otp-divider::before,
.otp-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}
.otp-divider span {
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
}

/* Social Buttons */
.otp-social-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.otp-social-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.otp-social-btn:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.otp-social-btn img {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* ===== Step 2: OTP Code Input ===== */
.otp-step { display: none; }
.otp-step.active { display: block; }

.otp-code-info {
  text-align: center;
  margin-bottom: 24px;
}
.otp-code-info .otp-sent-to {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
}
.otp-code-info .otp-phone-display {
  font-weight: 700;
  color: #0f172a;
}

.otp-code-inputs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}
.otp-code-input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: #0f172a;
  font-family: inherit;
}
.otp-code-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.otp-code-input.error {
  border-color: #ef4444;
  animation: otpShake 0.4s ease;
}

@keyframes otpShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Resend / Timer */
.otp-resend-section {
  text-align: center;
  margin-top: 16px;
}
.otp-timer {
  font-size: 13px;
  color: #94a3b8;
}
.otp-timer strong {
  color: #2563eb;
  font-weight: 700;
}
.otp-resend-btn {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
  padding: 4px;
}
.otp-resend-btn:disabled {
  color: #94a3b8;
  cursor: not-allowed;
  text-decoration: none;
}

/* Back button */
.otp-back-btn {
  background: none;
  border: none;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  margin-bottom: 16px;
  font-family: inherit;
  transition: color 0.2s;
}
.otp-back-btn:hover { color: #0f172a; }

/* Loading Spinner */
.otp-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: otpSpin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes otpSpin {
  to { transform: rotate(360deg); }
}

/* Success Animation */
.otp-success-icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: otpPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.otp-success-icon svg {
  width: 32px; height: 32px;
  stroke: #fff;
  stroke-width: 3;
}
@keyframes otpPop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* Demo Mode Badge */
.otp-demo-badge {
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .otp-modal {
    width: 95%;
    max-width: none;
    margin: 16px;
  }
  .otp-header { padding: 24px 20px 0; }
  .otp-body { padding: 20px; }
  .otp-code-input { width: 42px; height: 50px; font-size: 20px; }
}
