/* ============================================================
   CkAuth Demo — "Terminal Luxe"
   Dark industrial aesthetic with refined developer-tool polish
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Outfit:wght@300;400;600;700&display=swap');

/* --- Tokens --- */
:root {
  --bg-deep:    #0a0c10;
  --bg-surface: #12151c;
  --bg-raised:  #1a1e28;
  --bg-hover:   #222838;

  --text-primary:   #e8ecf4;
  --text-secondary: #8892a8;
  --text-muted:     #525c72;

  --accent:       #00e5ff;
  --accent-dim:   #00819080;
  --accent-glow:  #00e5ff18;
  --amber:        #ffab00;
  --red:          #ff3d5a;
  --green:        #00e676;

  --mono: 'JetBrains Mono', monospace;
  --sans: 'Outfit', system-ui, sans-serif;

  --radius:    6px;
  --radius-lg: 12px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--sans);
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-deep);
  line-height: 1.6;
  min-height: 100vh;
}

/* Subtle scan-line overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  z-index: 9999;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Nav --- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid #ffffff08;
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.nav-brand::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent), 0 0 20px var(--accent-dim);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.nav-brand span {
  color: var(--text-muted);
  font-weight: 400;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  font-size: 0.875rem;
}

.nav-links a {
  color: var(--text-secondary);
  transition: color 0.2s;
  font-weight: 400;
}

.nav-links a:hover {
  color: var(--text-primary);
  text-decoration: none;
}

/* --- Main content --- */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2rem 6rem;
}

/* --- Hero --- */
.hero {
  padding: 4rem 0 3rem;
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero h1 {
  font-family: var(--sans);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-sub {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 580px;
  line-height: 1.7;
}

/* --- Feature pills --- */
.features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2rem 0 3rem;
}

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-raised);
  border: 1px solid #ffffff08;
  border-radius: 100px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-family: var(--mono);
}

.feature-pill .icon {
  font-size: 1rem;
}

/* --- Split demo area --- */
.demo-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 2rem 0;
}

@media (max-width: 768px) {
  .demo-split { grid-template-columns: 1fr; }
}

/* --- Code block --- */
.code-panel {
  background: var(--bg-surface);
  border: 1px solid #ffffff0a;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.code-panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-raised);
  border-bottom: 1px solid #ffffff08;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.code-panel-header::before {
  content: '';
  display: flex;
  gap: 6px;
  width: 48px;
  height: 12px;
  background:
    radial-gradient(circle at 6px 6px, #ff5f5780 5px, transparent 5px),
    radial-gradient(circle at 24px 6px, #febc2e80 5px, transparent 5px),
    radial-gradient(circle at 42px 6px, #28c84080 5px, transparent 5px);
}

.code-panel pre {
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.code-panel pre .kw   { color: #c792ea; }
.code-panel pre .str  { color: #c3e88d; }
.code-panel pre .fn   { color: #82aaff; }
.code-panel pre .cm   { color: var(--text-muted); font-style: italic; }
.code-panel pre .prop { color: var(--accent); }
.code-panel pre .num  { color: var(--amber); }

/* --- Live demo panel --- */
.live-panel {
  background: var(--bg-surface);
  border: 1px solid #ffffff0a;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  min-height: 380px;
  position: relative;
}

.live-panel-label {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font-family: var(--mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  border: 1px solid #ffffff08;
  border-radius: 100px;
}

.live-panel-label::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  margin-right: 0.375rem;
  animation: pulse-dot 2s ease-in-out infinite;
}

/* --- QR area --- */
#qr-container {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

#qr-container.active { display: flex; }

#qr-mount {
  padding: 1.25rem;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow:
    0 0 0 1px rgba(0, 229, 255, 0.1),
    0 0 40px rgba(0, 229, 255, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.4);
}

#qr-mount svg {
  display: block;
}

.qr-hint {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.qr-timer {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.qr-timer .bar {
  width: 60px;
  height: 3px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
}

.qr-timer .bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  animation: drain 90s linear forwards;
}

@keyframes drain {
  from { width: 100%; }
  to   { width: 0%; }
}

/* --- Status message --- */
#auth-status {
  display: none;
  text-align: center;
}

#auth-status.active { display: block; }

.status-success {
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.875rem;
}

.status-error {
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.875rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border: none;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-deep);
  box-shadow: 0 0 20px var(--accent-dim);
}

.btn-primary:hover {
  background: #33ebff;
  box-shadow: 0 0 30px var(--accent-dim), 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid #ffffff12;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: #ffffff20;
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(255, 61, 90, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 61, 90, 0.08);
  border-color: rgba(255, 61, 90, 0.4);
}

/* --- Dashboard --- */
.dash-header {
  margin-bottom: 2.5rem;
}

.dash-header h1 {
  font-family: var(--sans);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.dash-header p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .dash-grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-surface);
  border: 1px solid #ffffff08;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.card-label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.card-value {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--text-primary);
  word-break: break-all;
}

.card-value.accent { color: var(--accent); }

/* --- Claims table --- */
.claims-card {
  grid-column: 1 / -1;
}

.claims-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.claims-table th {
  text-align: left;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 0.5rem 0;
  border-bottom: 1px solid #ffffff08;
  font-weight: 500;
}

.claims-table td {
  padding: 0.625rem 0;
  border-bottom: 1px solid #ffffff05;
  color: var(--text-secondary);
}

.claims-table td:first-child {
  color: var(--accent);
}

.claims-empty {
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--sans);
  font-size: 0.875rem;
  padding: 1rem 0;
}

/* --- Dash actions --- */
.dash-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid #ffffff08;
  margin-top: 1rem;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 3rem 2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

/* --- Loading spinner --- */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--bg-hover);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Utilities --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
