/* ---- Premium Interactive Light Theme Tokens ---- */
:root {
  /* Colors */
  --bg-main: #f8fafc; /* Slate 50 */
  --bg-card: #ffffff; 
  --bg-hover: #f1f5f9; /* Slate 100 */
  
  --border-light: #e2e8f0; /* Slate 200 */
  
  --text-main: #0f172a; /* Slate 900 */
  --text-muted: #475569; /* Slate 600 */
  --text-faint: #94a3b8; /* Slate 400 */
  
  --primary: #6366f1; /* Indigo 500 */
  --primary-hover: #4f46e5; /* Indigo 600 */
  --primary-bg: #e0e7ff; /* Indigo 100 */
  
  --danger: #ef4444; /* Red 500 */
  --danger-bg: #fee2e2; /* Red 100 */
  --warning: #f59e0b; /* Amber 500 */
  --warning-bg: #fef3c7; /* Amber 100 */
  --success: #10b981; /* Emerald 500 */
  
  --radius-sm: 8px;
  --radius-md: 16px;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-hover: 0 12px 20px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  
  /* Buttery smooth animation curve */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body, html {
  height: 100%;
  background-color: var(--bg-main);
  background-image: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.05) 0%, var(--bg-main) 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--text-main); font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 32px; line-height: 1.2; }
h2 { font-size: 22px; }
h3 { font-size: 14px; }
.muted { color: var(--text-muted); }

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); text-decoration: underline; }
button, input { font-family: inherit; }
::selection { background: var(--primary-bg); color: var(--primary-hover); }
.hidden { display: none !important; }

/* ---- Layout & Shell ---- */
.app-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.content-container { max-width: 1200px; margin: 0 auto; width: 100%; padding: 0 24px; }

/* ---- Navigation Bar ---- */
.navbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  height: 70px; display: flex; align-items: center; justify-content: space-between;
}

.nav-left { display: flex; align-items: center; gap: 40px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none !important; }
.brand-logo { 
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; background: var(--primary); color: #fff;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}
.brand-logo svg { width: 20px; height: 20px; }
.brand-text { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; color: var(--text-main); }

.nav-links { display: flex; gap: 6px; }
.nav-item {
  background: transparent; border: none; cursor: pointer;
  padding: 8px 16px; border-radius: 100px;
  color: var(--text-muted); font-weight: 500; font-size: 14px;
  transition: var(--transition);
}
.nav-item:hover { color: var(--text-main); background: var(--bg-hover); }
.nav-item.active { background: var(--primary-bg); color: var(--primary-hover); }

.search-box { position: relative; width: 340px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-faint); }
.search-box input {
  width: 100%; background: #fff; border: 1px solid var(--border-light);
  border-radius: 100px; padding: 10px 16px 10px 40px;
  color: var(--text-main); font-size: 14px; transition: var(--transition);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); background: #fff; }

