/* Base styles */
:root {
  --bg: #ffffff;
  --panel: #f8f9fa;
  --text: #2d5a27;
  --muted: #4a7c59;
  --accent: #2d5a27;
  --border: #d4e6d1;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

.site-header {
  border-bottom: 2px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
  box-shadow: 0 2px 4px rgba(45, 90, 39, 0.1);
}

.site-header .container {
  padding: 24px 0 20px 0;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  height: 60px;
  width: auto;
  flex-shrink: 0;
}

.header-text {
  flex: 1;
}

h1 {
  margin: 0 0 6px 0;
  font-size: 24px;
  color: var(--text);
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

main.container {
  padding: 24px 0 40px 0;
  display: grid;
  gap: 28px;
}

.intro {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}

.intro h2 {
  color: var(--accent);
  margin: 0 0 16px 0;
  font-size: 24px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
}

.intro p {
  margin: 0 0 16px 0;
  line-height: 1.7;
  font-size: 16px;
}

.intro p:last-child {
  margin-bottom: 0;
}

.data h2, .map-section h2 {
  margin: 6px 0 10px 0;
}

.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

#cases-table thead th,
#country-stats-table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

#cases-table tbody td,
#country-stats-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
  line-height: 1.35;
}

tbody tr:last-child td {
  border-bottom: none;
}

.map-section #map {
  height: 380px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.map-note {
  color: var(--muted);
  margin-top: 8px;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 0;
  color: var(--muted);
}

/* Medical content sections */
.taxonomy, .epidemiology, .diagnostics, .management, .conclusion, .references {
  margin-bottom: 32px;
}

.taxonomy h2, .epidemiology h2, .diagnostics h2, .management h2, .conclusion h2, .references h2 {
  color: var(--accent);
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.epidemiology h3, .diagnostics h3, .management h3 {
  color: var(--muted);
  margin: 20px 0 12px 0;
  font-size: 18px;
}

.diagnostic-methods, .management-areas {
  display: grid;
  gap: 20px;
  margin: 20px 0;
}

.method, .area {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.method h3, .area h3 {
  color: var(--accent);
  margin: 0 0 8px 0;
  font-size: 16px;
}

.practical-note {
  background: linear-gradient(135deg, #1a2332 0%, #111823 100%);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 16px;
  margin: 20px 0;
  font-style: italic;
}

.reference-list {
  list-style: none;
  padding: 0;
}

.reference-list li {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 8px;
  line-height: 1.5;
}

.reference-list li em {
  color: var(--muted);
  font-style: italic;
}

/* Compact horizontal bar chart for country stats */
.bar-chart {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.bar-item {
  display: grid;
  grid-template-columns: 1fr 4fr auto;
  align-items: center;
  gap: 8px;
}

.bar-label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-wrap {
  background: #e9f2ea;
  border: 1px solid var(--border);
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
}

.bar {
  height: 100%;
  background: linear-gradient(90deg, #7fbf7f, #2d5a27);
}

.bar-value {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text);
}

/* Inline bars inside table cells */
.inline-bar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
}

.inline-bar::before {
  content: "";
  display: block;
  height: 6px;
  width: 100%;
  background: #e9f2ea;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.inline-bar-fill {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  background: linear-gradient(90deg, #7fbf7f, #2d5a27);
  border-radius: 999px;
}

.inline-bar-value {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text);
}

/* Table controls */
.table-controls {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

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

/* Enhanced table styling */
#cases-table {
  font-size: 14px;
}

#cases-table th {
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}

#cases-table td {
  vertical-align: top;
  max-width: 200px;
  word-wrap: break-word;
}

#cases-table td:first-child {
  text-align: center;
  font-weight: 600;
  color: var(--accent);
  min-width: 40px;
  max-width: 50px;
}

#cases-table td:nth-child(2), /* Year */
#cases-table td:nth-child(3), /* Country */
#cases-table td:nth-child(4) { /* Age at Diagnosis */
  max-width: 200px;
  min-width: 40px;
}

#cases-table td:nth-child(5) { /* Laterality */
  text-align: center;
  min-width: 80px;
  max-width: 120px;
}

#cases-table td:nth-child(6) { /* Report Type */
  text-align: center;
  min-width: 100px;
  max-width: 140px;
  font-size: 12px;
}

#cases-table td:nth-child(7) { /* Source */
  text-align: center;
  min-width: 100px;
}

#cases-table td a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--border);
  transition: all 0.2s ease;
}

#cases-table td a:hover {
  background: var(--accent);
  color: var(--bg);
}

#cases-table td .unavailable {
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
}

/* Citation styling */
sup a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

sup a:hover {
  text-decoration: underline;
}

/* Map enhancements */
.map-section {
  margin: 0;
}

.map-note {
  color: var(--muted);
  margin-top: 12px;
  font-size: 14px;
}

/* Action section */
.action-section {
  margin: 40px 0;
}

.action-section h2 {
  color: var(--accent);
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 24px;
}

.action-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 24px;
}

@media (min-width: 768px) {
  .action-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

.action-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  transition: all 0.3s ease;
}

.action-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 196, 255, 0.1);
}

.action-card h3 {
  color: var(--accent);
  margin: 0 0 8px 0;
  font-size: 18px;
}

.action-card h4 {
  color: var(--text);
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
}

.action-card p {
  color: var(--muted);
  margin: 0 0 20px 0;
  line-height: 1.6;
  font-size: 14px;
}

.action-btn {
  display: inline-block;
  width: 100%;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
}

.action-btn.primary {
  background: var(--accent);
  color: var(--bg);
}

.action-btn.primary:hover {
  background: #6bb6ff;
  transform: translateY(-1px);
}

.action-btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

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

.action-btn.tertiary {
  background: var(--border);
  color: var(--text);
  border: 1px solid var(--border);
}

.action-btn.tertiary:hover {
  background: var(--muted);
  color: var(--bg);
  border-color: var(--muted);
}

/* Leaflet overrides for light theme */
.leaflet-container {
  background: #ffffff;
}

.leaflet-popup-content {
  color: var(--text);
  font-size: 14px;
}

.leaflet-popup-content h3 {
  color: var(--accent);
  margin: 0 0 8px 0;
}

.leaflet-popup-content p {
  margin: 4px 0;
}

/* Responsive design improvements */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  
  .logo {
    height: 50px;
  }
  
  h1 {
    font-size: 20px;
  }
  
  .diagnostic-methods, .management-areas {
    grid-template-columns: 1fr;
  }
  
  .table-controls {
    justify-content: center;
  }
  
  .filter-btn {
    flex: 1;
    min-width: 120px;
  }
}


