/* ==========================================================
   ScopeForge Design System
   Dark, editorial, professional. Built for technical users.
   ========================================================== */

:root {
  --bg-deep: #0B1120;
  --bg-surface: #131B2E;
  --bg-elevated: #1E293B;
  --bg-input: #0F172A;
  --amber: #D97706;
  --amber-light: #F59E0B;
  --amber-dim: #92400E;
  --amber-glow: rgba(217, 119, 6, 0.12);
  --emerald: #10B981;
  --emerald-glow: rgba(16, 185, 129, 0.12);
  --red: #EF4444;
  --red-glow: rgba(239, 68, 68, 0.12);
  --yellow: #EAB308;
  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #64748B;
  --text-dim: #475569;
  --border: rgba(148, 163, 184, 0.1);
  --border-focus: rgba(217, 119, 6, 0.4);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
::selection { background: var(--amber); color: var(--bg-deep); }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text-secondary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 3px; }

/* --- Typography --- */
h1, h2, h3 { color: var(--text-primary); }
.serif { font-family: 'Instrument Serif', Georgia, serif; }
a { color: var(--amber); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--amber-light); }

/* --- Layout --- */
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 680px; margin: 0 auto; padding: 0 24px; }

/* ===== NAVBAR ===== */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11, 17, 32, 0.88);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.navbar .container {
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: 'Instrument Serif', serif;
  font-size: 22px; font-weight: 400; text-decoration: none;
}
.nav-logo .scope { color: var(--text-primary); }
.nav-logo .forge { color: var(--amber); }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a {
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  text-decoration: none; transition: color var(--transition);
}
.nav-links a:hover { color: var(--text-primary); }
.nav-user {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--text-muted);
}
.nav-plan {
  padding: 3px 10px;
  background: var(--amber-glow);
  border: 1px solid rgba(217,119,6,0.2);
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  color: var(--amber); text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px;
  border: none; border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: all var(--transition);
  line-height: 1.2;
}
.btn-primary {
  background: linear-gradient(135deg, #B45309, #D97706);
  color: #fff;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(217,119,6,0.3); color: #fff; }
.btn-primary:disabled { background: var(--text-dim); cursor: not-allowed; transform: none; box-shadow: none; }

.btn-emerald {
  background: linear-gradient(135deg, #059669, #10B981);
  color: #fff;
}
.btn-emerald:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(16,185,129,0.3); color: #fff; }
.btn-emerald:disabled { background: var(--text-dim); cursor: not-allowed; transform: none; box-shadow: none; }

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

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-full { width: 100%; }
.btn-copy {
  padding: 6px 14px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
}
.btn-copy:hover { border-color: var(--amber); color: var(--amber); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-dim); }
.form-textarea { resize: vertical; min-height: 140px; line-height: 1.7; }
.form-select { appearance: auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 8px; margin-bottom: 32px; }
.tab {
  flex: 1;
  padding: 14px 20px;
  background: rgba(30, 41, 59, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all var(--transition);
}
.tab:hover { border-color: var(--text-dim); color: var(--text-secondary); }
.tab.active {
  background: var(--amber-glow);
  border-color: rgba(217,119,6,0.3);
  color: var(--text-primary);
  font-weight: 600;
}
.tab.active-emerald {
  background: var(--emerald-glow);
  border-color: rgba(16,185,129,0.3);
  color: var(--text-primary);
  font-weight: 600;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

/* ===== OUTPUT PANEL ===== */
.output-panel {
  margin-top: 28px;
  padding: 28px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  animation: fadeIn 0.3s ease;
}
.output-panel .toolbar {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-bottom: 16px;
}

/* Markdown rendering */
.md-body { font-size: 14px; line-height: 1.75; color: var(--text-secondary); }
.md-body h1 {
  font-family: 'Instrument Serif', serif;
  font-size: 22px; font-weight: 400;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(217,119,6,0.2);
}
.md-body h2 {
  font-family: 'Instrument Serif', serif;
  font-size: 18px; font-weight: 400;
  color: var(--amber);
  margin: 28px 0 12px 0;
}
.md-body h3 {
  font-size: 15px; font-weight: 600;
  color: var(--text-primary);
  margin: 20px 0 8px 0;
}
.md-body p { margin: 0 0 10px 0; }
.md-body strong { color: var(--text-primary); }
.md-body em { color: var(--text-secondary); }
.md-body ul, .md-body ol { margin: 8px 0 12px 24px; }
.md-body li { margin: 4px 0; line-height: 1.6; }
.md-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}
.md-body blockquote {
  margin: 12px 0;
  padding: 12px 18px;
  border-left: 3px solid var(--amber);
  background: var(--amber-glow);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-primary);
}

/* ===== VERDICT BADGES ===== */
.verdict-in { color: var(--emerald); font-weight: 700; }
.verdict-out { color: var(--red); font-weight: 700; }
.verdict-ambiguous { color: var(--yellow); font-weight: 700; }

/* ===== USAGE BAR ===== */
.usage-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 24px;
}
.usage-bar .count { color: var(--text-primary); font-weight: 600; }
.usage-bar .separator { color: var(--text-dim); }

/* ===== SECTION HEADERS ===== */
.section-header {
  display: flex; gap: 16px; align-items: flex-start;
  margin-bottom: 28px;
}
.section-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  font-size: 22px; flex-shrink: 0;
}
.section-icon.amber { background: var(--amber-glow); }
.section-icon.emerald { background: var(--emerald-glow); }
.section-title {
  font-family: 'Instrument Serif', serif;
  font-size: 24px; font-weight: 400;
  color: var(--text-primary); margin: 0;
}
.section-desc {
  font-size: 14px; color: var(--text-muted);
  margin: 4px 0 0 0; line-height: 1.5;
}