.search-results {
  position: absolute; top: calc(100% + 12px); left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); max-height: 300px; overflow-y: auto;
  box-shadow: var(--shadow-hover); z-index: 100;
}
.search-result-item { padding: 14px 20px; cursor: pointer; border-bottom: 1px solid var(--border-light); transition: var(--transition); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); padding-left: 24px; }
.search-result-item .sr-title { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--text-main); }
.search-result-item .sr-desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---- Main Content ---- */
.main-content { flex: 1; padding: 50px 0 80px; }
.view { display: none; animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.view.active { display: block; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.page-header { margin-bottom: 40px; }
.pkg-title-row { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.pkg-title-row h1 { font-family: var(--font-mono); font-size: 36px; margin: 0; }
.pkg-desc { font-size: 16px; color: var(--text-muted); max-width: 800px; line-height: 1.6; }
.pkg-meta { display: flex; gap: 24px; margin-top: 20px; font-family: var(--font-mono); font-size: 13px; color: var(--text-faint); flex-wrap: wrap; }

/* ---- Interactive Cards ---- */
.card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  margin-bottom: 24px; overflow: hidden; display: flex; flex-direction: column;
  transition: var(--transition);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: #cbd5e1; }
.card-header { padding: 24px; border-bottom: 1px solid var(--border-light); }
.card-title { margin: 0; font-size: 16px; color: var(--text-main); }
.card-subtitle { margin: 6px 0 0; font-size: 13px; color: var(--text-muted); }
.card-body { padding: 24px; flex: 1; display: flex; flex-direction: column; }
.p-0 { padding: 0 !important; }

.grid-layout { display: grid; gap: 24px; margin-bottom: 24px; }
.main-grid { grid-template-columns: 2fr 1fr; }
.split-grid { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .main-grid, .split-grid { grid-template-columns: 1fr; } }
.side-stack { display: flex; flex-direction: column; gap: 24px; }
.side-stack .card { margin-bottom: 0; }

/* ---- Badges ---- */
.pkg-badges { display: flex; gap: 10px; flex-wrap: wrap; }
.badge { 
  display: inline-flex; align-items: center; padding: 6px 12px;
  border-radius: 100px; font-family: var(--font-mono); font-size: 12px; font-weight: 600; 
  border: 1px solid transparent;
}
.badge-critical { background: var(--danger-bg); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }
.badge-high { background: var(--warning-bg); color: var(--warning); border-color: rgba(245, 158, 11, 0.2); }
.badge-medium, .badge-risk { background: var(--warning-bg); color: var(--warning); border-color: rgba(245, 158, 11, 0.2); }
.badge-ok { background: var(--bg-hover); color: var(--text-muted); border-color: var(--border-light); }
.count-badge { background: var(--bg-hover); color: var(--text-muted); padding: 2px 10px; margin-left: 10px; font-size: 12px; border: 1px solid var(--border-light); }

/* ---- Graph Area ---- */
.graph-card { height: 100%; min-height: 500px; }
.graph-canvas { width: 100%; height: 450px; background: #fafafa; border-radius: 0 0 var(--radius-md) var(--radius-md); box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); }

/* ---- Interactive Lists ---- */
.list-group { display: flex; flex-direction: column; }
.list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px; border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}
.list-item:last-child { border-bottom: none; }
.list-item:hover:not(.static) { background: var(--bg-hover); padding-left: 30px; cursor: pointer; border-left: 3px solid var(--primary); }
.list-item.static:hover { background: var(--bg-main); }

.li-content { display: flex; flex-direction: column; gap: 4px; }
.li-title { font-family: var(--font-mono); font-weight: 600; font-size: 14px; color: var(--text-main); transition: var(--transition); }
.list-item:hover:not(.static) .li-title { color: var(--primary); }
.li-sub { font-size: 13px; color: var(--text-muted); }
.li-right { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }

/* ---- Impact Group ---- */
#impact-content { display: flex; flex-direction: column; gap: 16px; }
.impact-group { padding: 24px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); background: #fff; transition: var(--transition); box-shadow: var(--shadow-sm); }
.impact-group:hover { border-color: rgba(239, 68, 68, 0.3); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.impact-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.impact-cve { font-family: var(--font-mono); font-weight: 700; font-size: 15px; color: var(--text-main); }
.impact-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; line-height: 1.6; }
.impact-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.impact-chip { font-family: var(--font-mono); font-size: 12px; padding: 6px 12px; background: #fff; color: var(--text-muted); border: 1px solid var(--border-light); border-radius: 100px; cursor: pointer; transition: var(--transition); }
.impact-chip:hover { border-color: var(--primary); background: var(--primary-bg); color: var(--primary-hover); transform: translateY(-1px); }

.cycle-path { font-family: var(--font-mono); color: var(--danger); font-size: 13px; font-weight: 500; }

/* ---- Empty States ---- */
.empty-state { text-align: center; padding: 100px 20px; }
.empty-icon-wrapper { display: inline-flex; justify-content: center; align-items: center; width: 72px; height: 72px; background: #fff; border: 1px solid var(--border-light); border-radius: 50%; margin-bottom: 24px; box-shadow: var(--shadow-md); }
.empty-icon { width: 32px; height: 32px; color: var(--text-faint); }
.chip-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 30px; }
.chip { font-family: var(--font-mono); font-size: 13px; padding: 8px 20px; background: #fff; border: 1px solid var(--border-light); border-radius: 100px; color: var(--text-muted); cursor: pointer; transition: var(--transition); box-shadow: var(--shadow-sm); }
.chip:hover { border-color: var(--primary); color: var(--primary-hover); background: var(--primary-bg); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.empty-panel { color: var(--text-faint); padding: 30px; text-align: center; font-style: italic; }
.error-banner { background: var(--danger-bg); border-left: 4px solid var(--danger); color: var(--danger); padding: 20px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-family: var(--font-mono); font-size: 14px; }

/* ---- Path Form ---- */
.path-form { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.input-group { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 10px; }
.input-group label { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.path-form input { width: 100%; background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 12px 16px; font-family: var(--font-mono); font-size: 14px; color: var(--text-main); transition: var(--transition); box-shadow: inset 0 1px 2px rgba(0,0,0,0.02); }
.path-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.path-arrow-wrapper { padding-bottom: 12px; }
.path-arrow { width: 20px; height: 20px; color: var(--text-faint); }
.btn-primary { background: var(--primary); color: #fff; border: none; padding: 12px 28px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; transition: var(--transition); height: 46px; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.path-chain { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 20px; font-family: var(--font-mono); font-size: 14px; }
.path-node { padding: 8px 16px; background: var(--primary-bg); border: 1px solid rgba(99,102,241,0.2); border-radius: var(--radius-sm); color: var(--primary-hover); font-weight: 600; }
.path-sep { color: var(--text-faint); font-weight: bold; }

/* ---- Text Blocks ---- */
.text-block p { font-size: 15px; line-height: 1.7; color: var(--text-muted); margin-bottom: 16px; }
.text-block p:last-child { margin-bottom: 0; }
.text-block strong { color: var(--text-main); font-weight: 600; }
.mb-6 { margin-bottom: 24px; }
.mt-6 { margin-top: 24px; }

/* ---- Footer ---- */
.app-footer { background: #fff; border-top: 1px solid var(--border-light); padding: 24px 0; margin-top: auto; }
.footer-content { display: flex; justify-content: space-between; align-items: center; }

.footer-right { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text-muted); }
.footer-label { font-weight: 500; }
.footer-value { font-family: var(--font-mono); font-weight: 600; color: var(--text-main); }
.footer-divider { color: var(--border-light); }
.footer-link { font-family: var(--font-mono); color: var(--primary); transition: var(--transition); font-weight: 500; }
.footer-link:hover { color: var(--primary-hover); text-decoration: underline; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .search-box { width: 240px; }
}
@media (max-width: 768px) {
  .nav-container { height: auto; flex-direction: column; padding: 20px; gap: 20px; }
  .nav-left { flex-direction: column; gap: 20px; }
  .nav-links { flex-wrap: wrap; justify-content: center; }
  .nav-right, .search-box { width: 100%; }
  .content-container { padding: 0 16px; }
  .main-content { padding: 30px 0 50px; }
  .pkg-title-row { flex-direction: column; align-items: flex-start; }
  .path-form { flex-direction: column; align-items: stretch; }
  .path-arrow-wrapper { display: none; }
  .btn-primary { width: 100%; }
  .footer-content { flex-direction: column; gap: 20px; text-align: center; }
}