/* ============================================================
   FingerBlurCam — style.css
   Premium Dark UI with Glassmorphism
   ============================================================ */

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

:root {
  --bg:          #080b14;
  --surface:     #0e1220;
  --glass:       rgba(255,255,255,0.04);
  --glass-border:rgba(255,255,255,0.09);
  --purple:      #818cf8;
  --purple-dim:  #4f46e5;
  --violet:      #a78bfa;
  --blue:        #60a5fa;
  --cyan:        #22d3ee;
  --green:       #34d399;
  --red:         #f87171;
  --text-1:      #f1f5f9;
  --text-2:      #94a3b8;
  --text-3:      #475569;
  --radius:      16px;
  --radius-sm:   10px;
  --shadow:      0 8px 32px rgba(0,0,0,0.45);
  --transition:  0.3s cubic-bezier(0.4,0,0.2,1);
}

html { scroll-behavior: smooth; }

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

/* ── Background Orbs ──────────────────────────────────────── */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
  animation: orb-float 12s ease-in-out infinite alternate;
}
.orb-1 { width: 560px; height: 560px; background: var(--purple-dim);  top: -120px; left: -120px; animation-delay: 0s; }
.orb-2 { width: 400px; height: 400px; background: var(--violet);      top: 40%;   right: -100px; animation-delay: -4s; }
.orb-3 { width: 320px; height: 320px; background: var(--blue);        bottom: 0;  left: 30%; animation-delay: -8s; }

@keyframes orb-float {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 30px) scale(1.08); }
}

/* ── Header ───────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8,11,20,0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--purple-dim), var(--violet));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 8px;
  box-shadow: 0 0 20px rgba(129,140,248,0.4);
}
.logo-icon svg { width: 100%; height: 100%; color: #fff; }

.logo-title {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text-1);
}
.logo-accent { color: var(--purple); }
.logo-sub {
  display: block;
  font-size: 0.68rem;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 5px 14px;
}
.badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse-green 2s ease-in-out infinite;
}
@keyframes pulse-green {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ── Main ─────────────────────────────────────────────────── */
.main {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ── Camera Section ───────────────────────────────────────── */
.camera-section {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 600px;
  background: #060912;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow), 0 0 80px rgba(79,70,229,0.12);
}

video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
}

#outputCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
}

/* ── Loading Overlay ──────────────────────────────────────── */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6,9,18,0.9);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.loading-overlay.active { display: flex; }

.loading-content { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; }

.spinner-ring {
  width: 56px; height: 56px;
  border: 3px solid rgba(129,140,248,0.15);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-title { font-size: 1.1rem; font-weight: 600; color: var(--text-1); }
.loading-sub   { font-size: 0.82rem; color: var(--text-2); font-family: 'JetBrains Mono', monospace; }

/* ── Start Screen ─────────────────────────────────────────── */
.start-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 5;
  text-align: center;
  padding: 24px;
}

.start-icon svg { width: 72px; height: 72px; animation: float-icon 3s ease-in-out infinite; }
@keyframes float-icon {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

.start-title { font-size: 1.6rem; font-weight: 700; color: var(--text-1); }
.start-desc  { font-size: 0.9rem; color: var(--text-2); max-width: 380px; }

.btn-start {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--purple-dim), var(--violet));
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(79,70,229,0.5);
  transition: var(--transition);
}
.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(79,70,229,0.65);
}
.btn-start:active { transform: translateY(0); }
.btn-icon { display: flex; }
.btn-icon svg { width: 18px; height: 18px; }

/* ── Status Overlay ───────────────────────────────────────── */
.status-overlay {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
  z-index: 20;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-1);
  transition: var(--transition);
}
.status-badge.blur-on {
  background: rgba(248,113,113,0.18);
  border-color: rgba(248,113,113,0.4);
  color: var(--red);
}
.status-badge.blur-on .status-dot { background: var(--red); box-shadow: 0 0 10px var(--red); }

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  transition: var(--transition);
}

.finger-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-1);
  font-family: 'JetBrains Mono', monospace;
}

/* ── Info Cards ───────────────────────────────────────────── */
.info-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.info-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  transition: var(--transition);
  overflow: hidden;
}
.info-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent);
  pointer-events: none;
}
.info-card:hover {
  border-color: rgba(255,255,255,0.14);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.card-icon-wrap {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.card-icon--purple { background: rgba(129,140,248,0.15); color: var(--purple); }
.card-icon--blue   { background: rgba(96,165,250,0.15);  color: var(--blue);   }
.card-icon--indigo { background: rgba(167,139,250,0.15); color: var(--violet); }
.card-icon--cyan   { background: rgba(34,211,238,0.15);  color: var(--cyan);   }

.card-body { flex: 1; min-width: 0; }
.card-label { font-size: 0.72rem; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.07em; }
.card-value { font-size: 0.95rem; font-weight: 600; color: var(--text-1); margin-top: 2px; transition: color var(--transition); }

.card-indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  transition: var(--transition);
  flex-shrink: 0;
}
.card-indicator.active {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

/* ── How To ───────────────────────────────────────────────── */
.howto-section {
  padding: 32px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
}
.howto-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 24px;
  background: linear-gradient(90deg, var(--purple), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.howto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.howto-item { display: flex; align-items: flex-start; gap: 16px; }
.howto-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--purple);
  opacity: 0.6;
  line-height: 1;
  flex-shrink: 0;
  padding-top: 2px;
}
.howto-text { display: flex; flex-direction: column; gap: 4px; }
.howto-text strong { font-size: 0.9rem; color: var(--text-1); }
.howto-text span   { font-size: 0.82rem; color: var(--text-2); }
.howto-text em     { color: var(--violet); font-style: normal; font-weight: 600; }

/* ── Footer ───────────────────────────────────────────────── */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px 24px;
  border-top: 1px solid var(--glass-border);
  font-size: 0.78rem;
  color: var(--text-3);
}
.footer strong { color: var(--text-2); }

/* ── Blur animation for canvas ────────────────────────────── */
@keyframes blur-pulse {
  0%,100% { filter: blur(22px); }
  50%      { filter: blur(26px); }
}

/* ── Card Icon Colors ─────────────────────────────────────── */
.card-icon--green { background: rgba(52,211,153,0.15); color: var(--green); }

/* ── Toast Notification ───────────────────────────────────── */
#saveToast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: rgba(10, 14, 26, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  min-width: 260px;
  max-width: 380px;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), opacity 0.35s ease;
  pointer-events: none;
}
#saveToast.show {
  transform: translateY(0);
  opacity: 1;
}
#saveToast.toast-error {
  border-color: rgba(248, 113, 113, 0.4);
  box-shadow: 0 8px 32px rgba(248,113,113,0.15);
}
.toast-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}
.toast-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.toast-body strong {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--green);
}
#saveToast.toast-error .toast-body strong {
  color: var(--red);
}
.toast-body span {
  font-size: 0.72rem;
  color: var(--text-2);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .main { padding: 20px 16px 48px; gap: 20px; }
  .camera-section { border-radius: 14px; }
  .howto-section  { padding: 20px; }
  .header-badge   { display: none; }
  .start-title    { font-size: 1.2rem; }
  .btn-start      { padding: 12px 24px; font-size: 0.9rem; }
  #saveToast { right: 12px; bottom: 12px; min-width: 0; width: calc(100% - 24px); max-width: none; }
}

