/**
 * Shared demo styles — matches hevcjs.dev design system.
 * Colors: ink (#0a0a0b), smoke (#18181b), ash (#27272a), accent (#6366f1)
 * Fonts: Inter (body), JetBrains Mono (code)
 */

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

body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: #0a0a0b;
  color: #e4e4e7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Navbar ---------- */
.demo-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: #18181b;
  border-bottom: 1px solid #27272a;
  flex-wrap: wrap;
}
.demo-nav-brand {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  text-decoration: none;
  margin-right: auto;
}
.demo-nav-brand span { color: #6366f1; }
.demo-nav a {
  color: #a1a1aa;
  text-decoration: none;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: 0.375rem;
  transition: color 0.15s, background 0.15s;
}
.demo-nav a:hover { color: #fff; background: rgba(99,102,241,0.1); }
.demo-nav a.active {
  color: #818cf8;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.25);
}

/* ---------- Layout ---------- */
.demo-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.demo-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.25rem;
  text-align: center;
}
.demo-subtitle {
  font-size: 0.85rem;
  color: #a1a1aa;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* ---------- Controls ---------- */
.demo-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  width: 100%;
}

.demo-input {
  flex: 1;
  min-width: 200px;
  background: #18181b;
  border: 1px solid #27272a;
  color: #e4e4e7;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.demo-input:focus { border-color: #6366f1; }
.demo-input::placeholder { color: #52525b; }

.demo-btn {
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.25);
  color: #818cf8;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.demo-btn:hover { background: rgba(99,102,241,0.25); border-color: rgba(99,102,241,0.4); }
.demo-btn:disabled { opacity: 0.4; cursor: default; }

.demo-btn-primary {
  background: #6366f1;
  border: 1px solid #6366f1;
  color: #fff;
}
.demo-btn-primary:hover { background: #4f46e5; }

/* ---------- Presets ---------- */
.demo-presets {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  width: 100%;
}
.demo-presets .demo-btn { font-size: 0.78rem; padding: 0.3rem 0.75rem; }

/* ---------- Toggle ---------- */
.demo-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.demo-toggle-label {
  font-size: 0.78rem;
  color: #a1a1aa;
  cursor: pointer;
  user-select: none;
}
.demo-toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  background: #27272a;
  border-radius: 999px;
  cursor: pointer;
  outline: none;
  border: 1px solid #3f3f46;
  transition: background 0.2s, border-color 0.2s;
}
.demo-toggle-switch:checked {
  background: #6366f1;
  border-color: #6366f1;
}
.demo-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e4e4e7;
  transition: transform 0.2s;
}
.demo-toggle-switch:checked::after { transform: translateX(16px); }

/* ---------- Video ---------- */
.demo-video {
  width: 100%;
  background: #000;
  border-radius: 0.75rem;
  border: 1px solid #27272a;
  aspect-ratio: 16/9;
}

/* ---------- Status ---------- */
.demo-status {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: #6366f1;
  min-height: 1.2em;
  width: 100%;
}

/* ---------- Log ---------- */
.demo-log {
  width: 100%;
  height: 200px;
  margin-top: 0.75rem;
  background: #18181b;
  color: #71717a;
  border: 1px solid #27272a;
  border-radius: 0.75rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.72rem;
  padding: 0.75rem;
  resize: vertical;
  outline: none;
  line-height: 1.5;
}

/* ---------- Code snippet ---------- */
.demo-code {
  width: 100%;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: rgba(10,10,11,0.8);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: 0.75rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  color: #a1a1aa;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.6;
}
.demo-code .kw { color: #6366f1; }
.demo-code .str { color: #4ade80; }
.demo-code .fn { color: #818cf8; }
.demo-code .cm { color: #52525b; }

/* ---------- Canvas (raw decoder demo) ---------- */
.demo-canvas {
  border: 1px solid #27272a;
  border-radius: 0.75rem;
  max-width: 100%;
  background: #000;
}

/* ---------- Frame navigation ---------- */
.demo-frame-nav {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.demo-frame-nav span {
  min-width: 80px;
  text-align: center;
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  color: #a1a1aa;
}

/* ---------- Info bar ---------- */
.demo-info {
  font-size: 0.8rem;
  color: #a1a1aa;
  margin-top: 0.5rem;
  text-align: center;
}
.demo-info span { color: #6366f1; font-weight: 500; }

/* ---------- Footer ---------- */
.demo-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #27272a;
  text-align: center;
  font-size: 0.75rem;
  color: rgba(161,161,170,0.5);
}
.demo-footer a { color: #a1a1aa; text-decoration: none; }
.demo-footer a:hover { color: #fff; }

/* ---------- Video.js overrides ---------- */
.video-js { width: 100% !important; aspect-ratio: 16/9; border-radius: 0.75rem; overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .demo-nav { gap: 0.5rem; padding: 0.5rem 1rem; }
  .demo-main { padding: 1.25rem 1rem; }
  .demo-title { font-size: 1.25rem; }
}
