/* Observatorio de Violencia RD — Diseño institucional profesional
   Estilo: Banco Central RD / ONE / Observatorios internacionales
   Tipografía: Inter (sans-serif) + Source Serif Pro (titulares)
*/
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Source+Serif+4:wght@600;700&display=swap');

:root {
  /* Paleta institucional */
  --primary: #0b3d6b;        /* Azul institucional oscuro */
  --primary-dark: #062a4a;
  --primary-light: #1e5b8f;
  --accent: #c1272d;          /* Rojo acento */
  --accent-soft: #e85a5a;
  --accent-dark: #8b1c20;
  --gold: #b8860b;            /* Dorado discreto */
  --success: #1e7e34;
  --warning: #b45309;
  --danger: #b71c1c;
  --neutral: #6b7280;
  /* Texto y fondos */
  --text: #0f172a;
  --text-soft: #475569;
  --text-mute: #94a3b8;
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  /* Tipografía */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, serif;
  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
  /* Radio */
  --r-sm: 4px;
  --r: 6px;
  --r-md: 8px;
  --r-lg: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.container { max-width: 1240px; margin: 0 auto; padding: 0 1.5rem; }
a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-light); text-decoration: underline; }
.muted { color: var(--text-mute); font-size: 0.9rem; }

/* === HEADER INSTITUCIONAL === */
.institutional-bar {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.85);
  font-size: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.institutional-bar .container { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.institutional-bar .institutional-id { letter-spacing: 0.05em; font-weight: 500; }
.institutional-bar .institutional-date { color: rgba(255,255,255,0.7); }

/* === HERO === */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 3rem 0 2.5rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M0 0h100v100H0z' fill='none'/%3E%3Cpath d='M10 10h20M70 10h20M10 50h20M70 50h20M10 90h20M70 90h20' stroke='rgba(255,255,255,0.04)' stroke-width='0.5'/%3E%3C/svg%3E");
  opacity: 0.6;
}
.hero > .container { position: relative; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.72rem; letter-spacing: 0.15em; text-transform: uppercase;
  background: rgba(255,255,255,0.1); padding: 0.4rem 0.9rem;
  border-radius: 100px; margin-bottom: 1rem; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.15);
}
.hero-tag::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-soft); display: inline-block;
  box-shadow: 0 0 6px var(--accent-soft);
}
.hero h1 {
  font-family: var(--font-serif);
  font-size: 2.8rem; font-weight: 700; line-height: 1.1;
  margin-bottom: 0.6rem; letter-spacing: -0.02em;
}
.hero-sub { font-size: 1.05rem; opacity: 0.92; margin-bottom: 1.5rem; max-width: 700px; }
.hero-sub strong { font-weight: 600; }
.hero-meta { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.meta-item {
  background: rgba(255,255,255,0.08); padding: 0.65rem 1.1rem;
  border-radius: var(--r-md); min-width: 100px; border: 1px solid rgba(255,255,255,0.1);
}
.meta-label {
  display: block; font-size: 0.68rem; letter-spacing: 0.1em;
  opacity: 0.75; text-transform: uppercase; font-weight: 500;
}
.meta-value { display: block; font-size: 1.5rem; font-weight: 700; margin-top: 0.1rem; font-variant-numeric: tabular-nums; }

/* === NAV === */
.main-nav {
  background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.main-nav .container { display: flex; gap: 0.25rem; flex-wrap: wrap; align-items: center; }
.main-nav a {
  padding: 0.95rem 1.1rem; color: var(--text-soft); font-weight: 500;
  font-size: 0.92rem; border-bottom: 2px solid transparent;
  transition: 0.15s; letter-spacing: 0.01em;
}
.main-nav a:hover { color: var(--primary); text-decoration: none; }
.main-nav a.active { color: var(--primary); border-bottom-color: var(--accent); font-weight: 600; }
.main-nav .nav-spacer { flex: 1; }
.main-nav .nav-cta {
  background: var(--primary); color: #fff !important;
  padding: 0.5rem 1rem; border-radius: var(--r); margin: 0.5rem 0;
  font-weight: 600 !important; font-size: 0.88rem !important;
}
.main-nav .nav-cta:hover { background: var(--primary-dark); }

/* === MAIN === */
main.container { padding: 2rem 1.5rem 4rem; }

/* === KPI GRID === */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.kpi-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.3rem 1.4rem;
  position: relative; overflow: hidden;
  transition: 0.2s;
  box-shadow: var(--shadow-sm);
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--primary);
}
.kpi-card.accent::before { background: var(--accent); }
.kpi-card.success::before { background: var(--success); }
.kpi-card.gold::before { background: var(--gold); }
.kpi-header { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.6rem; }
.kpi-icon {
  width: 36px; height: 36px; border-radius: var(--r);
  background: var(--bg-alt); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.kpi-card.accent .kpi-icon { background: #fef2f2; color: var(--accent); }
.kpi-card.success .kpi-icon { background: #f0fdf4; color: var(--success); }
.kpi-card.gold .kpi-icon { background: #fefce8; color: var(--gold); }
.kpi-label {
  color: var(--text-soft); font-size: 0.78rem; letter-spacing: 0.04em;
  text-transform: uppercase; font-weight: 600;
}
.kpi-num {
  font-family: var(--font-serif);
  font-size: 2.4rem; font-weight: 700; color: var(--primary);
  line-height: 1; margin: 0.3rem 0 0.4rem; font-variant-numeric: tabular-nums;
}
.kpi-card.accent .kpi-num { color: var(--accent); }
.kpi-card.success .kpi-num { color: var(--success); }
.kpi-card.gold .kpi-num { color: var(--gold); }
.kpi-foot { font-size: 0.78rem; color: var(--text-mute); border-top: 1px solid var(--bg-alt); padding-top: 0.5rem; }
.kpi-trend { display: inline-block; font-size: 0.72rem; font-weight: 600; margin-left: 0.4rem; }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }

/* === PANELS === */
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.5rem 1.7rem;
  margin-bottom: 1.5rem; box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 1.2rem; padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--bg-alt);
}
.panel h2 {
  font-family: var(--font-serif);
  font-size: 1.25rem; font-weight: 700; color: var(--text);
  letter-spacing: -0.01em;
}
.panel h2 .sub { display: block; font-family: var(--font-sans); font-size: 0.78rem; font-weight: 500; color: var(--text-mute); margin-top: 0.2rem; letter-spacing: 0; }
.panel h3 { font-size: 1.05rem; font-weight: 700; color: var(--primary); margin-bottom: 0.7rem; }
.panel p { margin-bottom: 0.7rem; color: #334155; }
.panel ul { padding-left: 1.4rem; }
.panel li { margin-bottom: 0.5rem; color: #334155; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* === BAR CHART === */
.bar-chart { display: flex; flex-direction: column; gap: 0.75rem; }
.bar-row {
  display: grid; grid-template-columns: 200px 1fr 70px;
  align-items: center; gap: 0.8rem;
}
.bar-label {
  font-weight: 500; color: var(--text); font-size: 0.88rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-track { height: 26px; background: var(--bg-alt); border-radius: var(--r); overflow: hidden; }
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; padding-left: 0.8rem;
  color: #fff; font-weight: 600; font-size: 0.82rem;
  min-width: 32px; transition: width 0.4s ease;
  font-variant-numeric: tabular-nums;
}
.bar-fill.tipo-homicidio { background: linear-gradient(90deg, #0b3d6b, #1e5b8f); }
.bar-fill.tipo-feminicidio { background: linear-gradient(90deg, #c1272d, #e85a5a); }
.bar-fill.tipo-muerte { background: linear-gradient(90deg, #b8860b, #d4a017); }
.bar-value { font-weight: 700; color: var(--text); text-align: right; font-size: 0.88rem; font-variant-numeric: tabular-nums; }

/* === RANKING === */
.ranking { display: flex; flex-direction: column; gap: 0.5rem; }
.rank-row {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.65rem 0.85rem; background: var(--bg);
  border-radius: var(--r); border: 1px solid var(--border);
  transition: 0.15s;
}
.rank-row:hover { background: #fff; border-color: var(--border-strong); }
.rank-num {
  background: var(--primary); color: #fff; font-weight: 700;
  width: 28px; height: 28px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-variant-numeric: tabular-nums;
}
.rank-row:nth-child(1) .rank-num { background: linear-gradient(135deg, #c1272d, #8b1c20); }
.rank-row:nth-child(2) .rank-num { background: linear-gradient(135deg, #b8860b, #8b6509); }
.rank-row:nth-child(3) .rank-num { background: linear-gradient(135deg, #6b7280, #475569); }
.rank-name { flex: 1; font-weight: 500; color: var(--text); }
.rank-val {
  background: var(--accent); color: #fff;
  padding: 0.2rem 0.65rem; border-radius: var(--r-sm);
  font-weight: 700; font-size: 0.82rem; font-variant-numeric: tabular-nums;
}

/* === DONUT === */
.donut-wrap { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; justify-content: center; }
.donut { position: relative; width: 180px; height: 180px; flex-shrink: 0; }
.donut svg { transform: rotate(-90deg); }
.donut-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); text-align: center;
}
.donut-center .num { font-family: var(--font-serif); font-size: 1.8rem; font-weight: 700; color: var(--primary); line-height: 1; }
.donut-center .lbl { font-size: 0.7rem; color: var(--text-mute); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; margin-top: 0.2rem; }
.donut-legend { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.88rem; }
.donut-legend .item { display: flex; align-items: center; gap: 0.6rem; }
.donut-legend .dot { width: 12px; height: 12px; border-radius: 3px; }

/* === EVENTOS LIST === */
.eventos-list { display: flex; flex-direction: column; gap: 0.85rem; }
.evento-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--r-md); padding: 1rem 1.2rem;
  background: var(--card);
  transition: 0.15s;
}
.evento-card:hover { box-shadow: var(--shadow-md); }
.evento-card.high { border-left-color: var(--danger); }
.evento-card.multi { border-left-color: var(--success); }
.evento-head {
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem;
}
.evento-head strong { font-size: 1rem; color: var(--text); }
.evento-id {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--text-mute); font-size: 0.75rem; font-weight: 500;
}
.evento-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.18rem 0.55rem; border-radius: var(--r-sm);
  font-size: 0.74rem; font-weight: 600; line-height: 1.4;
  border: 1px solid transparent;
}
.badge.tipo { background: #fef2f2; color: var(--accent); border-color: #fecaca; }
.badge.tipo-h { background: #eff6ff; color: var(--primary); border-color: #bfdbfe; }
.badge.tipo-f { background: #fef2f2; color: var(--accent); border-color: #fecaca; }
.badge.tipo-m { background: #fefce8; color: var(--gold); border-color: #fde68a; }
.badge.fuentes { background: #f0fdf4; color: var(--success); border-color: #bbf7d0; }
.badge.fuente-1 { background: #f8fafc; color: var(--neutral); border-color: var(--border); }
.badge.alta { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.badge.media { background: #fff7ed; color: var(--warning); border-color: #fed7aa; }
.badge.baja { background: #f1f5f9; color: var(--neutral); border-color: var(--border); }
.badge.good { background: #f0fdf4; color: var(--success); border-color: #bbf7d0; }
.badge.warn { background: #fff7ed; color: var(--warning); border-color: #fed7aa; }
.badge.info { background: #eff6ff; color: var(--primary); border-color: #bfdbfe; }
.evento-sinopsis { font-size: 0.92rem; color: #334155; line-height: 1.55; }

/* === DOWNLOADS === */
.download-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.dl-card {
  display: block; padding: 1.4rem 1.2rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-md); text-align: center;
  transition: 0.2s;
  position: relative; overflow: hidden;
}
.dl-card::after {
  content: "↓ Descargar"; position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--primary); color: #fff;
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.05em;
  padding: 0.35rem 0; transform: translateY(100%);
  transition: 0.2s;
}
.dl-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
  text-decoration: none;
}
.dl-card:hover::after { transform: translateY(0); }
.dl-icon {
  font-size: 2.2rem; margin-bottom: 0.5rem; line-height: 1;
  color: var(--primary);
}
.dl-title { font-weight: 700; color: var(--text); margin-bottom: 0.3rem; }
.dl-desc { font-size: 0.8rem; color: var(--text-soft); }

/* === FOOTER === */
.main-footer {
  background: var(--primary-dark); color: #cbd5e1;
  padding: 2.5rem 0 1.5rem; font-size: 0.85rem;
  border-top: 3px solid var(--accent);
}
.main-footer .footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; margin-bottom: 1.5rem;
}
.main-footer h4 {
  color: #fff; font-size: 0.85rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.7rem;
}
.main-footer p { margin-bottom: 0.4rem; }
.main-footer strong { color: #fff; }
.main-footer ul { list-style: none; }
.main-footer li { margin-bottom: 0.4rem; }
.main-footer a { color: #cbd5e1; }
.main-footer a:hover { color: #fff; }
.main-footer .footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1); padding-top: 1rem;
  text-align: center; color: var(--text-mute); font-size: 0.78rem;
}
@media (max-width: 800px) { .main-footer .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; } }

/* === TABLE === */
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th {
  background: var(--primary); color: #fff; text-align: left;
  padding: 0.6rem 0.8rem; font-weight: 600; font-size: 0.82rem;
  letter-spacing: 0.02em; text-transform: uppercase;
}
table.data th:first-child { border-top-left-radius: var(--r); }
table.data th:last-child { border-top-right-radius: var(--r); }
table.data td {
  padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--bg-alt);
  color: var(--text);
}
table.data tr:nth-child(even) td { background: var(--bg); }
table.data tr:hover td { background: #f1f5f9; }
table.data td code {
  background: var(--bg-alt); padding: 0.1rem 0.35rem;
  border-radius: var(--r-sm); font-size: 0.78rem;
}
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--border); }

/* === FILTERS === */
.filter-bar { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.filter-bar select, .filter-bar input {
  padding: 0.5rem 0.75rem; border: 1px solid var(--border-strong);
  border-radius: var(--r); font-size: 0.88rem;
  font-family: var(--font-sans); color: var(--text); background: #fff;
  min-width: 180px;
}
.filter-bar input:focus, .filter-bar select:focus { outline: 2px solid var(--primary-light); outline-offset: 0; border-color: var(--primary); }
.filter-bar button {
  background: var(--primary); color: #fff; border: 0;
  padding: 0.55rem 1.1rem; border-radius: var(--r);
  cursor: pointer; font-weight: 600; font-size: 0.88rem;
  transition: 0.15s;
}
.filter-bar button:hover { background: var(--primary-dark); }
.filter-bar button.secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.filter-bar .filter-info { margin-left: auto; color: var(--text-mute); font-size: 0.85rem; }

/* === MAPA === */
.map-container {
  position: relative; width: 100%; aspect-ratio: 1.5;
  background: linear-gradient(180deg, #e9eef3 0%, #d3dce4 100%);
  border-radius: var(--r-md); overflow: hidden; min-height: 480px;
  border: 1px solid var(--border);
}
.map-svg { width: 100%; height: 100%; display: block; }
.map-pin {
  position: absolute; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transform: translate(-50%, -50%); cursor: pointer; transition: 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.map-pin:hover { transform: translate(-50%, -50%) scale(1.2); z-index: 10; }
.map-pin.multi { background: var(--success); }
.map-pin .num { color: #fff; font-size: 0.72rem; font-weight: 700; }
.map-pin .popup {
  display: none; position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%); background: #fff; padding: 0.6rem 0.8rem;
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  white-space: nowrap; font-size: 0.82rem; z-index: 20;
  min-width: 180px; border: 1px solid var(--border);
}
.map-pin:hover .popup { display: block; }
.map-legend { display: flex; gap: 1.2rem; justify-content: center; margin-top: 1rem; font-size: 0.85rem; flex-wrap: wrap; }
.map-legend .item { display: flex; align-items: center; gap: 0.45rem; color: var(--text-soft); }
.map-legend .dot { width: 14px; height: 14px; border-radius: 50%; }
.map-prov { fill: #c5cdd5; stroke: #fff; stroke-width: 1.5; transition: 0.2s; cursor: pointer; }
.map-prov:hover { fill: #95a3b0; }
.map-prov.has-events { fill: #d4a017; }
.map-prov-label { font-size: 10px; fill: #475569; pointer-events: none; font-weight: 500; }

/* === ALERTAS === */
.alert {
  padding: 0.85rem 1.1rem; border-radius: var(--r-md);
  background: #eff6ff; border: 1px solid #bfdbfe;
  color: #1e3a8a; font-size: 0.88rem; margin-bottom: 1rem;
  display: flex; gap: 0.6rem; align-items: flex-start;
}
.alert.warn { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.alert.info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.alert-icon { flex-shrink: 0; font-size: 1.1rem; line-height: 1; }

/* === RESPONSIVE === */
@media (max-width: 720px) {
  .hero h1 { font-size: 2rem; }
  .hero-sub { font-size: 0.95rem; }
  .meta-item { min-width: 80px; padding: 0.5rem 0.8rem; }
  .meta-value { font-size: 1.2rem; }
  .kpi-num { font-size: 2rem; }
  .bar-row { grid-template-columns: 1fr; gap: 0.3rem; }
  .bar-value { text-align: left; }
  .main-nav .container { gap: 0; }
  .main-nav a { padding: 0.8rem 0.7rem; font-size: 0.85rem; }
}
