:root {
    --primary: #4e73df;
    --secondary: #1cc88a;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --light: #f8f9fc;
    --dark: #5a5c69;
    --white: #ffffff;
    --gray-100: #f8f9fc;
    --gray-200: #eaecf4;
    --gray-300: #dddfeb;
    --gray-400: #d1d3e2;
    --gray-500: #b7b9cc;
    --gray-600: #858796;
    --gray-700: #6e707e;
    --gray-800: #5a5c69;
    --gray-900: #3a3b45;
    --font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.loan-calculator-container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0px 5px 6px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.calculator-header {
    background: var(--primary);
    color: white;
    padding: 10px;
    text-align: center;
}

.calculator-content {
    display: flex;
    flex-wrap: wrap;
}

.input-panel {
    flex: 1;
    min-width: 300px;
    padding: 25px;
    /* background: var(--gray-100);*/
    border-right: 1px solid var(--gray-300);
    background: #e1e1e1;

}

.results-panel {
    flex: 1;
    min-width: 300px;
    padding: 20px 25px 25px 25px;
    display: flex;
    flex-direction: column;
    color: #222;
}

.form-group {
    margin-bottom: 40px;
    position: relative;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #505050;
    font-size: medium;
}

select, .radio-group {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 14px;
}

.radio-group {
    display: flex;
    background: white;
    padding: 8px;
}

.radio-option {
    flex: 1;
    text-align: center;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
}

.radio-option.active {
    background: var(--primary);
    color: white;
}

.slider-container {
    position: relative;
    margin-top: 5px;
}

.slider-value {
    position: absolute;
    right: 0;
    top: -25px;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    height: 8px;
    border-radius: 5px;
    /* background: var(--gray-300); */
    background: #ffffff;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

.credit-rating {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: 10px;
}

.rating-poor {
    background-color: #f8d7da;
    color: #721c24;
}

.rating-average {
    background-color: #fff3cd;
    color: #856404;
}

.rating-good {
    background-color: #d4edda;
    color: #155724;
}

.rating-very-good {
    background-color: #cce5ff;
    color: #004085;
}

.rating-excellent {
    background-color: #d1ecf1;
    color: #0c5460;
}

.tooltip-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background-color: var(--secondary);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 18px;
    font-size: 12px;
    margin-left: 5px;
    cursor: help;
    position: relative;
}

.tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: var(--dark);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0s;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.4;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--dark) transparent transparent transparent;
}

.tooltip-icon:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    padding-bottom: 5px;
    /* border-bottom: 1px solid var(--gray-200); */
    border-bottom: 1px dotted #878787
}

.monthly-payment {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    margin: 5px 0;
    padding: 5px;
    background: var(--gray-100);
    border-radius: 8px;
}

.chart-container {
    height: 250px;
    margin-top: 10px;
}

.apply-button {
    display: block;
    width: 100%;
    padding: 15px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.3s;
}

.tooltip-text.visible {
    visibility: visible;
    opacity: 1;
}

.apply-button:hover {
    background: #17a673;
}

@media (max-width: 768px) {
    .calculator-content {
        flex-direction: column;
    }

    .input-panel {
        border-right: none;
        border-bottom: 1px solid var(--gray-300);
    }

    .tooltip-text {
        width: 160px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .calculator-content {
        flex-direction: column;
    }

    .input-panel {
        border-right: none;
        border-bottom: 1px solid var(--gray-300);
    }

    .tooltip-text {
        width: 150px;
        font-size: 11px;
    }
}