.tablero-participacion-container {
  --gobmx-primary: #621132;
  --gobmx-secondary: #a0204c;
  --gobmx-accent: #cd4071;
  --gobmx-success: #28a745;
  --gobmx-danger: #dc3545;
  --gobmx-warning: #ffc107;
  --gobmx-info: #17a2b8;
  --gobmx-light: #f8f9fa;
  --gobmx-dark: #343a40;
  --gobmx-gray-100: #f8f9fa;
  --gobmx-gray-200: #e9ecef;
  --gobmx-gray-300: #dee2e6;
  --gobmx-gray-400: #ced4da;
  --gobmx-gray-500: #adb5bd;
  --gobmx-gray-600: #6c757d;
  --gobmx-gray-700: #495057;
  --gobmx-gray-800: #343a40;
  --gobmx-gray-900: #212529;

  font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  background-color: var(--gobmx-light);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
}

.tablero-header {
  background: linear-gradient(135deg,
      var(--gobmx-primary) 0%,
      var(--gobmx-secondary) 100%);
  color: white;
  padding: 20px;
  border-radius: 8px 8px 0 0;
  margin: -20px -20px 20px -20px;
}

.tablero-title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tablero-subtitle {
  margin: 8px 0 0 0;
  opacity: 0.9;
  font-size: 14px;
  font-weight: 400;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.stat-card {
  background: white;
  border-radius: 6px;
  padding: 16px;
  border-left: 4px solid var(--gobmx-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.stat-card.success {
  border-left-color: var(--gobmx-success);
}

.stat-card.danger {
  border-left-color: var(--gobmx-danger);
}

.stat-card.info {
  border-left-color: var(--gobmx-info);
}

.stat-card.warning {
  border-left-color: var(--gobmx-warning);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gobmx-primary);
  margin: 0;
}

.stat-label {
  font-size: 12px;
  color: var(--gobmx-gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.filters-section {
  background: white;
  padding: 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.filters-row {
  display: flex;
  gap: 15px;
  align-items: end;
  flex: 1 1 200px;
  /* Crece y se encoge, ancho mínimo 200px */
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  min-width: 150px;
}

.filter-label {
  font-size: 12px;
  color: var(--gobmx-gray-700);
  margin-bottom: 4px;
  font-weight: 500;
}

.filter-select,
.filter-input {
  padding: 8px 12px;
  border: 1px solid var(--gobmx-gray-300);
  border-radius: 4px;
  font-size: 14px;
  background: white;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-select {
  box-sizing: border-box;
  /* Incluye padding dentro del ancho */
  appearance: none;
  /* Quita estilo nativo en algunos navegadores */
}

.filter-group.select2-container {
  width: 100% !important;
  /* fuerza ancho completo */
}

.select2-selection {
  height: 50px;
  /* misma altura que tus inputs */
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  box-sizing: border-box;
}

.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: var(--gobmx-primary);
  box-shadow: 0 0 0 2px rgba(98, 17, 50, 0.1);
}

.btn-gobmx {
  background: var(--gobmx-primary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-gobmx:hover {
  background: var(--gobmx-secondary);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-gobmx.secondary {
  background: var(--gobmx-gray-500);
}

.btn-gobmx.secondary:hover {
  background: var(--gobmx-gray-600);
}

.participation-table-container {
  background: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#tabla-contenido {
  width: 100%;
  overflow-x: auto;
  /* scroll horizontal */
  -webkit-overflow-scrolling: touch;
  /* suaviza el scroll en móviles */
}

.tabla-scroll {
  overflow-x: auto;
  /* activa scroll horizontal */
  width: 100%;
  /* ocupa todo el ancho disponible */
}

.tabla-scroll table {
  min-width: 900px;
  /* fuerza a la tabla a ser más ancha que el contenedor */
  border-collapse: collapse;
}


.table-header {
  background: var(--gobmx-gray-100);
  padding: 12px 16px;
  border-bottom: 1px solid var(--gobmx-gray-200);
  font-weight: 600;
  color: var(--gobmx-gray-700);
  font-size: 14px;
}

.participation-table {
  min-width: 800px;
  /* ancho mínimo para que las columnas no se aplasten */
  width: 100%;
  border-collapse: collapse;
}

.participation-table th,
.participation-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--gobmx-gray-200);
  font-size: 13px;
}

.participation-table th {
  background: var(--gobmx-gray-50);
  font-weight: 600;
  color: var(--gobmx-gray-700);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.participation-table th.year-column {
  text-align: center;
  min-width: 80px;
}

.participation-table td.year-cell {
  text-align: center;
}

.participation-table tbody tr:hover {
  background: rgba(98, 17, 50, 0.03);
}

.organismo-name {
  font-weight: 500;
  color: var(--gobmx-gray-800);
}

.organismo-siglas {
  color: var(--gobmx-gray-500);
  font-size: 11px;
  display: block;
  margin-top: 2px;
}

.participation-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.participation-indicator.participated {
  background: var(--gobmx-success);
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}

.participation-indicator.not-participated {
  background: var(--gobmx-danger);
  box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

.participation-indicator.partial {
  background: var(--gobmx-warning);
  box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.2);
}

.participation-indicator:hover {
  transform: scale(1.2);
  z-index: 10;
}

.last-update {
  font-size: 11px;
  color: var(--gobmx-gray-500);
  margin-top: 2px;
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(98, 17, 50, 0.1);
  border-radius: 50%;
  border-top-color: var(--gobmx-primary);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.legend {
  display: flex;
  gap: 20px;
  margin-top: 16px;
  padding: 12px;
  background: var(--gobmx-gray-50);
  border-radius: 4px;
  font-size: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gobmx-gray-500);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.mi-toast-title {
  font-size: 18px !important;
  /* título grande */
}

.mi-toast-html {
  font-size: 14px !important;
  /* texto grande */
}

@media (max-width: 768px) {
  .tablero-participacion-container {
    margin: 10px;
    padding: 15px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .filters-row {
    flex-direction: column;
    align-items: stretch;
  }

  .participation-table {
    font-size: 12px;
  }

  .participation-table th,
  .participation-table td {
    padding: 8px 12px;
  }
}

/*=========== MAPA =============*/

.mapa-participacion-container {
  background-color: var(--gobmx-light);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
}

.mapa-header {
  background: linear-gradient(135deg, var(--gobmx-primary) 0%, var(--gobmx-secondary) 100%);
  color: white;
  padding: 20px;
  border-radius: 8px 8px 0 0;
  margin: -20px -20px 20px -20px;
}

.mapa-title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mapa-subtitle {
  margin: 8px 0 0 0;
  opacity: 0.9;
  font-size: 14px;
  font-weight: 400;
}

.mapa-controls {
  background: white;
  padding: 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  flex-direction: column;
  min-width: 150px;
}

.control-label {
  font-size: 12px;
  color: var(--gobmx-gray-700);
  margin-bottom: 4px;
  font-weight: 500;
}

.control-select {
  padding: 8px 12px;
  border: 1px solid var(--gobmx-gray-300);
  border-radius: 4px;
  font-size: 14px;
  background: white;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.control-select:focus {
  outline: none;
  border-color: var(--gobmx-primary);
  box-shadow: 0 0 0 2px rgba(98, 17, 50, 0.1);
}

.mapa-container {
  background: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: relative;
}

#mapa {
  height: 500px;
  width: 100%;
}

.mapa-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  border-radius: 6px;
  padding: 16px;
  border-left: 4px solid var(--gobmx-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.stat-card.success {
  border-left-color: var(--gobmx-success);
}

.stat-card.danger {
  border-left-color: var(--gobmx-danger);
}

.stat-card.info {
  border-left-color: var(--gobmx-info);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gobmx-primary);
  margin: 0;
}

.stat-label {
  font-size: 12px;
  color: var(--gobmx-gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.mapa-legend {
  background: white;
  padding: 12px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  margin-top: 15px;
}

.legend-title {
  font-weight: 600;
  color: var(--gobmx-gray-700);
  margin-bottom: 8px;
  font-size: 14px;
}

.legend-items {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.2);
}

.legend-color.participated {
  background: var(--gobmx-success);
}

.legend-color.not-participated {
  background: var(--gobmx-danger);
}

.legend-color.no-data {
  background: var(--gobmx-gray-400);
}

/* Estilos personalizados para popups de Leaflet */
.leaflet-popup-content-wrapper {
  border-radius: 6px;
  font-family: "Montserrat", sans-serif;
}

.popup-organismo {
  min-width: 200px;
}

.popup-title {
  font-weight: 600;
  color: var(--gobmx-primary);
  margin-bottom: 8px;
  font-size: 14px;
}

.popup-info {
  font-size: 12px;
  color: var(--gobmx-gray-700);
  margin-bottom: 4px;
}

.popup-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.popup-status.participated {
  background: rgba(40, 167, 69, 0.1);
  color: var(--gobmx-success);
  border: 1px solid var(--gobmx-success);
}

.popup-status.not-participated {
  background: rgba(220, 53, 69, 0.1);
  color: var(--gobmx-danger);
  border: 1px solid var(--gobmx-danger);
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(98, 17, 50, 0.1);
  border-radius: 50%;
  border-top-color: var(--gobmx-primary);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  .mapa-participacion-container {
    padding: 15px;
    margin: 10px;
  }

  .mapa-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .control-group {
    min-width: auto;
  }

  #mapa {
    height: 400px;
  }

  .mapa-stats {
    grid-template-columns: 1fr 1fr;
  }
}

.marker-pin-participacion {
  width: 20px;
  height: 20px;
  background: var(--gobmx-success);
  /* Rojo */
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
  position: absolute;
  top: -10px;
  left: -10px;
}

.mapa-informe-grid {
  display: grid;
  grid-template-columns: 8fr 4fr;
  /* 8 columnas mapa, 4 columnas informe */
  gap: 20px;
  margin-top: 20px;
}

/* Altura fija para el mapa */
.mapa-panel #mapa-participacion {
  height: 600px;
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 8px;
}

/* Informe */
.informe-panel {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 8px;
  height: 600px;
  /* misma altura que el mapa */
  overflow-y: auto;
  border: 1px solid #ccc;
}

/* Header institucional del informe */
.informe-panel h4 {
  background: linear-gradient(135deg, var(--gobmx-primary) 0%, var(--gobmx-secondary) 50%, var(--gobmx-primary) 100%);
  border-radius: 8px;
  color: white;
  margin: 0;
  padding: 20px;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: none;
  position: relative;
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}


.informe-panel h4::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gobmx-gold) 0%, white 50%, var(--gobmx-green-success) 100%);
}

#informe-participacion{
  margin-top: 10px;
}

/* ================== Responsive ================== */
@media screen and (max-width: 1024px) {
  .mapa-informe-grid {
    grid-template-columns: 2fr 1fr;
    /* reducir proporción en pantallas medianas */
  }
}

@media screen and (max-width: 768px) {
  .mapa-informe-grid {
    grid-template-columns: 1fr;
    /* mapa e informe en columna */
  }

  .mapa-panel,
  .informe-panel {
    height: auto;
    /* altura automática para adaptarse al contenido */
  }

  .mapa-panel #mapa-participacion {
    height: 400px;
    /* ajustar altura del mapa en móvil */
  }
}

#anio-selector,
#lbl-anio-selector {
  font-size: 18px;
}