/* ===== DESIGN SYSTEM ===== */
:root {
  --bg-base: #080c14;
  --bg-surface: #0d1424;
  --bg-card: #111827;
  --bg-card-hover: #1a2236;
  --bg-glass: rgba(255,255,255,0.04);
  --bg-glass-strong: rgba(255,255,255,0.08);

  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);

  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99,102,241,0.25);
  --cyan: #22d3ee;
  --cyan-glow: rgba(34,211,238,0.2);

  --risk-low: #22c55e;
  --risk-medium: #f59e0b;
  --risk-high: #f97316;
  --risk-critical: #ef4444;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;

  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 30px rgba(99,102,241,0.15);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(34,211,238,0.04) 0%, transparent 50%);
}

.hidden { display: none !important; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: all 0.3s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 40px;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.brand-logo-img { text-align: center; margin-bottom: 24px; display: flex; justify-content: center; }
.brand-logo-img img { transition: transform 0.3s ease; filter: drop-shadow(0 0 12px rgba(99,102,241,0.2)); }
.brand-logo-img:hover img { transform: scale(1.05); }

.modal-icon { font-size: 48px; text-align: center; margin-bottom: 16px; }
.modal-box h2 { text-align: center; font-size: 22px; font-weight: 700; margin-bottom: 12px; }
.modal-box p { color: var(--text-secondary); text-align: center; margin-bottom: 20px; line-height: 1.6; }
.modal-box ul { color: var(--text-secondary); margin: 0 0 20px 20px; line-height: 1.8; font-size: 14px; }

.checkbox-label {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; color: var(--text-secondary); margin-bottom: 20px;
  cursor: pointer; line-height: 1.5;
}
.checkbox-label input { margin-top: 3px; accent-color: var(--accent); }

/* ===== APP LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}
.brand-logo-img-sidebar { display: flex; align-items: center; }
.brand-logo-img-sidebar img { filter: drop-shadow(0 0 8px rgba(99,102,241,0.2)); }
.brand-icon { font-size: 28px; }
.brand-name { font-size: 18px; font-weight: 800; color: var(--text-primary); }
.brand-sub { font-size: 11px; color: var(--accent-light); font-weight: 500; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-glass); color: var(--text-primary); }
.nav-item.active {
  background: linear-gradient(135deg, var(--accent-glow), transparent);
  color: var(--accent-light);
  border: 1px solid rgba(99,102,241,0.2);
}
.nav-icon { font-size: 16px; width: 20px; display: flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 1.1rem; height: 1.1rem; stroke-width: 1.7; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.user-badge { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar { display: flex; align-items: center; justify-content: center; }
.user-avatar svg { width: 1.3rem; height: 1.3rem; stroke-width: 1.8; color: var(--accent-light); }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  overflow-x: hidden;
}

.page { display: none; padding: 32px; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.page-header p { color: var(--text-secondary); font-size: 14px; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease;
}
.card:hover { border-color: var(--border-strong); }
.card-title { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.05em; }

.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.2s ease;
}
.glass-card:hover { background: var(--bg-glass-strong); border-color: var(--border-strong); }

/* ===== STATS GRID ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
}
.stat-icon { font-size: 24px; margin-bottom: 10px; display: flex; align-items: center; }
.stat-icon svg { width: 28px; height: 28px; stroke-width: 1.8; filter: drop-shadow(0 0 8px currentColor); }
.stat-value { font-size: 32px; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

/* ===== CHARTS GRID ===== */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 32px; }
.chart-container { position: relative; height: 240px; display: flex; align-items: center; justify-content: center; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }

input[type="text"], input[type="password"], input[type="url"], select, textarea {
  width: 100%;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder { color: var(--text-muted); }

.scan-input-row {
  display: flex; gap: 12px; align-items: flex-end;
}
.scan-input-row .form-group { flex: 1; margin: 0; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: inherit;
  border: none; cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 100%);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-glass-strong);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--bg-card-hover); }

.btn-danger { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-icon {
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 6px; border-radius: 6px; color: var(--text-secondary);
  transition: all 0.2s;
}
.btn-icon svg { width: 1.1rem; height: 1.1rem; stroke-width: 2; }
.btn-icon:hover { background: var(--bg-glass); color: var(--text-primary); }

/* ===== SCAN PANEL ===== */
.scan-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}
.scan-panel h2 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.scan-panel p { color: var(--text-secondary); font-size: 14px; margin-bottom: 20px; }

/* ===== PROGRESS ===== */
.progress-bar {
  height: 4px; background: var(--border); border-radius: 4px; overflow: hidden;
  margin: 16px 0;
}
.progress-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  animation: progressAnim 2s ease-in-out infinite;
}
@keyframes progressAnim {
  0% { width: 0%; }
  50% { width: 75%; }
  100% { width: 95%; }
}

.scanning-indicator {
  display: flex; align-items: center; gap: 10px;
  color: var(--accent-light); font-size: 14px; font-weight: 500;
  padding: 16px; background: var(--accent-glow); border-radius: var(--radius-sm);
  border: 1px solid rgba(99,102,241,0.2);
}
.spinner {
  width: 18px; height: 18px; border: 2px solid rgba(99,102,241,0.2);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== RESULTS ===== */
.results-grid { display: grid; gap: 16px; }
.result-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.result-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.result-section-header h3 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.result-section-body { padding: 16px 20px; }

/* ===== SCORE DISPLAY ===== */
.score-display {
  display: flex; align-items: center; gap: 24px;
  padding: 24px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 20px;
}
.score-circle {
  width: 96px; height: 96px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800;
  border: 4px solid currentColor;
  flex-shrink: 0;
}
.score-info h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.score-info p { color: var(--text-secondary); font-size: 14px; }

/* ===== RISK BADGES ===== */
.risk-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.risk-low { color: var(--risk-low); background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.2); }
.risk-medium { color: var(--risk-medium); background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.2); }
.risk-high { color: var(--risk-high); background: rgba(249,115,22,0.12); border: 1px solid rgba(249,115,22,0.2); }
.risk-critical { color: var(--risk-critical); background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.2); }

