/* Modal — Premium Observatory of Violence RD */

/* Map legacy CSS vars to premium-dashboard.css vars */
:root {
  --card: #ffffff;
  --text: #0f172a;
  --text-soft: #475569;
  --text-mute: #94a3b8;
  --primary: #1e40af;
  --primary-dark: #0a1628;
  --primary-light: #3b82f6;
  --accent: #dc2626;
  --accent-soft: #f87171;
  --accent-dark: #b91c1c;
  --gold: #92400e;
  --success: #15803d;
  --warning: #d97706;
  --danger: #b91c1c;
  --neutral: #6b7280;
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, serif;
  --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);
  --r-sm: 4px;
  --r: 6px;
  --r-md: 8px;
  --r-lg: 12px;
}

.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem; backdrop-filter: blur(4px);
  animation: modalIn 0.18s ease-out;
}
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card); border-radius: 12px; max-width: 720px;
  width: 100%; max-height: 92vh; display: flex; flex-direction: column;
  box-shadow: 0 25px 50px rgba(0,0,0,0.3); overflow: hidden;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #f8fafc 0%, #fff 100%);
}
.modal-header h2 { font-family: var(--font-serif); font-size: 1.2rem; color: var(--text); margin: 0.3rem 0 0; }
.modal-header .evento-id {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.72rem;
  color: var(--text-mute); font-weight: 500;
}
.modal-close {
  background: none; border: 0; font-size: 1.8rem; color: var(--text-mute);
  cursor: pointer; padding: 0 0.5rem; line-height: 1; transition: 0.15s;
}
.modal-close:hover { color: var(--accent); }
.modal-body { padding: 1.2rem 1.5rem; overflow-y: auto; flex: 1; }
.modal-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem 1.2rem;
  background: var(--bg); padding: 0.8rem 1rem; border-radius: 6px; margin-bottom: 0.8rem;
}
.modal-grid div { display: flex; flex-direction: column; gap: 0.2rem; }
.modal-grid dt { font-size: 0.7rem; color: var(--text-mute); text-transform: uppercase; font-weight: 600; letter-spacing: 0.04em; margin: 0; }
.modal-grid dd { font-size: 0.9rem; color: var(--text); margin: 0; font-weight: 500; }
.modal-sinopsis {
  font-size: 0.95rem; line-height: 1.7; color: #1f2937;
  background: var(--bg); padding: 1rem 1.1rem; border-radius: 6px;
  border-left: 3px solid var(--primary); white-space: pre-wrap; word-wrap: break-word;
}
.modal-urls { list-style: none; padding: 0; margin: 0; max-height: 140px; overflow-y: auto; }
.modal-urls li { padding: 0.4rem 0; border-bottom: 1px solid var(--bg-alt); font-size: 0.82rem; word-break: break-all; }
.modal-urls li:last-child { border-bottom: 0; }
.modal-urls a { color: var(--primary); }
.modal-section-title {
  margin-top: 1.2rem; font-size: 0.95rem; color: var(--primary);
  border-bottom: 1px solid var(--border); padding-bottom: 0.4rem;
}
.modal-section-title::before {
  content: "▌"; margin-right: 0.3rem; opacity: 0.6;
}
.modal-fuentes { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.modal-fuentes li {
  padding: 0.45rem 0; border-bottom: 1px solid var(--bg-alt);
  font-size: 0.85rem; line-height: 1.5;
}
.modal-fuentes li:last-child { border-bottom: 0; }
.modal-fuentes a { color: var(--primary); text-decoration: none; }
.modal-fuentes a:hover { text-decoration: underline; }
.modal-fuentes a strong { color: var(--text); }
.modal-confianza {
  display: flex; align-items: center; gap: 0.5rem;
  margin-top: 0.6rem; font-size: 0.85rem; color: var(--text-soft);
}
.modal-warn {
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  padding: 0.7rem 0.9rem; border-radius: 6px; font-size: 0.88rem; margin-top: 0.8rem;
}
.modal-footer {
  padding: 0.8rem 1.5rem; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 0.5rem; background: var(--bg);
}
@media (max-width: 600px) { .modal-grid { grid-template-columns: 1fr; } }

/* Sinopsis en cards (landing) */
.evento-sinopsis {
  font-size: 0.92rem; color: #334155; line-height: 1.55;
  position: relative; transition: max-height 0.25s ease;
}
.evento-sinopsis.collapsed {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; max-height: 3.1em;
}
.evento-sinopsis:not(.collapsed) {
  -webkit-line-clamp: unset; overflow: visible; max-height: none;
}
.sinopsis-fade {
  position: absolute; bottom: 0; left: 0; right: 0; height: 2em;
  background: linear-gradient(to bottom, transparent, var(--card));
  pointer-events: none; transition: opacity 0.25s ease;
}
.sinopsis-fade.hidden { opacity: 0; }

/* Sinopsis en tabla (dashboard) */
.sinopsis-preview {
  font-size: 0.82rem; color: #475569; line-height: 1.4;
  max-width: 260px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}

/* Botón "Ver más" / "Ver descripción completa" */
.btn-toggle {
  background: none; border: 0; color: var(--primary); font-size: 0.78rem;
  cursor: pointer; padding: 0; margin-top: 0.2rem; font-weight: 600;
}
.btn-toggle:hover { text-decoration: underline; }

/* Botón "Ver detalle" / "Ver caso" */
.btn-detail {
  background: var(--primary); color: #fff; border: 0; padding: 0.3rem 0.7rem;
  border-radius: 4px; font-size: 0.76rem; font-weight: 600; cursor: pointer;
  transition: 0.15s; white-space: nowrap;
}
.btn-detail:hover { background: var(--primary-dark); }
.btn-detail.small { padding: 0.2rem 0.5rem; font-size: 0.72rem; }

/* ICCS badge */
.badge.iccs { background: #e8eaf6; color: #283593; }

/* ── Badge system for modal (premium) ── */
.badge {
  display: inline-block;
  border-radius: var(--r-sm);
  padding: 2px 7px;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.badge.tipo-h,
.badge.homicidio { background: #dc2626; color: #fff; }
.badge.tipo-f,
.badge.feminicidio { background: #7e22ce; color: #fff; }
.badge.tipo-m,
.badge.muerte_violenta { background: #d97706; color: #fff; }
.badge.fuentes { background: #15803d; color: #fff; }
.badge.fuente-1 { background: #6b7280; color: #fff; }
.badge.iccs { background: #e8eaf6; color: #283593; }
.badge.alta, .badge.alto { background: #15803d; color: #fff; }
.badge.media, .badge.medio { background: #d97706; color: #fff; }
.badge.baja, .badge.bajo { background: #6b7280; color: #fff; }
.badge.alto-evidence { background: #15803d; color: #fff; }
.badge.media-evidence { background: #d97706; color: #fff; }
.badge.bajo-evidence { background: #6b7280; color: #fff; }
.badge.badge-success { background: #15803d; color: #fff; }
.badge.badge-danger { background: #dc2626; color: #fff; }
.badge.badge-warning { background: #d97706; color: #fff; }
.badge.badge-info { background: #1e40af; color: #fff; }
.badge.pd-badge-blue { background: #1e40af; color: #fff; }
.badge.pd-badge-red { background: #dc2626; color: #fff; }
.badge.pd-badge-green { background: #15803d; color: #fff; }
.badge.pd-badge-gold { background: #d97706; color: #fff; }
.badge.pd-badge-gray { background: #6b7280; color: #fff; }
.badge.pd-badge-purple { background: #7e22ce; color: #fff; }
.badge.pd-badge-warning { background: #d97706; color: #fff; }

/* Premium modal enhancements */
.modal-overlay {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.modal .modal-section-premium {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.modal .modal-section-premium h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e40af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.75rem;
}
.modal .kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.4rem 1rem;
  align-items: center;
}
.modal .kv .k {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.modal .kv .v {
  font-size: 0.875rem;
  font-weight: 500;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* ── Premium Event Modal (.pdmodal) ── */
.pdmodal {
  background: #ffffff;
  border-radius: 16px;
  max-width: 760px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.05);
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.pdmodal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  flex-shrink: 0;
  border-left: 4px solid #64748b;
}
.pdmodal-header-left { flex: 1; min-width: 0; }
.pdmodal-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 500;
  margin-bottom: 0.25rem;
  display: inline-block;
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
}
.pdmodal-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 0.5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.pdmodal-meta {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.pdmodal-date {
  font-size: 0.8rem;
  color: #64748b;
}
.pdmodal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}
.pdmodal-close:hover { color: #dc2626; }
.pdmodal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.pdmodal-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}
.pdmodal-kpi {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
}
.pdmodal-kpi-val {
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f172a;
  font-feature-settings: 'tnum';
  line-height: 1;
  margin-bottom: 0.2rem;
}
.pdmodal-kpi-val.text-green { color: #15803d; }
.pdmodal-kpi-val.text-red { color: #dc2626; }
.pdmodal-kpi-val.text-gold { color: #d97706; }
.pdmodal-kpi-lbl {
  font-size: 0.65rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pdmodal-section {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1rem;
}
.pdmodal-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e40af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.pdmodal-sinopsis {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #334155;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.pdmodal-confidence {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid #e5e7eb;
  font-size: 0.8rem;
  color: #64748b;
}
.pdmodal-conf-text { color: #64748b; }
.pdmodal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.pdmodal-iccs {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.pdmodal-iccs-code {
  background: #e8eaf6;
  color: #283593;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.pdmodal-territorial { display: flex; flex-direction: column; gap: 0.3rem; }
.pdmodal-terr-label { font-size: 0.75rem; color: #64748b; font-weight: 600; margin-right: 0.3rem; }
.pdmodal-personas { display: flex; flex-direction: column; gap: 0.6rem; }
.pdmodal-persona { display: flex; gap: 0.75rem; padding: 0.5rem; background: #fff; border-radius: 6px; border: 1px solid #e5e7eb; }
.pdmodal-persona-role { font-size: 0.68rem; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; min-width: 60px; padding-top: 0.1rem; }
.pdmodal-persona-info { font-size: 0.85rem; color: #0f172a; display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.pdmodal-persona-name { font-weight: 600; }
.pdmodal-persona-protected { color: #7e22ce; font-weight: 600; font-size: 0.82rem; }
.pdmodal-persona-meta { color: #64748b; font-size: 0.8rem; }
.pdmodal-footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  background: #f8fafc;
  flex-shrink: 0;
}

/* Fuentes in modal */
.mfont { display: flex; flex-direction: column; gap: 0.5rem; }
.mfont-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  transition: border-color 0.15s;
}
.mfont-item:hover { border-color: #3b82f6; }
.mfont-url { margin-bottom: 0.25rem; }
.mfont-link { text-decoration: none; display: flex; flex-direction: column; gap: 0.15rem; }
.mfont-link:hover { text-decoration: underline; }
.mfont-medio { font-size: 0.82rem; font-weight: 700; color: #1e40af; }
.mfont-titulo { font-size: 0.8rem; color: #475569; }
.mfont-meta { display: flex; gap: 0.75rem; align-items: center; }
.mfont-date { font-size: 0.72rem; color: #94a3b8; font-family: 'JetBrains Mono', monospace; }
.mfont-conf { font-size: 0.72rem; color: #15803d; font-weight: 600; }
.mfont-no-source { font-size: 0.82rem; color: #64748b; line-height: 1.5; padding: 0.5rem 0; }
.mfont-note { font-size: 0.75rem; color: #94a3b8; margin-bottom: 0.25rem; font-style: italic; }

@media (max-width: 600px) {
  .pdmodal-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .pdmodal-grid-2 { grid-template-columns: 1fr; }
  .pdmodal-body { padding: 1rem; }
}

