/* ═══════════════════════════════════════════════════
   CTI Watch — Design System
   ═══════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:     #060e1c;
  --surf:   #0c1a2e;
  --surf2:  #112236;
  --surf3:  #172c42;

  /* Borders */
  --bdr:    #1e3554;
  --bdr2:   #294d78;
  --bdr3:   #31609a;

  /* Accent colours — MUST keep -dim suffix everywhere */
  --cyan:     #22d3ee;
  --cyan-dim: rgba(34,211,238,.14);

  --vio:      #a78bfa;
  --vio-dim:  rgba(167,139,250,.14);

  --grn:      #34d399;
  --grn-dim:  rgba(52,211,153,.14);

  --red:      #f87171;
  --red-dim:  rgba(248,113,113,.14);

  --amb:      #fbbf24;
  --amb-dim:  rgba(251,191,36,.14);

  /* Text */
  --t1: #dff0ff;   /* bright – headings, values */
  --t2: #7cb5d0;   /* medium – body, labels     */
  --t3: #3d6882;   /* dim    – placeholders, meta*/

  /* Misc */
  --r:  .5rem;
  --r2: .75rem;
  --r3: 1rem;
  --shadow: 0 4px 28px rgba(0,0,0,.6);
  --shadow-sm: 0 2px 10px rgba(0,0,0,.45);
}

/* ── Reset ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--t1); font-family: 'Inter', system-ui, sans-serif; }

/* ── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--surf); }
::-webkit-scrollbar-thumb { background: var(--bdr2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--bdr3); }

/* ── Animations ──────────────────────────────────── */
@keyframes fadeUp    { from { opacity:0; transform:translateY(10px) } to { opacity:1; transform:none } }
@keyframes fadeRight { from { opacity:0; transform:translateX(16px) } to { opacity:1; transform:none } }
@keyframes float     { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-7px)} }
@keyframes shimmer   { 0%{background-position:-400% 0} 100%{background-position:400% 0} }

.anim-up    { animation: fadeUp    .28s ease-out; }
.anim-right { animation: fadeRight .28s ease-out; }
.anim-float { animation: float 4s ease-in-out infinite; }

/* ── Colour utilities ────────────────────────────── */
.c1 { color: var(--t1); }
.c2 { color: var(--t2); }
.c3 { color: var(--t3); }
.cc { color: var(--cyan); }
.cv { color: var(--vio); }
.cg { color: var(--grn); }
.cr { color: var(--red); }
.ca { color: var(--amb); }

.bg0 { background: var(--bg);    }
.bg1 { background: var(--surf);  }
.bg2 { background: var(--surf2); }
.bg3 { background: var(--surf3); }

.bd  { border: 1px solid var(--bdr);  }
.bd2 { border: 1px solid var(--bdr2); }
.bd3 { border: 1px solid var(--bdr3); }

/* ── Decorative ──────────────────────────────────── */
.grid-bg {
  background-image:
    linear-gradient(rgba(34,211,238,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,211,238,.04) 1px, transparent 1px);
  background-size: 48px 48px;
}
.glow-cyan   { position:fixed; border-radius:50%; pointer-events:none; background: radial-gradient(circle, rgba(34,211,238,.08) 0%, transparent 70%); }
.glow-purple { position:fixed; border-radius:50%; pointer-events:none; background: radial-gradient(circle, rgba(167,139,250,.08) 0%, transparent 70%); }

.text-gradient {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--vio) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ── Sidebar ─────────────────────────────────────── */
#sidebar {
  background: var(--surf);
  border-right: 1px solid var(--bdr);
}

.nav-section {
  font-size: .625rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--t3); padding: .5rem .75rem .2rem;
}

.nav-item {
  display: flex; align-items: center; gap: .625rem;
  padding: .5rem .75rem; border-radius: var(--r);
  font-size: .8125rem; font-weight: 500;
  color: var(--t2); text-decoration: none;
  border-left: 2px solid transparent;
  transition: background .15s, color .15s;
}
.nav-item i { width: 1rem; text-align: center; font-size: .8125rem; color: var(--t3); flex-shrink: 0; transition: color .15s; }
.nav-item:hover { background: var(--cyan-dim); color: var(--t1); }
.nav-item:hover i { color: var(--cyan); }
.nav-item.active { background: var(--cyan-dim); color: var(--cyan); border-left-color: var(--cyan); }
.nav-item.active i { color: var(--cyan); }

