/* report-gen web UI — dark professional theme */
:root {
  --bg: #0a0a1a;
  --surface: #111128;
  --card: #161633;
  --card-hover: #1a1a3a;
  --border: #1e1e3f;
  --border-soft: #232349;
  --text: #d4d4e8;
  --text-strong: #ffffff;
  --muted: #7a7a9a;
  --accent: #00d4aa;
  --accent-dim: rgba(0, 212, 170, 0.12);
  --gold: #ffd700;
  --orange: #ff8800;
  --red: #ef4444;
  --blue: #0088ff;
  --green: #00ff88;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

code, pre, .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 0.7rem; align-items: center; padding: 0 0.5rem 1.2rem; border-bottom: 1px solid var(--border); }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.brand-name { font-weight: 800; color: var(--text-strong); font-size: 1.05rem; letter-spacing: 0.02em; }
.brand-sub { font-size: 0.7rem; color: var(--muted); }

nav { flex: 1; margin-top: 1rem; }
.nav-section { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin: 1rem 0.5rem 0.4rem; }
.nav-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.7rem; margin: 2px 0;
  color: var(--text); text-decoration: none;
  border-radius: 8px; font-size: 0.9rem; font-weight: 500;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.nav-item:hover { background: var(--card); color: var(--text-strong); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.nav-ico { width: 18px; text-align: center; opacity: 0.85; }
.sidebar-foot { font-size: 0.68rem; color: var(--muted); padding: 1rem 0.5rem 0; border-top: 1px solid var(--border); }

/* ── Main ── */
.main { flex: 1; padding: 2rem 2.5rem; max-width: 1100px; }

.page-head { margin-bottom: 1.6rem; }
.page-head .kicker { color: var(--accent); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.page-head h1 { color: var(--text-strong); font-size: 1.7rem; font-weight: 800; margin-top: 0.2rem; }
.page-head .sub { color: var(--muted); font-size: 0.92rem; margin-top: 0.3rem; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow);
}
.card h2 { color: var(--text-strong); font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; }
.card h3 { color: var(--text-strong); font-size: 0.95rem; margin: 0.8rem 0 0.4rem; }

/* ── Stats ── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.8rem; margin-bottom: 1.2rem; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem; text-align: center;
}
.stat .num { font-size: 1.7rem; font-weight: 800; color: var(--text-strong); line-height: 1.1; }
.stat .lbl { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.2rem; }

/* ── Buttons ── */
/* .theme-btn: light & dark PDF buttons share .btn so they render identically */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 1.1rem; border-radius: 8px;
  font-size: 0.88rem; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border-soft);
  background: var(--card); color: var(--text);
  text-decoration: none; transition: all 0.15s;
}
.btn:hover { background: var(--card-hover); color: var(--text-strong); transform: translateY(-1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04121a; }
.btn.primary:hover { background: #00e6b8; color: #04121a; }
.btn.danger { border-color: rgba(239, 68, 68, 0.4); color: var(--red); }
.btn.danger:hover { background: rgba(239, 68, 68, 0.12); }
.btn.ghost { background: transparent; }
.btn.small { padding: 0.3rem 0.7rem; font-size: 0.78rem; }
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

/* ── Forms ── */
label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text); margin: 0.9rem 0 0.35rem; }
label .req { color: var(--red); }
input, textarea, select {
  width: 100%; padding: 0.6rem 0.8rem;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border-soft); border-radius: 8px;
  font-size: 0.9rem; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
}
textarea { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.4rem; }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th {
  text-align: left; color: var(--text-strong); font-weight: 600;
  padding: 0.6rem 0.8rem; background: var(--card);
  border-bottom: 1px solid var(--border); font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
}
td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }
.muted { color: var(--muted); }
.mono { font-size: 0.85em; }

