/**
 * Estilos especificos para clima.html
 * Layout de grid con 4 mapas y panel de texto
 */

/* ============================================================
   CAPITULO CLIMA - LAYOUT PRINCIPAL
   ============================================================ */

.chapter-clima {
  display: grid;
  grid-template-columns: 20% 40% 40%;
  grid-template-rows: 1fr;
  gap: 0.3rem;
  height: calc(100vh - 60px); /* Restar altura del timeline */
  padding: 0.5rem;
  padding-top: 0.3rem;
  box-sizing: border-box;
}

/* Titulo del capitulo - OCULTO (cada mapa tiene su header) */
.chapter-clima .map-title {
  display: none;
}

/* ============================================================
   CONTENEDOR DE CONTENIDO (debajo del titulo)
   ============================================================ */

.clima-content {
  grid-column: 1 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: 20% 40% 40%;
  grid-template-rows: 1fr 1fr;
  gap: 0.3rem;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

/* ============================================================
   CARD 1 - TEXTO EXPLICATIVO (columna izquierda completa)
   ============================================================ */

.clima-text-card {
  grid-column: 1;
  grid-row: 1 / 3;
  background: var(--color-bg-white);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  padding: 0.8rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.clima-text-card .card-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-btn-primary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--color-btn-primary);
}

.clima-text-card .card-content {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--color-gray-900);
  flex: 1;
}

.clima-text-card .card-content p {
  margin-bottom: 0.5rem;
  font-size: 18px;
}

.clima-text-card .card-content ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.clima-text-card .card-content li {
  padding: 0.3rem 0;
  padding-left: 1.2rem;
  position: relative;
}

.clima-text-card .card-content li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6rem;
  width: 6px;
  height: 6px;
  background: var(--color-btn-primary);
  border-radius: 50%;
}

/* ============================================================
   SELECTORES DE MODELO Y PERIODO
   ============================================================ */

.clima-selectors {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 2px solid var(--color-btn-primary);
}

.selector-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.selector-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-btn-primary);
  min-width: 60px;
}

.selector-buttons {
  display: flex;
  gap: 0.4rem;
  flex: 1;
}

.selector-btn {
  flex: 1;
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: 2px solid var(--color-border);
  background: var(--color-bg-white);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.selector-btn:hover {
  background: var(--color-bg-gray);
  border-color: var(--color-btn-primary);
}

.selector-btn.active {
  background: var(--color-btn-primary);
  color: var(--color-bg-white);
  border-color: var(--color-btn-primary);
}

/* Seccion de conceptos Q05/Q95 */
.clima-concepts {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border-light);
}

.clima-concepts .concept-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-data-blue);
  margin-bottom: 0.3rem;
}

.clima-concepts .concept-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.3rem;
  padding: 0.3rem;
  background: rgba(74, 144, 217, 0.05);
  border-radius: 4px;
}

.clima-concepts .concept-label {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--color-btn-primary);
  min-width: 30px;
}

.clima-concepts .concept-desc {
  font-size: 1rem;
  color: var(--color-gray-800);
  line-height: 1.3;
}

/* ============================================================
   CARDS DE MAPAS (2, 3, 4, 5)
   ============================================================ */

