/* vulnsecurity web console - holographic design system
   optimized: GPU-only animations (transform/opacity), selective backdrop-filter,
   reduced-motion aware, focus-visible a11y, cached as a single external asset. */

:root {
  color-scheme: dark;

  /* surfaces */
  --bg: #050510;
  --bg-2: #070714;
  --surface: rgba(20, 20, 38, 0.55);
  --surface-2: rgba(30, 30, 54, 0.5);
  --surface-3: rgba(46, 46, 78, 0.55);
  --surface-solid: #14142a;

  /* lines + text */
  --border: rgba(140, 170, 255, 0.12);
  --border-h: rgba(160, 200, 255, 0.30);
  --text: #edf0ff;
  --text-2: #a6acd6;
  --text-3: #6a6f9a;

  /* accents */
  --accent: #22d3ee;
  --accent-h: #67e8f9;
  --accent-2: #a855f7;
  --accent-3: #ec4899;
  --ok: #34d399;
  --bad: #fb5178;
  --warn: #fbbf24;

  /* shape */
  --radius: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* holographic gradient + glows */
  --holo: linear-gradient(115deg, #22d3ee 0%, #a855f7 35%, #ec4899 60%, #22d3ee 100%);
  --glow-soft: 0 1px 0 rgba(255, 255, 255, 0.02), 0 8px 40px rgba(80, 40, 160, 0.24);
  --glow-strong: 0 0 0 1px rgba(140, 170, 255, 0.18), 0 20px 60px rgba(80, 40, 160, 0.4);

  --mono: 'SF Mono', 'Cascadia Code', 'Fira Code', ui-monospace, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;

  /* motion tokens (zeroed out under reduced-motion) */
  --motion-fast: 0.15s;
  --motion: 0.25s;
  --motion-slow: 0.35s;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font: 13px/1.5 var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ---- holographic aurora background (single compositor-only transform anim) ---- */
body::before {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: -2;
  pointer-events: none;
  background-color: var(--bg);
  background-image:
    radial-gradient(42% 40% at 15% 18%, rgba(34, 211, 238, 0.18), transparent 60%),
    radial-gradient(45% 45% at 85% 12%, rgba(168, 85, 247, 0.20), transparent 60%),
    radial-gradient(50% 50% at 78% 88%, rgba(236, 72, 153, 0.16), transparent 60%),
    radial-gradient(40% 40% at 18% 92%, rgba(59, 130, 246, 0.15), transparent 60%);
  filter: blur(24px);
  will-change: transform;
  animation: auroraDrift 30s ease-in-out infinite alternate;
}

/* subtle static grid, masked toward center - no animation, near-zero cost */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 160, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 160, 255, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 50% 38%, #000 0%, transparent 82%);
          mask-image: radial-gradient(circle at 50% 38%, #000 0%, transparent 82%);
}

@keyframes auroraDrift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2%, -2%, 0) scale(1.06); }
  100% { transform: translate3d(-2%, 2%, 0) scale(1.03); }
}
@keyframes holoShift { to { background-position: 200% center; } }
@keyframes floatY { 50% { transform: translateY(-4px); } }

a { color: var(--accent); text-decoration: none; transition: color var(--motion-fast); }
a:hover { color: var(--accent-h); }
h1, h2, h3 { font-weight: 500; letter-spacing: -0.01em; }

/* holographic gradient text - reusable, single animation */
.holo-text {
  background: var(--holo);
  background-size: 200% auto;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: holoShift 6s linear infinite;
}

/* ---------------------------------------------------------------- layout */
.shell { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  height: 52px;
  background: rgba(10, 10, 24, 0.6);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
          backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--holo);
  background-size: 200% 100%;
  opacity: 0.8;
  animation: holoShift 6s linear infinite;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-left svg {
  width: 20px; height: 20px;
  color: var(--accent);
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.7));
  animation: floatY 4s ease-in-out infinite;
}
.topbar h1 {
  font-size: 14px; font-weight: 700; letter-spacing: 0.02em;
  background: var(--holo); background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: holoShift 6s linear infinite;
}
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }

.page { flex: 1; padding: 28px 24px; max-width: 1440px; width: 100%; margin: 0 auto; }

