/* ═══════════════════════════════════════════════════════════════════
   CVEPing — Complete Stylesheet
   ═══════════════════════════════════════════════════════════════════ */

/* 1. Custom Properties
   ─────────────────────────────────────────────────────────────────── */
:root {
  --bg-body: #0a0f1c;
  --bg-surface: #111928;
  --bg-card: rgba(17, 25, 40, 0.75);
  --bg-card-hover: rgba(255, 255, 255, 0.03);
  --bg-input: rgba(255, 255, 255, 0.03);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --accent-bg: rgba(99, 102, 241, 0.1);
  --accent-border: rgba(99, 102, 241, 0.3);
  --critical: #dc2626;
  --critical-bg: rgba(220, 38, 38, 0.1);
  --critical-border: rgba(220, 38, 38, 0.2);
  --high: #ea580c;
  --high-bg: rgba(234, 88, 12, 0.1);
  --high-border: rgba(234, 88, 12, 0.2);
  --medium: #eab308;
  --medium-bg: rgba(234, 179, 8, 0.1);
  --low: #16a34a;
  --low-bg: rgba(22, 163, 74, 0.1);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --container-max: 1200px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

/* 2. Global Reset & Base
   ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-hover);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--accent);
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

.text-muted {
  color: var(--text-muted);
  font-size: 13px;
}

/* 3. Landing Page — Background
   ─────────────────────────────────────────────────────────────────── */
body.landing {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
    var(--bg-body);
}

/* 4. Landing Sections
   ─────────────────────────────────────────────────────────────────── */
.landing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
}

.landing-header .logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-hover);
}

.landing-header .logo-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
}

.landing-header nav {
  display: flex;
  gap: 24px;
}

.landing-header nav a {
  font-size: 14px;
  color: var(--text-secondary);
}

.landing-header nav a:hover {
  color: var(--text-primary);
}

/* Hero */
.hero {
  text-align: center;
  max-width: 800px;
  margin: 80px auto 60px;
}

.hero h1 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.hero-note {
  font-size: 13px;
  color: var(--text-muted);
}

/* How it works */
.how-it-works {
  padding: 60px 0;
}

.how-it-works h2,
.live-stats h2,
.tech-grid h2,
.differentiator h2,
.features h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 32px;
  text-align: center;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.cards-grid .card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  backdrop-filter: blur(12px);
}

.cards-grid .card .card-emoji {
  font-size: 32px;
  margin-bottom: 16px;
}

.cards-grid .card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.cards-grid .card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Live stats */
.live-stats {
  padding: 60px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  backdrop-filter: blur(12px);
}

.stat-box .stat-number {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-box .stat-number.critical-color {
  color: var(--critical);
}

.stat-box .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* Tech grid */
.tech-grid {
  padding: 60px 0;
}

.tech-grid-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.tech-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

.tech-badge .tech-category {
  font-size: 10px;
  color: var(--text-muted);
}

/* Comparison table */
.differentiator {
  padding: 60px 0;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.comparison-table th {
  padding: 12px 20px;
  text-align: left;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.comparison-table td {
  padding: 16px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.comparison-table td:last-child {
  color: var(--accent-hover);
}

/* Features */
.features {
  padding: 60px 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.features-grid .feature {
  padding: 24px;
}

.features-grid .feature h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.features-grid .feature p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Footer */
.landing-footer {
  padding: 40px 0;
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

.landing-footer p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.landing-footer .footer-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 12px;
}

.landing-footer .footer-links a {
  font-size: 13px;
  color: var(--text-secondary);
}

/* 5. Dashboard Layout
   ─────────────────────────────────────────────────────────────────── */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-left .logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-hover);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.stat-card .stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
}

.stat-card .stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 6. Tech Chips
   ─────────────────────────────────────────────────────────────────── */
.tech-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.tech-chips.collapsed {
  max-height: 76px; /* ~2 rows of chips */
}

.tech-chips-toggle {
  background: none;
  border: none;
  color: var(--accent-hover);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0;
  font-family: var(--font-body);
}

.tech-chips-toggle:hover {
  color: var(--accent);
}

.chip {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--font-body);
}

.chip:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
}

.chip.active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent-hover);
}

.chip-count {
  margin-left: 4px;
  opacity: 0.5;
}

/* 7. Filters Bar
   ─────────────────────────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0;
}

.severity-filters {
  display: flex;
  gap: 6px;
}

.search-input {
  padding: 8px 14px 8px 34px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  width: 260px;
  outline: none;
  font-size: 12px;
  font-family: var(--font-body);
  transition: border-color 0.15s;
}

.search-input:focus {
  border-color: var(--accent-border);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-wrapper {
  position: relative;
}

.search-wrapper .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}

/* 8. Vulnerability List
   ─────────────────────────────────────────────────────────────────── */
