/* ─────────────────────────────────────────────────────────────────────────
   OTP Portal — Dark Glassmorphism Design System
   ───────────────────────────────────────────────────────────────────────── */

/* ── Tokens ── */
:root {
  --bg-deep:      #06070f;
  --bg-surface:   rgba(255, 255, 255, 0.03);
  --bg-elevated:  rgba(255, 255, 255, 0.06);

  --glass-bg:     rgba(12, 14, 28, 0.72);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur:   24px;

  --accent:       #6366f1;
  --accent-dim:   rgba(99, 102, 241, 0.18);
  --accent-glow:  rgba(99, 102, 241, 0.35);
  --accent-light: #818cf8;
  --purple-glow:  rgba(139, 92, 246, 0.4);

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;
  --text-hint:      #64748b;

  --success:        #10b981;
  --success-dim:    rgba(16, 185, 129, 0.15);
  --success-glow:   rgba(16, 185, 129, 0.35);
  --danger:         #f43f5e;
  --danger-dim:     rgba(244, 63, 94, 0.15);

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-card:  0 32px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--glass-border);
  --shadow-btn:   0 4px 24px var(--accent-glow);
  --shadow-input: 0 0 0 2px var(--accent);

  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; font-size: 16px; }

body {
  min-height: 100vh;
  background-color: var(--bg-deep);
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text-primary);
  overflow-x: hidden;
  position: relative;
}

/* ── Animated Background Orbs ── */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  animation: orbFloat 12s ease-in-out infinite;
}

.orb-1 {
  width: 480px; height: 480px;
  background: radial-gradient(circle, #4f46e5 0%, transparent 70%);
  top: -120px; left: -120px;
  animation-delay: 0s;
}
.orb-2 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
  bottom: -60px; right: -60px;
  animation-delay: -4s;
}
.orb-3 {
  width: 240px; height: 240px;
  background: radial-gradient(circle, #0ea5e9 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -8s;
  opacity: 0.2;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -30px) scale(1.05); }
  66%       { transform: translate(-20px, 20px) scale(0.97); }
}

/* ── Layout ── */
.main-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* Fix for mobile keyboard overlap */
  padding-top: max(8vh, 24px);
  min-height: 100vh;
  min-height: 100dvh; /* Adapts to mobile keyboard */
  padding-bottom: 40px;
  padding-left: 16px;
  padding-right: 16px;
  gap: 20px;
}

/* ── Site Header ── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 440px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--accent-glow);
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.logo-accent { color: var(--accent-light); }

.header-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--success);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 50px;
}

.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.85); }
}

/* ── Card ── */
.card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 36px 32px 32px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-card), 0 0 80px rgba(99, 102, 241, 0.08);
}

.card-glow {
  position: absolute;
  top: -1px; left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
  border-radius: 2px;
}

/* ── Form Panel ── */
.form-panel {
  display: block;
  animation: fadeSlideIn 0.3s ease;
}

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

.step-header { margin-bottom: 24px; }

.step-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.2;
}

.step-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ── Form ── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color var(--transition);
}

.form-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92rem;
  padding: 13px 16px 13px 42px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  letter-spacing: 0.02em;
}

.input-suffix {
  position: absolute;
  right: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  pointer-events: none;
}

/* When suffix is present, add right padding */
.input-wrap:has(.input-suffix) .form-input {
  padding-right: 100px;
}

.form-input::placeholder { color: var(--text-hint); font-family: 'Inter', sans-serif; }

.form-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-input), 0 0 24px var(--accent-dim);
  background: rgba(99, 102, 241, 0.04);
}

.form-input:focus + .input-suffix { color: var(--accent-light); }

.form-input:focus ~ .input-icon { color: var(--accent-light); }
.input-wrap:focus-within .input-icon { color: var(--accent-light); }

.field-hint {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-hint);
  line-height: 1.5;
}

.field-hint code {
  background: var(--bg-elevated);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--accent-light);
}

.field-error {
  margin-top: 6px;
  font-size: 0.76rem;
  color: var(--danger);
  min-height: 18px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Buttons ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition);
}

.btn:hover::before { background: rgba(255,255,255,0.06); }
.btn:active::before { background: rgba(255,255,255,0.12); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 8px 32px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  margin-top: 10px;
}

.btn-ghost:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.18); }

.btn-outline {
  background: transparent;
  color: var(--accent-light);
  border: 1.5px solid rgba(99, 102, 241, 0.4);
  padding: 11px 20px;
}

.btn-outline:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.btn-icon, .btn-text { display: flex; align-items: center; }

.btn-spinner { display: none; }
.btn-spinner svg { animation: spinnerSpin 0.8s linear infinite; }

@keyframes spinnerSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Result Box ── */
.result-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px 0;
  animation: fadeSlideIn 0.35s ease;
}

.result-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.result-icon.success {
  background: var(--success-dim);
  box-shadow: 0 0 32px var(--success-glow);
}

.result-icon.error {
  background: var(--danger-dim);
  box-shadow: 0 0 32px rgba(244, 63, 94, 0.25);
}

.result-label {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.55;
  max-width: 320px;
  margin-bottom: 4px;
}

/* ── OTP Display ── */
.otp-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(99, 102, 241, 0.08);
  border: 1.5px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 16px 0 4px;
  width: 100%;
  justify-content: center;
}

.otp-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-primary);
  text-shadow: 0 0 20px var(--accent-glow);
}

.copy-btn {
  background: var(--accent-dim);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 8px;
  color: var(--accent-light);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.copy-btn:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
  transform: scale(1.05);
}

.copy-btn.copied {
  background: var(--success-dim);
  border-color: var(--success);
  color: var(--success);
}

/* ── Site Footer ── */
.site-footer {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .card { padding: 28px 20px 24px; border-radius: var(--radius-lg); }
  .otp-code { font-size: 1.6rem; }
  .step-title { font-size: 1.25rem; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