/* ---------------------------------------------------------------- cards */
.stack { display: grid; gap: 20px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); perspective: 1400px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; perspective: 1400px; }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  -webkit-backdrop-filter: blur(14px) saturate(130%);
          backdrop-filter: blur(14px) saturate(130%);
  box-shadow: var(--glow-soft);
  transition: transform var(--motion-slow) cubic-bezier(0.2, 0.7, 0.2, 1),
              box-shadow var(--motion-slow), border-color var(--motion-slow);
  transform-style: preserve-3d;
}
/* animated holographic border - only painted on hover to save cost */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--holo);
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--motion-slow);
  pointer-events: none;
}
/* mouse-follow spotlight (--mx/--my set by app.js) */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 0%), rgba(120, 200, 255, 0.10), transparent 45%);
  opacity: 0;
  transition: opacity var(--motion-slow);
  pointer-events: none;
}
.card:hover {
  transform: translateY(-4px) rotateX(2.5deg);
  border-color: var(--border-h);
  box-shadow: var(--glow-strong);
}
.card:hover::before { opacity: 0.65; animation: holoShift 5s linear infinite; }
.card:hover::after { opacity: 1; }

.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-header h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-2); }

/* ---------------------------------------------------------------- typography helpers */
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.small { font-size: 11px; }

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 500;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.green { background: rgba(52, 211, 153, 0.12); color: var(--ok); border-color: rgba(52, 211, 153, 0.25); }
.badge.red { background: rgba(251, 81, 120, 0.10); color: var(--bad); border-color: rgba(251, 81, 120, 0.25); }
.badge.blue { background: rgba(34, 211, 238, 0.10); color: var(--accent); border-color: rgba(34, 211, 238, 0.25); }
.badge.warn { background: rgba(251, 191, 36, 0.12); color: var(--warn); border-color: rgba(251, 191, 36, 0.28); }

/* ---------------------------------------------------------------- forms */
form { display: grid; gap: 12px; }
.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
label { display: grid; gap: 4px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }

input, textarea, select {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(10, 10, 24, 0.5);
  color: var(--text);
  padding: 8px 10px;
  font: inherit; font-size: 13px;
  transition: border-color var(--motion), box-shadow var(--motion);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.18), 0 0 20px rgba(34, 211, 238, 0.22);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { min-height: 100px; resize: vertical; }
input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--accent); padding: 0; }

/* ---------------------------------------------------------------- buttons */
button, .btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: background var(--motion), color var(--motion), border-color var(--motion),
              box-shadow var(--motion), transform var(--motion);
  white-space: nowrap;
  text-decoration: none;
}
button:hover, .btn:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-h);
  box-shadow: 0 0 16px rgba(120, 180, 255, 0.22);
  transform: translateY(-1px);
}
button:active, .btn:active { transform: translateY(0); }
button:disabled { opacity: 0.45; cursor: not-allowed; background: var(--surface-2); color: var(--text-3); border-color: var(--border); box-shadow: none; transform: none; }

.btn-primary { background: linear-gradient(115deg, var(--accent), var(--accent-2)); color: #050510; font-weight: 700; border-color: transparent; box-shadow: 0 0 18px rgba(34, 211, 238, 0.35); }
.btn-primary:hover { background: linear-gradient(115deg, var(--accent-h), var(--accent-3)); border-color: transparent; color: #050510; box-shadow: 0 0 26px rgba(168, 85, 247, 0.5); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: rgba(251, 81, 120, 0.10); border-color: rgba(251, 81, 120, 0.4); box-shadow: 0 0 16px rgba(251, 81, 120, 0.3); }
.btn-sm { padding: 4px 10px; font-size: 11px; }

/* ---------------------------------------------------------------- action rows */
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { padding: 8px 12px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); border-bottom: 1px solid var(--border); }
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--motion-fast); }
tbody tr:hover { background: rgba(120, 160, 255, 0.04); }

/* ---------------------------------------------------------------- pre / code */
pre {
  margin: 0; padding: 16px; overflow: auto;
  background: rgba(6, 6, 16, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: 12px/1.6 var(--mono);
  white-space: pre-wrap; word-break: break-word;
  color: var(--text-2);
  max-height: 520px;
}

/* ---------------------------------------------------------------- misc rows */
.topline { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }

.history-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: 0; }
.history-item .topline { margin-bottom: 6px; }
.history-item pre { max-height: 200px; margin-top: 8px; }

