/* app.css — DiagFlow application pages (vehicle selector, known problems, flowchart)
   Extends theme.css design tokens. Never duplicates base resets or font imports. */

/* ── App Header ─────────────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 12, 16, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}

.app-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-logo {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-decoration: none;
}

.app-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.app-nav-link {
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.app-nav-link:hover { color: var(--fg); }

/* ── Page Layout ─────────────────────────────────────────────────────────── */
.app-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 2rem 6rem;
}

.page-hero {
  text-align: center;
  margin-bottom: 3rem;
}

.page-hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 1.25rem 0 1rem;
}

.page-lede {
  font-size: 1rem;
  color: var(--fg-muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
}

.engine-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 0.3rem 0.9rem;
  border-radius: 2px;
  margin-top: 0.5rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.75rem 1.75rem;
  border-radius: 4px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.88; }

.btn-secondary {
  display: inline-block;
  background: var(--bg-elevated);
  color: var(--fg);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.65rem 1.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s;
}
.btn-secondary:hover { border-color: var(--fg-muted); }

.btn-outline {
  display: inline-block;
  background: transparent;
  color: var(--fg-muted);
  font-size: 0.88rem;
  padding: 0.65rem 1.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  text-decoration: none;
  transition: color 0.15s;
}
.btn-outline:hover { color: var(--fg); }

/* ── Vehicle Selector ─────────────────────────────────────────────────────── */
.selector-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2.5rem;
}

.selector-steps { display: flex; flex-direction: column; gap: 2.5rem; }

.selector-step { }

.step-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.step-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.1em;
  background: rgba(245,158,11,0.1);
  border: 1px solid var(--accent-dim);
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
}

.step-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
}

.select-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.select-chip {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.select-chip:hover { border-color: var(--fg-muted); }
.select-chip.active {
  background: rgba(245,158,11,0.12);
  border-color: var(--accent);
  color: var(--accent);
}
.select-chip.disabled { opacity: 0.45; cursor: default; }

.select-loading, .select-empty, .select-error {
  font-size: 0.85rem;
  color: var(--fg-muted);
  font-style: italic;
}
.select-error { color: var(--red); }

.selection-summary {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.summary-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
}

.summary-value {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--fg);
  flex: 1;
}

/* Demo prompt under selector */
.demo-prompt {
  text-align: center;
  margin-top: 2.5rem;
  font-size: 0.875rem;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.demo-prompt-label { }
.demo-prompt-link { color: var(--accent); text-decoration: none; }
.demo-prompt-link:hover { text-decoration: underline; }

/* ── Known Problems Page ──────────────────────────────────────────────────── */
.problems-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.problems-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.freq-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--fg-muted);
  letter-spacing: 0.05em;
}

.freq-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.freq-dot.high { background: var(--red); }
.freq-dot.med  { background: var(--accent); }
.freq-dot.low  { background: var(--blue); }

.problems-list { display: flex; flex-direction: column; gap: 1.5rem; }

.problem-card-full {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.75rem;
  border-left: 4px solid var(--border);
}

.problem-card-full.freq-high { border-left-color: var(--red); }
.problem-card-full.freq-med  { border-left-color: var(--accent); }
.problem-card-full.freq-low  { border-left-color: var(--blue); }

.pcf-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.pcf-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.freq-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.55rem;
  border-radius: 2px;
  flex-shrink: 0;
}
.freq-badge.freq-high { background: rgba(239,68,68,0.15); color: var(--red); }
.freq-badge.freq-med  { background: rgba(245,158,11,0.15); color: var(--accent); }
.freq-badge.freq-low  { background: rgba(59,130,246,0.15); color: var(--blue); }

.pcf-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.tsb-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0.2rem;
}

.pcf-description {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.pcf-codes {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pcf-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  text-transform: uppercase;
}

.code-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.code-chip {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--fg);
}

.fast-fix {
  background: rgba(34,197,94,0.05);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 4px;
  padding: 1rem 1.25rem;
}

.fast-fix-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--green);
  margin-bottom: 0.5rem;
}

.fast-fix-text {
  font-size: 0.875rem;
  color: var(--fg);
  line-height: 1.65;
}

/* Flowchart CTA on vehicle page */
.flowchart-cta {
  margin-top: 3.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2.5rem;
  text-align: center;
}

.flowchart-cta-inner { max-width: 520px; margin: 0 auto; }

.flowchart-cta h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 1rem 0 0.75rem;
  letter-spacing: -0.02em;
}

.flowchart-cta p {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--fg-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h2 { font-size: 1.3rem; color: var(--fg); margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.9rem; line-height: 1.7; }
.empty-state a { color: var(--accent); }

/* ── Flowchart Page ───────────────────────────────────────────────────────── */
.fc-progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 2.5rem;
  overflow: hidden;
}

.fc-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

.fc-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.fc-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.75rem;
}

.fc-step-num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.fc-question {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.fc-context {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.65;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border-radius: 4px;
  border-left: 3px solid var(--border);
}

.fc-choices { display: flex; flex-direction: column; gap: 0.6rem; }

.fc-choice {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  padding: 0.75rem 1.1rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: border-color 0.15s, background 0.15s;
}
.fc-choice:hover:not(.disabled) { border-color: var(--fg-muted); background: var(--bg-elevated); }
.fc-choice.selected { border-color: var(--accent); background: rgba(245,158,11,0.08); color: var(--accent); }
.fc-choice.disabled { opacity: 0.45; cursor: default; pointer-events: none; }

.fc-choice-icon {
  font-size: 0.75rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.5;
}

/* Result panel */
.fc-result {
  border-radius: 8px;
  padding: 2rem;
  margin-top: 1rem;
  border: 1px solid var(--border);
}

.fc-result.outcome-fix {
  background: rgba(34,197,94,0.06);
  border-color: rgba(34,197,94,0.25);
}

.fc-result.outcome-escalate {
  background: rgba(59,130,246,0.06);
  border-color: rgba(59,130,246,0.25);
}

.fc-result-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--green);
  margin-bottom: 0.75rem;
}
.outcome-escalate .fc-result-badge { color: var(--blue); }

.fc-result-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.fc-result-steps-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
}

.fc-steps-list {
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.fc-steps-list li {
  font-size: 0.9rem;
  color: var(--fg);
  line-height: 1.65;
}

.fc-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.fc-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.fc-meta-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
}

.fc-meta-item > span:last-child {
  font-size: 0.88rem;
  color: var(--fg);
  font-weight: 500;
}

.fc-restart {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Fade-in animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease forwards; }

/* Utility */
.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .app-main { padding: 2rem 1.25rem 4rem; }
  .selector-card { padding: 1.5rem; }
  .selection-summary { flex-direction: column; align-items: flex-start; }
  .pcf-header { flex-direction: column; }
  .problems-header { flex-direction: column; align-items: flex-start; }
  .fc-restart { flex-direction: column; }
}
