/* =======================
   EDGELOOP — TERMINAL CSS
   Terminal-style scanner homepage
   ======================= */

/* ---- TERMINAL MAIN ---- */
.terminal-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 32px;
}

/* ---- TERMINAL HEADER ---- */
.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.terminal-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.terminal-title h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.terminal-title p {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}

.terminal-title .live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.terminal-title .live-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  animation: pulse 2s ease-in-out infinite;
}

.terminal-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.terminal-meta .meta-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
}

.terminal-meta .meta-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---- FILTER BAR ---- */
.terminal-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.filter-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-right: 4px;
}

.terminal-filter .filter-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.15s;
}

.terminal-filter .filter-btn:hover {
  color: var(--fg);
  border-color: rgba(255,255,255,0.15);
  background: var(--bg-card);
}

.terminal-filter .filter-btn.active {
  color: var(--cyan);
  background: var(--cyan-dim);
  border-color: rgba(0, 229, 200, 0.3);
}

.sort-label {
  margin-left: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}

.terminal-filter .sort-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.terminal-filter .sort-btn:hover { color: var(--fg); background: var(--bg-card); }
.terminal-filter .sort-btn.active { color: var(--cyan); }

/* ---- SCAN SECTION ---- */
.scan-section {
  margin-bottom: 36px;
}

.scan-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.scan-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scan-section-title h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.scan-section-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.icon-pred { background: rgba(0,229,200,0.15); }
.icon-eq   { background: rgba(0,150,255,0.15); }
.icon-sb   { background: rgba(245,166,35,0.15); }
.icon-fx   { background: rgba(160,100,255,0.15); }
.icon-cm   { background: rgba(255,120,50,0.15); }

.scan-section-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.scan-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
}

.scan-count strong {
  color: var(--cyan);
  font-size: 12px;
}

.scan-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(122,122,142,0.6);
  letter-spacing: 0.04em;
}

/* ---- SCAN PANEL ---- */
.scan-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.scan-panel-body {
  padding: 0;
}

/* ---- TERMINAL TABLE ---- */
.terminal-table {
  width: 100%;
  border-collapse: collapse;
}

.terminal-table thead tr {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.terminal-table th {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  color: rgba(122,122,142,0.8);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 8px 14px;
  text-align: left;
  white-space: nowrap;
}

.terminal-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 12px;
  vertical-align: middle;
}

.terminal-table tbody tr:last-child td {
  border-bottom: none;
}

.terminal-table tbody tr:hover td {
  background: rgba(255,255,255,0.015);
}

.terminal-table .mono-cell {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
}

.terminal-table .spread-cell {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.terminal-table .spread-high { color: #FF5050; }
.terminal-table .spread-mid  { color: var(--amber); }
.terminal-table .spread-low  { color: var(--fg-muted); }

/* Source tag in cell */
.source-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tag-pm  { background: rgba(0,229,200,0.12); color: #00E5C8; }
.tag-eq  { background: rgba(0,150,255,0.12); color: #0096FF; }
.tag-sb  { background: rgba(245,166,35,0.12); color: #F5A623; }
.tag-fx  { background: rgba(160,100,255,0.12); color: #A064FF; }
.tag-cm  { background: rgba(255,120,50,0.12); color: #FF7832; }

/* ---- EMPTY STATE ---- */
.terminal-empty {
  padding: 32px 20px;
  text-align: center;
}

.terminal-empty .empty-icon {
  font-size: 24px;
  margin-bottom: 8px;
  opacity: 0.4;
}

.terminal-empty .empty-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.6;
}

.terminal-empty .empty-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(122,122,142,0.5);
  margin-top: 4px;
}

/* ---- SCAN STATUS BAR ---- */
.scan-status-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}

.scan-status-bar .status-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.scan-status-bar .status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fg-muted);
}

.scan-status-bar .status-dot.active {
  background: var(--cyan);
  animation: pulse 2s ease-in-out infinite;
}

/* ---- GLOBAL SUMMARY STRIP ---- */
.global-summary {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.summary-item {
  flex: 1;
  padding: 16px 20px;
  border-right: 1px solid var(--border);
  text-align: center;
}

.summary-item:last-child { border-right: none; }

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

.summary-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1;
}

.summary-value.cyan  { color: var(--cyan); }
.summary-value.amber { color: var(--amber); }
.summary-value.muted { color: var(--fg-muted); }

/* ---- SCAN NOW BUTTON ---- */
.scan-now-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--bg);
  background: var(--cyan);
  border: none;
  border-radius: 7px;
  padding: 9px 18px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: opacity 0.2s;
}

.scan-now-btn:hover { opacity: 0.85; }
.scan-now-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.scan-now-btn .spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.scan-now-btn.loading .spinner { display: block; }
.scan-now-btn.loading .btn-label { display: none; }
.scan-now-btn .btn-loading-text { display: none; }
.scan-now-btn.loading .btn-loading-text { display: inline; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .terminal-main { padding: 24px 16px; }

  .terminal-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .terminal-meta { align-items: flex-start; }

  .global-summary { flex-wrap: wrap; }
  .summary-item { min-width: 50%; border-bottom: 1px solid var(--border); }

  .terminal-table { font-size: 11px; }
  .terminal-table th, .terminal-table td { padding: 8px 10px; }

  .scan-section-header { flex-wrap: wrap; }
}

@media (max-width: 600px) {
  .terminal-filter { gap: 6px; }
  .filter-label { display: none; }
  .sort-label { margin-left: 8px; }
}