/* ============================================================
   AI QR Code Assistant — design tokens
   Palette:
     --bg-void:      #0a0d16  (deep space navy background)
     --bg-panel:     #11141f  (raised panel)
     --line:         rgba(255,255,255,0.08)
     --accent:       #3d5afe  (electric blue — matches wave bars)
     --accent-dim:   #1f3dbc
     --ink:          #f0f2ff  (primary text)
     --ink-dim:      #9aa0b4  (secondary text)
     --good:         #4ade80  (understood / success)
   Type:
     display: 'Space Grotesk' — headings, techy + geometric
     body:    'Inter' — everything readable
     mono:    'JetBrains Mono' — the raw encoded QR string ("terminal" signature)
   ============================================================ */

:root {
  --bg-void: #0a0d16;
  --bg-panel: #11141f;
  --bg-panel-raised: #161a28;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #3d5afe;
  --accent-dim: #1f3dbc;
  --accent-glow: rgba(61, 90, 254, 0.35);
  --ink: #f0f2ff;
  --ink-dim: #9aa0b4;
  --ink-faint: rgba(240, 242, 255, 0.4);
  --good: #4ade80;
  --warn: #f0b429;
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-void);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, .display {
  font-family: "Space Grotesk", "Inter", sans-serif;
  letter-spacing: -0.02em;
  margin: 0;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- Navbar ---------- */
.navbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(20px, 4vw, 56px);
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
}

.navbar__mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  display: grid;
  place-items: center;
  box-shadow: 0 0 24px var(--accent-glow);
  flex-shrink: 0;
}

.navbar__mark svg { width: 16px; height: 16px; }

.navbar__links {
  display: flex;
  gap: 28px;
  font-size: 14px;
  color: var(--ink-dim);
}

.navbar__links a {
  text-decoration: none;
  transition: color 0.2s ease;
}
.navbar__links a:hover { color: var(--ink); }

@media (max-width: 640px) {
  .navbar__links { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 640px;
  overflow: hidden;
}

.hero__canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.85;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 24px;
}

.hero__content {
  max-width: 760px;
  width: 100%;
  text-align: center;
  pointer-events: auto;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
  background: rgba(255, 255, 255, 0.03);
}

.hero__eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
}

.hero h1 {
  color: var(--ink);
  font-size: clamp(32px, 5vw, 54px);
  font-weight: 600;
  line-height: 1.05;
  text-shadow: 0 1px 24px rgba(31, 61, 188, 0.35);
}

.hero p.subtitle {
  color: var(--ink-dim);
  margin-top: 14px;
  font-size: clamp(14px, 1.6vw, 17px);
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.prompt-form {
  margin-top: 34px;
  display: flex;
  justify-content: center;
}

.prompt-shell {
  position: relative;
  width: 100%;
  max-width: 720px;
}

.prompt-border {
  position: relative;
  border-radius: 20px;
  padding: 2px;
  background: linear-gradient(135deg, rgba(255,255,255,0.14), rgba(255,255,255,0.04) 40%, rgba(0,0,0,0.2));
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

textarea#prompt {
  width: 100%;
  height: 128px;
  resize: none;
  border-radius: 18px;
  background: rgba(15, 15, 20, 0.6);
  border: 1px solid var(--line);
  color: var(--ink);
  outline: none;
  backdrop-filter: blur(14px);
  padding: 18px 64px 18px 18px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea#prompt::placeholder { color: var(--ink-faint); }

textarea#prompt:focus {
  border-color: rgba(61, 90, 254, 0.5);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.prompt-submit {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: #f0f2ff;
  color: #0a0d16;
  border: none;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, background 0.2s ease;
}
.prompt-submit:hover { background: #ffffff; transform: translateY(-1px); }
.prompt-submit:active { transform: translateY(0); }
.prompt-submit svg { width: 18px; height: 18px; }
.prompt-submit:disabled { opacity: 0.5; pointer-events: none; }

.hero__examples {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.chip {
  font-size: 12.5px;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  padding: 7px 13px;
  border-radius: 999px;
  transition: all 0.15s ease;
}
.chip:hover {
  color: var(--ink);
  border-color: rgba(61,90,254,0.5);
  background: rgba(61,90,254,0.08);
}

.scroll-cue {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  color: var(--ink-faint);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 6px); }
}

/* ---------- Results section ---------- */
.results {
  position: relative;
  z-index: 2;
  background: var(--bg-void);
  padding: 72px clamp(20px, 5vw, 56px) 100px;
  border-top: 1px solid var(--line);
}

.results__inner {
  max-width: 920px;
  margin: 0 auto;
}

.state {
  display: none;
}
.state.active { display: block; }

/* idle state */
#state-idle {
  text-align: center;
  color: var(--ink-faint);
  padding: 40px 0;
  font-size: 14px;
}

/* loading state */
#state-loading {
  text-align: center;
  padding: 40px 0;
}

.pulse-dot-row {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 18px;
}
.pulse-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}
.pulse-dot:nth-child(2) { animation-delay: 0.15s; }
.pulse-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}
#loading-label { color: var(--ink-dim); font-size: 14px; }

/* error state */
#state-error {
  border: 1px solid rgba(240, 84, 84, 0.35);
  background: rgba(240, 84, 84, 0.06);
  border-radius: var(--radius-sm);
  padding: 22px 24px;
  color: #ffb4b4;
  font-size: 14px;
}
#state-error button {
  margin-top: 14px;
  background: transparent;
  border: 1px solid rgba(240,84,84,0.4);
  color: #ffb4b4;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
}

/* result state */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 800px) {
  .result-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}

.panel h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  margin-bottom: 18px;
}

.understood-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 14.5px;
}
.understood-row:last-child { margin-bottom: 0; }
.understood-row .check {
  width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px;
  color: var(--good);
}
.understood-row .label { color: var(--ink-dim); }
.understood-row .value { color: var(--ink); font-weight: 500; }

.terminal {
  margin-top: 20px;
  background: #05060a;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  position: relative;
}
.terminal__bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.terminal__bar span {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
}
.terminal__body {
  font-size: 13.5px;
  color: var(--good);
  word-break: break-all;
  line-height: 1.6;
  min-height: 1.6em;
}
.terminal__body .cursor {
  display: inline-block;
  width: 7px;
  background: var(--good);
  margin-left: 2px;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.qr-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

#qr-canvas-wrap {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px;
  width: 220px;
  height: 220px;
  display: grid;
  place-items: center;
}
#qr-canvas-wrap canvas, #qr-canvas-wrap img { display: block; max-width: 100%; }

.customize-row {
  display: flex;
  gap: 14px;
  width: 100%;
  justify-content: center;
}
.color-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-dim);
}
.color-field input[type="color"] {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: none;
  padding: 0;
}

.logo-upload {
  width: 100%;
}
.logo-upload label {
  display: block;
  font-size: 11.5px;
  color: var(--ink-dim);
  margin-bottom: 8px;
  text-align: center;
}
.logo-upload input[type="file"] {
  width: 100%;
  font-size: 12.5px;
  color: var(--ink-dim);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  justify-content: center;
}

.btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 11px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
}
.btn:hover { border-color: rgba(61,90,254,0.5); background: rgba(61,90,254,0.1); }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  border: none;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.1); background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%); }

.btn-ghost {
  background: none;
}

.footer-note {
  text-align: center;
  margin-top: 40px;
  font-size: 12.5px;
  color: var(--ink-faint);
}
