#loanCalculatorWrapper {
    max-width: 600px;
    margin: 20px auto;
    font-family: 'FiraGO Georgian', sans-serif;
    padding: 0 10px; /* Added for mobile spacing */
}

#loanCalculator label {
    display: block;
    margin-top: 15px;
    font-weight: bold;
    font-size: 16px; /* Slightly larger for readability */
    color: #440018;
}

#loanCalculator input[type="number"] {
    width: 100%;
    padding: 10px 15px; /* Increased padding for touch targets */
    margin-top: 5px;
    box-sizing: border-box;
    font-size: 16px; /* Matches style guide, prevents zoom */
    background-color: #F8F0F5;
    border: 1px solid #440018;
    color: #440018;
    border-radius: 20px; /* Matches form fields (previously 4px) */
    transition: border-color 0.3s ease;
}

#loanCalculator input[type="number"]:focus {
    outline: none;
    border-color: #440018;
    box-shadow: 0 0 5px rgba(68, 0, 24, 0.3); /* Subtle focus effect */
}

#loanCalculator button {
    background-color: #F8F0F5;
    color: #440018;
    border: 1px solid #440018;
    padding: 10px 20px; /* Slightly larger for touch */
    margin-top: 15px;
    margin-right: 10px;
    font-size: 16px;
    border-radius: 20px; /* Matches style guide */
    cursor: pointer;
    font-family: 'FiraGO Georgian', sans-serif;
    text-transform: uppercase; /* Matches previous buttons */
    transition: background-color 0.3s ease, color 0.3s ease;
}

#loanCalculator button:hover {
    background-color: #440018;
    color: #F8F0F5;
}

#loanCalculator select {
    width: 100%;
    padding: 10px 30px 10px 15px; /* Extra right padding for arrow */
    margin-top: 5px;
    box-sizing: border-box;
    font-size: 16px;
    background-color: #F8F0F5;
    border: 1px solid #440018;
    color: #440018;
    border-radius: 20px; /* Matches style guide */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='5' viewBox='0 0 10 5'><path fill='%23440018' d='M0 0h10L5 5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 10px 5px;
    cursor: pointer;
    font-family: 'FiraGO Georgian', sans-serif;
    transition: border-color 0.3s ease;
}

#loanCalculator select:focus {
    outline: none;
    border-color: #440018;
    box-shadow: 0 0 5px rgba(68, 0, 24, 0.3);
}

#loanCalculator select option {
    background-color: #F8F0F5; /* Lighter background for options */
    color: #440018; /* Avoid reverse for better mobile readability */
}

#lc_result {
    margin-top: 20px;
    font-size: 16px;
    color: #440018;
    font-family: 'FiraGO Georgian', sans-serif;
}

/* --- Popup Overlay (shared for all popups) --- */
#lc_schedule_popup,
#lc_apply_popup {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999 !important;
    overflow-y: auto;
    transition: opacity 0.3s ease;
    opacity: 0;
}

#lc_schedule_popup.active,
#lc_apply_popup.active {
    display: block;
    opacity: 1;
}

/* --- Popup Inner Container (shared for all popups) --- */
#lc_schedule_popup_inner,
#lc_apply_popup_inner {
    background: #F8F0F5;
    width: 90%;
    max-width: 400px;
    margin: 40px auto;
    padding: 24px 18px 18px 18px;
    position: relative;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(68, 0, 24, 0.18);
    font-family: 'FiraGO Georgian', sans-serif;
    color: #440018;
    transform: translateY(24px);
    transition: transform 0.3s ease;
}

#lc_schedule_popup.active #lc_schedule_popup_inner,
#lc_apply_popup.active #lc_apply_popup_inner {
    transform: translateY(0);
}

/* --- Close Button (shared for all popups) --- */
#lc_close_schedule,
#lc_close_apply {
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    position: absolute;
    top: 12px;
    right: 16px;
    color: #440018;
    transition: color 0.3s ease;
    z-index: 2;
    line-height: 1;
}

