/* ============================================================
   AWS Service Picker — styles
   A developer-focused, dark-mode first design with a clean,
   modern feel. Minimal palette: deep navy background, orange
   accent (a nod to AWS), white text, muted secondary text.
   ============================================================ */

/* --- Reset & tokens ---------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
:root {
  --bg-0: #0b0f19;
  --bg-1: #111827;
  --bg-2: #1a2236;
  --bg-3: #243049;
  --border: #2a3554;
  --text: #e8ecf4;
  --muted: #8892a6;
  --accent: #f59e0b;
  --accent2: #f97316;
  --accent-soft: rgba(245, 158, 11, 0.12);
  --green: #22c55e;
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --green-soft: rgba(34, 197, 94, 0.12);
  --blue: #3b82f6;
  --blue-soft: rgba(59, 130, 246, 0.12);
  --purple: #a78bfa;
  --purple-soft: rgba(167, 139, 250, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 260px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Fira Code', monospace;
  --transition: 180ms ease;
}
html {
  font-size: 15px;
  scroll-behavior: smooth;
}
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 2.25rem; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }

/* --- Utility classes --------------------------------------- */
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.row { display: flex; align-items: center; }
.row.gap { gap: 12px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.full { width: 100%; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* --- Layout shell ------------------------------------------ */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 90;
  transition: transform var(--transition);
}
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Brand ------------------------------------------------- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #000;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 1rem; }
.brand-sub { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

/* --- Nav --------------------------------------------------- */
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-ico { font-size: 1.05rem; width: 20px; text-align: center; }

.sidebar-foot { margin-top: auto; padding-top: 16px; }
.engine-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.engine-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
}

/* --- Top bar ----------------------------------------------- */
.topbar {
  height: 56px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-weight: 600; font-size: 0.95rem; }
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

/* --- Buttons ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #000;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn.outline:hover { border-color: var(--muted); }
.btn.ghost {
  background: transparent;
  color: var(--muted);
  padding: 9px 10px;
}
.btn.ghost:hover { color: var(--text); }
.btn.lg { padding: 12px 26px; font-size: 1rem; border-radius: var(--radius); }
.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
}
.icon-btn:hover { color: var(--text); }

.chip {
  font: inherit;
  font-size: 0.78rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.chip:hover { border-color: var(--accent); }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
}
.toggle input { accent-color: var(--accent); cursor: pointer; }

/* --- Inputs ------------------------------------------------ */
.input-area {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  padding: 14px 16px;
  resize: vertical;
  line-height: 1.5;
  transition: border-color var(--transition);
  margin: 12px 0;
}
.input-area::placeholder { color: var(--muted); }
.input-area:focus { border-color: var(--accent); outline: none; }

.text-input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  padding: 10px 14px;
  margin: 8px 0 12px;
}
.text-input:focus { border-color: var(--accent); outline: none; }

.field-label { font-size: 0.82rem; color: var(--muted); margin-top: 12px; }

/* --- Views ------------------------------------------------- */
.view { display: none; padding: 32px 28px 60px; max-width: 1120px; }
.view.active { display: block; }

/* --- Hero -------------------------------------------------- */
.hero { text-align: center; padding: 40px 0 36px; }
.hero-tag {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.hero-lead {
  max-width: 600px;
  margin: 14px auto 24px;
  color: var(--muted);
  font-size: 1.05rem;
}
.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.flow-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 36px;
  padding: 14px 20px;
  background: var(--bg-2);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}
.flow-strip span {
  color: var(--text);
  background: var(--bg-3);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}
.flow-strip i { font-style: normal; color: var(--accent); }