.clima-map-card {
  background: var(--color-bg-white);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Posicionamiento de cada card de mapa */
/* Fila superior: Primavera (izq) y Verano (der) */
.clima-map-card.map-primavera {
  grid-column: 2;
  grid-row: 1;
}

.clima-map-card.map-verano {
  grid-column: 3;
  grid-row: 1;
}

/* Fila inferior: Otoño (izq) e Invierno (der) */
.clima-map-card.map-otono {
  grid-column: 2;
  grid-row: 2;
}

.clima-map-card.map-invierno {
  grid-column: 3;
  grid-row: 2;
}

/* Header de cada card de mapa - OCULTO */
.clima-map-card .map-card-header {
  display: none;
}

.clima-map-card .map-card-title {
  display: none;
}

.clima-map-card .map-card-subtitle {
  display: none;
}

/* Contenedor del mapa */
.clima-map-card .map-container {
  flex: 1;
  min-height: 0;
  position: relative;
}

/* ============================================================
   CONTROLES DE CAPAS DENTRO DE CADA MAPA
   ============================================================ */

.clima-map-card .map-controls {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  z-index: 100;
  max-width: 180px;
  font-size: 0.8rem;
  padding:1px
}

.clima-map-card .map-controls-header {
  padding: 0.4rem 0.6rem;
  background: var(--color-btn-primary);
  color: var(--color-bg-white);
  border-radius: 8px 8px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.clima-map-card .map-controls-title {
  font-size: 0.75rem;
  font-weight: 600;
}

.clima-map-card .map-controls-toggle {
  background: transparent;
  border: none;
  color: var(--color-bg-white);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0.1rem 0.3rem;
}

.clima-map-card .map-controls-content {
  padding: 0.4rem;
}

.clima-map-card .map-controls.collapsed .map-controls-content {
  display: none;
}

.clima-map-card .layer-control {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0rem 0;
}

.clima-map-card .layer-control input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.clima-map-card .layer-control label {
  font-size: 0.75rem;
  cursor: pointer;
}

/* ============================================================
   LEYENDA COMPACTA
   ============================================================ */

.clima-map-card .map-legends {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  background: rgba(255, 255, 255, 0.521);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  z-index: 100;
  max-width: 250px;
  font-size: 0.75rem;
}

.clima-map-card .map-legends-header {
  padding: 0.3rem 0.5rem;
  background: var(--color-bg-gray);
  border-radius: 8px 8px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.clima-map-card .map-legends-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-gray-900);
}

.clima-map-card .map-legends-content {
  padding: 0.3rem;
}

.clima-map-card .legend-categoria {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0;
}

.clima-map-card .legend-simbolo {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}

.clima-map-card .legend-label {
  font-size: 0.7rem;
  color: var(--color-gray-900);
}

/* ============================================================
   CONTROLES CLIMA - Posicionados en el mapa
   ============================================================ */

.clima-map-controls {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 100;
  min-width: 160px;
  font-size: 0.75rem;
}

.clima-map-controls .map-controls-header {
  padding: 0.4rem 0.6rem;
  background: var(--color-bg-white);
  color: var(--color-gray-900);
  border-radius: 6px 6px 0 0;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.clima-map-controls .map-controls-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-gray-900);
}

.clima-map-controls .map-controls-toggle {
  background: transparent;
  border: none;
  color: var(--color-text-gray);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0.1rem 0.3rem;
}

.clima-map-controls .map-controls-content {
  padding: 0.4rem;
}

.clima-map-controls.collapsed .map-controls-content {
  display: none;
}

.clima-map-controls .layer-control {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.1rem 0;
}

.clima-map-controls .layer-control input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
}

.clima-map-controls .layer-control label {
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--color-gray-900);
}

/* ============================================================
   LEYENDA CLIMA - Rampa horizontal
   ============================================================ */

.clima-map-legends {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  right: auto;
  width: auto;
  max-width: 180px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 100;
  font-size: 0.65rem;
  box-sizing: border-box;
  padding: 0.3rem 0.5rem;
}

/* Ocultar header de leyenda para mantener altura baja */
.clima-map-legends .map-legends-header {
  display: none;
}

.clima-map-legends .map-legends-content {
  padding: 0.25rem 0.4rem;
  width: 100%;
  box-sizing: border-box;
}

.clima-map-legends.collapsed .map-legends-content {
  display: none;
}

.clima-map-legends .legend-item {
  margin: 0;
  width: 100%;
}

.clima-map-legends .legend-item-title {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--color-gray-900);
  margin-bottom: 0.25rem;
  text-align: center;
}

/* Rampa de colores horizontal - extendida al 100% */
.clima-map-legends .legend-ramp-container {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  box-sizing: border-box;
}

.clima-map-legends .legend-ramp-bar {
  height: 12px;
  width: 100%;
  min-width: 100%;
  border-radius: 3px;
  border: 1px solid var(--color-gray-400);
  box-sizing: border-box;
}

.clima-map-legends .legend-ramp-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.5rem;
  color: var(--color-gray-800);
  padding: 0;
  width: 100%;
}

.clima-map-legends .legend-ramp-label {
  text-align: center;
}

.map-legends-empty {
  font-size: 0.65rem;
  color: var(--color-gray-600);
  text-align: center;
  padding: 0.3rem;
}

/* ============================================================
   SELECTOR DE ESCENARIO/MODELO (para Card 3 y 5)
   ============================================================ */

.scenario-selector {
  display: flex;
  gap: 0.2rem;
  padding: 0.2rem;
  background: var(--color-bg-gray);
  border-top: 1px solid var(--color-border-light);
  flex-shrink: 0;
}

