:root {
  --blue-500: #3b82f6;
  --green-500: #019863;
  /* Added green */
  --green-100: #cde9df;
  /* Lighter green for backgrounds */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: white;
  color: var(--gray-800);
  margin: 0;
}

.main-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem;
}

.grid-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.column {
  padding: 1rem;
  padding-left: 0;
}

.column-right {
  margin-top: 2rem;
}

.main-title {
  font-size: 2.25rem;
  font-weight: 200;
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 200;
  margin-bottom: 1rem;
}

.form-inputs-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 200;
  color: var(--gray-700);
  margin-bottom: 0.25rem;
}

.input-group input[type="number"] {
  width: 100%;
  min-width: 0;
  flex: 1 1 0%;
  resize: none;
  overflow: hidden;
  border-radius: 0.75rem;
  /* rounded-xl */
  color: #0c1c17;
  background-color: #f8fcfa;
  border: 1.5px solid var(--green-100);
  padding: 15px;
  font-size: 0.9rem;
  font-weight: 100;
  line-height: normal;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  height: 2.5rem;
  /* h-14 */
}

.input-group input[type="number"]::placeholder {
  color: #46a080;
  opacity: 1;
}

.input-group input[type="number"]:focus {
  outline: none;
  border-color: var(--green-100);
  box-shadow: none;
}

.toggle-container {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.toggle-button {
  font-size: 0.875rem;
  padding: 0.25rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: 9999px;
  background-color: var(--white);
  color: var(--gray-700);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.toggle-button.active {
  background-color: var(--blue-500);
  color: var(--white);
  border-color: var(--blue-500);
}

.slider-container {
  position: relative;
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
}
.slider-wrapper {
  width: 80%;
}
.down-payment-value {
  width: 20%;
  text-align: right;
  font-size: 0.8rem;
  margin-top: 6px
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

/* Custom styling for the range slider */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: var(--green-100);
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #019863;
  cursor: pointer;
  border-radius: 50%;
  margin-top: -6px;
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(1, 152, 99, 0.2);
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #019863;
  cursor: pointer;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(1, 152, 99, 0.2);
}

.slider::-ms-thumb {
  width: 20px;
  height: 20px;
  background: #019863;
  cursor: pointer;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(1, 152, 99, 0.2);
}

.slider:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--green-100);
}

/* Summary Section - Fixed for cutoff issues */
.summary-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  color: var(--gray-700);
  width: 100%;
  overflow: hidden; /* Prevent horizontal overflow */
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--green-100);
  flex-wrap: wrap; /* Allow wrapping on very small screens */
  gap: 0.5rem; /* Add gap between label and value when wrapped */
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-row .label {
  font-weight: 100;
}

.summary-row .value {
  font-weight: 100;
  font-size: 1.125rem;
  min-width: 0; /* Allow shrinking */
  flex-shrink: 0; /* Prevent shrinking of values */
  text-align: right;
  word-break: break-word; /* Break long values if needed */
}

/* Table section */
.table-section {
  margin-top: 3rem;
}

.table-container {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--green-100);
  border-radius: 0.5rem;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

#amortizationTable {
  width: 100%;
  text-align: left;
  border-collapse: collapse;
  font-size: 0.875rem;
  color: var(--gray-500);
  /* border: 1px solid var(--green-100); */
}

#amortizationTable thead {
  position: sticky;
  top: 0;
  background-color: #f8fcfa;
  color: var(--gray-700);
  font-size: 0.75rem;
  text-transform: uppercase;
}

#amortizationTable th,
#amortizationTable td {
  padding: 0.75rem 1.5rem;
}

#amortizationTable th:not(:first-child),
#amortizationTable td:not(:first-child) {
  text-align: right;
}

#amortizationTable tbody tr {
  border-bottom: 1px solid var(--green-100);
  background-color: var(--white);
}

#amortizationTable tbody tr:last-child {
  border-bottom: none;
}

#amortizationTable td:first-child {
  font-weight: 500;
  color: var(--gray-900);
  white-space: nowrap;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--gray-700);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.25rem 0.75rem;
  border-radius: 0.5rem;
  transition: background 0.2s, color 0.2s;
}

.tab-btn.active {
  background: var(--green-100);
  color: var(--green-500);
}

.amortization-panels {
  height: 400px; /* or any value you prefer */
  position: relative;
  min-height: 300px;
  max-height: 500px;
}

.amortization-panels > #tabPanelTable,
.amortization-panels > #tabPanelChart {
  height: 100%;
}

.chart-container {
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

.chart-container canvas {
  height: 100% !important;
  width: 100% !important;
  display: block;
}

.main-footer {
  background: #f5f5f5;
  text-align: center;
  margin-top: 5rem;
  padding: 1.5rem 0;
  font-size: 0.8rem;
  color: #222;
  letter-spacing: 0.02em;
}

.footer-link {
  color: inherit;
  text-decoration: none;
  transition: text-decoration 0.2s, color 0.2s;
}

.footer-link:hover,
.footer-link:focus {
  text-decoration: underline;
  color: #019863;
}

.tab-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 3px;
}

/* Responsive Design */
@media (min-width: 768px) {
  .main-container {
    padding: 2rem;
  }

  .column {
    padding: 1.5rem;
    padding-left: 0;
  }
}

@media (max-width: 768px) {
  .summary-row .value {
    font-size: 1rem;
    max-width: 50%;
  }
}

@media (min-width: 1024px) {
  .grid-container {
    grid-template-columns: 25% 75%;
    gap: 4rem;
  }

  .column-right {
    margin-top: 0;
  }
}

/* Responsive table container for mobile */
@media (max-width: 600px) {
  html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
  }

  .main-container,
  .grid-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
    gap: 1rem;
  }

  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
  }
  .column {
    padding: 1rem 0 1rem 0;
  }
  .column-right {
    margin-top: 0;
  }

  .section-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    margin-top: 0;
  }

  #amortizationTable {
    /* min-width: 500px; */
    width: 100%;
    table-layout: auto;
    font-size: 0.75rem;
  }

  #amortizationTable th,
  #amortizationTable td {
    padding: 0.5rem 0.5rem;
    white-space: nowrap;
  }

  body, html {
    overflow-x: hidden;
  }

  /* Mobile fixes for summary section */
  .summary-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .summary-row .value {
    text-align: left;
    font-size: 1rem;
  }
  
  .summary-row .label {
    font-size: 0.875rem;
  }
  th {
    font-size: 0.5rem;
  }
  .tab-buttons {
    margin-top: -5px;
  }
}