/* ============================================================
   SHADOW ID - Design System
   ============================================================ */

:root {
  --bg:        #050A14;
  --surface:   #0B1526;
  --surface-2: #101D32;
  --border:    rgba(77,163,255,.12);
  --border-2:  rgba(77,163,255,.22);
  --blue:      #4DA3FF;
  --blue-dim:  #1a4a7a;
  --blue-glow: rgba(77,163,255,.15);
  --green:     #2ECC71;
  --orange:    #FF9F1C;
  --red:       #FF3B30;
  --text:      #E2EAF4;
  --text-2:    #7A91AA;
  --text-3:    #3F5672;
  --mono:      'JetBrains Mono', monospace;
  --sans:      'Inter', sans-serif;
  --display:   'Space Grotesk', sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--blue-dim); border-radius: 2px; }

/* ── HEADER ─────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(5,10,20,.92);
  backdrop-filter: blur(12px);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.brand-icon {
  color: var(--blue);
  font-size: 1.3rem;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-name {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--text);
}
.brand-sub {
  font-size: .65rem;
  color: var(--text-3);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  align-items: center;
  gap: .25rem;
}
.nav-link {
  text-decoration: none;
  color: var(--text-2);
  font-size: .8rem;
  padding: .4rem .85rem;
  border-radius: 4px;
  transition: color .2s, background .2s;
  letter-spacing: .02em;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--blue); }
#settings-btn { font-size: .9rem; padding: .4rem .7rem; }

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5,10,20,.85);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  width: 100%;
  max-width: 440px;
  margin: 1rem;
}
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-family: var(--display);
  font-size: .95rem;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 1rem;
  cursor: pointer;
  padding: .25rem;
  transition: color .2s;
}
.modal-close:hover { color: var(--text); }
.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.field-label {
  font-size: .75rem;
  color: var(--text-2);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 500;
}
.text-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 5px;
  padding: .7rem 1rem;
  color: var(--text);
  font-family: var(--mono);
  font-size: .8rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.text-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}
.modal-hint {
  font-size: .75rem;
  color: var(--text-3);
  line-height: 1.5;
}

/* ── MAIN ────────────────────────────────────────────────────── */
.main {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 3rem 2rem 4rem;
}

/* ── VIEWS ───────────────────────────────────────────────────── */
.view { }
.hidden { display: none !important; }
.view-title {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 2rem;
  color: var(--text);
}

/* ── HERO ────────────────────────────────────────────────────── */
.hero {
  max-width: 680px;
  margin-bottom: 2.5rem;
}
.hero-eyebrow {
  font-size: .7rem;
  color: var(--blue);
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: .75rem;
}
.hero-title {
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 1rem;
  letter-spacing: -.01em;
}
.hero-desc {
  color: var(--text-2);
  font-size: .9rem;
  max-width: 500px;
  line-height: 1.7;
}

/* ── SEARCH CARD ─────────────────────────────────────────────── */
.search-card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 3rem;
}
.input-row {
  display: flex;
  gap: .75rem;
  align-items: stretch;
}
.input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-3);
  font-size: .9rem;
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 5px;
  padding: .85rem 6rem .85rem 2.75rem;
  color: var(--text);
  font-family: var(--sans);
  font-size: .9rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}