/* ── Form inputs ─────────────────────────────────── */
.inp {
  width: 100%; background: var(--surf2);
  border: 1px solid var(--bdr2); border-radius: var(--r);
  padding: .5rem .75rem; color: var(--t1); font-size: .875rem;
  outline: none; transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.inp::placeholder { color: var(--t3); }
.inp:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-dim); }
.inp-sm { padding: .375rem .625rem; font-size: .8125rem; }
select.inp { cursor: pointer; }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem 1rem; border-radius: var(--r);
  font-size: .8125rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none; white-space: nowrap; line-height: 1;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
  font-family: inherit;
}
.btn:disabled { opacity: .4; pointer-events: none; }

.btn-primary { background: var(--cyan); color: #05101e; border-color: var(--cyan); }
.btn-primary:hover { background: #54e6f7; }

.btn-secondary { background: var(--cyan-dim); color: var(--cyan); border-color: var(--bdr2); }
.btn-secondary:hover { background: rgba(34,211,238,.22); border-color: var(--cyan); }

.btn-ghost { background: transparent; color: var(--t2); border-color: var(--bdr2); }
.btn-ghost:hover { background: var(--surf2); color: var(--t1); border-color: var(--bdr3); }

.btn-danger { background: var(--red-dim); color: var(--red); border-color: rgba(248,113,113,.25); }
.btn-danger:hover { background: rgba(248,113,113,.22); border-color: var(--red); }

.btn-sm { padding: .3rem .65rem; font-size: .75rem; }
.btn-lg { padding: .7rem 1.5rem; font-size: .9375rem; }

/* ── Cards ───────────────────────────────────────── */
.card {
  background: var(--surf); border: 1px solid var(--bdr);
  border-radius: var(--r2); padding: 1.25rem;
}

/* ── Intelligence card ───────────────────────────── */
.intel-card {
  background: var(--surf); border: 1px solid var(--bdr);
  border-radius: var(--r2); display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.intel-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--bdr3); transition: background .2s;
}
.intel-card.has-cve::before   { background: var(--red); }
.intel-card.has-match::before { background: var(--cyan); }
.intel-card:hover { border-color: var(--bdr2); transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.5); }

.intel-card-body   { padding: 1rem 1rem 1rem 1.25rem; flex: 1; display: flex; flex-direction: column; gap: .625rem; }
.intel-card-footer {
  padding: .625rem 1rem .625rem 1.25rem;
  border-top: 1px solid var(--bdr);
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}

/* ── News card ───────────────────────────────────── */
.news-card {
  background: var(--surf); border: 1px solid var(--bdr);
  border-radius: var(--r2); padding: 1.125rem;
  display: flex; flex-direction: column; gap: .75rem;
  transition: border-color .2s, transform .2s;
}
.news-card:hover { border-color: var(--bdr2); transform: translateY(-2px); }

/* ── Stat card ───────────────────────────────────── */
.stat-card {
  background: var(--surf); border: 1px solid var(--bdr);
  border-radius: var(--r2); padding: 1.25rem;
  transition: border-color .2s, transform .15s;
}
.stat-card:hover { border-color: var(--bdr2); transform: translateY(-1px); }