.scenario-btn {
  flex: 1;
  padding: 0.2rem 0.4rem;
  font-size: 0.65rem;
  border: 1px solid var(--color-border);
  background: var(--color-bg-white);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.scenario-btn:hover {
  background: var(--color-gray-200);
}

.scenario-btn.active {
  background: var(--color-btn-primary);
  color: var(--color-bg-white);
  border-color: var(--color-btn-primary);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1200px) {
  .clima-content {
    grid-template-columns: 25% 37.5% 37.5%;
  }
}

@media (max-width: 992px) {
  .clima-content {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto repeat(2, 1fr);
  }

  .clima-text-card {
    grid-column: 1 / -1;
    grid-row: 1;
    max-height: 200px;
  }

  /* Fila 2: Primavera (izq) y Verano (der) */
  .clima-map-card.map-primavera {
    grid-column: 1;
    grid-row: 2;
  }

  .clima-map-card.map-verano {
    grid-column: 2;
    grid-row: 2;
  }

  /* Fila 3: Otoño (izq) e Invierno (der) */
  .clima-map-card.map-otono {
    grid-column: 1;
    grid-row: 3;
  }

  .clima-map-card.map-invierno {
    grid-column: 2;
    grid-row: 3;
  }
}

@media (max-width: 768px) {
  .chapter-clima {
    padding: 0.5rem;
  }

  .clima-content {
    grid-template-columns: 1fr;
    grid-template-rows: auto repeat(4, 1fr);
    gap: 0.5rem;
  }

  .clima-text-card {
    grid-column: 1;
    grid-row: 1;
    max-height: 150px;
  }

  .clima-map-card.map-primavera,
  .clima-map-card.map-verano,
  .clima-map-card.map-otono,
  .clima-map-card.map-invierno {
    grid-column: 1;
  }

  .clima-map-card.map-primavera { grid-row: 2; }
  .clima-map-card.map-verano { grid-row: 3; }
  .clima-map-card.map-otono { grid-row: 4; }
  .clima-map-card.map-invierno { grid-row: 5; }
}

/* ============================================================
   BOTON SPLIT VERTICAL PARA COMPARAR CAPAS
   (Oculto temporalmente - descomentar display: flex para mostrar)
   ============================================================ */

.clima-split-btn {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  display: none; /* OCULTO TEMPORALMENTE */
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--color-btn-primary);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-btn-primary);
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.clima-split-btn:hover {
  background: var(--color-btn-primary);
  color: var(--color-bg-white);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(162, 26, 92, 0.3);
}

.clima-split-btn.active {
  background: var(--color-btn-primary);
  color: var(--color-bg-white);
}

.clima-split-btn .split-icon {
  font-size: 0.85rem;
}

/* Barra de Split Vertical */
.clima-split-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-bg-white);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  cursor: ew-resize;
  z-index: 150;
  user-select: none;
}

.clima-split-bar::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 40px;
  background: var(--color-bg-white);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.clima-split-bar::after {
  content: "⇄";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--color-btn-primary);
  font-size: 1rem;
  font-weight: bold;
}

/* Etiquetas de capas en modo Split */
.clima-split-label {
  position: absolute;
  bottom: 2.5rem;
  padding: 0.3rem 0.6rem;
  background: rgba(0, 0, 0, 0.75);
  color: var(--color-bg-white);
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 140;
  pointer-events: none;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clima-split-label-left {
  left: 0.5rem;
}

.clima-split-label-right {
  right: 0.5rem;
}

/* ============================================================
   SELECTOR DE VARIABLE CLIMATICA
   ============================================================ */

.clima-variable-selector {
  position: absolute;
  top: 0.5rem;
  left: 10rem;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.clima-variable-selector label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-btn-primary);
  white-space: nowrap;
}

.clima-variable-select {
  font-size: 0.75rem;
  padding: 0.3rem 0.5rem;
  border: 2px solid var(--color-btn-primary);
  border-radius: 4px;
  background: var(--color-bg-white);
  color: var(--color-gray-900);
  cursor: pointer;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
}

.clima-variable-select:hover {
  border-color: var(--color-btn-primary-hover);
}

.clima-variable-select:focus {
  border-color: var(--color-btn-primary);
  box-shadow: 0 0 0 2px rgba(162, 26, 92, 0.2);
}

/* ============================================================
   CAPITULO 3 - INTRODUCCION ESCENARIOS
   Layout: 50% texto + 50% mapa con controles
   ============================================================ */

.chapter-intro-escenarios {
  width: 100%;
  height: calc(100vh - 65px) !important;
  min-height: calc(100vh - 65px);
  padding: 0.5rem;
  box-sizing: border-box;
  display: block !important;
  grid-template-columns: none !important;
}

.chapter-intro-escenarios .map-title {
  display: none;
}

.intro-escenarios-content {
  display: grid;
  grid-template-columns: 40% 60%;
  gap: 0.5rem;
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* Panel izquierdo - Texto */
.intro-text-panel {
  background: var(--color-bg-white);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  padding: 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.intro-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-btn-primary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--color-btn-primary);
  flex-shrink: 0;
}

