/* ═══════════════════════════════════════════════════════════════════
   main.css — Evil Origin Detection v2
   ═══════════════════════════════════════════════════════════════════ */

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

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; scroll-behavior: smooth; }
body {
  font-family: 'Outfit', sans-serif;
  font-size: 17px; font-weight: 400;
  min-height: 100vh; overflow-x: hidden;
  transition: background 0.35s, color 0.35s;
}
a { color: var(--blue); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent); }
button { cursor: pointer; font-family: inherit; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ── Backgrounds ─────────────────────────────────────────────────── */
#cosmos-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: var(--cosmos-opacity, 1); transition: opacity 0.6s;
}
#forensic-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: var(--grid-opacity, 0); transition: opacity 0.6s;
  background-image:
    linear-gradient(rgba(0,0,40,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,40,0.035) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ── Top Nav ─────────────────────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; height: 54px;
  padding: 0 28px; gap: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.topnav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
}
.brand-icon { width: 24px; height: 24px; flex-shrink: 0; }
.icon-horn-l, .icon-horn-r { fill: var(--accent); }
.icon-eye  { stroke: var(--accent); fill: none; }
.icon-iris { stroke: var(--accent); fill: none; }
.icon-pupil{ fill: var(--accent); animation: pupil-pulse 3s ease-in-out infinite; }
@keyframes pupil-pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

.brand-name {
  font-family: 'Outfit', sans-serif; font-weight: 700;
  font-size: 17px; letter-spacing: -0.02em;
  color: var(--text); white-space: nowrap;
}
.brand-evil { color: var(--accent); }

.topnav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.theme-switcher {
  display: flex; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border);
}
.theme-btn {
  font-family: 'Space Mono', monospace; font-size: 12px;
  padding: 5px 12px; border: none;
  background: transparent; color: var(--text3);
  transition: all 0.18s;
}
.theme-btn:hover { color: var(--text); background: var(--bg3); }
.theme-btn.active { background: var(--accent-glow); color: var(--accent); }

.gh-link {
  display: flex; align-items: center; gap: 6px;
  font-family: 'Space Mono', monospace; font-size: 11px;
  padding: 5px 12px; border-radius: 7px; font-weight: 400;
  border: 1px solid var(--border); color: var(--text3);
  transition: all 0.18s; letter-spacing: 0.03em;
}
.gh-link:hover { border-color: var(--teal); color: var(--teal); background: rgba(68,221,187,0.06); }

/* ── Main content ─────────────────────────────────────────────────── */
#main-content { position: relative; z-index: 1; }

/* ── Page containers ──────────────────────────────────────────────── */
.page-center {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  min-height: calc(100vh - 54px);
  padding: 32px 24px 64px;
}
.page-wide {
  max-width: 1600px; margin: 0 auto;
  padding: 24px 24px 64px;
}

/* ── Surface card ─────────────────────────────────────────────────── */
.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color 0.2s, background 0.3s;
}
.surface:hover { border-color: var(--border2); }

/* ── Section cards ────────────────────────────────────────────────── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  transition: border-color 0.2s;
}
.section-card-title {
  font-family: 'Space Mono', monospace; font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text3); margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.section-card-title::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
}

/* ── Results layout ───────────────────────────────────────────────── */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-template-rows: auto;
  gap: 20px;
  align-items: start;
}
.results-main { display: flex; flex-direction: column; gap: 18px; }
.results-side {
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 70px;
}

/* Graph — full width row below main+side */
.results-graph-row {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .results-grid { grid-template-columns: 1fr; }
  .results-side { position: static; }
}

/* ── Score display ────────────────────────────────────────────────── */
.score-numeral {
  font-family: 'Outfit', sans-serif;
  font-size: 72px; font-weight: 800;
  letter-spacing: -0.04em; line-height: 1;
}
.score-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 7px;
}
.score-row-label {
  font-family: 'Space Mono', monospace; font-size: 12px;
  color: var(--text3); width: 116px; flex-shrink: 0;
}
.score-row-bar {
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--bg3); overflow: hidden;
}
.score-row-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.8s cubic-bezier(.16,1,.3,1);
}
.score-row-val {
  font-family: 'Space Mono', monospace; font-size: 12px;
  color: var(--text2); width: 82px; text-align: right; flex-shrink: 0;
}

/* ── Verdict badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  font-family: 'Space Mono', monospace; font-size: 11px;
  font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 5px;
}
.badge-malicious  { background: rgba(255,85,85,0.15);  color: var(--v-malicious);  border: 1px solid rgba(255,85,85,0.3); }
.badge-suspicious { background: rgba(255,170,68,0.15); color: var(--v-suspicious); border: 1px solid rgba(255,170,68,0.3); }
.badge-clean      { background: rgba(68,221,187,0.12); color: var(--v-clean);      border: 1px solid rgba(68,221,187,0.25); }
.badge-unknown    { background: rgba(90,90,128,0.15);  color: var(--v-unknown);    border: 1px solid rgba(90,90,128,0.25); }

/* ── Tag chips ────────────────────────────────────────────────────── */
.tag-chip {
  display: inline-flex; align-items: center;
  font-family: 'Space Mono', monospace; font-size: 12px;
  padding: 4px 11px; border-radius: 6px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); white-space: nowrap;
}
.tag-chip.malicious { background: rgba(255,85,85,0.1);  border-color: rgba(255,85,85,0.25); color: var(--v-malicious); }
.tag-chip.info      { background: rgba(68,221,187,0.08); border-color: rgba(68,221,187,0.2); color: var(--teal); }
.tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Source rows ──────────────────────────────────────────────────── */
.source-row {
  display: flex; align-items: center;
  padding: 8px 10px; border-radius: 9px;
  background: var(--bg2); border: 1px solid var(--border);
  margin-bottom: 6px; gap: 9px;
  transition: border-color 0.15s, background 0.15s;
}
.source-row:hover { background: var(--bg3); border-color: var(--border2); }
.source-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.source-name {
  font-family: 'Space Mono', monospace; font-size: 12px;
  color: var(--text); width: 112px; flex-shrink: 0; font-weight: 400;
}
.source-summary { flex: 1; font-size: 12px; color: var(--text2); }
.source-link {
  font-size: 14px; color: var(--text3); padding: 2px 6px;
  border-radius: 4px; transition: color 0.15s, background 0.15s;
}
.source-link:hover { color: var(--accent); background: var(--accent-glow); }

