/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: auto;
  font-family: 'Roboto', Arial, sans-serif;
  background: #f4f4f4;
}

/* MAP behind everything */
#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* LEFT PANEL */
#panel-left {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 999;
}

.floating-panel {
  background-color: rgba(255, 255, 255, 0.92);
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dropdown-box {
  width: 250px;
}

/* RIGHT PANEL with tabs */
.top-right-box {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 40%;
  max-height: 80%;
  overflow-y: auto;
  z-index: 999;
}

.tab-list {
  list-style: none;
  display: flex;
  border-bottom: 2px solid #ddd;
  background: #fff;
  margin: 0;
  padding: 0;
}

.tab-item {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  cursor: pointer;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  color: #555;
  transition: color 0.3s, border-bottom 0.3s;
}

.tab-item.active,
.tab-item:hover {
  color: #2E7D32;
  border-bottom: 2px solid #2E7D32;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
  margin-top: 8px;
}

.tab-content.active {
  display: block;
}

.info-section {
  background: #f5f5f5;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  min-height: 40px;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.1);
  padding: 10px;
  margin-bottom: 10px;
}

.chart-container {
  margin-top: 6px;
  width: 100%;
  background: #fafafa;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-container canvas {
  width: 100%;
  height: 100%;
}

.chart-row {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  margin-top: 6px;
}

.monthly-subchart {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 98%;
}

.monthly-subchart h4 {
  text-align: center;
  color: #2E7D32;
  margin-bottom: 6px;
}

.monthly-subchart .chart-container {
  flex: 1;
  max-height: 80%;
  margin-top: 4px;
}

h3,
h4 {
  text-align: center;
  color: #2E7D32;
}

label {
  font-weight: bold;
  margin-bottom: 4px;
  display: block;
}

select {
  width: 100%;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.logo-container {
  text-align: center;
  margin-bottom: 10px;
}

.baseline-logo {
  max-width: 200px;
  object-fit: contain;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Override section specific styles */
.override-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.override-row label {
  flex-grow: 1;
  margin-right: 10px;
  font-weight: normal;
  margin-bottom: 0;
  min-width: 200px;
}

.override-row input[type='number'] {
  width: 90px;
  text-align: right;
  padding: 4px;
  border: 1px solid #ccc;
  border-radius: 3px;
}

/* Botones de aplicar cambios */
#saveCostOverrides,
#saveCopOverridesBtn {
  display: block;
  margin: 8px auto 0 auto;
  background-color: #4CAF50;
  color: #fff;
  font-weight: bold;
  border: none;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
}

#saveCostOverrides:hover,
#saveCopOverridesBtn:hover {
  background-color: #45a049;
}

/* Modal styling */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.modal-content h2 {
  margin-bottom: 12px;
  color: #2E7D32;
}

.modal-content button {
  margin-top: 12px;
  padding: 8px 14px;
  background: #4CAF50;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

.modal-content button:hover {
  background: #45a049;
}

/* Participant Arena styling */
#participantArena {
  position: absolute;
  top: 20px;
  right: 20px;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 10px;
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  z-index: 1000;
  width: 15%;
  height: 10%;
}

#participantArena img {
  max-width: 100%;
  height: 100%;
  object-fit: contain;
}

/* === ESTILOS PARA DETAILS/SUMMARY === */
details > summary {
  cursor: pointer;
  font-weight: bold;
  padding: 5px 0;
  margin-bottom: 10px;
  list-style: none;
  display: block;
  color: #2E7D32;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}

/* Ocultar marcador por defecto en Webkit */
details > summary::-webkit-details-marker {
  display: none;
}

/* Añadir un indicador personalizado (triángulo) */
details > summary::before {
  content: '▶ ';
  font-size: 0.8em;
  margin-right: 5px;
  display: inline-block;
  transition: transform 0.2s ease-in-out;
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
}

details[open] > summary::before {
  transform: translateY(-50%) rotate(90deg);
}

/* Mover el texto del summary para dejar espacio al indicador */
details > summary {
  padding-left: 15px;
}

/* Estilo opcional para el contenido dentro de details cuando está abierto */
details[open] > *:not(summary) {
  margin-top: 10px;
  animation: fadeIn 0.4s ease-in-out;
}

/* Asegura que info-section aplicado a details funcione bien */
details.info-section {
  position: relative;
}

/* NEW: Styles for the Loading Indicator */
#loadingIndicator {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5em;
  color: #333;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .top-right-box {
    width: 60%;
    max-height: 75%;
  }
  #panel-left {
    flex-direction: column;
    align-items: flex-start;
  }
  .dropdown-box {
    width: 200px;
  }
  .override-row label {
    min-width: 150px;
  }
  .override-row input[type='number'] {
    width: 70px;
  }
}

@media (max-width: 600px) {
  #participantArena {
    bottom: 10px;
    top: auto;
    left: 10px;
    right: auto;
    width: auto;
    height: auto;
    padding: 5px;
  }
  #participantArena img {
    max-width: 80px;
    max-height: 40px;
  }
  .top-right-box {
    width: 90%;
    max-height: 65%;
    bottom: 60px;
    right: 5%;
    left: 5%;
  }
  #panel-left {
    top: 10px;
    left: 5%;
    right: 5%;
    width: 90%;
    align-items: center;
    gap: 8px;
  }
  .dropdown-box {
    width: 90%;
    max-width: 300px;
  }
  .override-row label {
    min-width: 120px;
  }
}