/* CSS Custom Properties for unified design system */
:root {
    --primary-color: #4D4DDC;
    --primary-dark: #3636A5;
    --accent-color: #6F6FF2;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --background-color: #f5f7fa;
    --card-background: #f7fafc;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
    --light-gray: #ecf0f1;
    --medium-gray: #bdc3c7;
    --hover-bg: #edf2f7;
    --cyan-color: #00BCD4;
    --cyan-dark: #0097A7;
    --cyan-darker: #00838F;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: var(--background-color);
    color: var(--text-primary);
    /* Prevent pull-to-refresh on mobile */
    overscroll-behavior-y: contain;
}

/* Touch-friendly input improvements */
input, select, textarea, button {
    /* Larger touch targets */
    min-height: 44px;
    /* Better mobile appearance */
    -webkit-appearance: none;
    border-radius: 8px;
    /* Prevent zoom on double-tap */
    touch-action: manipulation;
    /* Better touch feedback */
    transition: all 0.2s ease;
}

/* Remove iOS styling */
input[type="number"], input[type="text"], input[type="email"] {
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

/* Mobile-optimized hover states */
@media (hover: hover) {
    .scenario-btn:hover, .carousel-arrow:hover, .view-toggle-btn:hover {
        transform: translateY(-1px);
    }
}

@media (hover: none) {
    .scenario-btn:active, .carousel-arrow:active, .view-toggle-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s;
    }
}

/* Mobile form validation and UX */
.form-validation-error {
    border-color: #ff4444 !important;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Better focus states */
input:focus, select:focus, textarea:focus, button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 16px 16px 0 0;
    margin: -30px -30px 30px -30px;
    padding: 60px 40px;
    color: white;
    position: relative;
    overflow: hidden;
}

.header-content {
    position: relative;
    z-index: 2;
}