/* --- Feature grid ------------------------------------------ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 8px;
}
.feature-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.feature-ico {
  font-size: 1.4rem;
  margin-bottom: 8px;
}
.feature-card h3 { font-size: 0.95rem; margin-bottom: 4px; }
.feature-card p { font-size: 0.84rem; color: var(--muted); }

/* --- Panel ------------------------------------------------- */
.panel {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.examples {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 4px 0 16px;
}

/* --- Alert ------------------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-top: 12px;
}
.alert.error { background: var(--red-soft); color: var(--red); border: 1px solid rgba(239,68,68,0.25); }

/* --- Results ----------------------------------------------- */
.results-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.summary-card {
  background: var(--bg-1);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 28px;
}
.results-cols {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
}
.section-h {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 12px;
  margin-top: 28px;
}
.section-h:first-child { margin-top: 0; }

/* Recommendations */
.rec-list { display: flex; flex-direction: column; gap: 14px; }
.rec-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--transition);
}
.rec-card:hover { border-color: var(--accent); }
.rec-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.rec-name { font-weight: 700; font-size: 1rem; }
.rec-cat {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
}
.cat-compute   { background: var(--blue-soft); color: var(--blue); }
.cat-storage   { background: var(--green-soft); color: var(--green); }
.cat-database  { background: var(--purple-soft); color: var(--purple); }
.cat-ai        { background: var(--accent-soft); color: var(--accent); }
.cat-networking { background: rgba(99,102,241,0.12); color: #818cf8; }
.cat-security  { background: rgba(239,68,68,0.10); color: #f87171; }
.cat-integration { background: rgba(45,212,191,0.12); color: #2dd4bf; }
.cat-observability { background: rgba(251,191,36,0.12); color: #fbbf24; }
.rec-purpose { font-size: 0.9rem; margin: 4px 0 8px; color: var(--text); }
.rec-why { font-size: 0.84rem; color: var(--muted); }
.rec-meta {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--muted);
  flex-wrap: wrap;
  align-items: center;
}
.rec-meta strong { color: var(--text); font-weight: 600; }
.match-bar {
  width: 60px;
  height: 6px;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
}
.match-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}
.btn-whynot {
  font-size: 0.78rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-left: auto;
  transition: border-color var(--transition), color var(--transition);
}
.btn-whynot:hover { border-color: var(--accent); color: var(--accent); }

/* Architecture */
.arch-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.arch-ascii {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--accent);
  overflow-x: auto;
  margin-bottom: 10px;
  white-space: pre;
}

/* Checklist */
.checklist {
  list-style: none;
  counter-reset: step;
  padding: 0;
}
.checklist li {
  counter-increment: step;
  display: flex;
  align-items: start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.checklist li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-3);
  display: grid;
  place-items: center;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent);
}
.checklist li.done { color: var(--muted); text-decoration: line-through; }
.checklist li.done::before { background: var(--green); color: #000; }

/* Requirements sidebar */
.req-list { display: flex; flex-direction: column; gap: 10px; }
.req-chip {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.req-type {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}
.req-need { font-size: 0.88rem; font-weight: 600; margin-bottom: 2px; }
.req-detail { font-size: 0.8rem; color: var(--muted); }

/* --- Projects ---------------------------------------------- */
.projects-list { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.project-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.project-card:hover { border-color: var(--accent); }
.project-name { font-weight: 600; margin-bottom: 2px; }
.project-problem { font-size: 0.84rem; color: var(--muted); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.project-date { font-size: 0.74rem; color: var(--muted); }

/* --- Architecture review ----------------------------------- */
.review-results { margin-top: 24px; }
.findings-section { margin-bottom: 20px; }
.findings-section h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 8px; }
.finding-item {
  background: var(--bg-2);
  border-left: 3px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  margin-bottom: 6px;
  color: var(--text);
}
.findings-section.security .finding-item { border-left-color: var(--red); }
.findings-section.missing .finding-item  { border-left-color: var(--accent); }
.findings-section.cost .finding-item     { border-left-color: var(--green); }
.findings-section.scalability .finding-item { border-left-color: var(--blue); }
.findings-section.alternatives .finding-item { border-left-color: var(--purple); }

/* --- Modal ------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: grid;
  place-items: center;
  z-index: 200;
}
.modal {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 500px;
  max-width: 94vw;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-body { padding: 20px; }
.whynot-answer {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 16px;
}
.whynot-answer p { margin-bottom: 10px; font-size: 0.9rem; }
.whynot-answer strong { color: var(--accent); font-weight: 600; }

/* --- Save modal (inline dialog) ---------------------------- */
#saveProjectBtn.saved { pointer-events: none; opacity: 0.6; }

/* --- Loading ----------------------------------------------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: grid;
  place-items: center;
  z-index: 300;
}
.loader {
  text-align: center;
}
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader p { color: var(--muted); font-size: 0.88rem; }

/* --- Toast ------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 22px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  z-index: 400;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
  transition: opacity 0.3s;
}
.toast.hidden { opacity: 0; pointer-events: none; }

/* --- Empty state ------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  max-width: 400px;
  margin: 0 auto;
}
.empty-ico { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state h3 { margin-bottom: 4px; }
.empty-state .btn { margin-top: 18px; }

/* --- Responsive -------------------------------------------- */
@media (max-width: 900px) {
  .results-cols { grid-template-columns: 1fr; }
  .col-side { order: -1; }
}
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
  }
  .hamburger {
    display: block;
  }
  .hero h1 { font-size: 1.6rem; }
  .view { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; }
}
@media (max-width: 480px) {
  .hero-actions { flex-direction: column; align-items: stretch; }
  .results-head { flex-direction: column; }
}