/* ── Severity ── */
.badge {
  display: inline-block; padding: 0.14rem 0.6rem; border-radius: 99px;
  font-size: 0.72rem; font-weight: 700; color: #04121a; white-space: nowrap;
}
.sev-critical { background: #ef4444; }
.sev-high { background: #ff8800; }
.sev-medium { background: #ffd700; }
.sev-low { background: #0088ff; }
.sev-info { background: #7a7a9a; color: #fff; }

/* ── Finding list ── */
.finding-row {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 0.9rem 1rem; border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 0.6rem; background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}
.finding-row:hover { border-color: var(--border-soft); background: var(--card); }
.finding-row .fid { color: var(--muted); font-size: 0.78rem; min-width: 46px; font-family: 'JetBrains Mono', monospace; }
.finding-row .fbody { flex: 1; }
.finding-row .ftitle { color: var(--text-strong); font-weight: 600; font-size: 0.94rem; }
.finding-row .fmeta { color: var(--muted); font-size: 0.78rem; margin-top: 0.15rem; }
.finding-row .factions { display: flex; gap: 0.4rem; }

/* ── Empty state ── */
.empty {
  text-align: center; padding: 3rem 1.5rem; color: var(--muted);
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty .big { font-size: 2rem; margin-bottom: 0.6rem; }

/* ── Checklist ── */
.check-item {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.55rem 0.8rem; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 0.4rem; background: var(--surface);
}
.check-item .name { flex: 1; font-size: 0.88rem; }
.check-item.done .name { color: var(--muted); text-decoration: line-through; }
.status-pill { font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 99px; }
.status-pending { background: rgba(255, 215, 0, 0.15); color: var(--gold); }
.status-done { background: rgba(0, 255, 136, 0.12); color: var(--green); }
.status-n\/a { background: rgba(122, 122, 154, 0.2); color: var(--muted); }
select.status-select { width: auto; padding: 0.25rem 0.5rem; font-size: 0.75rem; }

/* ── Category picker ── */
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
/* landing-page module picker: 3 across on desktop, 1 column on phones */
.mod-grid { grid-template-columns: repeat(3, 1fr); }
.cat-option {
  border: 1px solid var(--border); border-radius: 10px; padding: 0.7rem 0.9rem;
  cursor: pointer; background: var(--surface); transition: all 0.15s;
  position: relative;
}
.cat-option:hover { border-color: var(--accent); background: var(--card); }
.cat-option.selected {
  border: 2px solid var(--accent); background: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.18), 0 2px 12px rgba(0, 212, 170, 0.15);
  transform: translateY(-1px);
}
.cat-option input { position: absolute; opacity: 0; }
.cat-option .code { color: var(--accent); font-weight: 700; font-size: 0.78rem; font-family: 'JetBrains Mono', monospace; }
.cat-option .cname { color: var(--text-strong); font-weight: 600; font-size: 0.88rem; }
.cat-option .check-mark {
  position: absolute; top: 0.5rem; right: 0.6rem;
  display: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); color: #04121a;
  font-size: 0.7rem; font-weight: 800; line-height: 18px; text-align: center;
}
.cat-option.selected .check-mark { display: block; }
.cat-panel {
  margin-top: 1rem; padding: 1rem 1.2rem; border-left: 3px solid var(--accent);
  background: var(--accent-dim); border-radius: 0 10px 10px 0;
}
.cat-panel h4 { color: var(--accent); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.3rem; }
.cat-panel p { font-size: 0.85rem; }
.cat-panel .rem { margin-top: 0.5rem; }

/* ── CVSS calculator ── */
.cvss-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.7rem; margin: 0.8rem 0; }
.cvss-cell { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.7rem; }
.cvss-cell .clabel { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.cvss-cell .cvalue { font-size: 0.95rem; font-weight: 700; color: var(--text-strong); }
.cvss-cell select { margin-top: 0.3rem; padding: 0.3rem 0.5rem; font-size: 0.78rem; }
.cvss-result {
  margin-top: 0.9rem; padding: 1rem 1.2rem; border-radius: 10px;
  background: var(--card); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap;
}
.cvss-result .score { font-size: 2.2rem; font-weight: 800; color: var(--text-strong); line-height: 1; }
.cvss-result .vec { font-size: 0.75rem; color: var(--muted); font-family: 'JetBrains Mono', monospace; word-break: break-all; }

/* ── Report preview meta ── */
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 0.35rem 1rem; font-size: 0.88rem; }
.kv .k { color: var(--muted); font-weight: 600; }
.kv .v { color: var(--text); }

/* ── Alerts ── */
.alert { padding: 0.8rem 1.1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.88rem; }
.alert.error { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.4); color: #fca5a5; }

/* ── Info button (FAB) ── */
.info-fab {
  position: fixed; right: 1.4rem; bottom: 1.4rem;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: #04121a;
  border: none; font-size: 1.3rem; font-weight: 800;
  cursor: pointer; box-shadow: 0 4px 18px rgba(0, 212, 170, 0.4);
  z-index: 60; transition: transform 0.15s, box-shadow 0.15s;
  font-family: 'Inter', sans-serif;
}
.info-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(0, 212, 170, 0.55); }
.info-fab.pulse { animation: fabPulse 1.6s ease-in-out 3; }
@keyframes fabPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.6); }
  50% { box-shadow: 0 0 0 16px rgba(0, 212, 170, 0); }
}

