/* Toggle buttons styles */
#room-filter {
  margin-left: 20px;
}

/* Wrappers para las diferentes vistas de gráficos */
.sensors-wrapper,
.gauges-wrapper {
  width: 100%;
  padding: 0.5rem;
}

/* Grid containers */
.chart-grid {
  display: flex;
  max-width: auto;
  gap: 1rem;
  padding: 1rem;
  align-items: center;
}

.sensors-grid {
  flex-direction: column;
  align-items: stretch;
}

.gauges-grid {
  flex-flow: row wrap;
  justify-content: flex-start;
  align-content: flex-start;
  margin: 0;
  width: 100%;
}

/* General chart container styles */
.chart-container {
  position: relative;
  width: 100%;
  border: 1px solid var(--brand-green-light);
  border-radius: 8px;
  background-color: var(--brand-bg);
  box-shadow: 0 2px 8px var(--shadow-green-10);
  margin-top: 1rem;
  overflow: hidden;
}

/* Ensure Plotly's output div inside chart-container fills it */
.chart-container > div:first-child,
.chart-container > .plotly-graph-div {
  width: 100% !important;
  height: 100% !important;
}

.gauge-container {
  flex: 0 0 200px;
  width: 200px;
  height: 190px;
  position: relative;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gauge-container:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 16px var(--shadow-green-20);
  z-index: 2;
}

/* Sensor chart containers */
.sensor-container {
  background-color: #fff;
  width: 100%;
}

.sensor-container::before {
  content: "";
  display: block;
  padding-bottom: 40%;
}

.sensor-container > div:first-child,
.sensor-container > .plotly-graph-div {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Loading states */
.loading {
  color: var(--brand-gray);
  font-size: 0.9em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: 1;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--brand-green-light);
  border-radius: 50%;
  border-top-color: var(--brand-green);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Asegurar que los mensajes de error se centren */
.gauge-container p,
.sensor-container p {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin: 0;
  z-index: 1;
}

/* vpd specific styles */
.vpd-container {
  width: 100%;
  background-color: #fff;
}

/* Aspect ratio for VPD. E.g., 4:3 */
.vpd-container::before {
  content: "";
  display: block;
  padding-bottom: 75%;
}

.vpd-container > div:first-child,
.vpd-container > .plotly-graph-div {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Interactive chart container */
#chart {
  width: 100%;
  background-color: #fff;
  height: auto;
}

#chart::before {
  display: none;
}

#chart > div:first-child,
#chart > .plotly-graph-div {
  position: relative;
  width: 100% !important;
  height: auto !important;
  min-height: 467px;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  /* Sensor container for mobile */
  .sensor-container {
    height: auto;
    min-height: 50vh;
  }
  
  .sensor-container::before {
    display: none;
  }
  
  .sensor-container > div:first-child,
  .sensor-container > .plotly-graph-div {
    position: relative;
    height: 50vh !important;
  }
  
  /* VPD container for mobile */
  .vpd-container {
    height: auto;
    min-height: 50vh;
  }
  
  .vpd-container::before {
    display: none;
  }
  
  .vpd-container > div:first-child,
  .vpd-container > .plotly-graph-div {
    position: relative;
    height: 50vh !important;
  }
  
  /* Interactive chart container for mobile */
  #chart {
    height: 80dvh;
    min-height: 500px;
  }
  
  #chart > div:first-child,
  #chart > .plotly-graph-div {
    position: relative;
    height: 100% !important;
  }

  /* Ensure debug info is at the bottom */
  #debug-info {
    margin-top: 2rem;
    padding-bottom: 2rem;
  }
}

