/* ==========================================================================
   HELLO WORLD STARTER — DESIGN TOKENS & MONOWIDTH THEME
   ========================================================================== */

:root {
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Roboto Mono', Menlo, Monaco, Consolas, monospace;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Color Palette - Dark Theme Default */
  --bg-primary: #090a0f;
  --bg-secondary: #0f111a;
  --bg-tertiary: #161926;
  --bg-card: rgba(16, 18, 28, 0.85);
  --bg-input: #0b0d14;
  --bg-code: #07080c;
  --bg-highlight: rgba(255, 255, 255, 0.04);

  --border-subtle: #1e2235;
  --border-medium: #2a3048;
  --border-focus: #4e5a80;

  --text-main: #f0f3fc;
  --text-muted: #8b95b2;
  --text-dim: #545d7a;
  
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.15);
  --accent-blue: #38bdf8;
  --accent-amber: #f59e0b;
  --accent-purple: #a855f7;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 15px rgba(56, 189, 248, 0.12);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --bg-code: #0f172a;
  --bg-highlight: rgba(0, 0, 0, 0.03);

  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #64748b;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --accent-green: #059669;
  --accent-green-glow: rgba(5, 150, 105, 0.12);
  --accent-blue: #0284c7;
  --accent-amber: #d97706;
  --accent-purple: #9333ea;

  --shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 0 12px rgba(2, 132, 199, 0.08);
}

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

html, body {
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: 
    radial-gradient(var(--border-subtle) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ==========================================================================
   MONOWIDTH LABELS & BADGES (Core Design Element)
   ========================================================================== */

.mono-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mono-label.section-tag {
  color: var(--accent-blue);
  font-weight: 600;
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.mono-label.brand-badge {
  color: var(--text-main);
  font-weight: 600;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.status-ok {
  color: var(--accent-green);
  font-weight: 600;
}

.mono-label.request-counter-pill {
  background: var(--bg-tertiary);
  padding: 4px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.mono-label.request-counter-pill span {
  color: var(--accent-blue);
  font-weight: 600;
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */

.layout-wrapper {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px 60px 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 36px;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 40px;
  flex: 1;
}

/* ==========================================================================
   BUTTONS & CONTROLS
   ========================================================================== */

button {
  font-family: var(--font-mono);
  cursor: pointer;
  border: none;
  background: none;
  transition: all 0.15s ease;
}

.mono-btn-ghost {
  padding: 5px 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.mono-btn-ghost:hover {
  border-color: var(--border-medium);
  color: var(--text-main);
  background: var(--bg-highlight);
}

.mono-btn-ghost-sm {
  padding: 3px 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.mono-btn-ghost-sm:hover {
  border-color: var(--border-medium);
  color: var(--text-main);
}

.mono-btn-copy {
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
}

.mono-btn-copy:hover {
  background: var(--bg-highlight);
  border-color: var(--accent-blue);
}

.mono-btn-primary {
  background: var(--text-main);
  color: var(--bg-primary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  border: 1px solid transparent;
}

.mono-btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

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

.mono-btn-run {
  background: var(--accent-blue);
  color: #ffffff;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.mono-btn-run:hover {
  opacity: 0.9;
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */

.hero-section {
  padding: 24px 0 10px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-top-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.latency-tag {
  color: var(--accent-green);
  font-weight: 600;
}

.hero-title {
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-main);
  display: flex;
  align-items: baseline;
}

.text-gradient {
  background: linear-gradient(135deg, var(--text-main) 30%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cursor-blink {
  display: inline-block;
  color: var(--accent-blue);
  font-weight: 400;
  animation: blink 1s infinite step-start;
  margin-left: 2px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hero-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 620px;
  line-height: 1.6;
}

.quick-curl-bar {
  display: flex;
  align-items: center;
  background: var(--bg-code);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 6px 8px 6px 14px;
  margin-top: 8px;
  max-width: 600px;
  box-shadow: var(--shadow-glow);
}

.prompt-symbol {
  color: var(--accent-green);
  font-weight: 700;
  margin-right: 10px;
}

.curl-code-text {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #e2e8f0;
  flex: 1;
  overflow-x: auto;
  white-space: nowrap;
}

/* ==========================================================================
   SECTION COMMON
   ========================================================================== */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.header-with-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.helper-text {
  color: var(--text-dim);
  font-size: 10px;
}

/* ==========================================================================
   TERMINAL CARD (Section 02 - Code Snippets)
   ========================================================================== */

.terminal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 6px 12px;
  overflow-x: auto;
}

.terminal-tabs {
  display: flex;
  gap: 4px;
}

.tab-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 12px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-highlight);
}

.tab-btn.active {
  color: var(--text-main);
  background: var(--bg-primary);
  border-color: var(--border-medium);
  font-weight: 600;
}

.terminal-code-body {
  padding: 16px 20px;
  background: var(--bg-code);
  overflow-x: auto;
}

.code-block {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: #e2e8f0;
  white-space: pre;
}

.terminal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}

.snippet-meta {
  display: flex;
  gap: 12px;
}

/* ==========================================================================
   INSPECTOR CARD (Section 03 - Live API)
   ========================================================================== */

.inspector-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.request-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.method-selector {
  display: flex;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-primary);
}

.method-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  color: var(--text-muted);
}

.method-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
}

.endpoint-input-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 280px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
}

.endpoint-prefix {
  color: var(--accent-blue);
  font-weight: 600;
}

.get-params-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.param-divider {
  color: var(--text-dim);
}

.mono-input {
  font-family: var(--font-mono);
  font-size: 12px;
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 4px 6px;
  outline: none;
  flex: 1;
}

.mono-input:focus {
  background: var(--bg-highlight);
  border-radius: 2px;
}

.mono-select {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  outline: none;
}

.post-body-config {
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}

.post-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.response-window {
  display: flex;
  flex-direction: column;
}

.response-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.res-meta-left {
  display: flex;
  gap: 12px;
}

.res-status-tag {
  color: var(--accent-green);
  font-weight: 600;
}

.response-body {
  padding: 16px 20px;
  background: var(--bg-code);
  min-height: 140px;
  max-height: 320px;
  overflow-y: auto;
}

.json-code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Syntax Highlight classes */
.json-key { color: #38bdf8; }
.json-string { color: #34d399; }
.json-number { color: #f59e0b; }
.json-boolean { color: #a855f7; }
.json-null { color: #94a3b8; }

/* ==========================================================================
   SECTION 04: MONOSPACE TABLE (SQLite Activity)
   ========================================================================== */

.activity-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.activity-table-wrapper {
  overflow-x: auto;
}

.mono-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 12px;
}

.mono-table th {
  background: var(--bg-secondary);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 500;
}

.mono-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.mono-table tr:last-child td {
  border-bottom: none;
}

.mono-table tr:hover td {
  background: var(--bg-highlight);
}

.text-right {
  text-align: right;
}

.badge-method {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}

.badge-method.GET {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-method.POST {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.table-empty {
  text-align: center;
  padding: 30px !important;
  color: var(--text-dim);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.footer {
  margin-top: 50px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-left, .footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

kbd {
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: 3px;
  padding: 2px 5px;
  font-size: 10px;
  color: var(--text-main);
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  animation: toastIn 0.2s ease-out forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(10px); }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .nav-right {
    width: 100%;
    justify-content: space-between;
  }
  .hero-title {
    font-size: 32px;
  }
  .post-config-grid {
    grid-template-columns: 1fr;
  }
  .request-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .send-btn {
    width: 100%;
    justify-content: center;
  }
}