/* ── Badges ──────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem; border-radius: .375rem;
  font-size: .6875rem; font-weight: 600; white-space: nowrap; line-height: 1.4;
}
.badge-cyan { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(34,211,238,.25); }
.badge-vio  { background: var(--vio-dim);  color: var(--vio);  border: 1px solid rgba(167,139,250,.25); }
.badge-red  { background: var(--red-dim);  color: var(--red);  border: 1px solid rgba(248,113,113,.25); }
.badge-amb  { background: var(--amb-dim);  color: var(--amb);  border: 1px solid rgba(251,191,36,.25); }
.badge-grn  { background: var(--grn-dim);  color: var(--grn);  border: 1px solid rgba(52,211,153,.25); }
.badge-muted{ background: var(--surf2);    color: var(--t2);   border: 1px solid var(--bdr2); }
.badge-mono { font-family: 'JetBrains Mono', monospace; letter-spacing: -.02em; }

/* ── Table ───────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  background: var(--surf2); color: var(--t3);
  font-size: .6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  padding: .625rem 1rem; border-bottom: 1px solid var(--bdr2); text-align: left;
}
.tbl td { padding: .8rem 1rem; border-bottom: 1px solid var(--bdr); color: var(--t2); font-size: .875rem; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255,255,255,.02); }

/* ── Tabs ────────────────────────────────────────── */
.tab {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .6rem .25rem; font-size: .8125rem; font-weight: 500;
  color: var(--t3); border-bottom: 2px solid transparent;
  text-decoration: none; transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--t2); }
.tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }

/* ── Empty state ─────────────────────────────────── */
.empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 4rem 2rem; text-align: center;
}
.empty-icon { font-size: 2.5rem; color: var(--bdr3); margin-bottom: 1rem; }
.empty h3   { font-size: 1rem; font-weight: 600; color: var(--t2); margin-bottom: .375rem; }
.empty p    { font-size: .8125rem; color: var(--t3); max-width: 26rem; line-height: 1.65; }

/* ── Notification toast ──────────────────────────── */
.toast {
  background: var(--surf); border-radius: var(--r2);
  padding: .875rem 1rem; box-shadow: var(--shadow);
  display: flex; align-items: flex-start; gap: .75rem;
}

/* ── Auth card ───────────────────────────────────── */
.auth-card { background: var(--surf); border: 1px solid var(--bdr2); border-radius: var(--r3); box-shadow: var(--shadow); }

/* ── FAQ ─────────────────────────────────────────── */
.faq-item { background: var(--surf); border: 1px solid var(--bdr); border-radius: var(--r2); overflow: hidden; }
.faq-btn  { width:100%; display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:1rem 1.125rem; text-align:left; background:transparent; border:none; cursor:pointer; transition:background .15s; }
.faq-btn:hover { background: var(--surf2); }
.faq-icon { font-size:.75rem; color:var(--t3); flex-shrink:0; transition:transform .2s; }
.faq-answer { padding: 0 1.125rem 1rem 1.125rem; }

/* ── Pagination ──────────────────────────────────── */
.pg-btn {
  display:inline-flex; align-items:center; justify-content:center;
  min-width:2rem; height:2rem; padding:0 .5rem; border-radius:var(--r);
  font-size:.8125rem; color:var(--t2); border:1px solid var(--bdr);
  text-decoration:none; transition:all .15s;
}
.pg-btn:hover { background:var(--surf2); color:var(--t1); border-color:var(--bdr2); }
.pg-btn.active { background:var(--cyan); color:#05101e; border-color:var(--cyan); font-weight:700; }
.pg-btn.off    { opacity:.3; pointer-events:none; }

/* ── Responsive grids ────────────────────────────── */

/* Stat cards: 2 cols → 4 cols */
.stat-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 900px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }

/* Intelligence / search cards: 1 → 2 → 3 → 4 */
.card-grid {
  display: grid; gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 600px)  { .card-grid { grid-template-columns: repeat(2, 1fr); gap: 1.125rem; } }
@media (min-width: 1200px) { .card-grid { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; } }
@media (min-width: 1600px) { .card-grid { grid-template-columns: repeat(4, 1fr); } }

/* News cards: 1 → 2 → 3 */
.news-grid {
  display: grid; gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px)  { .news-grid { grid-template-columns: repeat(2, 1fr); gap: 1.125rem; } }
@media (min-width: 1200px) { .news-grid { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; } }

/* ── Misc helpers ────────────────────────────────── */
.mono { font-family: 'JetBrains Mono', monospace; letter-spacing: -.02em; }
.line-clamp-2 { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.line-clamp-3 { display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.divider { border: none; border-top: 1px solid var(--bdr); }
.progress-bar { height:4px; border-radius:99px; transition:width .4s ease; background:var(--cyan); }
.progress-track { width:100%; height:4px; background:var(--surf3); border-radius:99px; overflow:hidden; }
