/* ============================================================
   EvilBit Map — dark cyber-audit design system
   Spec: spec.viz.StaticWebApp, spec.viz.FitToViewportLayoutReq
   ============================================================ */

:root {
  --bg: #0a0e14;
  --bg-soft: #0d1320;
  --panel: #11161f;
  --panel-2: #151c28;
  --border: #1e2633;
  --border-strong: #2a3547;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --same: #10b981;
  --changed: #f59e0b;
  --dropped: #ef4444;
  --dead: #64748b;
  --accent: #38bdf8;
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
  --glow-same: 0 0 12px rgba(16, 185, 129, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(56, 189, 248, 0.06), transparent 60%),
    radial-gradient(1000px 500px at 90% 0%, rgba(16, 185, 129, 0.05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

::selection {
  background: rgba(56, 189, 248, 0.3);
}

/* ---------------- Header ---------------- */

.app-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 19, 32, 0.7);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--same));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  color: #04121a;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.5px;
}

.brand small {
  display: block;
  color: var(--text-dim);
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 1px;
}

.status-line {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  max-width: 520px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-line.error {
  color: var(--dropped);
}

/* ---------------- KPI row ---------------- */

.kpi-row {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 12px 24px 0;
}

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 13px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.kpi-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

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

.kpi-value {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--mono);
  line-height: 1.1;
}

.kpi-hint {
  font-size: 11px;
  color: var(--text-dim);
}

/* ---------------- Verdict strip ---------------- */

.verdict-bar {
  flex: none;
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--border);
  margin: 10px 24px 0;
}

.bar-segment {
  height: 100%;
  background: var(--vc);
  transition: width 0.3s ease;
}

/* ---------------- Main layout ---------------- */

/* ---------------- Main layout ---------------- */

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 14px;
  padding: 12px 24px;
}

.map-column {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.map-title {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.map-title-main {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.map-title b {
  color: var(--text);
  font-weight: 600;
}

.nearest-ip-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  width: 340px;
  min-width: 340px;
  max-width: 340px;
  height: 24px;
  box-sizing: border-box;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}

.nearest-ip-badge b {
  color: var(--accent);
  font-weight: 600;
}

.nearest-ip-badge .badge-verdict,
.nearest-ip-badge .badge-audited {
  color: var(--accent);
  font-weight: 600;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.zoom-toggle,
.zoom-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.zoom-toggle button,
.zoom-actions button {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.zoom-toggle button:hover,
.zoom-actions button:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--border);
}

.zoom-toggle button.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--vc);
  box-shadow: 0 0 8px var(--vc);
}

.map-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 99px, rgba(30, 38, 51, 0.35) 100px),
    repeating-linear-gradient(90deg, transparent, transparent 99px, rgba(30, 38, 51, 0.35) 100px),
    #080c12;
}

/* Square map scaled to fit available height */
#map-canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.drop-zone {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 12, 18, 0.88);
  border: 2px dashed var(--border-strong);
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  text-align: center;
  font-family: var(--mono);
  color: var(--text-muted);
  font-size: 13px;
  z-index: 5;
}

.drop-zone.dragging {
  opacity: 1;
  pointer-events: auto;
}

/* ---------------- Right column (Enlarged Info Pane) ---------------- */

.side-column {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.inspector-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-y: auto;
}

.inspector-card > .map-title {
  margin-bottom: 12px;
}

.inspector-badge {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

.inspector-empty {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px 0;
}

.inspector-empty-title {
  color: var(--text-muted);
  font-weight: 600;
}

.inspector-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.inspector-host {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.verdict-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--vc);
  background: color-mix(in srgb, var(--vc) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--vc) 45%, transparent);
}

.inspector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.inspector-grid div {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.inspector-grid span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}

.inspector-grid b {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.inspector-probes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.probe-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 12px;
}

.probe-row > span:first-child {
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.8px;
}

.probe-detail {
  color: var(--text-dim);
  margin-left: auto;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.status-pill.ok {
  color: var(--same);
  border-color: rgba(16, 185, 129, 0.4);
}

.status-pill.rst {
  color: var(--changed);
  border-color: rgba(245, 158, 11, 0.4);
}

.status-pill.none {
  color: var(--dead);
}

.status-pill.other {
  color: var(--accent);
}

.rdap-section {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.rdap-title {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.rdap-block {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.rdap-block span {
  color: var(--text-dim);
}

/* ---------------- Footer ---------------- */

.app-footer {
  flex: none;
  padding: 10px 24px 12px;
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--mono);
  text-align: center;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 1100px) {
  /* Narrow windows: stack the columns and let the page scroll naturally. */
  html,
  body {
    height: auto;
  }

  body {
    display: block;
    overflow-y: auto;
  }

  .workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .map-column {
    height: 55vh;
    min-height: 320px;
  }

  .side-column {
    overflow: visible;
  }

  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .kpi-row {
    grid-template-columns: 1fr;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .status-line {
    text-align: left;
  }

  .map-column {
    height: 60vh;
  }

  .workspace {
    padding-left: 14px;
    padding-right: 14px;
  }
}
