/* ── Results ───────────────────────────────────────────────────────────────── */
#results { margin: 48px 0; }

.loading {
  text-align: center;
  padding: 40px 20px;
  display: none;
  max-width: 500px;
  margin: 0 auto;
}

.loading.active { display: block; }

/* Scanner animation */
.scanner-container {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 32px;
}

.scanner-ring {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(0, 229, 255, 0.1);
  border-radius: 50%;
}

.scanner-ring::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid transparent;
  border-top-color: var(--cyber);
  border-radius: 50%;
  animation: spin 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  filter: drop-shadow(0 0 8px var(--cyber));
}

.scanner-dots {
  position: absolute;
  inset: 15px;
  border: 1px dashed rgba(0, 229, 255, 0.2);
  border-radius: 50%;
  animation: spin 10s linear infinite reverse;
}

.scanner-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyber);
  animation: pulse 2s ease-in-out infinite;
}

/* Progress */
.progress-wrap {
  margin-bottom: 24px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.progress-bar-bg {
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--cyber);
  box-shadow: 0 0 10px var(--cyber);
  transition: width 0.3s ease;
}

/* Terminal */
.terminal-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: left;
  height: 130px;
  overflow-y: hidden;
  position: relative;
}

.terminal-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 50%, rgba(0, 229, 255, 0.02) 50%);
  background-size: 100% 4px;
  pointer-events: none;
}

.terminal-line {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  display: flex;
  gap: 8px;
  opacity: 0;
  animation: terminalFadeIn 0.3s forwards;
}

.terminal-line .time { color: var(--cyber); opacity: 0.7; }
.terminal-line .msg { color: var(--text); }
.terminal-line .status { color: var(--safe); margin-left: auto; }

/* Result card */
.result-card {
  display: none;
}

.result-card.active {
  display: block;
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.glass-panel {
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glow-safe   { box-shadow: 0 0 40px -10px rgba(16,185,129,0.3); }
.glow-warn   { box-shadow: 0 0 40px -10px rgba(245,158,11,0.3); }
.glow-danger { box-shadow: 0 0 40px -10px rgba(239,68,68,0.3); }

/* Error */
.error-card {
  background: rgba(255,61,113,0.07);
  border: 1px solid rgba(255,61,113,0.2);
  border-radius: 12px;
  padding: 24px 28px;
  display: none;
  animation: fadeUp 0.4s ease forwards;
}

.error-card.active { display: block; }

.error-card p {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--danger);
}

/* Stats */
.stat-cell {
  padding: 20px 24px;
  border-right: 1px solid var(--border);
}

.stat-cell:last-child { border-right: none; }

.stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.stat-value.highlight { color: var(--accent); }

/* AI/Threat Summary */
.ai-section {
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

.ai-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  padding: 2px 8px;
  background: rgba(0,229,255,0.1);
  border: 1px solid rgba(0,229,255,0.2);
  border-radius: 4px;
  color: var(--accent);
}

.ai-summary {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.ai-dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.2s infinite;
}

.ai-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Details */
.detail-section {
  padding: 28px 32px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 10px;
}

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; gap: 16px; }
}

.detail-table {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: rgba(30, 41, 59, 0.2);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s ease;
}

.detail-row:last-child { border-bottom: none; }
.detail-row:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
.detail-row:hover { background: rgba(239, 68, 68, 0.05); }

.detail-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  flex: 1;
}

.detail-value {
  font-family: var(--font-display);
  font-weight: 400;
  color: #ffffff;
  font-size: 14px;
  text-align: right;
  flex: 2;
}

/* Status Colors for Values */
.detail-row[data-status="safe"] .detail-value { color: var(--safe); }
.detail-row[data-status="warn"] .detail-value { color: var(--warn); }
.detail-row[data-status="danger"] .detail-value { color: var(--danger); }

/* Category tags */
.categories-section {
  padding: 0 32px 28px;
}

.cat-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.cat-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 5px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
}

