/* Reset y base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* Body usa flexbox vertical para mantener el footer al fondo */
body {
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Fondos */
body.fondo {
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
    url("background.webp") no-repeat center center / cover;
}

body.fondo2 {
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
    url("background2.webp") no-repeat center center / cover;
}

body.fondo3 {
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.221), rgba(0, 0, 0, 0.221)),
    url("background3.webp") no-repeat center center / cover;
}

body.fondo4 {
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.221), rgba(0, 0, 0, 0.221)),
    url("background4.png") no-repeat center center / cover;
}

/* Header */
header {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: clamp(6px, 1.2vh, 12px) 0;
}

/* Footer fijo abajo pero sin tapar contenido */
footer {
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: center;
  padding: clamp(6px, 1.2vh, 12px) 0;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.1);
  margin-top: auto;
  /* ❗️Lo empuja al fondo */
}

/* Contenedor principal ocupa todo el espacio restante */
.container {
  flex: 1;
  /* ❗️Hace que empuje el footer hacia abajo */
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: clamp(8px, 1.6vh, 18px);
  padding: clamp(8px, 1.6vh, 18px);
  width: 95%;
  max-width: 1600px;
  margin: 0 auto;
  min-height: 0;
}

/* Columna de gráficas */
.charts {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.6vh, 18px);
  min-height: 0;
}

/* Tarjetas */
.chart-container,
.data-section,
.proyecto {
  background: rgba(255, 255, 255, 0.598);
  border-radius: 15px;
  padding: clamp(10px, 1.6vh, 16px);
  backdrop-filter: blur(10px);
}

/* Gráficas responsivas */
.chart-container {
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: stretch;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Columna de datos */
.datos {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.6vh, 18px);
  min-height: 0;
}

.textoPeque {
  font-size: 0.9rem;
  opacity: 0.8;
}

.valor-grande {
  font-size: clamp(1.2rem, 2.6vh, 2rem);
  font-weight: bold;
  margin-left: 0.6rem;
}

.data-section div {
  display: flex;
  align-items: center;
  margin: clamp(6px, 1.2vh, 12px) 0;
}

/* Proyecto */
.proyecto {
  color: #fff;
  text-align: center;
  margin: clamp(8px, 1.2vh, 12px) 0;
  font-size: clamp(0.9rem, 1.8vh, 1rem);
}

/* Logos */
.logos {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(6px, 1vw, 12px);
  padding: 0 clamp(8px, 2vw, 16px);
  max-width: 96%;
}

.logos img {
  height: clamp(28px, 5vh, 42px);
  margin: 0;
  object-fit: contain;
}

/* Nombre de empresa */
.company-name {
  font-size: clamp(1.1rem, 2.6vh, 2rem);
  font-weight: bold;
  background: #9ac31c;
  color: #000;
  padding: clamp(6px, 1.2vh, 10px) clamp(12px, 2vw, 20px);
  border-radius: 20px;
  text-align: center;
  display: inline-block;
}

/* Tablas responsivas */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap>table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.table-wrap th,
.table-wrap td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  text-align: left;
  white-space: nowrap;
}

/* Breakpoints */
@media (max-width: 1200px) {
  .container {
    grid-template-columns: 3fr 2fr;
  }
}

@media (max-width: 900px) {
  .container {
    grid-template-columns: 1fr;
  }

  .company-name {
    font-size: clamp(1rem, 2.4vh, 1.7rem);
  }
}

@media (max-width: 600px) {
  .logos img {
    height: clamp(24px, 4.5vh, 36px);
  }
}

/* Contenedor de Temp/Hum: dos columnas iguales, centradas y separadas */
.temp_hum {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* mitad y mitad */
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
  width: 100%;
  padding: clamp(6px, 1vh, 12px) 0;
}

/* Cada métrica centrada y con icono + valor en línea */
.temp_hum .metric {
  display: inline-flex;
  justify-content: center;
  /* centra el bloque en su mitad */
  align-items: center;
  gap: clamp(8px, 1.5vw, 16px);
}

/* Iconos grandes (puedes subir a 72px si quieres) */
.temp_hum .metric svg {
  width: clamp(40px, 5vw, 64px);
  height: clamp(40px, 5vw, 64px);
}

/* Valor bien grande sólo aquí (sin romper otros .valor-grande) */
.temp_hum .valor-grande {
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1;
}

.data-section.energia {
  padding: clamp(14px, 2vh, 20px);
}

.energia .titulo-bloque {
  margin: 0 0 clamp(10px, 1.6vh, 16px) 0;
  font-size: clamp(1.2rem, 3vh, 1.6rem);
}

.energia-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* mitad y mitad */
  gap: clamp(12px, 2vw, 28px);
  align-items: center;
  width: 100%;
}

.energia .metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* centrado en su mitad */
  justify-content: center;
  padding: clamp(8px, 1.2vh, 14px);
}

.energia .label {
  opacity: 0.9;
  margin-bottom: clamp(4px, .6vh, 8px);
}

.energia .value {
  font-size: clamp(2rem, 6vw, 3.5rem);
  /* bien grande */
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  /* mejor alineación de cifras */
}