/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #060910;
  --surface: rgba(255,255,255,0.04);
  --surface2: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --teal: #00f5c4;
  --blue: #0062ff;
  --purple: #7c3aff;
  --text: #f0f4ff;
  --text2: #8a96b0;
  --text3: #4a5568;
  --danger: #ff4d6d;
  --success: #00f5c4;
  --radius: 20px;
  --radius-sm: 12px;
}

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ========== BACKGROUND ========== */
.bg-orbs {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  animation: drift 12s ease-in-out infinite alternate;
}
.orb1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #0062ff, transparent 70%);
  top: -150px; left: -100px;
}
.orb2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #00f5c4, transparent 70%);
  bottom: -100px; right: -80px;
  animation-delay: -4s;
}
.orb3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #7c3aff, transparent 70%);
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  animation-delay: -8s;
}
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(30px, 20px) scale(1.1); }
}

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ========== LAYOUT ========== */
.container {
  position: relative; z-index: 2;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}

/* ========== CARD ========== */
.card {
  width: 100%; max-width: 440px;
  background: rgba(10, 14, 26, 0.85);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 0 0 1px rgba(0,245,196,0.05),
    0 24px 80px rgba(0,0,0,0.6),
    0 4px 24px rgba(0,98,255,0.08);
  animation: cardIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card-header {
  padding: 28px 32px 0;
  display: flex; flex-direction: column; gap: 24px;
}

/* ========== LOGO ========== */
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* ========== TABS ========== */
.tabs {
  position: relative;
  display: flex;
  background: var(--surface);
  border-radius: 10px;
  padding: 4px;
  border: 1px solid var(--border);
}
.tab {
  flex: 1; padding: 9px 16px;
  background: none; border: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem; font-weight: 500;
  color: var(--text2);
  border-radius: 7px;
  transition: color 0.25s;
  position: relative; z-index: 1;
}
.tab.active { color: var(--text); }
.tab-indicator {
  position: absolute;
  top: 4px; left: 4px;
  width: calc(50% - 4px); height: calc(100% - 8px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 7px;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.tab-indicator.right { transform: translateX(100%); }

/* ========== PANEL ========== */
.panel { padding: 28px 32px 32px; }
.panel.hidden { display: none; }

.panel-title { margin-bottom: 24px; }
.panel-title h1 {
  font-family: 'Syne', sans-serif;
  font-size: 1.75rem; font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 40%, var(--teal));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}
.panel-title p { color: var(--text2); font-size: 0.9rem; }

/* ========== INPUTS ========== */
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-group { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
label {
  font-size: 0.78rem; font-weight: 500;
  color: var(--text2); letter-spacing: 0.02em;
  text-transform: uppercase;
}
input {
  width: 100%; padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 0.95rem;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
input::placeholder { color: var(--text3); }
input:focus {
  border-color: rgba(0,245,196,0.4);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(0,245,196,0.08);
}

/* ========== FINGERPRINT ZONE ========== */
.fingerprint-zone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 0 24px;
  cursor: pointer;
  margin-bottom: 4px;
}

/* Rings */
.fp-rings {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.ring {
  position: absolute; border-radius: 50%;
  border: 1.5px solid rgba(0,245,196,0);
  opacity: 0;
  transition: all 0.3s;
}
.r1 { width: 110px; height: 110px; }
.r2 { width: 150px; height: 150px; }
.r3 { width: 190px; height: 190px; }

/* Scanning state */
.fingerprint-zone.scanning .ring {
  border-color: rgba(0,245,196,0.35);
  opacity: 1;
  animation: ringPulse 1.6s ease-out infinite;
}
.fingerprint-zone.scanning .r2 { animation-delay: 0.3s; }
.fingerprint-zone.scanning .r3 { animation-delay: 0.6s; }

@keyframes ringPulse {
  0% { transform: scale(0.85); opacity: 0.8; }
  100% { transform: scale(1.15); opacity: 0; }
}

/* FP Icon */
.fp-icon {
  width: 80px; height: 80px;
  color: var(--text3);
  transition: color 0.4s, filter 0.4s, transform 0.3s;
  position: relative; z-index: 1;
}
.fingerprint-zone:hover .fp-icon {
  color: var(--teal);
  transform: scale(1.05);
}
.fingerprint-zone.scanning .fp-icon {
  color: var(--teal);
  filter: drop-shadow(0 0 12px rgba(0,245,196,0.6));
  animation: fpPulse 0.8s ease-in-out infinite alternate;
}
@keyframes fpPulse {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

/* Fill animation: simulates the fingerprint being read line by line */
.fingerprint-zone.scanning .fp-icon svg path {
  animation: fpLineFill 2.5s ease forwards;
}
.fingerprint-zone.scanning .fp-icon svg path:nth-child(1) { animation-delay: 0.0s; }
.fingerprint-zone.scanning .fp-icon svg path:nth-child(2) { animation-delay: 0.1s; }
.fingerprint-zone.scanning .fp-icon svg path:nth-child(3) { animation-delay: 0.2s; }
.fingerprint-zone.scanning .fp-icon svg path:nth-child(4) { animation-delay: 0.3s; }
.fingerprint-zone.scanning .fp-icon svg path:nth-child(5) { animation-delay: 0.4s; }
.fingerprint-zone.scanning .fp-icon svg path:nth-child(6) { animation-delay: 0.5s; }
.fingerprint-zone.scanning .fp-icon svg path:nth-child(7) { animation-delay: 0.6s; }
.fingerprint-zone.scanning .fp-icon svg path:nth-child(8) { animation-delay: 0.7s; }
.fingerprint-zone.scanning .fp-icon svg path:nth-child(9) { animation-delay: 0.8s; }
.fingerprint-zone.scanning .fp-icon svg path:nth-child(10) { animation-delay: 0.9s; }
.fingerprint-zone.scanning .fp-icon svg path:nth-child(11) { animation-delay: 1.0s; }
@keyframes fpLineFill {
  from { stroke: var(--text3); }
  to { stroke: var(--teal); filter: drop-shadow(0 0 4px rgba(0,245,196,0.8)); }
}

/* Success state */
.fingerprint-zone.success .fp-icon {
  color: var(--teal);
  filter: drop-shadow(0 0 18px rgba(0,245,196,0.8));
  animation: successBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes successBounce {
  from { transform: scale(0.8); }
  to { transform: scale(1); }
}

/* Error state */
.fingerprint-zone.error .fp-icon {
  color: var(--danger);
  filter: drop-shadow(0 0 12px rgba(255,77,109,0.6));
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.fp-label {
  margin-top: 14px;
  font-size: 0.82rem; font-weight: 500;
  color: var(--text3);
  letter-spacing: 0.01em;
  transition: color 0.3s;
  text-align: center;
}
.fingerprint-zone.scanning .fp-label { color: var(--teal); }
.fingerprint-zone.error .fp-label { color: var(--danger); }
.fingerprint-zone.success .fp-label { color: var(--teal); }

/* Scan line sweep */
.fingerprint-zone.scanning::after {
  content: '';
  position: absolute;
  left: calc(50% - 40px);
  top: 32px;
  width: 80px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
  border-radius: 2px;
  animation: scanLine 1.4s ease-in-out infinite;
  opacity: 0.7;
  z-index: 2;
}
@keyframes scanLine {
  0% { transform: translateY(0px); opacity: 0; }
  10% { opacity: 0.8; }
  90% { opacity: 0.8; }
  100% { transform: translateY(78px); opacity: 0; }
}

/* ========== BUTTON ========== */
.btn-primary {
  width: 100%; padding: 15px 24px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  border: none; border-radius: var(--radius-sm);
  color: #060910; font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: all 0.25s;
  box-shadow: 0 4px 20px rgba(0,245,196,0.2);
  position: relative; overflow: hidden;
  letter-spacing: 0.01em;
}
.btn-primary::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0; transition: opacity 0.25s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,245,196,0.35); }
.btn-primary:hover::before { opacity: 1; }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.5; cursor: not-allowed; transform: none;
  box-shadow: none;
}
.btn-icon { font-size: 1.1rem; }

/* ========== DIVIDER ========== */
.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 16px; color: var(--text3); font-size: 0.8rem;
}
.divider::before, .divider::after {
  content: ''; flex: 1;
  height: 1px; background: var(--border);
}

.switch-text { text-align: center; font-size: 0.85rem; color: var(--text2); }
.switch-text a {
  color: var(--teal); text-decoration: none; font-weight: 500;
  transition: opacity 0.2s;
}
.switch-text a:hover { opacity: 0.75; }

/* ========== SUCCESS CARD ========== */
.success-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 56px 32px 48px;
  text-align: center;
}
.success-card h2 {
  font-family: 'Syne', sans-serif;
  font-size: 2rem; font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff, var(--teal));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}
.success-card p { color: var(--text2); font-size: 0.9rem; margin-bottom: 28px; }

.success-animation {
  position: relative; width: 100px; height: 100px;
  margin-bottom: 28px;
}
.success-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--teal);
  animation: successRing 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
  box-shadow: 0 0 30px rgba(0,245,196,0.3);
}
@keyframes successRing {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.success-check {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.success-check svg { width: 50px; height: 50px; }
.check-path {
  stroke-dasharray: 60; stroke-dashoffset: 60;
  animation: drawCheck 0.5s ease 0.4s forwards;
}
@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

.progress-bar {
  width: 100%; height: 3px;
  background: var(--surface2); border-radius: 2px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  border-radius: 2px;
  width: 0%;
  transition: width 3s linear;
}

/* ========== TOAST ========== */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(10,14,26,0.95);
  border: 1px solid var(--border2);
  border-radius: 100px;
  padding: 12px 22px;
  display: flex; align-items: center; gap: 10px;
  font-size: 0.875rem; color: var(--text);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  backdrop-filter: blur(16px);
  opacity: 0; pointer-events: none;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 100; white-space: nowrap;
}
.toast.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.toast.success { border-color: rgba(0,245,196,0.3); }
.toast.error { border-color: rgba(255,77,109,0.3); }

/* ========== UTILITY ========== */
.hidden { display: none !important; }

/* ========== RESPONSIVE ========== */
@media (max-width: 480px) {
  .card-header, .panel { padding-left: 22px; padding-right: 22px; }
  .input-row { grid-template-columns: 1fr; }
  .panel-title h1 { font-size: 1.5rem; }
}