/* ===== SEVERITY BADGE ===== */
.sev-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
}
.sev-critical { background: rgba(239,68,68,0.2); color: #ef4444; }
.sev-high { background: rgba(249,115,22,0.2); color: #f97316; }
.sev-medium { background: rgba(245,158,11,0.2); color: #f59e0b; }
.sev-low { background: rgba(34,197,94,0.15); color: #22c55e; }
.sev-info { background: rgba(148,163,184,0.15); color: #94a3b8; }

/* ===== FINDINGS LIST ===== */
.findings-list { display: flex; flex-direction: column; gap: 10px; }
.finding-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; background: var(--bg-glass); border-radius: var(--radius-sm);
  border: 1px solid var(--border); transition: border-color 0.2s ease;
}
.finding-item:hover { border-color: var(--border-strong); }
.finding-msg { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.finding-rec { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

/* ===== HEADERS TABLE ===== */
.headers-grid { display: grid; gap: 8px; }
.header-row {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 10px 14px; background: var(--bg-glass); border-radius: var(--radius-sm);
}
.header-name { font-size: 13px; font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.header-status { font-size: 12px; font-weight: 600; }
.status-pass { color: var(--risk-low); }
.status-fail { color: var(--risk-critical); }
.status-warn { color: var(--risk-medium); }

/* ===== PORTS GRID ===== */
.ports-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.port-badge {
  padding: 8px; border-radius: var(--radius-sm);
  text-align: center; font-size: 12px; font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.port-open { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.25); color: #ef4444; }
.port-closed { background: var(--bg-glass); border: 1px solid var(--border); color: var(--text-muted); }

/* ===== SSL GRADE ===== */
.ssl-grade {
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 12px;
  font-size: 28px; font-weight: 900;
}
.grade-A { background: rgba(34,197,94,0.2); color: #22c55e; border: 2px solid rgba(34,197,94,0.4); }
.grade-B { background: rgba(34,211,238,0.2); color: #22d3ee; border: 2px solid rgba(34,211,238,0.4); }
.grade-C { background: rgba(245,158,11,0.2); color: #f59e0b; border: 2px solid rgba(245,158,11,0.4); }
.grade-D, .grade-F { background: rgba(239,68,68,0.2); color: #ef4444; border: 2px solid rgba(239,68,68,0.4); }
.grade-NA { background: var(--bg-glass); color: var(--text-muted); border: 2px solid var(--border); }

/* ===== TECH CHIPS ===== */
.tech-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tech-chip {
  padding: 6px 12px; border-radius: 20px;
  background: var(--bg-glass-strong); border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--accent-light);
  display: flex; align-items: center; gap: 6px;
}

/* ===== METRIC ROW ===== */
.metric-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.metric-row:last-child { border-bottom: none; }
.metric-label { font-size: 13px; color: var(--text-secondary); }
.metric-value { font-size: 13px; font-weight: 600; font-family: 'JetBrains Mono', monospace; }

/* ===== REPORTS TABLE ===== */
.reports-table { width: 100%; border-collapse: collapse; }
.reports-table th {
  text-align: left; padding: 12px 16px;
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
}
.reports-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.reports-table tr:last-child td { border-bottom: none; }
.reports-table tr:hover td { background: var(--bg-glass); }
.url-cell { font-family: 'JetBrains Mono', monospace; font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.module-tag {
  padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600;
  background: var(--accent-glow); color: var(--accent-light);
}

/* ===== ALERT ===== */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; margin-bottom: 16px;
}
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: #ef4444; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.2); color: #22c55e; }
.alert-info { background: var(--accent-glow); border: 1px solid rgba(99,102,241,0.2); color: var(--accent-light); }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.2); color: #f59e0b; }
.alert-high-intensity {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(249, 115, 22, 0.15) 100%);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ff8a8a;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.1);
  animation: pulse-border 2s infinite;
}
@keyframes pulse-border {
  0% { border-color: rgba(239, 68, 68, 0.3); }
  50% { border-color: rgba(239, 68, 68, 0.6); }
  100% { border-color: rgba(239, 68, 68, 0.3); }
}

/* ===== HARDENING LIST ===== */
.hardening-list { display: flex; flex-direction: column; gap: 10px; }
.hardening-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px; background: var(--bg-glass); border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}
.hardening-priority { font-size: 10px; font-weight: 700; text-transform: uppercase; margin-bottom: 2px; }
.hardening-tip { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.priority-high { color: var(--risk-high); }
.priority-medium { color: var(--risk-medium); }
.priority-low { color: var(--risk-low); }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state .empty-icon { margin-bottom: 16px; opacity: 0.5; display: flex; justify-content: center; }
.empty-state .empty-icon svg { width: 56px; height: 56px; stroke-width: 1.5; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.empty-state p { font-size: 14px; }

/* ===== TWO-COL LAYOUT ===== */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ===== MISC TEXT ===== */
.text-muted { color: var(--text-secondary); }
.small { font-size: 12px; margin-top: 12px; text-align: center; }
.mono { font-family: 'JetBrains Mono', monospace; }
.text-accent { color: var(--accent-light); }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .charts-grid, .two-col, .three-col { grid-template-columns: 1fr; }
  .page { padding: 20px; }
}