.vuln-list {
  margin-top: 8px;
}

.vuln-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  overflow: hidden;
  transition: all 0.15s;
  cursor: pointer;
}

.vuln-row:hover {
  background: var(--bg-card-hover);
}

.vuln-row[data-status="action_required"] {
  border-color: var(--critical-border);
}

.vuln-row-main {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
}

.vuln-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.vuln-title {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vuln-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.vuln-cvss,
.vuln-epss {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.vuln-cvss-label,
.vuln-epss-label {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  display: block;
}

.vuln-date {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.vuln-expand-icon {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.vuln-row.expanded .vuln-expand-icon {
  transform: rotate(180deg);
}

/* 9. Expanded Detail
   ─────────────────────────────────────────────────────────────────── */
.vuln-expanded {
  padding: 0 20px 16px;
  border-top: 1px solid var(--border);
  animation: fadeIn 0.2s;
}

.vuln-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 14px 0 12px;
}

.vuln-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}

.detail-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.detail-value {
  font-size: 13px;
  color: var(--text-secondary);
}

.detail-value a {
  font-size: 12px;
  word-break: break-all;
}

.vuln-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* 10. Severity Badges
   ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.badge-critical {
  background: var(--critical);
  color: white;
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.25);
}

.badge-high {
  background: var(--high);
  color: white;
  box-shadow: 0 0 12px rgba(234, 88, 12, 0.2);
}

.badge-medium {
  background: var(--medium);
  color: var(--bg-body);
}

.badge-low {
  background: var(--low);
  color: var(--bg-body);
}

.badge-unknown {
  background: var(--text-muted);
  color: var(--bg-body);
}

/* 11. Status Dots
   ─────────────────────────────────────────────────────────────────── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-new {
  background: var(--accent);
}

.status-action_required {
  background: var(--critical);
  box-shadow: 0 0 8px var(--critical);
  animation: pulse 2s infinite;
}

.status-monitoring {
  background: var(--medium);
}

.status-patched {
  background: var(--low);
}

.status-dismissed {
  background: var(--text-muted);
}

/* 12. Buttons
   ─────────────────────────────────────────────────────────────────── */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-body);
}

.btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  border-color: var(--accent-border);
  background: var(--accent-bg);
  color: var(--accent-hover);
}

.btn-secondary:hover {
  background: var(--accent-glow);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 11px;
}

.btn-active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent-hover);
}

.btn-ghost {
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
}

/* 13. Settings Panel
   ─────────────────────────────────────────────────────────────────── */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.panel-section {
  margin-bottom: 24px;
}

.panel-section h4 {
  font-size: 14px;
  margin-bottom: 4px;
}

.panel-section .section-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.tech-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.tech-item {
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s;
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-body);
}

.tech-item:hover {
  border-color: var(--border-hover);
}

.tech-item.active {
  border-color: var(--accent-border);
  background: var(--accent-bg);
  color: var(--accent-hover);
}

.tech-item .tech-check {
  color: var(--accent);
  font-size: 14px;
}

.sbom-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-muted);
  font-size: 14px;
}

.sbom-dropzone:hover {
  border-color: var(--border-hover);
}

.sbom-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.sbom-result {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 0;
}

.pagination .btn {
  min-width: 36px;
  text-align: center;
}

.pagination .btn[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination-dots {
  color: var(--text-muted);
  font-size: 14px;
  padding: 0 4px;
}

/* 14. Skeleton Loading
   ─────────────────────────────────────────────────────────────────── */
.skeleton {
  height: 72px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.03) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* 15. Animations
   ─────────────────────────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

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

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

/* 16. Scrollbar
   ─────────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* 17. Responsive
   ─────────────────────────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 1024px) {
  .stats-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .cards-grid,
  .features-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .vuln-row-main {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
  }

  .vuln-title {
    white-space: normal;
    order: 3;
    width: 100%;
  }

  .vuln-meta {
    width: 100%;
    order: 4;
  }

  .panel {
    width: 95%;
    padding: 16px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .container {
    padding: 0 16px;
  }

  .vuln-details-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .landing-header {
    flex-direction: column;
    gap: 12px;
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .severity-filters {
    flex-wrap: wrap;
  }

  .search-input {
    width: 100%;
  }

  .dashboard-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-right {
    flex-wrap: wrap;
    gap: 6px;
  }

  .stat-card .stat-value {
    font-size: 24px;
  }

  .tech-chips.collapsed {
    max-height: 40px; /* 1 row on mobile */
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: 1fr;
  }

  .hero {
    margin: 40px auto 30px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .hero-subtitle {
    font-size: 15px;
  }
}
