/* ============================================================
   COMPONENTS.CSS — Modo claro
   Graficas del Caribe — CBDN Academy 2026
   ============================================================ */

/* --- Prosa --- */
.prose p {
  color: var(--text-secondary);
  font-size: 0.925rem;
  line-height: 1.80;
  margin-bottom: 0.9rem;
  font-weight: 300;
}

.prose h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 1.4rem 0 0.5rem;
}

.prose h4 {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-dorado);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin: 1.1rem 0 0.35rem;
}

.prose ul, .prose ol { padding-left: 0; list-style: none; margin-bottom: 0.6rem; }

.prose li {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.28rem 0;
  font-size: 0.90rem;
  color: var(--text-secondary);
  font-weight: 300;
  line-height: 1.65;
}

.prose li::before {
  content: '';
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--color-rojo);
  flex-shrink: 0;
  margin-top: 0.55rem;
  opacity: 0.6;
}

.prose strong { color: var(--text-primary); font-weight: 600; }

/* --- Callouts --- */
.callout {
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.1rem;
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  font-size: 0.875rem;
}

.callout--warning {
  background: rgba(196,30,58,0.05);
  border: 1px solid rgba(196,30,58,0.20);
  border-left: 3px solid var(--color-rojo);
}

.callout--info {
  background: rgba(168,135,31,0.05);
  border: 1px solid rgba(168,135,31,0.18);
  border-left: 3px solid var(--color-dorado);
}

.callout__icon { font-size: 0.95rem; flex-shrink: 0; }
.callout__text { color: var(--text-secondary); margin: 0; line-height: 1.6; }

/* --- Tablas SCI --- */
.sci-form { margin-bottom: 1.75rem; }

.sci-form__header {
  background: var(--surface-th);
  border: 1px solid var(--border-mid);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sci-form__badge {
  background: var(--color-rojo);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.sci-form__title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-mid);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--surface-table);
}

.sci-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.sci-table th {
  background: var(--surface-th);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.55rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-mid);
  white-space: nowrap;
}

.sci-table td {
  padding: 0.52rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: top;
  line-height: 1.5;
  font-weight: 300;
}

.sci-table tr:last-child td { border-bottom: none; }
.sci-table tbody tr:hover { background: rgba(196,30,58,0.03); }

.sci-table tr.row-highlight td {
  background: rgba(168,135,31,0.06);
  color: var(--text-primary);
  font-weight: 600;
  border-top: 1px solid var(--border-dorado);
}

.sci-table td:first-child {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

/* --- Stats --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px,1fr));
  gap: 0.65rem;
  margin-bottom: 1.4rem;
}

.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-card);
}

.stat-card__label {
  font-size: 0.60rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: 0.28rem;
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-rojo);
  line-height: 1;
  margin-bottom: 0.2rem;
}

.stat-card__desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 300;
}

/* --- Content cards --- */
.content-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.3rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-card);
}

.content-card--acento { border-left: 3px solid var(--color-rojo); }
.content-card--dorado { border-left: 3px solid var(--color-dorado); }

.content-card__title {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.65rem;
}

/* --- Staff Cards --- */
.staff-card {
  display: flex;
  gap: 1.5rem;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-card);
  align-items: flex-start;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.staff-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.staff-card__photo {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border-mid);
  background: var(--surface-th);
}

.staff-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.staff-card__content {
  flex: 1;
}

.staff-card__role {
  font-family: var(--font-display);
  font-size: 0.60rem;
  font-weight: 700;
  color: var(--color-dorado);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.25rem;
}

.staff-card__name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-rojo);
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

