/* =====================================================
   CHAGAS DISEASE WORLD DAY – DASHBOARD STYLES
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-1: #009c3b;
  --accent-2: #22c55e;
  --accent-3: #4ade80;
  --accent-gradient: linear-gradient(135deg, #009c3b 0%, #ffdf00 100%);
  --accent-gradient-subtle: linear-gradient(135deg, rgba(0, 156, 59, 0.15) 0%, rgba(255, 223, 0, 0.15) 100%);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 40px rgba(0,156,59,0.15);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset & Base ---------- */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background gradient */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(0,156,59,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(255,223,0,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(34,197,94,0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 { font-family: 'Outfit', sans-serif; font-weight: 700; letter-spacing: -0.02em; }

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  padding: 0 2rem;
}
.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}
.nav-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 20px rgba(0,156,59,0.3);
}
.nav-brand-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}
.nav-brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

.nav-tabs {
  display: flex;
  gap: 4px;
}
.nav-tab {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}
.nav-tab.active {
  color: var(--text-primary);
  background: rgba(0,156,59,0.15);
}
.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  border-radius: 3px;
  background: var(--accent-gradient);
}

/* ---------- Main Layout ---------- */
main {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease;
}
.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Hero Section ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  margin-bottom: 3rem;
  padding: 2rem 0;
}
.hero-text h1 {
  font-size: 2.8rem;
  line-height: 1.15;
  margin-bottom: 1rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-text p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}
.hero-date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 99px;
  background: rgba(0,156,59,0.1);
  border: 1px solid rgba(0,156,59,0.2);
  color: var(--accent-2);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.hero-image {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border: 1px solid var(--border-glass);
}
.hero-image img {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  display: block;
}
.hero-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,156,59,0.1) 0%, transparent 60%);
  pointer-events: none;
}

/* ---------- Stats Cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}
.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: var(--transition);
}
.stat-card:hover {
  border-color: rgba(0,156,59,0.2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.stat-card:hover::before { opacity: 1; }
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.purple { background: rgba(0,156,59,0.15); color: #22c55e; }
.stat-icon.pink { background: rgba(255,223,0,0.15); color: #f472b6; }
.stat-icon.blue { background: rgba(34,197,94,0.15); color: #60a5fa; }
.stat-icon.green { background: rgba(16,185,129,0.15); color: #34d399; }
.stat-info { flex: 1; }
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 4px;
}
.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.stat-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---------- Section Headers ---------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.section-title {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

/* ---------- Search & Controls ---------- */
.search-container {
  position: relative;
  max-width: 360px;
  width: 100%;
}
.search-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(0,156,59,0.15);
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

/* ---------- Chart Container ---------- */
.chart-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  overflow: hidden;
}

.chart-wrapper {
  width: 100%;
  overflow-x: auto;
  position: relative;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 1.5rem;
}
.pagination-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.pagination-btn:hover:not(:disabled) {
  background: rgba(0,156,59,0.1);
  border-color: rgba(0,156,59,0.3);
  color: var(--text-primary);
}
.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.pagination-btn.active {
  background: var(--accent-1);
  border-color: var(--accent-1);
  color: white;
}
.pagination-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0 8px;
}

/* ---------- Tooltip ---------- */
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.82rem;
  color: var(--text-primary);
  z-index: 200;
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}
.chart-tooltip.visible { opacity: 1; }
.tooltip-name {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--accent-2);
  white-space: normal;
  max-width: 300px;
}
.tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 0;
}
.tooltip-label { color: var(--text-muted); }
.tooltip-value { font-weight: 600; color: var(--text-primary); }

/* ---------- Network Graph ---------- */
.network-container {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  height: 700px;
}
.network-canvas {
  width: 100%;
  height: 100%;
}
.network-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}
.network-controls button {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(8px);
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.network-controls button:hover {
  background: rgba(0,156,59,0.2);
  color: var(--text-primary);
  border-color: rgba(0,156,59,0.3);
}
.network-legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-glass);
  font-size: 0.75rem;
  color: var(--text-secondary);
  z-index: 10;
}
.network-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.network-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Network tooltip */
.network-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.82rem;
  color: var(--text-primary);
  z-index: 200;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.network-tooltip.visible { opacity: 1; }

/* Network filter */
.network-filter {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.network-filter label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.network-filter select,
.network-filter input[type="range"] {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}
.network-filter input[type="range"] {
  accent-color: var(--accent-1);
}
.filter-value {
  font-size: 0.75rem;
  color: var(--accent-2);
  font-weight: 600;
}

/* Network search */
.network-search {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 300px;
}
.network-search input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  border-radius: 99px;
  border: 1px solid var(--border-glass);
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  outline: none;
}
.network-search input::placeholder { color: var(--text-muted); }
.network-search input:focus { border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(0,156,59,0.15); }
.network-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- Download Buttons ---------- */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.download-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: var(--text-primary);
}
.download-card:hover {
  border-color: rgba(0,156,59,0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.download-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: rgba(16,185,129,0.12);
  color: #34d399;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.download-info { flex: 1; }
.download-title { font-weight: 600; margin-bottom: 4px; }
.download-desc { font-size: 0.78rem; color: var(--text-secondary); }
.download-arrow {
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: var(--transition);
}
.download-card:hover .download-arrow {
  color: var(--accent-2);
  transform: translateX(4px);
}

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border-glass);
  padding: 2rem;
  margin-top: 3rem;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  text-align: center;
}
.footer-line {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.8;
}
.footer-line strong {
  color: var(--text-secondary);
  font-weight: 600;
}
.footer-line a {
  color: var(--accent-2);
  text-decoration: none;
}
.footer-line a:hover { text-decoration: underline; }

/* ---------- Loading ---------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}
.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-glass);
  border-top-color: var(--accent-1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------- Bar Chart SVG Styles ---------- */
.bar-rect {
  transition: opacity 0.15s ease;
  cursor: pointer;
}
.bar-label {
  font-family: 'Inter', sans-serif;
  fill: var(--text-secondary);
  font-size: 11px;
}
.bar-value {
  font-family: 'Outfit', sans-serif;
  fill: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
}
.axis-label {
  font-family: 'Inter', sans-serif;
  fill: var(--text-muted);
  font-size: 11px;
}
.grid-line {
  stroke: rgba(255,255,255,0.05);
  stroke-dasharray: 3 3;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr; }
  .hero-text h1 { font-size: 2.2rem; }
  .hero-image { order: -1; }
  .hero-image img { height: auto; max-height: 300px; }
  .network-container { height: 500px; }
}
@media (max-width: 768px) {
  main { padding: 1rem; }
  .nav { padding: 0 1rem; }
  .nav-tabs { gap: 2px; }
  .nav-tab { padding: 6px 12px; font-size: 0.78rem; }
  .hero-text h1 { font-size: 1.8rem; }
  .stat-value { font-size: 1.6rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .search-container { max-width: 100%; }
  .network-container { height: 400px; }
  .network-filter { top: 60px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .nav-brand-text { font-size: 0.9rem; }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ---------- Edge tooltip papers list ---------- */
.edge-papers-list {
  list-style: none;
  padding: 0;
  margin-top: 8px;
  max-height: 200px;
  overflow-y: auto;
}
.edge-papers-list li {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: normal;
}
.edge-papers-list li:last-child { border-bottom: none; }
.edge-papers-year {
  color: var(--accent-2);
  font-weight: 600;
  margin-right: 6px;
}

/* Counter animation */
.stat-value[data-count] {
  display: inline-block;
}