.intro-description {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--color-gray-900);
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.btn-link-inecc {
  display: inline-block;
  padding: 0.5rem 0.8rem;
  background: var(--color-data-blue);
  color: var(--color-bg-white);
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s ease;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.btn-link-inecc:hover {
  background: var(--color-data-blue-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 217, 0.3);
}

/* Tabs de gráficas */
.intro-tabs-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: 0.8rem;
  border-top: 1px solid var(--color-border);
  padding-top: 0.8rem;
  overflow: hidden;
}

.intro-tabs-header {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
  margin-bottom: 0;
}

.intro-tab-btn {
  flex: 1;
  padding: 0.5rem 0.3rem;
  border: none;
  background: var(--color-gray-200);
  color: var(--color-text-gray);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: all 0.2s ease;
  text-align: center;
}

.intro-tab-btn:hover {
  background: var(--color-gray-300);
}

.intro-tab-btn.active {
  background: var(--color-btn-primary);
  color: var(--color-bg-white);
}

.intro-tabs-content {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--color-gray-100);
  border-radius: 0 0 6px 6px;
  overflow: hidden;
  position: relative;
}

.intro-tab-panel {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.5rem;
  box-sizing: border-box;
  background: var(--color-bg-white);
  border-radius: 4px;
}

.intro-tab-panel.active {
  display: block;
}

.intro-tab-panel canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Panel derecho - Mapa ocupa toda la altura */
.intro-map-panel {
  display: flex;
  flex-direction: column;
  background: var(--color-bg-white);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

.intro-map-panel .map-container {
  flex: 1;
  min-height: 0;
  height: 100%;
  position: relative;
}

/* Título de grupo de capas (para separar Temperatura y Precipitación) */
.layer-group-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-data-blue);
  margin: 0.4rem 0 0.2rem 0;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid var(--color-border);
}

.layer-group-title:first-child {
  margin-top: 0;
}

/* ============================================================
   CAPITULOS 4 y 5 - GRID 2x2 ESCENARIOS
   ============================================================ */

.chapter-escenarios-grid {
  width: 100%;
  height: calc(100vh - 65px) !important;
  min-height: calc(100vh - 65px);
  padding: 0.5rem;
  box-sizing: border-box;
  display: flex !important;
  flex-direction: column;
  grid-template-columns: none !important;
}

.chapter-escenarios-grid .map-title {
  display: none;
}

.escenarios-grid-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
}

.grid-row {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.grid-row-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-data-blue);
  text-align: center;
  margin: 0;
  padding: 0.3rem;
  background: rgba(74, 144, 217, 0.1);
  border-radius: 4px 4px 0 0;
  flex-shrink: 0;
}

.grid-maps-row {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  min-height: 0;
}

.grid-map-card {
  display: flex;
  flex-direction: column;
  background: var(--color-bg-white);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  min-height: 0;
}

.grid-map-header {
  padding: 0.4rem 0.8rem;
  flex-shrink: 0;
}

.grid-map-header h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-bg-white);
}

.grid-map-header span {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.85);
}

.grid-map-ssp245 {
  background: linear-gradient(135deg, var(--color-data-blue) 0%, var(--color-data-blue-dark) 100%);
}

.grid-map-ssp585 {
  background: linear-gradient(135deg, var(--color-temp-hot) 0%, var(--color-temp-hot-dark) 100%);
}

.grid-map-card .map-container {
  flex: 1;
  min-height: 150px;
}

.grid-fuente {
  font-size: 0.75rem;
  color: var(--color-text-gray);
  text-align: center;
  padding: 0.5rem;
  margin: 0;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
  flex-shrink: 0;
}

/* ============================================================
   CAPITULO 5 - LAYOUT TEXTO + GRAFICA (30% - 70%)
   ============================================================ */

.chapter-clima-grafica {
  display: grid;
  grid-template-columns: 30% 1fr;
  grid-template-rows: 1fr;
  gap: 0.5rem;
  padding: 0.5rem;
  width: 100%;
  height: calc(100vh - 65px) !important;
  min-height: calc(100vh - 65px);
  box-sizing: border-box;
}

.chapter-clima-grafica .map-title {
  display: none;
}

.chapter-clima-grafica .chapter-text {
  grid-column: 1;
  grid-row: 1;
  background: var(--color-bg-white);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  overflow-y: auto;
}

.chapter-clima-grafica .chapter-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-btn-primary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--color-btn-primary);
}

.chapter-clima-grafica .chapter-content {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-gray-900);
}

