.advanced-loan-calculator {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 25px;
    background-color: #2E3A59;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    color: #fff;
    line-height: 1.6;
    transition: background-color 0.3s ease;
}

/* Dark Mode */
.advanced-loan-calculator.dark-mode {
    background-color: #fff;
    color: #333;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.theme-toggle-container {
    margin-bottom: 20px;
    text-align: center;
}

.theme-toggle-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: #333;
}

.theme-toggle-label:hover {
    opacity: 0.8;
}

.sun-icon, .moon-icon {
    font-size: 16px;
    opacity: 0.7;
}

.advanced-loan-calculator .sun-icon,
.advanced-loan-calculator .calc-form-column label,
.advanced-loan-calculator .calc-results-column h3,
.advanced-loan-calculator .moon-icon {
    color: white;
}

.advanced-loan-calculator.dark-mode .sun-icon,
.advanced-loan-calculator.dark-mode .moon-icon,
.advanced-loan-calculator.dark-mode .calc-form-column label,
.advanced-loan-calculator.dark-mode .calc-results-column h3 {
    color: #333;
}

.theme-toggle-input {
    position: relative;
    width: 50px;
    height: 26px;
    background-color: #ccc;
    border-radius: 13px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 10px;
}

.theme-toggle-input:checked {
    background-color: #3498db;
}

.theme-toggle-input:checked + .sun-icon {
    opacity: 0.3;
}

.theme-toggle-input:checked + .moon-icon {
    opacity: 1;
}

.theme-toggle-input::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.theme-toggle-input:checked::before {
    transform: translateX(24px);
}

.calculator-container {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

@media (min-width: 1024px) {
    .calculator-container {
        flex-direction: row;
    }
    .calc-form-column {
        width: 40%;
    }
    .calc-results-column {
        padding-left: 30px;
        border-left: 1px solid #eee;
        width: 60%;
    }
}

@media (max-width: 1023px) {
    .calculator-container {
        flex-direction: column;
    }
    .calc-form-column,
    .calc-results-column {
        width: 100%;
        margin-bottom: 20px;
    }
    .calc-results-column {
        padding-left: 0;
        border-left: none;
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 15px;
}

.form-control,
.advanced-loan-calculator input[type="number"],
.advanced-loan-calculator select {
    width: 100%;
    font-size: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
    color: #fff;
}

.advanced-loan-calculator.dark-mode input[type="number"],
.advanced-loan-calculator.dark-mode select {
    background: #f8f9fa;
    color: #333;
}

.form-control:focus,
.advanced-loan-calculator input[type="number"]:focus,
.advanced-loan-calculator select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    color: #fff;
}

.btn-toggle, .btn-export {
    background-color: #ecf0f1;
    color: #2c3e50;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.3s;
}

.btn-toggle:hover, .btn-export:hover {
    background-color: #dcdde1;
}

.loan-results h3 {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
    font-size: 15px;
}

.result-row strong {
    font-weight: 600;
    color: #9ed654;
    transition: opacity 0.15s ease-in-out;
}

#pie-chart-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

#pie-chart-container h4{
    color: #fff;
}

#cost-pie-chart{
    width:400px !important;
    height:400px !important;
}

.amortization-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
}

.amortization-table th,
.amortization-table td {
    padding: 10px;
    text-align: right;
    border-bottom: 1px solid #eee;
}

.amortization-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.advanced-loan-calculator{ 
    background-color: #1b8381 !important;
    background: #1b8381 !important;
	color: white !important;
	-webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    box-shadow: 0 25px 50px -12px #00000040;
}

.theme-toggle-container{ 
    display: none;
} 

/* Fixed-height container for the amortization schedule with vertical scrolling */
#amortization-table {
    height: 300px;           
    overflow-y: auto;     
    overflow-x: hidden;     
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 1rem;
    display: block;
    width: max-content;
}

/* Ensure the table inside doesn't shrink below a readable width */
#amortization-table table {
width: 100%;
min-width: 600px; /* Maintains column readability on small screens */
}

/* Optional: Custom scrollbar styling for WebKit browsers (Chrome, Edge, Safari) */
#amortization-table::-webkit-scrollbar {
width: 8px; /* Width of the scrollbar */
}
.amortization-table::-webkit-scrollbar-track {
background: #f8fafc; /* Track background */
border-radius: 4px;
}
#amortization-table::-webkit-scrollbar-thumb {
background: #cbd5e0; /* Scrollbar thumb color */
border-radius: 4px;
}
#amortization-table::-webkit-scrollbar-thumb:hover {
background: #a0aec0; /* Darker thumb on hover */
}


@media (max-width: 600px) {
    .advanced-loan-calculator {
        padding: 15px;
        margin: 15px;
    }
    .result-row span, .result-row strong {
        font-size: 14px;
    }
    .btn-toggle, .btn-export {
        font-size: 14px;
        padding: 12px;
    }
}