.search-input::placeholder { color: var(--text-3); }
.input-type-badge {
  position: absolute;
  right: .75rem;
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--blue);
  background: var(--blue-dim);
  padding: .15rem .5rem;
  border-radius: 3px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.btn-analyze {
  background: var(--blue);
  color: #050A14;
  border: none;
  border-radius: 5px;
  padding: .85rem 1.5rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .6rem;
  white-space: nowrap;
  transition: background .2s, transform .1s;
  letter-spacing: .02em;
}
.btn-analyze:hover { background: #6fb8ff; }
.btn-analyze:active { transform: scale(.98); }

.spinner { display: inline-flex; }

.search-meta {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.meta-item {
  font-size: .72rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.meta-item i { color: var(--blue); font-size: .7rem; }

/* ── RESULT BLOCKS ───────────────────────────────────────────── */
.results {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.result-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  animation: fadeUp .4s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}
.block-label {
  font-family: var(--display);
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.block-tag {
  font-size: .65rem;
  font-family: var(--mono);
  padding: .2rem .6rem;
  border-radius: 3px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.block-tag.warning { background: rgba(255,159,28,.12); color: var(--orange); }
.block-tag.ok      { background: rgba(46,204,113,.12); color: var(--green); }

.block-actions {
  display: flex;
  gap: .5rem;
}
.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-2);
  font-size: .8rem;
  padding: .3rem .55rem;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.icon-btn:hover { color: var(--blue); border-color: var(--blue); }

/* ── SCORE / OVERVIEW ────────────────────────────────────────── */
.overview-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 2rem;
  align-items: start;
}
.score-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
}
.score-ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
}
.score-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.ring-bg {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 8;
}
.ring-fill {
  fill: none;
  stroke: var(--blue);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1), stroke .4s;
}
.score-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: row;
  gap: 1px;
}
.score-number {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.score-max {
  font-size: .8rem;
  color: var(--text-3);
  align-self: flex-end;
  margin-bottom: .2rem;
}
.score-label {
  font-family: var(--display);
  font-weight: 600;
  font-size: .85rem;
  letter-spacing: .04em;
}
.score-label.low    { color: var(--green); }
.score-label.medium { color: var(--orange); }
.score-label.high   { color: var(--red); }
.score-sublabel {
  font-size: .68rem;
  color: var(--text-3);
  text-align: center;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.overview-stats {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding-top: .5rem;
}
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .75rem;
  background: var(--surface-2);
  border-radius: 5px;
  border: 1px solid var(--border);
}
.stat-name {
  font-size: .78rem;
  color: var(--text-2);
}
.stat-val {
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--text);
  font-weight: 500;
}

.risk-bar-wrap { margin-top: .5rem; }
.risk-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.risk-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 1s ease, background .4s;
}
.risk-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: .63rem;
  color: var(--text-3);
  margin-top: .35rem;
  font-family: var(--mono);
}

/* ── IED BREAKDOWN ───────────────────────────────────────────── */
.ied-breakdown {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.breakdown-title {
  font-size: .72rem;
  color: var(--text-3);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: .75rem;
}
.breakdown-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .5rem;
}
.breakdown-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .6rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.breakdown-key {
  font-size: .7rem;
  color: var(--text-3);
}
.breakdown-val {
  font-family: var(--mono);
  font-size: .9rem;
  color: var(--blue);
  font-weight: 500;
}

/* ── EXPOSURE LIST ───────────────────────────────────────────── */
.exposure-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.exposure-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .75rem 1.25rem;
  align-items: start;
}
.exposure-card.confirmed { border-left: 2px solid var(--red); }
.exposure-card.probable  { border-left: 2px solid var(--orange); }
.exposure-card.indirect  { border-left: 2px solid var(--text-3); }
.exposure-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: .35rem;
  flex-shrink: 0;
}
.confirmed .exposure-status-dot { background: var(--red); box-shadow: 0 0 6px var(--red); }
.probable  .exposure-status-dot { background: var(--orange); }
.indirect  .exposure-status-dot { background: var(--text-3); }
.exposure-body { display: flex; flex-direction: column; gap: .25rem; }
.exposure-type {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text);
}
.exposure-meta {
  font-size: .72rem;
  color: var(--text-3);
  font-family: var(--mono);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.confidence-badge {
  font-size: .65rem;
  font-family: var(--mono);
  padding: .15rem .55rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  align-self: start;
}
.confidence-badge.high   { background: rgba(255,59,48,.12);  color: var(--red); }
.confidence-badge.medium { background: rgba(255,159,28,.12); color: var(--orange); }
.confidence-badge.low    { background: rgba(122,145,170,.1); color: var(--text-2); }

.event-count {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--text-3);
}

/* ── ATTACK SIMULATION ───────────────────────────────────────── */
.attack-intro {
  font-size: .82rem;
  color: var(--text-2);
  margin-bottom: 1rem;
  line-height: 1.6;
}
.attack-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.attack-item {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  padding: .75rem 1rem;
  background: var(--surface-2);
  border-radius: 5px;
  border: 1px solid var(--border);
}
.attack-icon {
  color: var(--orange);
  font-size: .85rem;
  margin-top: .1rem;
  flex-shrink: 0;
}
.attack-text { font-size: .82rem; color: var(--text-2); line-height: 1.5; }

/* ── RECOMMENDATIONS ─────────────────────────────────────────── */
.rec-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.rec-item {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  padding: .85rem 1rem;
  background: var(--surface-2);
  border-radius: 5px;
    border: 1px solid var(--border);
}
.rec-priority {
  font-size: .6rem;
  font-family: var(--mono);
  padding: .2rem .5rem;
  border-radius: 3px;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: .05rem;
}
.rec-priority.high   { background: rgba(255,59,48,.12); color: var(--red); }
.rec-priority.medium { background: rgba(255,159,28,.12); color: var(--orange); }
.rec-priority.low    { background: rgba(77,163,255,.12); color: var(--blue); }
.rec-body { display: flex; flex-direction: column; gap: .15rem; }
.rec-title { font-size: .82rem; font-weight: 500; color: var(--text); }
.rec-desc  { font-size: .76rem; color: var(--text-3); line-height: 1.5; }

