/* ===== LOGIN PAGE — Apple-inspired Premium Auth ===== */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  padding-top: max(var(--space-4), env(safe-area-inset-top));
  padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
  position: relative;
  overflow: hidden;
}

/* Background particle canvas */
.login-particles {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}

.login-content {
  text-align: center;
  max-width: 400px;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* ── Logo with double ring — matches loading screen ── */
.login-logo {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 28px;
}

.login-logo-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(124, 58, 237, 0.5))
          drop-shadow(0 0 40px rgba(167, 139, 250, 0.2));
}

.login-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1.5px solid rgba(139, 92, 246, 0.2);
  animation: login-ring-pulse 3s ease-in-out infinite;
}

.login-ring--2 {
  inset: -18px;
  border-color: rgba(139, 92, 246, 0.07);
  animation: login-ring-pulse 3s ease-in-out infinite 1.5s;
}

@keyframes login-ring-pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 0.15; }
}

/* ── Title — exact match with loading screen typography ── */
.login-title {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.1;
  margin: 0 0 12px;
  display: flex;
  justify-content: center;
  gap: 0.35em;
  animation: loginFadeUp 0.6s cubic-bezier(0.22,1,0.36,1) 0.1s both;
}

.login-title-word--accent {
  background: linear-gradient(135deg, #e2d6ff 0%, #a78bfa 40%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-title-word--light {
  font-weight: 300;
  background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.6) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: clamp(0.75rem, 2vw, 0.88rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: rgba(167, 139, 250, 0.5);
  margin-bottom: var(--space-8);
  min-height: 1.5em;
  animation: loginFadeUp 0.6s cubic-bezier(0.22,1,0.36,1) 0.2s both;
}

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

/* ── Form area with smooth transitions ── */
.login-form {
  margin-top: var(--space-4);
  transition: opacity 0.2s ease, transform 0.2s ease;
  animation: loginFadeUp 0.6s cubic-bezier(0.22,1,0.36,1) 0.3s both;
}

/* ── Phone Input ── */
.login-input-group {
  margin-bottom: var(--space-5);
}

.login-phone-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 16px 20px;
  transition: all 0.4s cubic-bezier(0.22,1,0.36,1);
}

.login-phone-wrapper:focus-within {
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.06), 0 8px 32px rgba(0,0,0,0.2);
  background: rgba(255,255,255,0.05);
}

.login-phone-prefix {
  color: rgba(255,255,255,0.35);
  font-weight: 600;
  font-size: 1.05rem;
  white-space: nowrap;
  font-family: inherit;
}

.login-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  outline: none;
  font-family: inherit;
}

.login-input::placeholder {
  color: rgba(255,255,255,0.15);
  font-weight: 400;
  letter-spacing: 0.08em;
}

/* Phone progress bar */
.login-phone-progress {
  height: 2px; border-radius: 2px; margin-top: 10px;
  background: rgba(255,255,255,0.03); overflow: hidden;
}
.login-phone-progress-fill {
  height: 100%; width: 0%; border-radius: 2px;
  background: linear-gradient(90deg, #8B5CF6, #A78BFA);
  transition: width 0.3s cubic-bezier(0.22,1,0.36,1);
}

/* ── PIN inputs ── */
.login-pin-title {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-2);
  letter-spacing: -0.02em;
}

.login-pin-subtitle {
  color: rgba(255,255,255,0.3);
  font-size: 0.78rem;
  margin-bottom: var(--space-5);
  font-weight: 400;
}

.login-pin-wrapper {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: var(--space-5);
}

.login-pin-input {
  width: 58px;
  height: 66px;
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: all 0.3s cubic-bezier(0.22,1,0.36,1);
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.login-pin-input:focus {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.08);
  transform: scale(1.06);
  background: rgba(139, 92, 246, 0.04);
}

.login-pin-input--filled {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.06);
}

.login-pin-input--success {
  border-color: rgba(74, 222, 128, 0.5) !important;
  background: rgba(74, 222, 128, 0.06) !important;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.08) !important;
  animation: pinSuccess 0.3s cubic-bezier(0.22,1,0.36,1);
}

.login-pin-input--error {
  border-color: rgba(239, 68, 68, 0.5) !important;
  background: rgba(239, 68, 68, 0.06) !important;
  animation: pinShake 0.4s ease;
}

@keyframes pinSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

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

/* ── Auto-hint (replaces submit button on phone step) ── */
.login-auto-hint {
  margin: 20px 0 0;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.18);
  letter-spacing: 0.04em;
  font-weight: 400;
  transition: opacity 0.4s ease;
}

/* ── Submit Button — premium glass with glow ── */
.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: 16px var(--space-5);
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.22,1,0.36,1);
  font-family: inherit;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -0.01em;
  overflow: hidden;
}

.login-btn--glow::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 50%);
  border-radius: inherit;
  pointer-events: none;
}

.login-btn-arrow {
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1);
}

.login-btn:hover:not(:disabled) .login-btn-arrow {
  transform: translateX(4px);
}

.login-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.3), 0 0 0 1px rgba(139,92,246,0.1);
}

.login-btn:active:not(:disabled) {
  transform: scale(0.98);
}

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

.login-btn.loading span,
.login-btn.loading svg {
  opacity: 0;
}

.login-btn.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ===== DENIED STEP ===== */
.login-denied {
  text-align: center;
  animation: loginFadeUp 0.4s ease-out;
}

