@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Syne:wght@400;600;700;800&display=swap');

:root {
  --bg0: #060810;
  --bg1: #0d1117;
  --bg2: #131922;
  --bg3: #1a2332;
  --bg4: #1f2b3e;
  --border: #1e2d42;
  --border2: #253650;
  --text0: #e8edf5;
  --text1: #a8b8cc;
  --text2: #6a7f9a;
  --text3: #3d5570;
  --accent: #00d4aa;
  --accent2: #00a882;
  --accent-dim: rgba(0,212,170,.08);
  --accent-glow: rgba(0,212,170,.15);
  --red: #ff4444;
  --red-dim: rgba(255,68,68,.08);
  --orange: #ff8c42;
  --yellow: #f0b429;
  --blue: #4da6ff;
  --purple: #9b7fff;
  --pink: #ff6b9d;
  --critical: #ff4444;
  --high: #ff8c42;
  --medium: #f0b429;
  --low: #00d4aa;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-sans: 'Syne', sans-serif;
  --radius: 6px;
  --sidebar-w: 220px;
  --topbar-h: 52px;
}

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

html, body {
  height: 100%;
  background: var(--bg0);
  color: var(--text0);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  overflow: hidden;
}

/* Subtle scan-line effect */
body::before {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,.03) 2px, rgba(0,0,0,.03) 4px);
  pointer-events: none;
  z-index: 9999;
}

/* ---- LAYOUT ---- */
#app { display: flex; height: 100vh; width: 100vw; overflow: hidden; }

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#logo {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

#logo .logo-mark {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}

#logo .logo-sub {
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

nav { flex: 1; padding: 8px 0; overflow-y: auto; }

nav .section-label {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 10px 16px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--text2);
  font-size: 12px;
  transition: all .15s ease;
  border-left: 2px solid transparent;
  position: relative;
}

.nav-item:hover { color: var(--text0); background: var(--bg2); }
.nav-item.active { color: var(--accent); background: var(--accent-dim); border-left-color: var(--accent); }
.nav-item .nav-icon { font-size: 14px; width: 18px; text-align: center; opacity: .7; }
.nav-item.active .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: var(--bg0);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

#sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text3);
}

#sidebar-footer .version { color: var(--accent2); }

/* Main area */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg0);
}

/* Top bar */
#topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}

#topbar .page-title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--text0);
  letter-spacing: 1px;
}

#topbar .page-desc { font-size: 11px; color: var(--text3); }

.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s ease;
  letter-spacing: .5px;
}

.btn-primary { background: var(--accent); color: var(--bg0); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent2); box-shadow: 0 0 12px var(--accent-glow); }
.btn-ghost { background: transparent; color: var(--text1); border-color: var(--border2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--red-dim); color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: white; }
.btn-sm { padding: 4px 10px; font-size: 10px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Content area */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Pages */
.page { display: none; animation: fadeIn .2s ease; }
.page.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Cards */
.card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text1);
}

.card-body { padding: 16px; }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.flex-row { display: flex; gap: 16px; }
.flex-col { display: flex; flex-direction: column; gap: 16px; }

/* Stat card */
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent);
}

.stat-card.red::before { background: var(--red); }
.stat-card.orange::before { background: var(--orange); }
.stat-card.yellow::before { background: var(--yellow); }
.stat-card.blue::before { background: var(--blue); }
.stat-card.purple::before { background: var(--purple); }

.stat-value {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card.red .stat-value { color: var(--red); }
.stat-card.orange .stat-value { color: var(--orange); }
.stat-card.yellow .stat-value { color: var(--yellow); }
.stat-card.blue .stat-value { color: var(--blue); }
.stat-card.purple .stat-value { color: var(--purple); }

.stat-label { font-size: 10px; color: var(--text3); letter-spacing: 1px; text-transform: uppercase; }

/* Textarea / Input */
textarea, input[type=text], input[type=search], select {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text0);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 12px;
  width: 100%;
  outline: none;
  transition: border-color .15s;
  resize: vertical;
}

textarea:focus, input[type=text]:focus, input[type=search]:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

textarea { min-height: 120px; }
input[type=file] { display: none; }

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text3); margin-bottom: 6px; }

