/* ============================================================
   CyberShield — Cyber Security News Dashboard
   style.css · Cybrexa Internship · Project 04 (Capstone)

   Design Direction:
   Dark ops console aesthetic — NOT the typical near-black +
   acid-green. Instead: deep navy base (#060d1a) with a
   phosphor-amber accent (#f5a623) — the color of old
   radar screens and threat consoles. Signature element:
   the animated scan-line overlay across the whole page,
   evoking a live security operations center monitor.
   Type: Share Tech Mono for data/labels, Inter for body.
============================================================ */

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

:root {
  /* Palette: Deep navy radar console */
  --bg:          #060d1a;
  --bg-card:     #0a1628;
  --bg-elevated: #0f1e38;
  --border:      #162036;
  --border-lit:  #1e3050;

  /* Accent: Phosphor amber */
  --amber:       #f5a623;
  --amber-dim:   rgba(245,166,35,0.1);
  --amber-glow:  rgba(245,166,35,0.2);

  /* Status colors */
  --red:         #ff3b5c;
  --red-dim:     rgba(255,59,92,0.12);
  --yellow:      #ffd166;
  --yellow-dim:  rgba(255,209,102,0.1);
  --green:       #06d6a0;
  --green-dim:   rgba(6,214,160,0.1);
  --blue:        #4cc9f0;
  --blue-dim:    rgba(76,201,240,0.1);

  /* Text */
  --text:        #a8c0d8;
  --text-bright: #ddeeff;
  --text-muted:  #3a5070;

  /* Type */
  --mono:  'Share Tech Mono', monospace;
  --sans:  'Inter', system-ui, sans-serif;

  /* Layout */
  --radius:    6px;
  --radius-lg: 12px;
  --navbar-h:  52px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  /* Signature: CRT scan-line overlay */
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0,0,0,0.08) 2px,
      rgba(0,0,0,0.08) 4px
    );
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-lit); border-radius: 3px; }

/* ═══════════════════════════════════
   NAVBAR
═══════════════════════════════════ */
.navbar {
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(6,13,26,0.96);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(10px);
  gap: 16px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--text-bright);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-icon {
  font-size: 20px;
  color: var(--amber);
  line-height: 1;
}

.accent { color: var(--amber); }

.nav-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--green);
  letter-spacing: 0.1em;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

.nav-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  flex: 0 0 auto;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text); background: var(--bg-elevated); }
.tab-btn.active { background: var(--amber); color: #000; font-weight: 700; }

.nav-clock {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--amber);
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.nav-right { flex-shrink: 0; }

/* ═══════════════════════════════════
   TAB CONTENT
═══════════════════════════════════ */
.tab-content { display: block; }
.tab-content.hidden { display: none; }

/* ═══════════════════════════════════
   THREAT TICKER
═══════════════════════════════════ */
.threat-ticker {
  display: flex;
  align-items: center;
  gap: 0;
  height: 32px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-card);
}

.ticker-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #000;
  background: var(--amber);
  padding: 0 12px;
  height: 100%;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  font-weight: 700;
}

.ticker-track {
  flex: 1;
  overflow: hidden;
  height: 100%;
  display: flex;
  align-items: center;
}

.ticker-inner {
  display: flex;
  gap: 60px;
  animation: ticker-scroll 40s linear infinite;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  padding-left: 20px;
}

.ticker-inner:hover { animation-play-state: paused; }

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item { display: inline-flex; align-items: center; gap: 8px; }
.ticker-sev-critical { color: var(--red); }
.ticker-sev-high     { color: var(--yellow); }
.ticker-sev-medium   { color: var(--amber); }

/* ═══════════════════════════════════
   KPI ROW
═══════════════════════════════════ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  border-bottom: 1px solid var(--border);
  background: var(--border);
}

.kpi-card {
  background: var(--bg-card);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-card.kpi-danger { border-top: 2px solid var(--red); }
.kpi-card.kpi-warn   { border-top: 2px solid var(--amber); }

.kpi-value {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1;
}

.kpi-card.kpi-danger .kpi-value { color: var(--red); }
.kpi-card.kpi-warn .kpi-value   { color: var(--amber); }

.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.kpi-delta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
}

.kpi-delta.positive { color: var(--green); }

/* ═══════════════════════════════════
   DASHBOARD GRID
═══════════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}

.dash-panel {
  background: var(--bg-card);
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════
   SHARED PANEL STYLES
═══════════════════════════════════ */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--amber);
  text-transform: uppercase;
}

.panel-badge {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 20px;
}

/* ── Dash News List ── */
.dash-news-list {
  overflow-y: auto;
  max-height: 320px;
  flex: 1;
}

.dash-news-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.dash-news-item:hover { background: var(--bg-elevated); }
.dash-news-item:last-child { border-bottom: none; }

.dns-sev {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-block;
  width: fit-content;
}

.sev-critical { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,59,92,0.3); }
.sev-high     { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(255,209,102,0.3); }
.sev-medium   { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245,166,35,0.3); }
.sev-low      { background: var(--green-dim); color: var(--green); border: 1px solid rgba(6,214,160,0.3); }

.dns-title {
  font-size: 13px;
  color: var(--text-bright);
  line-height: 1.4;
  font-weight: 500;
}