/* ── Modal ── */
.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 70;
  background: rgba(4, 6, 18, 0.75); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 1rem;
}
.modal {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 16px; max-width: 720px; width: 100%;
  max-height: 86vh; overflow-y: auto; position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.modal-close {
  position: absolute; top: 0.9rem; right: 1rem; z-index: 1;
  background: none; border: none; color: var(--muted);
  font-size: 1.1rem; cursor: pointer; padding: 0.3rem;
}
.modal-close:hover { color: var(--text-strong); }
.modal-body { padding: 1.8rem 2rem 1.6rem; }
.steps { display: grid; gap: 0.55rem; margin: 0.9rem 0; }
.step {
  display: flex; gap: 0.8rem; align-items: flex-start;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.7rem 0.9rem; font-size: 0.88rem;
}
.step-num {
  min-width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent);
  font-weight: 800; font-size: 0.8rem; display: flex;
  align-items: center; justify-content: center;
}
.demo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.demo-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.8rem 0.9rem;
}
.info-foot {
  display: grid; gap: 0.4rem; margin-top: 1.2rem;
  padding-top: 1rem; border-top: 1px solid var(--border);
  font-size: 0.8rem; color: var(--muted);
}

/* ── Screenshot upload ── */
.shot-preview { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.6rem; }
.shot-thumb {
  width: 96px; height: 72px; object-fit: cover;
  border: 1px solid var(--border); border-radius: 8px;
  cursor: zoom-in; transition: transform 0.15s, border-color 0.15s;
  display: block;
}
.shot-thumb:hover { transform: scale(1.04); border-color: var(--accent); }
.shot-strip .shot-thumb { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.shot-preview .shot-thumb { width: 120px; height: 90px; }
.shot-preview > div { text-align: center; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; min-width: 0; height: auto; position: sticky; top: 0; z-index: 50;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.7rem;
    padding: 0.7rem 1rem; border-right: none; border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  }
  .brand { padding: 0; border-bottom: none; gap: 0.5rem; margin-right: 0.4rem; }
  .brand-name { font-size: 0.95rem; }
  .brand-sub { display: none; }
  nav { display: flex; flex-wrap: wrap; margin-top: 0; gap: 0.15rem; }
  .nav-item { padding: 0.4rem 0.6rem; font-size: 0.82rem; margin: 0; }
  .nav-section, .sidebar-foot { display: none; }
  .main { padding: 1.2rem; max-width: none; }
  .form-grid, .cat-grid { grid-template-columns: 1fr; }
  /* module cards on the landing page — inline 3-col grid replaced by this */
  .mod-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .main { padding: 0.9rem; }
  .page-head h1 { font-size: 1.35rem; }
  .card { padding: 1.1rem 1rem; }

  /* key/value rows stack under their labels */
  .kv { grid-template-columns: 1fr; gap: 0.15rem 0; }
  .kv .k { margin-top: 0.45rem; }

  /* finding rows stack: id + title first, actions below */
  .finding-row { flex-wrap: wrap; gap: 0.4rem; padding: 0.8rem; }
  .finding-row .fid { min-width: 0; }
  .finding-row .factions { width: 100%; justify-content: space-between; align-items: center; }

  /* long URLs / vectors wrap instead of overflowing */
  .mono, .fmeta, .kv .v, .cvss-result .vec { overflow-wrap: anywhere; word-break: break-word; }

  /* 16px inputs stop iOS Safari from zooming on focus */
  input, select, textarea { font-size: 16px; }

  /* full-width buttons on small screens */
  .btn-row .btn { flex: 1 1 auto; justify-content: center; }
  .btn-row .btn.small { flex: 0 0 auto; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat .num { font-size: 1.4rem; }
  .demo-grid { grid-template-columns: 1fr; }
  .modal-body { padding: 1.2rem 1rem; }
}