.header h1 {
    color: white;
    margin-bottom: 16px;
    font-size: 2.5rem;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header .tagline {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 0;
}

.header-graphic {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    opacity: 0.1;
}

.graphic-element {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.graphic-element:nth-child(1) {
    width: 200px;
    height: 200px;
    top: -50px;
    right: -50px;
}

.graphic-element:nth-child(2) {
    width: 150px;
    height: 150px;
    bottom: -30px;
    left: 10%;
}

.graphic-element:nth-child(3) {
    width: 100px;
    height: 100px;
    top: 30%;
    left: 60%;
}

/* Stars Animation */
.stars-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}

.star {
  position: absolute;
  color: white;
  font-size: 12px;
  opacity: 0;
  animation: starMove 8s linear infinite, twinkle 2s ease-in-out infinite alternate;
}

@keyframes starMove {
  0% {
    transform: translate(0px, 0px);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: translate(200px, -150px);
    opacity: 0;
  }
}

@keyframes twinkle {
  0%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* Individual star positioning and delays */
.star-1 {
  top: 15%;
  left: 10%;
  animation-delay: 0s;
  font-size: 12px;
}

.star-2 {
  top: 35%;
  left: 25%;
  animation-delay: -1.5s;
  font-size: 10px;
}

.star-3 {
  top: 70%;
  left: 5%;
  animation-delay: -3s;
  font-size: 14px;
}

.star-4 {
  top: 80%;
  left: 40%;
  animation-delay: -4.5s;
  font-size: 8px;
}

.star-5 {
  top: 25%;
  left: 60%;
  animation-delay: -6s;
  font-size: 16px;
}

.star-6 {
  top: 60%;
  left: 75%;
  animation-delay: -7.5s;
  font-size: 9px;
}

.star-7 {
  top: 10%;
  left: 85%;
  animation-delay: -2s;
  font-size: 11px;
}

.star-8 {
  top: 90%;
  left: 15%;
  animation-delay: -3.5s;
  font-size: 13px;
}

.star-9 {
  top: 45%;
  left: 95%;
  animation-delay: -5s;
  font-size: 10px;
}

.star-10 {
  top: 20%;
  left: 45%;
  animation-delay: -6.5s;
  font-size: 15px;
}

.star-11 {
  top: 65%;
  left: 30%;
  animation-delay: -1s;
  font-size: 8px;
}

.star-12 {
  top: 85%;
  left: 70%;
  animation-delay: -8s;
  font-size: 12px;
}

/* Container Styles */
.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Add container fix for mobile */
@media screen and (max-width: 768px) {
  .container {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding: 20px;
    box-sizing: border-box;
    margin: 0;
  }
  
  .section {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
    padding: 0;
  }
}

/* Summary Cards */
.summary-cards {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Make all summary cards equal width (side by side) */
.summary-cards .summary-card {
    width: calc(50% - 10px);
    flex: 0 0 calc(50% - 10px);
}

.summary-card {
    width: calc(50% - 10px);
    padding: 10px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    border-radius: 8px;
    background-color: var(--card-background);
    box-sizing: border-box;
}

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    background-color: var(--hover-bg);
}

.card-icon {
    background-color: rgba(77, 77, 220, 0.1);
    color: var(--primary-color);
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    font-size: 20px;
}

.card-icon i {
    font-size: 20px;
}

.card-content {
    flex: 1;
}

.summary-card .summary-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.summary-card .summary-value {
    display: block;
    font-size: 16px !important;
    font-weight: 700;
    color: var(--text-primary);
}

.monthly-payment-card .summary-value {
    display: block;
    font-size: 16px !important;
    font-weight: 700;
    color: white !important;
}

/* Additional summary cards (beyond the first two) take full width */
.summary-cards .summary-card:nth-child(n+3) {
    width: 100%;
}

.summary-details {
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 15px;
}

h1, h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
}

h1 {
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 10px;
}

.tagline {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group-dual {
    margin-bottom: 20px;
}

.form-group-dual label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.dual-inputs {
    display: flex;
    gap: 10px;
}

.input-with-label {
    position: relative;
    flex: 1;
}

.input-with-label input {
    width: 100%;
    padding: 12px 40px 12px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
}

.input-with-label input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.input-label {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-weight: 600;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.section {
    margin-bottom: 30px;
}

.section.payment-breakdown {
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 20px;
}

.view-toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.view-toggle-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.view-toggle-btn:hover {
    background-color: var(--primary-dark);
}

.view-toggle-btn:active {
    transform: scale(0.98);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.summary-item.refinancing-dependent {
    display: none;
}

.summary-item.refinancing-dependent .card-content {
    display: flex;
    flex-direction: column;
}

.summary-item:hover {
    background-color: var(--hover-bg);
}

.summary-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.95rem;
    flex: 1;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 400px;
    margin: 0;
    padding: 0;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
}

.chart-container:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.pie-chart-container {
    height: 350px;
}

.loan-chart {
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    max-height: none;
}

.loan-chart canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    max-height: none;
}



.collapsible-container {
    margin-top: 15px;
}

.collapsible {
    background-color: #4D4DDC;
    color: white;
    cursor: pointer;
    padding: 14px 16px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 16px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* Button text wrapper to keep main text and suffix together */
.button-text {
    display: flex;
    align-items: center;
}

.active, .collapsible:hover {
    background-color: #3636A5;
}

/* Arrow icon in collapsible headers */
.arrow-icon {
    transition: transform 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
    display: inline-block;
}

/* Style for the (drop-down) text */
.dropdown-suffix {
    font-size: 12px;
    opacity: 0.8;
    font-weight: normal;
    margin-left: 4px;
    display: inline-block !important;
    transform: none !important;
    white-space: nowrap;
    transition: none !important;
}

/* Ensure dropdown suffix is always visible, even when button is active */
.collapsible.active .dropdown-suffix {
    display: inline-block !important;
    opacity: 0.8 !important;
}

/* Rotate arrow when active */
.collapsible.active .arrow-icon {
    transform: rotate(180deg);
}

/* Updated content class for better handling of expandable sections */
.content {
    padding: 0 18px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
    background-color: #f7fafc;
    border-radius: 0 0 12px 12px;
    opacity: 0;
    transform: translateY(-10px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0);
}

/* Main Optional Features container */
.section > .collapsible-container > .content {
    transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* When Optional Features is active, give it plenty of room */
.section > .collapsible-container > .collapsible.active + .content {
    max-height: 5000px;  /* Large enough to fit all possible content */
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.05);
}

/* Nested sections within Optional Features */
.nested-section {
    margin: 20px 0;
    padding: 0;
    border: none;
}

.nested-section h3 {
    font-size: 16px;
    margin: 0; /* Remove vertical margin around title completely */
    color: #4D4DDC;
}

.nested-section:first-child {
    margin-top: 10px;
}

.nested-section:last-child {
    margin-bottom: 10px;
}

.nested-section .collapsible-container {
    margin: 0;
    width: 100%; /* Ensure consistent width for all nested sections */
}

.nested-section .collapsible {
    background-color: #4D4DDC;
    color: white;
    border: none;
    width: 100%; /* Ensure consistent button width */
}

.nested-section .collapsible:hover {
    background-color: #3636A5;
}

/* Nested sections content */
.nested-section .content {
    transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
    background-color: white;
    border: 1px solid #e2e8f0;
    border-top: none;
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
    width: 100%; /* Ensure consistent content width */
    box-sizing: border-box; /* Include padding and border in width calculation */
}

/* When a nested section is active */
.nested-section .collapsible.active + .content {
    max-height: 2000px;  /* Enough room for each nested section */
    opacity: 1;
    transform: translateY(0);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.03);
    width: 100%; /* Maintain full width when active */
}

.nested-section .content > div {
    margin-bottom: 15px;
}

/* Special case for prepayments section */
#prepaymentInputs {
    max-height: none;
}

/* Remove any overflow restrictions on nested content */
.nested-section .content > div {
    max-height: none;
    overflow: visible;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    .content, 
    .collapsible, 
    .collapsible span,
    .section > .collapsible-container > .content,
    .nested-section .content {
        transition: max-height 0.1s ease-out, opacity 0.1s ease-out !important;
        transform: none !important;
    }
}

/* Override any conflicting max-height settings */
.active + .content {
    max-height: 5000px !important;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1), 
                opacity 0.25s cubic-bezier(0.4, 0.0, 0.2, 1),
                transform 0.25s cubic-bezier(0.4, 0.0, 0.2, 1),
                box-shadow 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.05);
}