.dns-meta {
  display: flex;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* ── Charts ── */
.chart-wrap {
  padding: 16px;
  flex: 1;
  position: relative;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-wrap canvas { max-width: 100%; max-height: 220px; }

.chart-wrap-wide {
  padding: 16px 20px;
  height: 200px;
}

.chart-wrap-wide canvas { width: 100%; height: 100%; }

/* ── Severity Legend ── */
.severity-legend {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leg-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.leg-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
}

.leg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.leg-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Full Panel ── */
.full-panel {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1px;
}

/* ═══════════════════════════════════
   SECTION HEADER
═══════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: -0.01em;
}

.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border-lit);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 10px;
  cursor: pointer;
  outline: none;
}

.filter-select:focus { border-color: var(--amber); }

.btn-refresh, .btn-analyze {
  background: var(--amber);
  color: #000;
  border: none;
  border-radius: var(--radius);
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-refresh:hover, .btn-analyze:hover {
  background: #ffbe4a;
  box-shadow: 0 0 16px var(--amber-glow);
}

/* ═══════════════════════════════════
   NEWS FEED
═══════════════════════════════════ */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  padding: 16px 20px 24px;
}

.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s, transform 0.15s;
  cursor: default;
}

.news-card:hover {
  border-color: var(--border-lit);
  transform: translateY(-2px);
}

.news-card.sev-card-critical { border-left: 3px solid var(--red); }
.news-card.sev-card-high     { border-left: 3px solid var(--yellow); }
.news-card.sev-card-medium   { border-left: 3px solid var(--amber); }
.news-card.sev-card-low      { border-left: 3px solid var(--green); }

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-cat {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--blue);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1.4;
}

.card-summary {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.card-source {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
}

.card-time {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════
   ANALYTICS
═══════════════════════════════════ */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px 20px 24px;
}

.analytics-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.analytics-panel .chart-wrap { min-height: 260px; }
.analytics-panel .chart-wrap canvas { max-height: 260px; }

/* ═══════════════════════════════════
   IP INTEL
═══════════════════════════════════ */
.ip-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 20px 0;
}

.ip-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.ip-form {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.ip-input-row {
  display: flex;
  gap: 8px;
}

.ip-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border-lit);
  border-radius: var(--radius);
  color: var(--text-bright);
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.2s;
}

.ip-input:focus { border-color: var(--amber); }

.ip-quick-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.quick-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.quick-ip {
  background: transparent;
  border: 1px solid var(--border-lit);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 8px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.quick-ip:hover { border-color: var(--amber); color: var(--amber); }

.ip-results {
  padding: 16px;
}

.ip-results.hidden { display: none; }

.ip-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ip-field {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.ip-field-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.ip-field-value {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-bright);
  word-break: break-all;
}

.ip-risk-bar {
  margin-top: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.ip-risk-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.ip-risk-track {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.ip-risk-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.whois-block {
  padding: 16px;
  min-height: 200px;
}

.placeholder-text {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
  margin-top: 16px;
}

.whois-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
}

.whois-table tr { border-bottom: 1px solid var(--border); }
.whois-table tr:last-child { border-bottom: none; }
.whois-table td { padding: 8px 4px; }
.whois-table td:first-child { color: var(--text-muted); width: 40%; letter-spacing: 0.04em; }
.whois-table td:last-child { color: var(--text-bright); }

/* Bad IP Grid */
.bad-ip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
  padding: 12px 16px 16px;
}

.bad-ip-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bad-ip-addr {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--red);
  font-weight: 700;
}

.bad-ip-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════
   GLOSSARY
═══════════════════════════════════ */
.glossary-search {
  background: var(--bg-card);
  border: 1px solid var(--border-lit);
  border-radius: var(--radius);
  color: var(--text-bright);
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 14px;
  min-width: 300px;
  outline: none;
  transition: border-color 0.2s;
}

.glossary-search:focus { border-color: var(--amber); }

.glossary-categories {
  display: flex;
  gap: 8px;
  padding: 12px 20px 0;
  flex-wrap: wrap;
}

.gcat-btn {
  background: transparent;
  border: 1px solid var(--border-lit);
  border-radius: 20px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.gcat-btn:hover, .gcat-btn.active {
  background: var(--amber-dim);
  border-color: var(--amber);
  color: var(--amber);
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  padding: 14px 20px 28px;
}

.glossary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s;
}

.glossary-card:hover { border-color: var(--amber); }

.gcard-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.gcard-term {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--amber);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.gcard-cat {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.gcard-def {
  font-size: 12px;
  color: var(--text);
  line-height: 1.65;
}

.gcard-example {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--green);
  background: var(--green-dim);
  border-left: 2px solid var(--green);
  padding: 6px 10px;
  border-radius: 0 4px 4px 0;
}

/* ═══════════════════════════════════
   FOOTER
═══════════════════════════════════ */
.footer {
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  background: var(--bg-card);
  margin-top: 1px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  gap: 16px;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════
   LOADING SHIMMER
═══════════════════════════════════ */
.shimmer {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════
   RESPONSIVE
═══════════════════════════════════ */
@media (max-width: 900px) {
  .navbar { flex-wrap: wrap; height: auto; padding: 10px; gap: 8px; }
  .nav-tabs { order: 3; width: 100%; overflow-x: auto; }
  .kpi-row { grid-template-columns: repeat(2,1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .ip-layout { grid-template-columns: 1fr; }
  .section-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 500px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .news-grid { grid-template-columns: 1fr; }
  .tab-btn { font-size: 10px; padding: 4px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, .ticker-inner, .pulse-dot { animation: none !important; transition: none !important; }
}
