/* Calculadora de Inversión - Estilos */

.investment-calculator {
  max-width: 950px;
  margin: 2rem auto;
  padding: 2rem;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Títulos de Sección */
.section-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #1a365d;
  margin: 1.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e0e0e0;
}

.section-title:first-child {
  margin-top: 0;
}

/* Grupos de Formulario */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #333;
  font-size: 0.95rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
  background: #fff;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #1a365d;
  box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

.form-group input::placeholder {
  color: #999;
}

.field-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
}

/* Campo de Momento de Contribución - Centrado */
.contribution-timing-field {
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* Toggle de Opciones Avanzadas */
.advanced-options-toggle {
  margin: 1rem 0;
  text-align: center;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  padding: 0.75rem 1.5rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.3s ease;
  background: #f9f9f9;
}

.checkbox-label:hover {
  border-color: #1a365d;
  background: #f0f4f8;
}

.checkbox-label input[type="checkbox"] {
  margin-right: 0.5rem;
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.checkbox-label span {
  font-size: 1rem;
  color: #333;
  font-weight: 500;
}

/* Sección de Opciones Avanzadas */
.advanced-options-section {
  display: none;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
  margin-top: 1rem;
  border-left: 4px solid #ffc107;
}

.advanced-options-section.active {
  display: block;
  animation: slideDown 0.4s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    max-height: 1000px;
    transform: translateY(0);
  }
}

/* Contenedor del Botón */
.button-container {
  text-align: center;
  margin: 2rem 0;
}

#calculateBtn {
  background-color: #1a365d;
  color: white;
  border: none;
  padding: 1rem 3rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(26, 54, 93, 0.2);
}

#calculateBtn:hover {
  background-color: #2d4a7c;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(26, 54, 93, 0.3);
}

#calculateBtn:active {
  transform: translateY(0);
}

/* Sección de Resultados */
.results-section {
  display: none;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 3px solid #1a365d;
  animation: fadeIn 0.5s ease;
}

.results-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tarjetas de Resultado */
.result-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.result-card {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  padding: 1.5rem;
  border-radius: 10px;
  text-align: center;
  border: 2px solid #1a365d;
  transition: transform 0.3s ease;
}

.result-card:hover {
  transform: translateY(-5px);
}

.result-card.primary {
  background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
  border-color: #28a745;
}

.result-label {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.result-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1a365d;
  margin: 0;
  word-break: break-word;
}

.result-value.earnings {
  color: #28a745;
}

/* Desglose */
.breakdown-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: white;
  border-radius: 6px;
  border-left: 4px solid #1a365d;
}

.breakdown-item.hidden {
  display: none;
}

.breakdown-label {
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
}

.breakdown-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #1a365d;
}

.breakdown-value.earnings {
  color: #28a745;
}

.breakdown-value.fees {
  color: #dc3545;
}

/* Gráfico de Inversión */
.chart-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.investment-chart {
  margin-top: 1rem;
}

.chart-bar {
  display: flex;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
}

.chart-segment.initial {
  background-color: #1a365d;
}

.chart-segment.contributions {
  background-color: #5a9bd5;
}

.chart-segment.earnings {
  background-color: #28a745;
}

.chart-segment:hover {
  filter: brightness(1.1);
  cursor: pointer;
}

.chart-label {
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.chart-legend {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.legend-color.initial {
  background-color: #1a365d;
}

.legend-color.contributions {
  background-color: #5a9bd5;
}

.legend-color.earnings {
  background-color: #28a745;
}

/* Tabla de Crecimiento */
.table-section {
  margin-top: 2rem;
}

.toggle-btn {
  display: block;
  margin: 0 auto 1rem;
  background-color: #6c757d;
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle-btn:hover {
  background-color: #5a6268;
  transform: translateY(-2px);
}

.growth-table {
  display: none;
  overflow-x: auto;
  margin-top: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  max-height: 500px;
  overflow-y: auto;
}

.growth-table.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

.growth-table table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.growth-table thead {
  background-color: #1a365d;
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.growth-table th {
  padding: 1rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

.growth-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #e0e0e0;
  font-size: 0.875rem;
  white-space: nowrap;
}

.growth-table tbody tr:hover {
  background-color: #f8f9fa;
}

.growth-table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

.growth-table tbody tr:nth-child(even):hover {
  background-color: #f0f0f0;
}

.growth-table tbody tr:last-child {
  font-weight: 600;
  background-color: #d4edda;
}

/* Responsive Design */
@media (max-width: 768px) {
  .investment-calculator {
    padding: 1.5rem;
    margin: 1rem;
  }

  .section-title {
    font-size: 1.1rem;
  }

  .result-cards {
    grid-template-columns: 1fr;
  }

  .result-value {
    font-size: 1.5rem;
  }

  .breakdown-grid {
    grid-template-columns: 1fr;
  }

  #calculateBtn {
    width: 100%;
    padding: 1rem 2rem;
  }

  .chart-legend {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .toggle-btn {
    width: 100%;
  }

  .growth-table {
    font-size: 0.8rem;
  }

  .growth-table th,
  .growth-table td {
    padding: 0.5rem 0.3rem;
  }
}

@media (max-width: 480px) {
  .investment-calculator {
    padding: 1rem;
    margin: 0.5rem;
  }

  .section-title {
    font-size: 1rem;
    margin: 1rem 0 0.75rem;
  }

  .form-group label {
    font-size: 0.9rem;
  }

  .form-group input,
  .form-group select {
    padding: 0.6rem;
    font-size: 0.95rem;
  }

  .result-card {
    padding: 1rem;
  }

  .result-label {
    font-size: 0.85rem;
  }

  .result-value {
    font-size: 1.3rem;
  }

  .breakdown-value {
    font-size: 1.1rem;
  }

  #calculateBtn {
    font-size: 1rem;
    padding: 0.875rem 1.5rem;
  }

  .toggle-btn {
    font-size: 0.9rem;
    padding: 0.6rem 1.5rem;
  }

  .growth-table th,
  .growth-table td {
    padding: 0.4rem 0.2rem;
    font-size: 0.75rem;
  }

  .chart-bar {
    height: 40px;
  }

  .chart-label {
    font-size: 0.75rem;
  }
}

/* Animación de pulso para tarjeta principal */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

.result-card.primary {
  animation: pulse 2s ease-in-out infinite;
}
