/* ============================================================================
   estilos.css — estilos compartidos por la portada y el visor
============================================================================ */

:root {
  --azul:        #195c97;
  --azul-claro:  #1976d2;
  --verde:       #2e7d32;
  --borde:       #e5e7eb;
  --gris-texto:  #444;
  --gris-suave:  #f7f8fa;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #222;
  margin: 0;
  padding: 24px 16px 60px;
  background: #fff;
  line-height: 1.45;
}

.contenedor {
  max-width: 1100px;
  margin: 0 auto;
}

/* --- Encabezado institucional --------------------------------------- */
.encabezado-institucional {
  margin-bottom: 28px;
  padding: 0 16px 24px;
  text-align: center;
  border-bottom: 1px solid var(--borde);
}

.institucional-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 20px clamp(26px, 5vw, 54px);
  margin: 0 auto 18px;
}

.institucional-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  object-fit: contain;
}

.logo-came   { width: 180px; }
.logo-unam   { width: 76px; }
.logo-icaycc { width: 240px; }
.logo-ioa    { width: 82px; }

.institucional-agradecimiento {
  max-width: 850px;
  margin: 0 auto;
  color: #4b5563;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.55;
  letter-spacing: .02em;
}

/* --- Encabezado ---------------------------------------------------- */
.encabezado {
  text-align: center;
  margin-bottom: 28px;
}
.encabezado h1 {
  font-size: 22px;
  margin: 0 0 6px;
  color: var(--azul);
}
.encabezado p {
  margin: 0;
  font-size: 14px;
  color: #666;
}

/* --- Portada: tarjetas de entidad ----------------------------------- */
.grid-entidades {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.tarjeta-entidad {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 26px 18px;
  border: 1px solid var(--borde);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .07);
  text-decoration: none;
  color: inherit;
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.tarjeta-entidad:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
  border-color: #c3d6e8;
}
.tarjeta-entidad img {
  width: 84px;
  height: 84px;
  object-fit: contain;
}
.tarjeta-entidad .nombre {
  font-size: 16px;
  font-weight: 600;
  color: var(--azul);
}
.tarjeta-entidad .descripcion {
  font-size: 13px;
  color: #666;
}

/* Entidad aún sin productos */
.tarjeta-entidad.inactiva {
  opacity: .55;
  cursor: default;
  pointer-events: none;
}
.etiqueta-proximamente {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--gris-suave);
  border: 1px solid var(--borde);
  border-radius: 20px;
  padding: 3px 10px;
  color: #777;
}

/* --- Enlace de regreso ---------------------------------------------- */
.volver {
  display: inline-block;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--azul-claro);
  text-decoration: none;
}
.volver:hover { text-decoration: underline; }

/* --- Selector de fecha ---------------------------------------------- */
.selector-fecha fieldset {
  border: 1px solid #d3d3d3;
  border-radius: 10px;
  padding: 10px 14px 8px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  max-width: 640px;
  margin: 0 auto 28px;
  text-align: center;
}
.selector-fecha legend {
  color: #555;
  font-size: 13px;
  font-weight: 600;
  padding: 0 4px;
}
.selector-fecha label {
  font-size: 12px;
  color: var(--gris-texto);
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.selector-fecha select {
  background: #fff;
  border: 1px solid #c7c7c7;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
}
.selector-fecha select:hover  { border-color: #b0b0b0; }
.selector-fecha select:focus  { outline: 2px solid #90caf9; outline-offset: 1px; }

.selector-fecha button {
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  margin: 2px 4px;
  border: 1px solid #c7c7c7;
  background: #f9f9f9;
  color: #333;
  transition: background .18s, border-color .18s;
}
#btn-ver-dia {
  background: var(--azul-claro);
  border-color: var(--azul-claro);
  color: #fff;
  font-weight: 500;
}
#btn-ver-dia:hover { background: #1e81e0; border-color: #1e81e0; }

#btn-dia-actual {
  background: var(--verde);
  border-color: var(--verde);
  color: #fff;
  font-weight: 500;
  margin-top: 8px;
}
#btn-dia-actual:hover { background: #359239; border-color: #359239; }

/* --- Bloques de producto -------------------------------------------- */
.bloque {
  margin: 0 auto 44px;
  text-align: center;
}
.bloque h2 {
  font-size: 15px;
  color: #555;
  font-weight: 600;
  margin: 0 0 14px;
}

#meteograma {
  width: 100%;
  max-width: 560px;
  height: auto;
}