/* ===== EXAMPLE BUTTON ===== */
.btn-example {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: var(--amber-glow);
  border: 1px solid rgba(217,119,6,0.2);
  border-radius: var(--radius-sm);
  color: var(--amber);
  font-size: 12px; font-weight: 500;
  cursor: pointer; margin-bottom: 20px;
  font-family: 'DM Sans', sans-serif;
}
.btn-example:hover { background: rgba(217,119,6,0.18); }

/* ===== LOADING ===== */
.loading {
  display: flex; align-items: center; gap: 8px;
  padding: 20px 0;
}
.loading-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--amber);
  animation: pulse 1.4s ease-in-out infinite;
}
.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }
.loading-text { color: var(--text-muted); font-size: 13px; margin-left: 4px; }

/* ===== ALERTS ===== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 20px;
}
.alert-error {
  background: var(--red-glow);
  border: 1px solid rgba(239,68,68,0.2);
  color: #FCA5A5;
}
.alert-success {
  background: var(--emerald-glow);
  border: 1px solid rgba(16,185,129,0.2);
  color: #6EE7B7;
}
.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #93C5FD;
}

/* ===== AUTH PAGES ===== */
.auth-page {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 120px);
  padding: 40px 0;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
}
.auth-card h1 {
  font-family: 'Instrument Serif', serif;
  font-size: 28px; font-weight: 400;
  text-align: center; margin-bottom: 8px;
}
.auth-card .subtitle {
  text-align: center; color: var(--text-muted);
  font-size: 14px; margin-bottom: 32px;
}
.auth-footer {
  text-align: center; margin-top: 24px;
  font-size: 14px; color: var(--text-muted);
}

/* ===== PRICING PAGE ===== */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 48px;
}
.price-card {
  padding: 36px 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
}
.price-card.featured {
  border-color: var(--border-focus);
  background: linear-gradient(180deg, rgba(217,119,6,0.04), var(--bg-surface));
}
.price-card.featured::before {
  content: 'MOST POPULAR';
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  padding: 4px 14px;
  background: linear-gradient(135deg, #B45309, #D97706);
  border-radius: 100px;
  font-size: 10px; font-weight: 700;
  color: #fff; letter-spacing: 0.1em;
}
.price-name {
  font-size: 13px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.08em; margin-bottom: 8px;
}
.price-amount {
  font-family: 'Instrument Serif', serif;
  font-size: 48px; color: var(--text-primary);
  margin-bottom: 4px; line-height: 1;
}
.price-amount span { font-size: 16px; color: var(--text-muted); font-family: 'DM Sans', sans-serif; }
.price-desc { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.price-features { list-style: none; margin-bottom: 28px; }
.price-features li {
  font-size: 14px; color: var(--text-secondary);
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.price-features li:last-child { border-bottom: none; }
.check { color: var(--emerald); font-weight: 700; }

/* ===== FOOTER ===== */
.footer {
  padding: 36px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 60px;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  .tabs { flex-direction: column; }
  .nav-links { gap: 14px; }
}
