/* ================================================================
   BET-EL — responsive.css
   CSS global de responsive. Se carga en TODOS los archivos HTML.
   ================================================================ */

/* ===== RESET BASE ===== */
*, *::before, *::after { box-sizing: border-box !important; }
body { overflow-x: hidden !important; }

/* ===== CARDS RESUMEN LLUVIA ===== */
.cards-resumen-lluvia {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  margin-bottom: 20px;
}
.cards-resumen-lluvia .stat-card {
  min-width: 0;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}
.cards-resumen-lluvia .stat-label {
  font-size: 11px;
  white-space: normal;
  word-break: break-word;
  overflow: hidden;
  line-height: 1.3;
}

/* ===== GRÁFICOS ESTADÍSTICAS ===== */
.grid-graficos-principales {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
  width: 100%;
}

/* ===== RESPONSIVE 768px ===== */
@media (max-width: 768px) {

  /* Grids de 3 o 4 columnas fijas → 2 columnas */
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns: 1fr 1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Cards de comparación amplias → 1 columna */
  .cards-comparacion,
  .comparacion-cards {
    grid-template-columns: 1fr !important;
  }

  /* Gráficos estadísticas → 1 columna */
  .grid-graficos-principales {
    grid-template-columns: 1fr !important;
  }

  /* Todas las cards: sin desborde */
  .card, [class*="card"], [class*="Card"] {
    min-width: 0 !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  /* Labels de cards */
  [class*="label"], [class*="Label"] {
    white-space: normal !important;
    word-break: break-word !important;
  }

  /* Tablas con scroll horizontal */
  .tabla-wrapper, [class*="tabla"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
  }

  /* Canvas Chart.js */
  canvas {
    max-width: 100% !important;
  }
  [class*="chart"], [class*="grafico"], [class*="Chart"] {
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  /* Botones en cabeceras de página */
  .page-header button,
  .page-header a {
    font-size: 12px !important;
    padding: 6px 10px !important;
  }
}

/* ===== RESPONSIVE 480px ===== */
@media (max-width: 480px) {

  /* Grids de 2 columnas → 1 columna en pantallas muy chicas */
  [style*="grid-template-columns: repeat(2"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}