/* --- Tablas de máximos pronosticados --------------------------------- */
.bloque-tabla { margin-bottom: 30px; }
.bloque-tabla:last-child { margin-bottom: 44px; }

.tabla-ozono {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  font-size: 13px;
  border: 1px solid var(--borde);
  border-radius: 7px;
  overflow: hidden;
}
.tabla-ozono th,
.tabla-ozono td {
  border: 0;
  padding: 10px 12px;
  text-align: center;
}
.tabla-ozono th:first-child,
.tabla-ozono td:first-child {
  text-align: left;
  white-space: nowrap;
}
.tabla-ozono thead th {
  background: var(--azul);
  color: #fff;
  border-bottom: 1px solid var(--borde);
}
.tabla-ozono tbody tr + tr td {
  border-top: 1px solid var(--borde);
}

/* Colores oficiales por categoría */
.val-buena                { background: #00E400; color: #000; }
.val-aceptable            { background: #FFFF00; color: #000; }
.val-mala                 { background: #FF7E00; color: #000; }
.val-muy-mala             { background: #FF0000; color: #fff; }
.val-extremadamente-mala  { background: #8F3F97; color: #fff; }
.val-sin-dato             { background: #e0e0e0; color: #222; }

/* --- Mapas animados --------------------------------------------------- */
.fila-mapas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}
.mapa {
  flex: 1 1 420px;
  max-width: 560px;
}
.mapa h3 {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  margin: 0 0 8px;
}
.mapa img {
  width: 100%;
  height: auto;
  border: 1px solid var(--borde);
  border-radius: 6px;
  background: var(--gris-suave);
}
.mapa .sin-dato {
  padding: 60px 12px;
  border: 1px dashed #ccc;
  border-radius: 6px;
  color: #999;
  font-size: 13px;
}

/* --- Controles de reproducción --------------------------------------- */
.fecha-frame {
  margin: 18px 0 12px;
  font-weight: 600;
  font-size: 15px;
}
.controles button {
  background: #fff;
  border: 1px solid #d6d6d6;
  border-radius: 8px;
  padding: 7px 12px;
  margin: 4px;
  cursor: pointer;
  color: #343434;
  font-size: 13px;
}
.controles button:hover { background: var(--gris-suave); }
.controles .linea {
  margin-top: 14px;
  font-size: 13px;
  color: var(--gris-texto);
}
.controles input[type="number"] { width: 60px; }

/* --- Mensajes -------------------------------------------------------- */
.cargando { margin: 20px; font-weight: 600; color: #666; }
.error    { color: #b00020; font-size: 13px; }
.sin-dato-producto { color: #666; font-size: 13px; }

/* --- Pie ------------------------------------------------------------- */
.pie {
  text-align: center;
  font-size: 12px;
  color: #888;
  margin-top: 50px;
  padding-top: 18px;
  border-top: 1px solid var(--borde);
}

@media (max-width: 560px) {
  .encabezado-institucional {
    padding-right: 0;
    padding-left: 0;
  }

  .institucional-logos {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 24px 18px;
  }

  .institucional-logo {
    margin: auto;
  }

  .logo-came   { width: 145px; }
  .logo-unam   { width: 70px; }
  .logo-icaycc { width: 165px; }
  .logo-ioa    { width: 76px; }
}