#lc_close_schedule:hover,
#lc_close_apply:hover {
    color: #660024;
}

/* --- Application Success Message --- */
#lc_apply_success {
    display: none;
    text-align: center;
    margin-top: 30px;
}
#lc_apply_success .success-icon {
    font-size: 48px;
    color: green;
    margin-bottom: 10px;
}

/* --- Application Form Fields --- */
#lc_apply_form label {
    display: block;
    margin-top: 10px;
    font-weight: bold;
    color: #440018;
}
#lc_apply_form input[type="text"],
#lc_apply_form input[type="tel"] {
    width: 100%;
    padding: 10px 12px;
    margin-top: 5px;
    margin-bottom: 10px;
    border-radius: 20px;
    border: 1px solid #440018;
    background: #fff;
    font-size: 15px;
    box-sizing: border-box;
}
#lc_apply_form button[type="submit"] {
    width: 100%;
    background: #F8F0F5;
    color: #440018;
    border: 1px solid #440018;
    border-radius: 20px;
    padding: 10px 0;
    margin-top: 10px;
    font-size: 16px;
    cursor: pointer;
    text-transform: uppercase;
    transition: background 0.3s, color 0.3s;
}
#lc_apply_form button[type="submit"]:hover {
    background: #440018;
    color: #F8F0F5;
}

/* --- Loan Schedule Table: Make it more readable and less squeezed on desktop --- */
#lc_schedule_table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto;
    font-size: 16px;
    background: #fff;
    min-width: 500px; /* Ensures table isn't squeezed on desktop */
}

#lc_schedule_table th,
#lc_schedule_table td {
    padding: 10px 14px;
    border: 1px solid #e0c9d6;
    text-align: center;
    white-space: nowrap;
}

#lc_schedule_table th {
    background: #f3e6ef;
    color: #440018;
    font-weight: bold;
    font-size: 16px;
}

#lc_schedule_table tr:nth-child(even) {
    background: #f8f0f5;
}

#lc_schedule_popup_inner > div[style*="overflow-x:auto"] {
    overflow-x: auto;
    margin: 0 -10px;
    padding: 0 10px;
}

/* On desktop, allow table to expand and center it in popup */
@media (min-width: 768px) {
    #lc_schedule_popup_inner {
        max-width: 650px;
    }
    #lc_schedule_table {
        min-width: 600px;
        font-size: 17px;
    }
}

/* On mobile, allow horizontal scroll if needed */
@media (max-width: 767px) {
    #lc_schedule_table {
        min-width: 480px;
        font-size: 14px;
    }
    #lc_schedule_popup_inner {
        padding: 8px 2px 8px 2px;
    }
}

/* Responsive for Popups */
@media only screen and (max-width: 767px) {
    #lc_schedule_popup_inner,
    #lc_apply_popup_inner {
        width: 98%;
        margin: 10px auto;
        padding: 12px 6px 10px 6px;
        max-height: 85vh;
        overflow-y: auto;
    }
    #lc_close_schedule,
    #lc_close_apply {
        font-size: 22px;
        top: 8px;
        right: 10px;
    }
    #lc_apply_form input[type="text"],
    #lc_apply_form input[type="tel"] {
        font-size: 14px;
        padding: 8px 8px;
    }
    #lc_apply_form button[type="submit"] {
        font-size: 14px;
        padding: 8px 0;
    }
    #lc_apply_success .success-icon {
        font-size: 36px;
    }
}

/* Safari-specific Fixes */
@supports (-webkit-overflow-scrolling: touch) {
    #loanCalculator select {
        -webkit-border-radius: 20px;
        border-radius: 20px;
        padding-right: 30px; /* Ensure arrow space */
    }

    #loanCalculator input[type="number"] {
        -webkit-border-radius: 20px;
        border-radius: 20px;
    }

    #lc_schedule_popup {
        -webkit-overflow-scrolling: touch; /* Smooth scrolling */
    }
}