.login-denied-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.15);
  color: #ef4444;
  margin-bottom: var(--space-5);
  animation: denied-pulse 2s ease-in-out infinite;
}

@keyframes denied-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.1); }
  50% { box-shadow: 0 0 0 14px rgba(239, 68, 68, 0); }
}

.login-denied-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  letter-spacing: -0.03em;
}

.login-denied-text {
  color: rgba(255,255,255,0.4);
  font-size: 0.88rem;
  line-height: 1.7;
  margin-bottom: var(--space-3);
}

.login-denied-hint {
  color: rgba(255,255,255,0.2);
  font-size: 0.75rem;
  margin-bottom: var(--space-6);
}

/* ===== EXPLAIN PIN STEP ===== */
.login-explain {
  text-align: center;
  animation: loginFadeUp 0.4s ease-out;
}

.login-explain-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.12);
  color: var(--purple-400);
  margin-bottom: var(--space-5);
}

.login-explain-text {
  color: rgba(255,255,255,0.4);
  font-size: 0.88rem;
  line-height: 1.7;
  margin-bottom: var(--space-5);
}

.login-explain-text strong {
  color: rgba(255,255,255,0.8);
}

.login-explain-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: var(--space-6);
  text-align: left;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.login-explain-feature {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: rgba(255,255,255,0.35);
  font-size: 0.82rem;
}

.login-explain-feature svg {
  flex-shrink: 0;
  color: var(--purple-400);
}

/* ===== Secondary Button ===== */
.login-btn--secondary {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.4);
}

.login-btn--secondary:hover:not(:disabled) {
  border-color: rgba(139, 92, 246, 0.3);
  color: var(--purple-400);
  box-shadow: none;
  transform: none;
}

/* ── Error ── */
.login-error {
  margin-top: var(--space-4);
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 12px;
  color: #ef4444;
  font-size: 0.82rem;
  animation: loginFadeUp 0.3s ease-out;
}

/* ===== BIOMETRIC AUTH ===== */

.login-bio-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  color: rgba(255,255,255,0.15);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.login-bio-divider::before,
.login-bio-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}

/* Fingerprint button on PIN step */
.login-btn--biometric {
  background: transparent;
  border: 1px solid rgba(86, 204, 242, 0.15);
  color: rgba(86, 204, 242, 0.8);
  gap: var(--space-3);
  transition: all 0.3s ease;
}

.login-btn--biometric:hover:not(:disabled) {
  border-color: rgba(86, 204, 242, 0.3);
  background: rgba(86, 204, 242, 0.04);
  box-shadow: 0 0 24px rgba(86, 204, 242, 0.06);
  transform: none;
}

.login-btn--biometric:active:not(:disabled) {
  background: rgba(86, 204, 242, 0.08);
}

.login-btn--biometric svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* ── Biometric Offer — particle canvas around fingerprint ── */
.login-bio-offer {
  text-align: center;
  animation: loginFadeUp 0.5s ease-out;
}

.login-bio-offer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, rgba(86, 204, 242, 0.08), rgba(86, 204, 242, 0.02));
  border: 1px solid rgba(86, 204, 242, 0.15);
  color: rgba(86, 204, 242, 0.85);
  margin-bottom: var(--space-5);
  position: relative;
  animation: bio-pulse 2.5s ease-in-out infinite;
}

.login-bio-canvas {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 0;
}

.login-bio-offer-icon svg {
  position: relative;
  z-index: 1;
}

.login-bio-offer-icon::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(86, 204, 242, 0.06);
  animation: bio-ring 2.5s ease-in-out infinite;
  pointer-events: none;
}

.login-bio-offer-icon::before {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px solid rgba(86, 204, 242, 0.03);
  animation: bio-ring 2.5s ease-in-out infinite 0.5s;
  pointer-events: none;
}

@keyframes bio-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(86, 204, 242, 0.1), 0 0 40px rgba(86, 204, 242, 0.03); }
  50% { box-shadow: 0 0 0 16px rgba(86, 204, 242, 0), 0 0 50px rgba(86, 204, 242, 0.06); }
}

@keyframes bio-ring {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 0.1; }
}

.login-bio-offer-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  letter-spacing: -0.03em;
}

.login-bio-offer-text {
  color: rgba(255,255,255,0.35);
  font-size: 0.85rem;
  line-height: 1.7;
  margin-bottom: var(--space-6);
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.login-bio-offer-text strong {
  color: rgba(86, 204, 242, 0.85);
}

/* Enable biometric button */
.login-btn--biometric-enable {
  background: linear-gradient(135deg, rgba(86, 204, 242, 0.85), rgba(56, 152, 204, 0.85));
  color: white;
  gap: var(--space-3);
  border: none;
}

.login-btn--biometric-enable:hover:not(:disabled) {
  box-shadow: 0 8px 32px rgba(86, 204, 242, 0.2);
  transform: translateY(-2px);
}

.login-btn--biometric-enable svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .login-title { font-size: 2rem; }
  .login-pin-input { width: 50px; height: 58px; font-size: 1.3rem; }
  .login-bio-offer-icon { width: 80px; height: 80px; }
}

@media (max-width: 480px) {
  .login-pin-input { width: 46px; height: 52px; font-size: 1.1rem; }
  .login-bio-offer-icon { width: 72px; height: 72px; }
}