/* Add consistent animation for all dropdowns */
.collapsible + .content {
    overflow-y: auto; /* Add scrollbar only if content exceeds max-height */
    transition: max-height 0.25s cubic-bezier(0.4, 0.0, 0.2, 1), 
                opacity 0.25s cubic-bezier(0.4, 0.0, 0.2, 1),
                transform 0.25s cubic-bezier(0.4, 0.0, 0.2, 1),
                box-shadow 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--card-background);
    font-weight: 600;
    color: var(--text-primary);
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

.prepayment-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.prepayment-year {
    min-width: 80px;
    font-weight: 600;
}

.dollar-sign {
    margin: 0 5px;
    font-weight: 600;
    color: var(--text-secondary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
}

.clear-button {
    background-color: var(--cyan-color);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
    position: relative;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transform: translateY(0);
}

.clear-button.has-selections {
    background-color: var(--cyan-dark);
    color: white;
}

.clear-button.has-selections:hover {
    background-color: var(--cyan-darker);
    color: white;
}

.clear-button:hover {
    background-color: var(--cyan-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

.download-button {
    background-color: var(--success-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin-top: 20px;
    transition: background-color 0.3s ease;
}

.download-button:hover {
    background-color: #229954;
}

/* Enhanced Payment Schedule Table Styling */
#scheduleTable tbody tr:hover {
    background-color: var(--hover-bg);
    transition: background-color 0.2s ease;
}

/* Special styling for payment schedule table rows */
.refinancing-year {
    background-color: rgba(75, 192, 192, 0.1) !important;
    border-left: 4px solid #4bc0c0;
}

.refinancing-year:hover {
    background-color: rgba(75, 192, 192, 0.2) !important;
}

.lump-sum-year {
    background-color: rgba(255, 159, 64, 0.1) !important;
    border-left: 4px solid #ff9f40;
}

.lump-sum-year:hover {
    background-color: rgba(255, 159, 64, 0.2) !important;
}

.lump-sum-year.refinancing-year {
    background: linear-gradient(90deg, rgba(75, 192, 192, 0.1) 50%, rgba(255, 159, 64, 0.1) 50%) !important;
    border-left: 4px solid #4bc0c0;
    border-right: 4px solid #ff9f40;
}

.lump-sum-year.refinancing-year:hover {
    background: linear-gradient(90deg, rgba(75, 192, 192, 0.2) 50%, rgba(255, 159, 64, 0.2) 50%) !important;
}



#scheduleTable th:first-child {
    border-radius: 8px 0 0 0;
}

#scheduleTable th:last-child {
    border-radius: 0 8px 0 0;
}

.table-responsive {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    width: 100%;
}

/* Scrollbar styling for payment schedule */
.table-responsive::-webkit-scrollbar {
    width: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--medium-gray);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.note-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.preset-scenarios {
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.preset-scenarios h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.preset-scenarios p {
    margin-bottom: 20px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Add shadow effect for Quick Scenarios dropdown */
.collapsible.active + .content .preset-scenarios {
    box-shadow: 0 4px 20px rgba(77, 77, 220, 0.08);
    border-radius: 12px;
    padding: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(77, 77, 220, 0.1);
    margin-top: 15px;
}

.scenario-container {
    display: flex;
    justify-content: space-between;
    margin: 0 -8px;
    padding: 0;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.25s cubic-bezier(0.4, 0.0, 0.2, 1),
                transform 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.collapsible:not(.active) + .content .scenario-container {
    opacity: 0;
    transform: translateY(-5px);
}

.scenario-column {
    flex: 1;
    min-width: 120px;
    margin: 0 8px;
    padding: 5px;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.scenario-column h4 {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e0e0e0;
    color: #1a3d66;
    font-size: 15px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scenario-column h4 i {
    margin-right: 5px;
}

.scenario-btn {
    background-color: #eeeeff;
    color: #4D4DDC;
    border: 1px solid #d8d8ff;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
    margin-bottom: 6px;
    width: 100%;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.scenario-btn:hover {
    background-color: #d8d8ff;
    transform: translateY(-2px);
}

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

.scenario-btn.active {
    background-color: #4D4DDC;
    color: white;
    border-color: #4D4DDC;
    position: relative;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Chart Carousel Styles */
.chart-carousel-section {
    padding: 0;
    background-color: white;
}

.chart-carousel-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 30px auto;
    overflow: hidden;
    background-color: white;
    border-radius: 0;
}

.chart-carousel {
    display: flex;
    width: 300%;
    transform: translateX(0);
    transition: transform 0.25s ease;
    overflow: visible;
}

.chart-slide {
    flex: 1;
    width: 33.3333%;
    padding: 20px 10px;
    background-color: white;
    border-radius: 0;
    box-shadow: none;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chart-slide .section-header {
    width: 90%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px auto;
}

.chart-slide .section-header h2 {
    margin: 0;
    padding: 0;
}

.chart-slide .view-toggle-container {
    margin: 0;
    padding: 0;
    position: static;
}

.chart-slide .chart-container {
    width: 100%;
    margin: 0;
    position: relative;
    overflow: hidden;
}

.chart-carousel .chart-container {
    height: 400px;
    width: 100%;
    margin: 0;
    background-color: transparent;
    border-radius: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: none;
    padding: 0;
}

.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-color: rgba(26, 61, 102, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.carousel-arrow:hover {
    background-color: rgba(26, 61, 102, 1);
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

.chart-indicators {
    display: flex;
    justify-content: center;
    margin-top: -5px;
    position: relative;
    z-index: 10;
    width: 100%;
    padding: 0;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    background-color: #ccc;
    margin: 0 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    min-width: 12px;
    min-height: 12px;
    max-width: 12px;
    max-height: 12px;
    flex-shrink: 0;
    flex-grow: 0;
    aspect-ratio: 1;
    box-sizing: border-box;
}

.indicator.active {
    background-color: #1a3d66;
}

.carousel-navigation-bottom {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    width: 100%;
    padding: 0;
    box-sizing: border-box;
}

.carousel-navigation-bottom .carousel-arrow {
    position: static;
    transform: none;
}



/* Summary card specific styling */
#loanAmountCard {
    transition: all 0.3s ease;
}

#loanAmountCard .summary-label {
    font-size: 0.9rem;
}

#loanAmountCard .summary-value {
    font-size: 16px;
    font-weight: 700;
}

#loanAmountCard .card-content, .monthly-payment-card .card-content {
    display: flex;
    flex-direction: column;
}

#loanAmountCard .card-icon {
    background-color: rgba(77, 77, 220, 0.1);
    color: var(--primary-color);
}

.monthly-payment-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
}

.monthly-payment-card .summary-value,
.monthly-payment-card .summary-label {
    color: white;
}

.monthly-payment-card .summary-label {
    color: rgba(255, 255, 255, 0.9);
}

.monthly-payment-card .card-icon {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}



/* Section title container with help icons */
.section-title-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

/* Style the help icon */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    font-size: 14px;
    font-weight: bold;
    margin-left: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.help-icon:hover {
    background-color: var(--primary-dark);
    transform: scale(1.1);
}

.help-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100001;
    justify-content: center;
    align-items: center;
}

.help-content {
    background-color: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.help-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.help-close:hover {
    background-color: var(--card-background);
    color: var(--text-primary);
}

.help-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.4rem;
    font-weight: 600;
}

.help-item {
    margin-bottom: 20px;
}

.help-item h4 {
    margin-bottom: 8px;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.help-item p {
    margin-bottom: 8px;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Mobile-specific help overlay styles */
@media screen and (max-width: 768px) {
    .help-overlay {
        z-index: 100001 !important;
        padding: 10px;
    }
    
    .help-content {
        width: 95%;
        max-width: none;
        max-height: 85vh;
        padding: 20px;
        margin: 0 auto;
    }
    
    .help-content h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .help-item {
        margin-bottom: 15px;
    }
    
    .help-item h4 {
        font-size: 1rem;
        margin-bottom: 6px;
    }
    
    .help-item p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    body {
        padding: 15px;
    }

    .header {
        margin: -25px -25px 20px -25px;
    }

    .header h1 {
        font-size: 2.2rem;
    }

    .header .tagline {
        font-size: 1.1rem;
    }

    .container {
        margin: 0 auto;
    }

    .summary-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .summary-cards .summary-card {
        padding: 12px;
    }

    .summary-card {
        margin-bottom: 0;
    }

    .card-icon {
        width: 40px;
        height: 40px;
    }

    .card-icon i {
        font-size: 18px;
    }

    .summary-card .summary-value {
        font-size: 16px;
    }

    .summary-card .summary-label {
        font-size: 12px;
    }

    .chart-container {
        height: 300px;
    }

    .chart-carousel .chart-container {
        /* Increased height to provide a taller chart on mobile */
        height: 450px;
        width: 100%;
        margin: 0 auto;
        padding-left: 0;
        padding-right: 0;
        -webkit-overflow-scrolling: touch;
    }

    .carousel-arrow {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    /* Scenario container for mobile - arranged in a 2x2 grid */
    .scenario-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin: 0;
        width: 100%;
        padding: 0;
    }

    /* Make scenario columns fit the grid layout */
    .scenario-column {
        width: 100%;
        min-width: unset;
        margin: 0;
        box-sizing: border-box;
    }

    /* Show scenario column titles on mobile but make them smaller */
    .scenario-column h4 {
        display: block !important;
        font-size: 12px;
        margin: 5px 0;
        padding: 5px 0;
        height: auto;
        text-align: center;
        white-space: normal;
        line-height: 1.2;
    }

    /* Adjust scenario buttons for mobile */
    .scenario-btn {
        padding: 8px 5px;
        font-size: 11px;
        margin-bottom: 6px;
        height: auto;
        white-space: normal;
        text-align: center;
        display: flex;
        justify-content: center;
        align-items: center;
    }
}

@media screen and (max-width: 480px) {
    .summary-card {
        padding: 10px;
    }

    .card-icon {
        width: 36px;
        height: 36px;
    }

    .card-icon i {
        font-size: 16px;
    }

    .summary-card .summary-value {
        font-size: 14px;
    }

    .chart-container {
        height: 250px;
    }

    .chart-carousel .chart-container {
        /* Increased height for very small screens as well */
        height: 450px;
        width: 100%;
        margin: 0 auto;
        padding-left: 0;
        padding-right: 0;
    }

    .carousel-arrow {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}



.table-responsive {
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

#scheduleTable {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    width: 100%;
    table-layout: fixed;
}

#scheduleTable th, #scheduleTable td {
    white-space: nowrap;
    padding: 6px 3px;
    text-align: right;
    font-size: 12px;
}

#scheduleTable th:first-child, #scheduleTable td:first-child {
    text-align: left;
    width: 12%;
    max-width: 80px;
    font-size: 11px;
}

#scheduleTable th:nth-child(2), #scheduleTable td:nth-child(2),
#scheduleTable th:nth-child(3), #scheduleTable td:nth-child(3),
#scheduleTable th:nth-child(4), #scheduleTable td:nth-child(4),
#scheduleTable th:nth-child(5), #scheduleTable td:nth-child(5),
#scheduleTable th:nth-child(6), #scheduleTable td:nth-child(6) {
    width: 18%;
    max-width: 140px;
    font-size: 11px;
}

/* Hide payment schedule completely on mobile and tablet */
@media (max-width: 1024px) {
  #outputs-section {
    display: none !important;
  }
}

/* Desktop-only optimization for better table fit */
@media (min-width: 1025px) {
  .table-responsive {
    overflow-x: hidden;
  }
  
  #scheduleTable {
    table-layout: fixed;
    width: 100%;
  }
}

/* Custom Dropdown Styling */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-selected {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    box-sizing: border-box;
    min-height: 50px;
}

.dropdown-selected:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(77, 77, 220, 0.15);
}

