/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 2rem 1rem;
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* Header */
header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2rem;
  text-align: center;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.95;
  font-weight: 300;
  margin-bottom: 1rem;
}

.header-nav {
  margin-top: 1rem;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 2px solid white;
  border-radius: 8px;
  display: inline-block;
  transition: all 0.3s ease;
  font-weight: 600;
}

.nav-link:hover {
  background: white;
  color: #667eea;
}

/* Main Content */
main {
  padding: 2rem;
}

section {
  margin-bottom: 2rem;
}

h2 {
  color: #333;
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid #667eea;
}

h3 {
  color: #555;
  font-size: 1.4rem;
  margin-bottom: 1rem;
  margin-top: 1.5rem;
}

h4 {
  color: #667eea;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

h5 {
  color: #666;
  font-size: 1rem;
  font-weight: 600;
}

/* Input Section */
.input-section {
  background: #f8f9fa;
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.section-description {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.subsection {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #dee2e6;
}

.subsection:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  color: #333;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 0.1rem 0.75rem;
  transition: all 0.3s ease;
}

.input-wrapper:focus-within {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.currency {
  color: #666;
  font-weight: 600;
  font-size: 1rem;
  min-width: 15px;
}

.input-wrapper input {
  flex: 1;
  border: none;
  padding: 0.65rem 0.25rem;
  font-size: 1rem;
  background: transparent;
}

.input-wrapper input:focus {
  outline: none;
}

input[type="number"] {
  width: 100%;
  padding: 0.75rem 0.75rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
}

input[type="number"]:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Calculate Button */
.calculate-btn {
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 1.25rem 2rem;
  font-size: 1.2rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 2rem;
}

.calculate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.calculate-btn:active {
  transform: translateY(0);
}

/* Results Section */
.results-section {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-group {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid #e9ecef;
}

.result-group:last-child {
  border-bottom: none;
}

.result-group h3 {
  color: #667eea;
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.result-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 1.5rem;
  border: 2px solid #e9ecef;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.highlight-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 2px solid #667eea;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #dee2e6;
  font-size: 0.95rem;
}

.result-item:last-child {
  border-bottom: none;
}

.result-total {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 2px solid #667eea;
  font-size: 1.1rem;
  font-weight: 700;
}

.result-value {
  font-weight: 600;
  color: #333;
}

.result-value.positive {
  color: #28a745;
}

.result-value.negative {
  color: #dc3545;
}

.savings {
  background: #d4edda;
  padding: 0.75rem;
  border-radius: 8px;
  margin-top: 0.5rem;
}

/* Debt Details */
.debt-details {
  margin-top: 1rem;
}

.debt-item {
  margin-bottom: 0.5rem;
}

.debt-paydown-details {
  margin-bottom: 1rem;
}

.paydown-item {
  margin-bottom: 0.3rem;
}

/* Runway Result */
.runway-result {
  background: #e7f3ff;
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  border: 2px solid #667eea;
}

/* Comparison Card */
.comparison-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 12px;
  padding: 2rem;
  border: 3px solid #667eea;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.comparison-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 2rem;
  align-items: center;
  margin-bottom: 2rem;
}

.comparison-item {
  text-align: center;
  padding: 1.5rem;
  background: white;
  border-radius: 12px;
  border: 2px solid #e9ecef;
}

.comparison-item h4 {
  color: #667eea;
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.comparison-value {
  font-size: 2rem;
  font-weight: 700;
  color: #333;
  margin: 0.5rem 0;
}

.comparison-label {
  color: #666;
  font-size: 0.9rem;
  margin: 0;
}

.comparison-divider {
  font-size: 1.5rem;
  font-weight: 700;
  color: #667eea;
  text-align: center;
}

.comparison-insights {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  border: 2px solid #e9ecef;
}

.insights-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.insight-item {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: #f8f9fa;
  border-left: 4px solid #667eea;
  margin: 0;
}

.insight-item.positive {
  background: #d4edda;
  border-left-color: #28a745;
  color: #155724;
}

.insight-item.negative {
  background: #fff3cd;
  border-left-color: #ffc107;
  color: #856404;
}

.comparison-result {
  margin-top: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 1rem 0.5rem;
  }

  header h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  main {
    padding: 1rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .comparison-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .comparison-divider {
    transform: rotate(90deg);
    font-size: 1.2rem;
  }

  .comparison-value {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.75rem;
  }

  .input-section {
    padding: 1rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.2rem;
  }

  .calculate-btn {
    font-size: 1rem;
    padding: 1rem;
  }
}

/* Toast notification */
.toast-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #28a745;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 0.95rem;
  font-weight: 500;
  z-index: 9999;
  animation: slideInRight 0.3s ease-out, fadeOut 0.3s ease-in 2.7s;
  pointer-events: none;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