.chapter-clima-grafica .chapter-content p {
  margin-bottom: 0.8rem;
}

.chapter-clima-grafica .chapter-chart-full {
  grid-column: 2;
  grid-row: 1;
  background: var(--color-bg-white);
  border-radius: 8px;
  padding: 0.8rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  position: relative;
}

.chapter-clima-grafica .chart-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-data-blue);
  margin-bottom: 0.5rem;
}

.chapter-clima-grafica .chart-container {
  position: absolute;
  top: 0.8rem;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 0.8rem;
  max-width: none !important;
  max-height: none !important;
  margin: 0;
}

.chapter-clima-grafica .chart-container canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
}

/* Listas del capítulo 5 */
.chapter-clima-grafica .modelos-lista,
.chapter-clima-grafica .datos-lista {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem 0;
}

.chapter-clima-grafica .modelos-lista li {
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.3rem;
  background: rgba(74, 144, 217, 0.1);
  border-left: 3px solid var(--color-data-blue);
  border-radius: 0 4px 4px 0;
  font-size: 0.85rem;
}

.chapter-clima-grafica .datos-titulo {
  margin-top: 1rem;
  color: var(--color-btn-primary);
}

.chapter-clima-grafica .datos-lista li {
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.4rem;
  background: rgba(162, 26, 92, 0.08);
  border-left: 3px solid var(--color-btn-primary);
  border-radius: 0 4px 4px 0;
  font-size: 0.85rem;
  line-height: 1.4;
}

/* ============================================================
   CAPITULO 6 - LAYOUT MAPA + TEXTO (60% - 40%)
   Similar al capítulo 3 de amenazas.html
   ============================================================ */

.clima-chapter-mapa-texto {
  display: grid;
  grid-template-columns: 60% 40%;
  grid-template-rows: auto 1fr;
  gap: 0.5rem;
  padding: 0.5rem;
  width: 100%;
  height: calc(100vh - 65px) !important;
  min-height: calc(100vh - 65px);
  box-sizing: border-box;
}

.clima-chapter-mapa-texto .map-title {
  grid-column: 1 / -1;
  grid-row: 1;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--color-btn-primary);
  margin: 0;
  padding: 0.8rem 1rem;
  background: var(--color-bg-white);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.clima-chapter-mapa-texto .chapter-map {
  grid-column: 1;
  grid-row: 2;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  position: relative;
}

.clima-chapter-mapa-texto .chapter-map .map-container {
  width: 100%;
  height: 100%;
}

.clima-chapter-mapa-texto .chapter-text {
  grid-column: 2;
  grid-row: 2;
  background: var(--color-bg-white);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  overflow-y: auto;
}

.clima-chapter-mapa-texto .chapter-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-btn-primary);
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-btn-primary);
}

.clima-chapter-mapa-texto .chapter-content {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-gray-900);
}

.clima-chapter-mapa-texto .chapter-content p {
  margin-bottom: 0.8rem;
}

.clima-chapter-mapa-texto .chapter-content ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.clima-chapter-mapa-texto .chapter-content li {
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.4rem;
  background: rgba(162, 26, 92, 0.05);
  border-left: 3px solid var(--color-btn-primary);
  border-radius: 0 4px 4px 0;
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Responsive para capítulos 3, 4, 5, 6 */
@media (max-width: 992px) {
  .intro-escenarios-content {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .intro-text-panel {
    max-height: 250px;
  }

  .grid-maps-row {
    grid-template-columns: 1fr;
  }

  .chapter-clima-grafica {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .chapter-clima-grafica .chapter-text {
    grid-column: 1;
    grid-row: 1;
    max-height: 200px;
  }

  .chapter-clima-grafica .chapter-chart-full {
    grid-column: 1;
    grid-row: 2;
  }

  .clima-chapter-mapa-texto {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }

  .clima-chapter-mapa-texto .chapter-map {
    grid-column: 1;
    grid-row: 2;
    min-height: 300px;
  }

  .clima-chapter-mapa-texto .chapter-text {
    grid-column: 1;
    grid-row: 3;
    max-height: 200px;
  }
}

@media (max-width: 768px) {
  .intro-text-panel {
    max-height: 200px;
    padding: 1rem;
  }

  .intro-title {
    font-size: 1.2rem;
  }

  .chapter-escenarios-grid .map-title {
    font-size: 1rem;
  }

  .grid-row-title {
    font-size: 0.85rem;
  }

  .chapter-clima-grafica .chapter-text {
    max-height: 150px;
  }

  .chapter-clima-grafica .chapter-title {
    font-size: 1rem;
  }
}
