/* Security Scanner Admin UI */
:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242736;
  --border: #2e3248;
  --text: #e2e8f0;
  --text-muted: #8892a4;
  --accent: #4f8ef7;
  --accent-hover: #6aa3ff;
  --danger: #f87171;
  --warning: #fbbf24;
  --success: #34d399;
  --info: #60a5fa;
  --critical: #ef4444;
  --high: #f97316;
  --medium: #eab308;
  --low: #22c55e;
  --radius: 8px;
  --sidebar-w: 200px;
  --navbar-h: 52px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  justify-content: space-between;
  z-index: 100;
}

.brand {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: var(--text);
}

.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.status-ok    { background: var(--success); }
.status-error { background: var(--danger); }
.status-unknown { background: var(--text-muted); }

/* Layout */
.layout {
  display: flex;
  margin-top: var(--navbar-h);
  min-height: calc(100vh - var(--navbar-h));
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  position: fixed;
  top: var(--navbar-h);
  bottom: 0;
  overflow-y: auto;
}

.nav-section { padding: 0.5rem 0; }
.nav-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.5rem 1rem 0.25rem;
}
.nav-link {
  display: block;
  padding: 0.4rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--surface2);
  border-left-color: var(--accent);
}

/* Content area */
.content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2rem;
  max-width: 900px;
}

/* Panels */
.panel { display: none; }
.panel.active { display: block; }

.panel h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.panel-desc {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Forms */
.scan-form { max-width: 560px; }

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="file"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
.field input[type="text"]:focus,
.field input[type="number"]:focus {
  border-color: var(--accent);
}

.field.row {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.field.row label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text);
  font-weight: 400;
  cursor: pointer;
  margin-bottom: 0;
}
.field.row input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Buttons */
.btn {
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-warning { background: var(--warning); color: #1a1d27; }
.btn-warning:hover:not(:disabled) { background: #f59e0b; }

hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* Result area */
.result-area {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

/* Progress spinner */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scan result display */
.scan-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.scan-title {
  font-weight: 600;
  font-size: 1rem;
}
.scan-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-done    { background: rgba(52,211,153,0.15); color: var(--success); }
.badge-pending { background: rgba(96,165,250,0.15); color: var(--info); }
.badge-running { background: rgba(251,191,36,0.15); color: var(--warning); }
.badge-error   { background: rgba(248,113,113,0.15); color: var(--danger); }

/* Severity summary */
.severity-grid {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.sev-chip {
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}
.sev-critical { background: rgba(239,68,68,0.15); color: var(--critical); }
.sev-high     { background: rgba(249,115,22,0.15); color: var(--high); }
.sev-medium   { background: rgba(234,179,8,0.15);  color: var(--medium); }
.sev-low      { background: rgba(34,197,94,0.15);  color: var(--low); }
.sev-info     { background: rgba(148,163,184,0.15); color: var(--text-muted); }

/* Metadata box */
.meta-box {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-family: monospace;
  font-size: 0.82rem;
  line-height: 2;
  color: var(--text-muted);
}
.meta-box span { color: var(--text); }

/* Findings list */
.findings-list { list-style: none; }
.finding-item {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border-left: 3px solid var(--border);
}
.finding-item.sev-critical { border-left-color: var(--critical); }
.finding-item.sev-high     { border-left-color: var(--high); }
.finding-item.sev-medium   { border-left-color: var(--medium); }
.finding-item.sev-low      { border-left-color: var(--low); }
.finding-item.sev-info     { border-left-color: var(--text-muted); }

.finding-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}
.finding-desc { font-weight: 500; }
.finding-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: monospace;
  word-break: break-all;
}

/* History table */
.history-table { width: 100%; border-collapse: collapse; }
.history-table th, .history-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.history-table th { color: var(--text-muted); font-weight: 600; }
.history-table tr:hover td { background: var(--surface2); cursor: pointer; }

/* Report buttons */
.report-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.report-buttons a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.82rem;
}
.report-buttons a:hover { text-decoration: underline; }

/* Error / alert */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.alert-error { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.3); color: var(--danger); }
.alert-success { background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.3); color: var(--success); }
.alert-info { background: rgba(96,165,250,0.1); border: 1px solid rgba(96,165,250,0.3); color: var(--info); }

/* No findings */
.no-findings {
  color: var(--success);
  font-weight: 500;
  padding: 0.5rem 0;
}