/* ── Tabs ─────────────────────────────────────────────────────────── */
.tab-nav {
  display: flex; gap: 3px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border); padding-bottom: 0;
}
.tab-btn {
  font-family: 'Outfit', sans-serif; font-size: 13px; font-weight: 500;
  padding: 8px 16px; border: none; background: transparent;
  color: var(--text3); border-radius: 8px 8px 0 0;
  border-bottom: 2px solid transparent;
  transition: all 0.15s; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); background: var(--bg3); }
.tab-btn.active {
  color: var(--text); border-bottom-color: var(--accent);
  background: var(--bg2);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Tables ───────────────────────────────────────────────────────── */
.info-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.info-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  vertical-align: top; line-height: 1.5;
}
.info-table td:first-child {
  font-family: 'Space Mono', monospace; font-size: 12px;
  color: var(--text3); white-space: nowrap;
  letter-spacing: 0.04em; width: 140px;
}
.info-table tr:last-child td { border-bottom: none; }
.info-table tr:hover td { background: var(--bg3); }

/* Port table */
.port-warn { color: var(--v-malicious) !important; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 600;
  padding: 9px 20px; border-radius: 9px; border: none;
  transition: all 0.18s; white-space: nowrap;
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent2);
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent; color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg3); color: var(--text); border-color: var(--border2); }
.btn-sm { font-size: 12px; padding: 5px 12px; border-radius: 6px; }

/* ── IOC input ────────────────────────────────────────────────────── */
.ioc-input-field {
  width: 100%;
  font-family: 'Space Mono', monospace; font-size: 15px;
  padding: 0 18px; border-radius: 10px;
  background: var(--bg2); border: 1px solid var(--border2);
  color: var(--text); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1;
}
.ioc-input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.ioc-input-field::placeholder { color: var(--text3); }

/* ── Timeline ─────────────────────────────────────────────────────── */
.timeline-item {
  display: flex; gap: 14px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; margin-top: 6px;
}
.timeline-date {
  font-family: 'Space Mono', monospace; font-size: 11px;
  color: var(--text3); white-space: nowrap; margin-top: 2px;
}
.timeline-summary { font-size: 14px; color: var(--text2); line-height: 1.5; }

/* ── Graph container ──────────────────────────────────────────────── */
.graph-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
}
.graph-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.graph-title {
  font-family: 'Space Mono', monospace; font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--text3);
}
.graph-body {
  display: grid;
  grid-template-columns: 1fr 300px;
  min-height: 460px;
}
.graph-canvas-area {
  position: relative; background: var(--bg2);
}
.graph-info-panel {
  border-left: 1px solid var(--border);
  padding: 20px; overflow-y: auto; max-height: 460px;
  background: var(--bg);
}
#graph-tooltip {
  display: none;
}
.graph-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text3); gap: 10px;
}

/* ── Geo map ──────────────────────────────────────────────────────── */
#geo-map {
  height: 180px; border-radius: 10px; overflow: hidden;
  background: var(--bg3); margin-bottom: 14px;
}

/* ── Screenshot ───────────────────────────────────────────────────── */
.screenshot-frame {
  border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border);
}

/* ── Source pills ─────────────────────────────────────────────────── */
.source-pill {
  display: inline-flex; align-items: center;
  font-family: 'Space Mono', monospace; font-size: 11px;
  padding: 4px 10px; border-radius: 6px;
  background: var(--bg3); border: 1px solid var(--border); color: var(--text3);
}
.source-pill.ok { border-color: rgba(68,221,187,0.3); color: var(--teal); background: rgba(68,221,187,0.07); }

/* ── Collapse ─────────────────────────────────────────────────────── */
.collapse-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-radius: 9px; background: var(--bg2);
  border: 1px solid var(--border); color: var(--text2);
  font-size: 13px; font-weight: 500; transition: all 0.18s;
}
.collapse-toggle:hover { background: var(--bg3); color: var(--text); border-color: var(--border2); }
.collapse-chevron { font-size: 10px; transition: transform 0.2s; }
.collapse-body { display: none; margin-top: 6px; }
.collapse-body.open { display: block; }

/* ── Divider ──────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ── Monospace util ───────────────────────────────────────────────── */
.mono { font-family: 'Space Mono', monospace; }

/* ── Footer ───────────────────────────────────────────────────────── */
.site-footer {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 24px; font-size: 12px; color: var(--text3);
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.footer-sep { opacity: 0.4; }
.site-footer a { color: var(--text3); }
.site-footer a:hover { color: var(--text2); }

/* ── Animations ───────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.anim-fade-up { animation: fadeUp 0.5s cubic-bezier(.16,1,.3,1) both; }
.anim-delay-1 { animation-delay: 0.08s; }
.anim-delay-2 { animation-delay: 0.16s; }
.anim-delay-3 { animation-delay: 0.24s; }
.anim-delay-4 { animation-delay: 0.32s; }

/* ── Section label ────────────────────────────────────────────────── */
.section-label {
  font-family: 'Space Mono', monospace; font-size: 10px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text3); margin-bottom: 10px;
}