/* ── Premium result CSS (injected dynamically but also defined here) ────── */
@keyframes orbit-glow {
  0%   { transform: rotate(0deg) translateX(46px) rotate(0deg); opacity: 0.8; }
  50%  { opacity: 0.4; }
  100% { transform: rotate(360deg) translateX(46px) rotate(-360deg); opacity: 0.8; }
}
@keyframes pulse-soft {
  0%, 100% { opacity: 1; filter: brightness(1); }
  50%      { opacity: 0.85; filter: brightness(1.2); }
}
.fade-up { animation: fade-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.card-inner {
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(0,0,0,0.2) 100%);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 1.25rem;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  box-shadow: 0 4px 20px -5px rgba(0,0,0,0.3);
}
.card-inner:hover {
  transform: translateY(-5px);
  border-color: rgba(255,255,255,0.15);
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(0,0,0,0.25) 100%);
  box-shadow: 0 20px 40px -12px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.08);
}
.card-header {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.card-icon {
  width: 38px; height: 38px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: inset 0 0 12px rgba(255,255,255,0.05);
}
.card-title {
  font-size: 11px; font-weight: 850; text-transform: uppercase;
  letter-spacing: 0.18em; color: rgba(255,255,255,0.3);
}
.card-body { padding: 8px 0; }
.p-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid rgba(255,255,255,0.03); gap: 12px;
}
.p-row:last-child { border-bottom: none; }
.p-label { font-size: 12.5px; font-weight: 600; color: rgba(255,255,255,0.4); white-space: nowrap; flex-shrink: 0; }
.p-value { font-size: 13.5px; font-weight: 800; color: rgba(255,255,255,0.95); text-align: right; overflow-wrap: anywhere; word-break: normal; }
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.1em;
  padding: 4px 12px; border-radius: 999px; border-width: 1px; border-style: solid;
  backdrop-filter: blur(4px); transition: all 0.2s ease;
}
.badge-ok      { background:rgba(16,185,129,.1); color:#34d399; border-color:rgba(16,185,129,0.3); box-shadow: 0 0 15px rgba(16,185,129,0.1); }
.badge-warn    { background:rgba(245,158,11,.1);  color:#fbbf24; border-color:rgba(245,158,11,0.3);  box-shadow: 0 0 15px rgba(245,158,11,0.1); }
.badge-bad     { background:rgba(239,68,68,.1);   color:#f87171; border-color:rgba(239,68,68,0.3);   box-shadow: 0 0 15px rgba(239,68,68,0.1); }
.badge-neutral { background:rgba(255,255,255,.05); color:rgba(255,255,255,0.5); border-color:rgba(255,255,255,0.1); }
.badge-ok.glowing { animation: pulse-soft 2s infinite ease-in-out; box-shadow: 0 0 20px rgba(16,185,129,0.2), inset 0 0 8px rgba(16,185,129,0.1); }

.summary-module {
  background: linear-gradient(135deg, rgba(255,255,255,0.02) 0%, rgba(0,0,0,0.4) 100%);
  border: 1px dashed rgba(255,255,255,0.15);
  border-radius: 1.5rem; backdrop-filter: blur(24px);
  box-shadow: inset 0 0 40px rgba(255,255,255,0.02);
}
.stat-pill {
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 24px; border-radius: 1.1rem;
  border: 1px solid rgba(255,255,255,0.06); background: rgba(0,0,0,0.4); min-width: 85px;
  transition: all 0.2s ease;
}
.stat-pill:hover { border-color: rgba(255,255,255,0.12); transform: scale(1.05); }

.score-ring-container {
  position: relative; width: 120px; height: 120px; margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
}
.score-ring-orbit {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: white; filter: blur(2px) drop-shadow(0 0 8px white);
  animation: orbit-glow 4s linear infinite; z-index: 10;
}
.score-number { font-size: 38px; font-weight: 950; letter-spacing: -0.02em; line-height: 1; }

/* Tabs */
.tab-container { display: flex; gap: 8px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 24px; overflow-x: auto; padding-bottom: 2px; }
.tab-btn { padding: 10px 20px; font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.5); background: transparent; border: none; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; white-space: nowrap; }
.tab-btn:hover { color: rgba(255,255,255,0.8); }
.tab-btn.active { color: var(--cyber, #00e5ff); border-bottom: 2px solid var(--cyber, #00e5ff); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeUp 0.4s ease forwards; }

/* Network Bar */
.dist-bar { width: 100%; height: 8px; border-radius: 4px; display: flex; overflow: hidden; background: rgba(255,255,255,0.05); margin: 16px 0 8px; }
.dist-segment { height: 100%; transition: width 0.3s ease; }
.dist-label-container { display: flex; gap: 16px; flex-wrap: wrap; font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.5); }
.dist-label { display: flex; align-items: center; gap: 6px; }
.dist-dot { width: 8px; height: 8px; border-radius: 50%; }

/* Page Preview */
.page-preview { width: 100%; aspect-ratio: 16/9; background: rgba(0,0,0,0.4); border-radius: 12px; border: 1px solid rgba(255,255,255,0.1); overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 20px rgba(0,229,255,0.1); }
.page-preview img { width: 100%; height: 100%; object-fit: cover; opacity: 0.8; transition: opacity 0.3s; }
.page-preview:hover img { opacity: 1; }
