/* Calculadora Financiera - Estilos */

.financial-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);
}

/* Selector de Modo */
.mode-selector {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.mode-btn {
  flex: 1;
  min-width: 200px;
  padding: 1rem 1.5rem;
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mode-btn:hover {
  background: #e9ecef;
  border-color: #1a365d;
}

.mode-btn.active {
  background: #1a365d;
  color: white;
  border-color: #1a365d;
}

/* Modos de Calculadora */
.calculator-mode {
  display: none;
}

.calculator-mode.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 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;
}

.mode-description {
  text-align: center;
  color: #666;
  font-style: italic;
  margin-bottom: 1.5rem;
}

/* Grupos de Formulario */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  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 Pago - Centrado */
.payment-timing-field {
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* Botón Resolver */
.solve-btn {
  padding: 0.3rem 0.75rem;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.solve-btn:hover {
  background: #218838;
}

.solve-btn.active {
  background: #ffc107;
  color: #333;
}

/* Sección de Flujos de Caja */
.cashflow-section {
  margin: 1.5rem 0;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #1a365d;
}

.cashflow-section > label {
  display: block;
  font-weight: 600;
  color: #1a365d;
  margin-bottom: 1rem;
}

.cashflow-item {
  display: grid;
  grid-template-columns: 80px 1fr 40px;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.cashflow-item span {
  font-weight: 500;
  color: #555;
}

.cashflow-input,
.irr-cashflow-input {
  padding: 0.6rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
}

.cashflow-input:focus,
.irr-cashflow-input:focus {
  outline: none;
  border-color: #1a365d;
}

.remove-cashflow,
.remove-irr-cashflow {
  width: 30px;
  height: 30px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-cashflow:hover,
.remove-irr-cashflow:hover {
  background: #c82333;
}

.add-btn {
  display: block;
  margin: 1rem auto 0;
  padding: 0.6rem 1.5rem;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.add-btn:hover {
  background: #218838;
}

/* Contenedor del Botón */
.button-container {
  text-align: center;
  margin: 2rem 0;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.button-container button {
  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);
}

.button-container button:hover {
  background-color: #2d4a7c;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(26, 54, 93, 0.3);
}

.button-container button:active {
  transform: translateY(0);
}

.secondary-btn {
  background-color: #6c757d !important;
}

.secondary-btn:hover {
  background-color: #5a6268 !important;
}

/* Sección de Resultados */
.results-section {
  display: none;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 3px solid #1a365d;
  animation: slideIn 0.5s ease;
}

.results-section.active {
  display: block;
}

@keyframes slideIn {
  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(250px, 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;
}

.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: 2rem;
  font-weight: 700;
  color: #1a365d;
  margin: 0;
  word-break: break-word;
}

.result-value.positive {
  color: #28a745;
}

.result-value.negative {
  color: #dc3545;
}

.result-explanation {
  margin-top: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 6px;
  color: #555;
  line-height: 1.6;
}

/* Tabla de Flujos */
.npv-breakdown,
.irr-interpretation {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.cashflow-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cashflow-table thead {
  background-color: #1a365d;
  color: white;
}

.cashflow-table th {
  padding: 1rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
}

.cashflow-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #e0e0e0;
  font-size: 0.9rem;
}

.cashflow-table tbody tr:hover {
  background-color: #f8f9fa;
}

.cashflow-table tbody tr:last-child {
  font-weight: 600;
  background-color: #d4edda;
}

.irr-interpretation p {
  margin: 0;
  color: #555;
  line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 768px) {
  .financial-calculator {
    padding: 1.5rem;
    margin: 1rem;
  }

  .mode-selector {
    flex-direction: column;
  }

  .mode-btn {
    min-width: auto;
  }

  .section-title {
    font-size: 1.1rem;
  }

  .result-cards {
    grid-template-columns: 1fr;
  }

  .result-value {
    font-size: 1.5rem;
  }

  .button-container button {
    width: 100%;
    padding: 1rem 2rem;
  }

  .cashflow-item {
    grid-template-columns: 60px 1fr 35px;
    gap: 0.3rem;
  }

  .cashflow-table {
    font-size: 0.8rem;
  }

  .cashflow-table th,
  .cashflow-table td {
    padding: 0.5rem 0.3rem;
  }
}

@media (max-width: 480px) {
  .financial-calculator {
    padding: 1rem;
    margin: 0.5rem;
  }

  .section-title {
    font-size: 1rem;
    margin: 1rem 0 0.75rem;
  }

  .mode-description {
    font-size: 0.9rem;
  }

  .form-group label {
    font-size: 0.9rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .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;
  }

  .button-container button {
    font-size: 1rem;
    padding: 0.875rem 1.5rem;
  }

  .cashflow-item {
    grid-template-columns: 50px 1fr 30px;
    font-size: 0.85rem;
  }

  .cashflow-table th,
  .cashflow-table td {
    padding: 0.4rem 0.2rem;
    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;
}