/* ── TECH TABLE ──────────────────────────────────────────────── */
.tech-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}
.tech-table tr { border-bottom: 1px solid var(--border); }
.tech-table tr:last-child { border-bottom: none; }
.tech-table td {
  padding: .6rem .5rem;
  vertical-align: top;
}
.tech-table td:first-child {
  color: var(--text-3);
  width: 200px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding-right: 1rem;
}
.tech-table td:last-child {
  font-family: var(--mono);
  color: var(--text-2);
}

.disclaimer {
  margin-top: 1rem;
  padding: .75rem 1rem;
  background: rgba(77,163,255,.06);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: .75rem;
  color: var(--text-3);
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  line-height: 1.5;
}
.disclaimer i { color: var(--blue); margin-top: .1rem; flex-shrink: 0; }

/* ── TIMELINE ────────────────────────────────────────────────── */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.tl-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.tl-line-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 20px;
}
.tl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
  margin-top: .3rem;
}
.tl-line {
  width: 1px;
  flex: 1;
  background: var(--border);
  min-height: 24px;
}
.tl-item:last-child .tl-line { display: none; }
.tl-content {
  padding-bottom: 1.25rem;
  flex: 1;
}
.tl-year {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--blue);
  margin-bottom: .2rem;
}
.tl-event {
  font-size: .82rem;
  color: var(--text);
}
.tl-source {
  font-size: .7rem;
  color: var(--text-3);
  margin-top: .1rem;
}

/* ── MONITOR CTA ─────────────────────────────────────────────── */
.monitor-cta {
  background: linear-gradient(135deg, #0B1526, #0D2240);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.monitor-cta-title {
  font-family: var(--display);
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .35rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.monitor-cta-title i { color: var(--blue); }
.monitor-cta-desc {
  font-size: .8rem;
  color: var(--text-2);
  max-width: 520px;
  line-height: 1.6;
}
.btn-monitor {
  background: none;
  border: 1px solid var(--blue);
  color: var(--blue);
  border-radius: 5px;
  padding: .7rem 1.4rem;
  font-family: var(--display);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, color .2s;
  letter-spacing: .02em;
}
.btn-monitor:hover { background: var(--blue); color: #050A14; }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn-primary {
  background: var(--blue);
  color: #050A14;
  border: none;
  border-radius: 5px;
  padding: .7rem 1.25rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  transition: background .2s;
}
.btn-primary:hover { background: #6fb8ff; }

/* ── HISTORY / MONITOR VIEWS ─────────────────────────────────── */
.history-list, .monitor-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color .2s;
  gap: 1rem;
}
.history-item:hover { border-color: var(--border-2); }
.history-id {
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--text);
}
.history-date {
  font-size: .72rem;
  color: var(--text-3);
  font-family: var(--mono);
}
.history-score {
  font-family: var(--mono);
  font-size: .82rem;
  font-weight: 600;
}
.history-score.low    { color: var(--green); }
.history-score.medium { color: var(--orange); }
.history-score.high   { color: var(--red); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 3rem 2rem;
  color: var(--text-3);
  font-size: .82rem;
  text-align: center;
}
.empty-state i { font-size: 2rem; }

/* ── FOOTER ──────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  font-size: .7rem;
  color: var(--text-3);
  font-family: var(--mono);
  flex-wrap: wrap;
  gap: .5rem;
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 700px) {
  .header-inner { padding: 0 1rem; }
  .brand-sub { display: none; }
  .main { padding: 2rem 1rem 3rem; }
  .input-row { flex-direction: column; }
  .btn-analyze { width: 100%; justify-content: center; }
  .overview-grid { grid-template-columns: 1fr; }
  .score-panel { flex-direction: row; justify-content: flex-start; }
  .monitor-cta { flex-direction: column; }
  .btn-monitor { width: 100%; text-align: center; }
  .exposure-card { grid-template-columns: auto 1fr; }
  .confidence-badge { display: none; }
}

/* ── TOAST ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: .75rem 1.25rem;
  font-size: .8rem;
  color: var(--text);
  z-index: 300;
  animation: slideIn .3s ease;
  max-width: 320px;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