@media (max-width: 640px) {
  .staff-card {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  .staff-card__photo {
    width: 70px;
    height: 70px;
  }
}

/* --- Organigrama --- */
.org-container {
  overflow-x: auto;
  padding: 0.5rem 0 1.5rem;
  background: var(--surface-card-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.org-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 680px;
  padding: 1rem;
}

.org-node {
  background: var(--surface-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 0.60rem 0.9rem;
  text-align: center;
  min-width: 130px;
  max-width: 170px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-fast);
}

.org-node:hover { box-shadow: 0 2px 12px rgba(196,30,58,0.12); }

.org-node--ci {
  background: var(--color-marino);
  border-color: var(--color-rojo);
  border-width: 2px;
  min-width: 165px;
}

.org-node--ci .org-node__role { color: rgba(255,255,255,0.6); }
.org-node--ci .org-node__name { color: #fff; }
.org-node--ci .org-node__detail { color: rgba(255,255,255,0.45); }

.org-node--staff { border-color: var(--color-rojo); border-style: dashed; }
.org-node--seccion { border-color: var(--color-dorado); border-width: 2px; }
.org-node--grupo { border-color: var(--border-mid); }

.org-node__role {
  font-size: 0.56rem;
  font-weight: 700;
  color: var(--color-dorado);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.18rem;
}

.org-node__name {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.org-node__detail {
  font-size: 0.58rem;
  color: var(--text-muted);
  margin-top: 0.12rem;
}

.org-connector-v {
  width: 1px;
  background: var(--border-mid);
  margin: 0 auto;
}

.org-connector-v--24 { height: 24px; }

/* --- Timeline --- */
.timeline-filters {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.timeline-filter-btn {
  padding: 0.26rem 0.8rem;
  border-radius: 20px;
  border: 1px solid var(--border-mid);
  background: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.timeline-filter-btn:hover { border-color: var(--color-rojo); color: var(--color-rojo); }

.timeline-filter-btn.is-active {
  background: rgba(196,30,58,0.08);
  border-color: var(--color-rojo);
  color: var(--color-rojo);
}

.timeline-container {
  position: relative;
  padding-left: 2rem;
}

.timeline-container::before {
  content: '';
  position: absolute;
  left: 0.5rem; top: 8px; bottom: 8px;
  width: 1px;
  background: linear-gradient(to bottom, var(--color-rojo) 0%, var(--border-mid) 100%);
}

.timeline-event { position: relative; }

.timeline-event__dot {
  position: absolute;
  left: -1.57rem; top: 1.1rem;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--surface-page);
  border: 1.5px solid var(--border-mid);
  transition: all var(--transition-fast);
  z-index: 1;
}

.timeline-event:hover .timeline-event__dot {
  background: var(--color-rojo);
  border-color: var(--color-rojo);
}

.timeline-event--critico .timeline-event__dot {
  border-color: var(--color-rojo);
  background: var(--color-rojo);
}

.timeline-event__card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 0.35rem;
  box-shadow: var(--shadow-card);
}

.timeline-event__card:hover {
  border-color: var(--border-mid);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.timeline-event--critico .timeline-event__card {
  border-color: rgba(196,30,58,0.20);
  border-left: 2px solid var(--color-rojo);
}

.timeline-event__header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.22rem;
}

.timeline-event__time {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--color-rojo);
  white-space: nowrap;
  min-width: 48px;
}

.timeline-event__unit {
  font-size: 0.60rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--surface-th);
  padding: 1px 6px;
  border-radius: 3px;
}

.timeline-event__desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
  font-weight: 300;
}

/* --- Loading / Error --- */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 2rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.loading-spinner {
  width: 26px; height: 26px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--color-rojo);
  border-radius: 50%;
  animation: spin 0.72s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-state {
  background: rgba(196,30,58,0.04);
  border: 1px solid rgba(196,30,58,0.20);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  color: var(--text-secondary);
  text-align: center;
  font-size: 0.875rem;
}

/* --- Animacion apertura acordeon --- */
@keyframes bodyFadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.accordion__body { animation: bodyFadeIn 180ms ease; }

/* --- Responsive --- */
@media (max-width: 640px) {
  .stats-row { grid-template-columns: repeat(2,1fr); }
  .sci-table { font-size: 0.75rem; }
  .sci-table th, .sci-table td { padding: 0.45rem 0.6rem; }
}

/* ============================================================
   MAPA LEAFLET — Leyenda y wrapper
   ============================================================ */
.mapa-leyenda {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  margin-bottom: 1rem;
}

.mapa-leyenda__item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.mapa-leyenda__dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Corregir z-index Leaflet dentro de acordeón */
.leaflet-container {
  font-family: var(--font-body) !important;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-card) !important;
}

.leaflet-popup-content {
  margin: 10px 14px !important;
  font-size: 0.82rem !important;
}