.dropdown-selected.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
}

.selected-text {
    font-weight: 600;
    flex: 1;
    margin-left: 8px;
}

.dropdown-icon {
    color: var(--primary-color);
    font-size: 18px;
    margin-right: 12px;
    transition: all 0.3s ease;
}

.dropdown-selected.active .dropdown-icon {
    color: white;
}

.arrow-icon {
    color: var(--text-secondary);
    font-size: 14px;
    transition: transform 0.3s ease, color 0.3s ease;
}

.dropdown-selected.active .arrow-icon {
    transform: rotate(180deg);
    color: white;
}

.dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--primary-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 25px rgba(77, 77, 220, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    max-height: 0;
    overflow: hidden;
}

.dropdown-options.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: 300px;
}

.dropdown-option {
    padding: 16px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-option:last-child {
    border-bottom: none;
}

.dropdown-option:hover {
    background: linear-gradient(135deg, var(--hover-bg) 0%, #f1f5f9 100%);
    transform: translateX(4px);
}

.dropdown-option.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
}

.option-icon {
    color: var(--primary-color);
    font-size: 16px;
    margin-right: 12px;
    min-width: 20px;
    transition: all 0.2s ease;
}

.dropdown-option.active .option-icon {
    color: white;
}

.dropdown-option:hover .option-icon {
    transform: scale(1.1);
}

.option-text {
    font-weight: 600;
    flex: 1;
    margin-right: 8px;
}

.option-detail {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--light-gray);
    padding: 4px 8px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.dropdown-option.active .option-detail {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.dropdown-option:hover .option-detail {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* Mobile optimizations */
@media screen and (max-width: 768px) {
    .custom-dropdown {
        position: relative;
        z-index: 99999;
    }
    
    .dropdown-selected {
        padding: 14px 16px;
        min-height: 52px;
        position: relative;
        z-index: 99999;
    }
    
    .dropdown-options {
        z-index: 100000 !important;
        position: absolute !important;
        box-shadow: 0 8px 32px rgba(77, 77, 220, 0.3) !important;
    }
    
    .dropdown-option {
        padding: 18px 16px;
    }
    
    .option-detail {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    /* Ensure parent sections don't clip the dropdown */
    .section {
        overflow: visible !important;
    }
    
    .form-group {
        overflow: visible !important;
        position: relative;
        z-index: 99999;
    }
}

/* Floating Home Button */
.floating-home-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.floating-home-btn.visible {
    opacity: 1;
    visibility: visible;
}

.floating-home-btn a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-radius: 50%;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(77, 77, 220, 0.3);
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.floating-home-btn a:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(77, 77, 220, 0.4);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
}

.floating-home-btn a:active {
    transform: translateY(0);
}

/* Site Footer Styles */
.site-footer {
    background-color: #f5f7fa;
    border-top: 1px solid #e2e8f0;
    padding: 15px 20px;
    margin-top: 30px;
    color: #718096;
    font-size: 0.85rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

.footer-left, .footer-right {
    display: flex;
    flex-direction: column;
}

.footer-left p {
    margin: 0 0 5px 0;
}

.footer-credit, .footer-powered {
    font-weight: 500;
}

.footer-contact {
    font-weight: 500;
}

.footer-contact i {
    margin-right: 4px;
    color: #4D4DDC;
}

.footer-contact a {
    color: #4D4DDC;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-contact a:hover {
    color: #3636A5;
    text-decoration: underline;
}

.version {
    text-align: right;
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.8;
}

@media screen and (max-width: 768px) {
    .site-footer {
        padding: 12px 15px;
        font-size: 0.75rem;
    }
    
    .footer-left p {
        margin: 0 0 3px 0;
    }
    
    .version {
        font-size: 0.7rem;
    }
}

/* Loan Selection Buttons */
.loan-selection-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
}

.loan-selection-buttons {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.loan-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    color: var(--primary-color);
    border: 1px solid rgba(14, 165, 233, 0.3);
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 60px;
    position: relative;
}

.loan-btn:hover {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
    border-color: rgba(14, 165, 233, 0.5);
}

.loan-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.4);
}

.loan-btn.active:hover {
    background: var(--primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.5);
}

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

/* Mobile responsiveness for loan buttons */
@media screen and (max-width: 600px) {
    .loan-selection-container {
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .loan-selection-buttons {
        gap: 6px;
        padding: 6px;
        border-radius: 10px;
    }
    
    .loan-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 50px;
    }
    
    /* Adjust floating home button to avoid overlap */
    .floating-home-btn {
        bottom: 80px;
        right: 15px;
    }
}

@media screen and (max-width: 480px) {
    .loan-selection-container {
        bottom: 12px;
    }
    
    .loan-selection-buttons {
        gap: 4px;
        padding: 4px;
    }
    
    .loan-btn {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 45px;
    }
    
    /* Adjust floating home button to avoid overlap */
    .floating-home-btn {
        bottom: 75px;
        right: 12px;
    }
}

 