/* Table */
.phantom-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.phantom-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text3);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.phantom-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text1);
  vertical-align: middle;
}
.phantom-table tr:last-child td { border-bottom: none; }
.phantom-table tr:hover td { background: var(--bg2); }
.phantom-table .mono { font-family: var(--font-mono); color: var(--text0); }
.phantom-table .copyable { cursor: pointer; }
.phantom-table .copyable:hover { color: var(--accent); }

/* Tags / Pills */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .5px;
}

.tag-type { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(0,212,170,.2); }
.tag-critical { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,68,68,.2); }
.tag-high { background: rgba(255,140,66,.08); color: var(--orange); border: 1px solid rgba(255,140,66,.2); }
.tag-medium { background: rgba(240,180,41,.08); color: var(--yellow); border: 1px solid rgba(240,180,41,.2); }
.tag-low { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(0,212,170,.2); }
.tag-tlp-red { background: rgba(255,68,68,.12); color: var(--red); border: 1px solid rgba(255,68,68,.3); }
.tag-tlp-amber { background: rgba(240,180,41,.12); color: var(--yellow); border: 1px solid rgba(240,180,41,.3); }
.tag-tlp-green { background: rgba(0,212,170,.12); color: var(--accent); border: 1px solid rgba(0,212,170,.3); }
.tag-tlp-white, .tag-tlp-clear { background: rgba(168,184,204,.08); color: var(--text1); border: 1px solid var(--border2); }
.tag-info { background: rgba(77,166,255,.08); color: var(--blue); border: 1px solid rgba(77,166,255,.2); }
.tag-mitre { background: rgba(155,127,255,.08); color: var(--purple); border: 1px solid rgba(155,127,255,.2); }

/* Code block */
.code-block {
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text1);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.code-block .highlight { color: var(--accent); }
.code-block .warning { color: var(--yellow); }
.code-block .danger { color: var(--red); }

/* IOC Result grid */
.ioc-section { margin-bottom: 16px; }
.ioc-section-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text3); margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.ioc-count { font-family: var(--font-sans); font-weight: 700; color: var(--accent); }
.ioc-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  border-radius: 4px;
  transition: background .1s;
}
.ioc-item:hover { background: var(--bg2); }
.ioc-value { font-family: var(--font-mono); font-size: 12px; color: var(--text0); flex: 1; word-break: break-all; }
.ioc-meta { font-size: 10px; color: var(--text3); }

/* Hash display */
.hash-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.hash-row:last-child { border-bottom: none; }
.hash-algo { font-size: 10px; color: var(--text3); letter-spacing: 1px; width: 60px; flex-shrink: 0; }
.hash-val { font-family: var(--font-mono); font-size: 11px; color: var(--accent); flex: 1; word-break: break-all; }

/* Entropy bar */
.entropy-bar {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, #00d4aa, #f0b429, #ff8c42, #ff4444);
  position: relative; margin: 8px 0;
}
.entropy-cursor {
  position: absolute; top: -3px;
  width: 12px; height: 12px;
  background: white; border-radius: 50%;
  border: 2px solid var(--bg0);
  box-shadow: 0 0 6px rgba(0,0,0,.5);
  transform: translateX(-50%);
}

/* ATT&CK heatmap */
.attck-grid {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 2px;
  font-size: 9px;
}
.attck-tactic {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 3px;
  text-align: center;
}
.attck-tactic.has-hits {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.attck-tactic-name { font-size: 8px; color: var(--text3); margin-bottom: 2px; }
.attck-tactic.has-hits .attck-tactic-name { color: var(--accent2); }
.attck-count { font-family: var(--font-sans); font-size: 14px; font-weight: 800; color: var(--text2); }
.attck-tactic.has-hits .attck-count { color: var(--accent); }

/* Technique list */
.ttp-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: all .15s;
}
.ttp-item:hover, .ttp-item.selected { border-color: var(--accent); background: var(--accent-dim); }
.ttp-id { font-size: 10px; color: var(--purple); width: 80px; flex-shrink: 0; font-weight: 600; }
.ttp-name { flex: 1; color: var(--text1); font-size: 12px; }
.ttp-tactic { font-size: 10px; color: var(--text3); }

/* Diamond Model */
.diamond-container {
  display: grid;
  grid-template-areas: ". adversary ." "capability . infrastructure" ". victim .";
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 8px;
  max-width: 600px;
  margin: 0 auto;
}

.diamond-cell {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  min-height: 80px;
}