/* ---------------------------------------------------------------- terminal / attach */
.terminal-screen {
  min-height: 420px; max-height: 65vh; overflow: auto;
  background: linear-gradient(180deg, #04040c, #06060f);
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: var(--radius);
  box-shadow: inset 0 0 60px rgba(34, 211, 238, 0.06), 0 0 30px rgba(34, 211, 238, 0.08);
  color: #c8f5ff;
  font: 12px/1.45 var(--mono);
  padding: 14px;
  text-shadow: 0 0 8px rgba(120, 220, 255, 0.22);
}
.status-line { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- empty state */
.empty { padding: 32px 20px; border: 1px dashed var(--border); border-radius: var(--radius-lg); color: var(--text-3); text-align: center; font-size: 13px; }

/* ---------------------------------------------------------------- login */
.login { max-width: 400px; margin: 12vh auto 0; animation: floatY 6s ease-in-out infinite; }
.login h2 {
  font-size: 18px; font-weight: 700; margin-bottom: 4px;
  text-transform: none; letter-spacing: normal;
  background: var(--holo); background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: holoShift 6s linear infinite;
}
.login .btn-primary { width: 100%; margin-top: 4px; }

/* ---------------------------------------------------------------- detail rows / stats */
.detail-row { display: flex; gap: 8px; font-size: 12px; }
.detail-row .label { color: var(--text-3); min-width: 100px; flex-shrink: 0; text-transform: none; letter-spacing: 0; }
.detail-row .value { color: var(--text-2); word-break: break-all; }

.stats-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat-card {
  position: relative; overflow: hidden;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); display: grid; gap: 6px;
  transition: transform var(--motion), box-shadow var(--motion);
}
.stat-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--holo); background-size: 200% 100%; animation: holoShift 5s linear infinite; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(80, 40, 160, 0.32); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); text-shadow: 0 0 20px rgba(120, 180, 255, 0.3); }

/* ---------------------------------------------------------------- findings */
.finding-entry { display: grid; gap: 14px; }
.finding-entry-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.finding-entry-title { display: grid; gap: 6px; }
.finding-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); margin-bottom: 6px; }
.finding-body { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }

/* ---------------------------------------------------------------- rendered markdown */
.md-body { color: var(--text); font-size: 13px; line-height: 1.65; word-break: break-word; }
.md-body > *:first-child { margin-top: 0; }
.md-body > *:last-child { margin-bottom: 0; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4, .md-body h5, .md-body h6 {
  margin: 20px 0 10px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em;
}
.md-body h1 { font-size: 20px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.md-body h2 { font-size: 17px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.md-body h3 { font-size: 15px; color: var(--accent-h); }
.md-body h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); }
.md-body h5, .md-body h6 { font-size: 12px; color: var(--text-2); }
.md-body p { margin: 10px 0; }
.md-body ul, .md-body ol { margin: 10px 0; padding-left: 22px; }
.md-body li { margin: 4px 0; }
.md-body li::marker { color: var(--accent); }
.md-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md-body a:hover { color: var(--accent-h); }
.md-body strong { color: #fff; font-weight: 700; }
.md-body em { color: var(--text); font-style: italic; }
.md-body hr { border: 0; height: 1px; margin: 18px 0; background: var(--holo); background-size: 200% 100%; opacity: 0.5; }
.md-body code {
  font-family: var(--mono); font-size: 0.88em;
  background: rgba(34, 211, 238, 0.10);
  border: 1px solid rgba(34, 211, 238, 0.18);
  color: var(--accent-h);
  padding: 1px 6px; border-radius: 6px;
}
.md-body pre {
  margin: 12px 0; padding: 14px 16px;
  background: rgba(4, 4, 12, 0.7);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  overflow: auto; max-height: 480px;
}
.md-body pre code { background: none; border: 0; color: #c8f5ff; padding: 0; font-size: 12px; line-height: 1.55; }
.md-body blockquote {
  margin: 12px 0; padding: 8px 16px;
  border-left: 3px solid var(--accent-2);
  background: rgba(168, 85, 247, 0.06);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-2);
}

/* ---------------------------------------------------------------- toast notifications */
.finding-toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.finding-toast {
  pointer-events: auto;
  padding: 12px 20px;
  background: rgba(20, 20, 44, 0.9);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid rgba(251, 81, 120, 0.4);
  border-left: 3px solid var(--bad);
  border-radius: var(--radius);
  color: var(--text);
  font: 13px/1.4 var(--mono);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  transform: translateX(120%);
  opacity: 0;
  transition: transform var(--motion-slow) ease, opacity var(--motion-slow) ease;
  max-width: 380px;
}
.finding-toast.show { transform: translateX(0); opacity: 1; }
.finding-toast .toast-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-weight: 600; color: #ff6b8a; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.finding-toast .toast-body { color: var(--text-2); font-size: 12px; line-height: 1.4; }

/* ---------------------------------------------------------------- scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--accent), var(--accent-2)); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(var(--accent-h), var(--accent-3)); }
* { scrollbar-width: thin; scrollbar-color: var(--accent-2) transparent; }

/* ---------------------------------------------------------------- accessibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button:focus-visible, .btn:focus-visible { outline-offset: 3px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 768px) {
  .page { padding: 16px; }
  .grid, .grid-2 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; height: auto; min-height: 52px; flex-wrap: wrap; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .card { padding: 16px; }
  .card:hover { transform: translateY(-2px); }
}

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  body::before { animation: none; }
  .card:hover { transform: none; }
  .stat-card:hover, button:hover, .btn:hover { transform: none; }
  .login { animation: none; }
}
