/* Layout para gráficos y tablas lado a lado */
.chart-table-container {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 20px;
  min-height: 0; /* Evitar altura excesiva */
}

.block-datos-corpus{
  margin: 60px 0px;
  max-height: 500px;
  overflow: visible;
}

.block-datos-corpus.block-datos-medios-provincia-block{
  max-height: none;
}


.table-section {
  flex: 1;
  min-width: 300px;
  max-width: 50%;
}

.chart-section {
  flex: 1;
  min-width: 300px;
  max-width: 50%;
}

.chart-wrapper {
  width: 100%;
  height: 400px;
  max-height: 400px; /* Limitar altura máxima */
  position: relative;
  overflow: hidden; /* Evitar desbordamiento */
}

.chart-section .chart-wrapper canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-height: 400px !important; /* Forzar altura máxima */
}

.table-section .table-responsive {
  max-height: 400px;
  overflow-y: auto;
}

.table-section .table {
  margin-bottom: 0;
  font-size: 0.9rem;
}

/* Responsive: en pantallas pequeñas, apilar verticalmente */
@media (max-width: 768px) {
  .chart-table-container {
    flex-direction: column;
  }
  
  .table-section,
  .chart-section {
    flex: none;
    width: 100%;
    max-width: 100%;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-bottom: 1rem;
  }
  
  .chart-wrapper {
    height: 300px;
    max-height: 300px;
  }
}
.table-section .table-responsive {
  max-height: 400px;
  overflow-y: auto;
}

.table-section .table {
  margin-bottom: 0;
  font-size: 0.9rem;
}

/* Asegurar que el gráfico se ajuste al contenedor */
.chart-section .chart-wrapper {
  position: relative;
  width: 100%;
  height: 400px;
}

.chart-section canvas {
  max-width: 100%;
  height: auto !important;
}

/* Estilos para el bloque de datos medios por provincia */
.provincia-tables-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 0;
  overflow-y: auto;
}

.provincia-table-wrapper {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px;
  background-color: #f9f9f9;
  margin-bottom: 0;
}

.provincia-title {
  color: #2c3e50;
  margin-bottom: 10px;
  font-size: 1.0em;
  font-weight: bold;
}

.provincia-stats-table {
  margin-bottom: 0;
  font-size: 0.85rem;
}

.provincia-stats-table td:first-child {
  font-weight: bold;
  background-color: #ecf0f1;
  width: 60%;
}

.provincia-stats-table td:last-child {
  text-align: right;
  width: 40%;
}

/* Responsive adjustments for provincia tables */
@media (max-width: 768px) {
  .provincia-tables-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    max-height: none;
    overflow-y: visible;
  }
}