.diamond-cell.adversary { grid-area: adversary; border-color: var(--red); }
.diamond-cell.capability { grid-area: capability; border-color: var(--purple); }
.diamond-cell.infrastructure { grid-area: infrastructure; border-color: var(--blue); }
.diamond-cell.victim { grid-area: victim; border-color: var(--yellow); }
.diamond-cell-label { font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 8px; font-weight: 600; }
.adversary .diamond-cell-label { color: var(--red); }
.capability .diamond-cell-label { color: var(--purple); }
.infrastructure .diamond-cell-label { color: var(--blue); }
.victim .diamond-cell-label { color: var(--yellow); }

/* Timeline */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content:''; position:absolute; left:8px; top:0; bottom:0; width:1px; background: var(--border2); }
.timeline-item { position: relative; margin-bottom: 16px; }
.timeline-dot { position:absolute; left:-20px; top:4px; width:8px; height:8px; border-radius:50%; background: var(--accent); border: 1px solid var(--bg0); }
.timeline-item.critical .timeline-dot { background: var(--red); }
.timeline-item.high .timeline-dot { background: var(--orange); }
.timeline-time { font-size: 10px; color: var(--text3); margin-bottom: 2px; }
.timeline-content { font-size: 12px; color: var(--text1); }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon { font-size: 36px; opacity: .3; margin-bottom: 12px; }
.empty-text { font-size: 12px; color: var(--text3); }

/* Toast notifications */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text0);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  animation: slideIn .2s ease;
  display: flex; align-items: center; gap: 8px;
  max-width: 320px;
}
.toast.success { border-color: var(--accent); }
.toast.error { border-color: var(--red); }
.toast.warning { border-color: var(--yellow); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* Tab system */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-btn { padding: 8px 14px; font-family: var(--font-mono); font-size: 11px; color: var(--text3); cursor: pointer; border-bottom: 2px solid transparent; transition: all .15s; background: none; border-top: none; border-left: none; border-right: none; }
.tab-btn:hover { color: var(--text1); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Section / Divider */
.section-title {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text3);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  color: var(--text3);
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.upload-zone .upload-icon { font-size: 28px; margin-bottom: 8px; }
.upload-zone .upload-text { font-size: 12px; }
.upload-zone .upload-sub { font-size: 10px; margin-top: 4px; color: var(--text3); }

/* Responsive */
@media (max-width: 900px) {
  #sidebar { width: 48px; min-width: 48px; }
  .nav-item span { display: none; }
  #logo .logo-sub { display: none; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* Copy feedback */
.copy-feedback { animation: pulse .3s ease; }
@keyframes pulse { 0% { color: var(--text1); } 50% { color: var(--accent); } 100% { color: var(--text1); } }

/* Progress bar */
.progress-bar { height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }

/* ---- TOOLS MODULE ---- */

/* Swiss Knife tabs */
.swiss-tab { border-bottom: 2px solid transparent; border-radius: 4px 4px 0 0; }
.swiss-tab.active { border-bottom-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* CIDR / Epoch result rows */
.cidr-result { display: flex; flex-direction: column; gap: 6px; }
.cidr-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.cidr-row:last-child { border-bottom: none; }
.cidr-key { font-size: 10px; color: var(--text3); min-width: 150px; text-transform: uppercase; letter-spacing: .5px; }
.cidr-val { font-size: 12px; color: var(--text0); font-family: var(--font-mono); cursor: pointer; }
.cidr-val:hover { color: var(--accent); }

/* JWT sections */
.jwt-section { margin-bottom: 14px; }
.jwt-part-label { font-size: 10px; font-weight: 600; letter-spacing: 1px; margin-bottom: 4px; text-transform: uppercase; }

/* CVSS options */
.cvss-opt { user-select: none; }
.cvss-opt:hover { border-color: var(--accent) !important; }
.cvss-opt.active { border-color: var(--accent) !important; background: var(--accent-dim) !important; }
.cvss-opt.active > div:first-child { color: var(--accent) !important; }

/* Hash Identifier reference grid */
#hash-output .empty-state { padding: 40px; }

/* URL Analyzer risk score */
.url-score-bar { height: 6px; background: var(--bg2); border-radius: 3px; overflow: hidden; }

/* Threat Actor Card */
#ta-card-preview { font-family: 'JetBrains Mono', monospace; }
