:root {
    --primary-color: #e60026;
    --primary-hover: #b8001d;
    --secondary-color: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success-color: #22c55e;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/*body {
    font-family: 'Inter', sans-serif;
    background-color: #DEDEDE;
    display: block;
    padding: 1rem;
    color: var(--text-primary);
    margin: 0;
}
*/
.calculator {
    background: white;
    width: 100%;
    max-width: 600px;
    transition: all 0.3s ease;
    margin: 0 auto;
    display: block;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
}

.calculator-top {
    padding: 2rem 2rem 0 2rem;
    border-radius: 1rem 1rem 0 0;
}

.calculator-bottom {
    width: 100%;
    border-radius: 0 0 1rem 1rem;
}

.calculator:hover {
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.calculator h2 {
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    text-align: center;
}

.call-message {
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    margin: 0;
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 0.4s ease;
    height: 0;
    overflow: hidden;
    padding: 0.5rem 0;
}

.calculator .call-message {
    color: var(--primary-color) !important;
}

.call-message.show {
    opacity: 1;
    height: auto;
    margin: 0.5rem 0;
    animation: elegant-appear 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes elegant-appear {
    0% {
        opacity: 0;
        transform: scale(0.98);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.input-group {
    margin: 1.5rem 0 0 0;
}

.label-input-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.input-group label {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

.input-group input[type="number"],
.input-group input[type="text"] {
    width: 120px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--secondary-color);
    transition: all 0.2s ease;
}

.input-group input[type="number"]:focus,
.input-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-group input[type="range"] {
    width: 100%;
    height: 8px;
    background: none;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    margin: 1rem 0;
}

.input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 1px solid rgba(133, 133, 133, 0.6);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.input-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: white;
    border: 1px solid rgba(133, 133, 133, 0.6);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.input-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.loan-term-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
    margin-bottom: 0.25rem;
}

.results {
    margin-top: 0;
    background-color: #000000;
    color: white;
    padding: 1.5rem 1.3rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.results-table {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.results-table div {
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 700;
}

.results-table .header {
    font-weight: 800;
    border-bottom: 2px solid #e60026;
    padding-bottom: 0.5rem;
    display: flex;
    align-items: flex-end;
    min-height: 2.5em;
}

.results-table .header:first-child {
    border-bottom: 2px solid #000;
}

.results-table .header:nth-child(2),
.results-table .header:nth-child(3) {
    text-align: right;
    justify-content: flex-end;
}

.results-table .row {
    padding: 0.5rem 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}
.results-table .row.value {
    justify-content: center !important;
    text-align: center !important;
    font-size: 1.15rem;
}
.results-table .row:nth-child(3n-2) {
    justify-content: flex-start;
    text-align: left;
}
.results-table .row:nth-child(3n-1),
.results-table .row:nth-child(3n) {
    justify-content: flex-end;
    text-align: right;
}

#total-savings {
    font-size: 1.7rem;
    font-weight: 900;
    text-align: center;
    margin-top: 1rem;
    padding: 1rem;
    background: #e60026;
    color: #fff;
    border-radius: 0.5rem;
    margin-bottom: 1.2rem;
    letter-spacing: 0.01em;
}

#error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    text-align: center;
}

.cta-button {
    display: block;
    width: 100%;
    background: #fff;
    color: #111;
    font-weight: 900;
    font-size: 1.5rem;
    text-transform: uppercase;
    text-align: center;
    border: none;
    border-radius: 0.5rem;
    padding: 1rem 0;
    margin-top: 0.5rem;
    margin-bottom: 1.2rem;
    letter-spacing: 0.01em;
    box-shadow: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}

.cta-button:hover {
    background: #f8fafc;
    color: #111;
}

.disclaimer {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    line-height: 1.4;
    text-align: center;
    margin-top: 1rem;
    padding: 0 0.5rem;
}

@media (max-width: 768px) {
    .calculator {
        width: 100%;
        max-width: 100%;
        margin: 1rem;
    }

    .calculator-top {
        padding: 1.5rem 1.5rem 0 1.5rem;
    }

    .calculator h2 {
        font-size: 1.5rem;
        margin-bottom: 1.25rem;
    }

    .input-group {
        margin: 1.25rem 0 0 0;
    }

    .input-group input[type="number"],
    .input-group input[type="text"] {
        width: 100px;
        font-size: 0.875rem;
    }

    .results-table {
        gap: 0.25rem;
    }

    .results-table div {
        padding: 0.5rem;
        font-size: 0.9375rem;
    }

    #total-savings {
        font-size: 1.5rem;
        padding: 0.75rem;
    }

    .cta-button {
        padding: 0.75rem 1.25rem;
        font-size: 1.0rem;
    }
}

@media (max-width: 480px) {
    .results {
        padding: 1.25rem 0.9rem !important;
    }
    .calculator {
        margin: 0 auto;
        width: 100%;
    }

    .calculator-top {
        padding: 1.25rem 1.25rem 0 1.25rem;
    }

    .calculator h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .input-group {
        margin: 1rem 0 0 0;
    }

    .label-input-container {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .input-group label {
        font-size: 1rem;
    }

    .input-group input[type="number"],
    .input-group input[type="text"] {
        width: 100px;
        font-size: 1rem;
        text-align: right;
    }

    .input-group input[type="range"] {
        height: 8px;
        margin: 0.75rem 0;
    }

    .input-group input[type="range"]::-webkit-slider-thumb {
        width: 30px;
        height: 30px;
    }

    .input-group input[type="range"]::-moz-range-thumb {
        width: 30px;
        height: 30px;
    }

    .loan-term-display {
        font-size: 0.75rem;
        margin-top: 0.25rem;
    }

    .results {
        margin-top: 0.75rem;
        padding: 1.25rem;
    }

    .results-table {
        grid-template-columns: 1.5fr 0.75fr 0.8fr;
        gap: 0.23rem;
    }

    .results-table div {
        padding: 0.5rem 0.25rem;
        font-size: 0.850rem;
    }

    .results-table .header {
        padding-bottom: 0.25rem;
    }

    .results-table .row {
        padding: 0.25rem;
    }

    #total-savings {
        font-size: 1.5rem;
        padding: 0.75rem;
        margin-top: 0.75rem;
    }

    .cta-button {
        padding: 0.75rem 1rem;
        font-size: 1.2rem;
        margin-top: 0.75rem;
    }

    .disclaimer {
        font-size: 0.7rem;
        margin-top: 0.75rem;
    }

    .call-message {
        padding-top: 1rem;
        font-size: 0.9375rem;
    }
}

@media (max-width: 320px) {
    .calculator {
        margin: 0.25rem;
    }

    .calculator-top {
        padding: 1rem 1rem 0 1rem;
    }

    .calculator h2 {
        font-size: 1.125rem;
    }

    .input-group input[type="number"],
    .input-group input[type="text"] {
        max-width: 100px;
    }

    .results-table {
        grid-template-columns: 1.2fr 0.7fr 0.75fr;
        font-size: 0.8125rem;
    }

    #total-savings {
        font-size: 1rem;
    }

    .input-group input[type="range"]::-webkit-slider-thumb {
        width: 34px;
        height: 34px;
    }

    .input-group input[type="range"]::-moz-range-thumb {
        width: 34px;
        height: 34px;
    }

    .input-group {
        margin: 1rem 0 0 0;
    }

    .call-message {
        font-size: 0.9375rem;
    }
}

/* Fix for iOS devices */
@supports (-webkit-touch-callout: none) {
    .input-group input[type="range"] {
        -webkit-appearance: none;
        background: #EA1E30;
        height: 8px;
        border-radius: 3px;
    }

    .input-group input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 20px;
        height: 20px;
        background: white;
        border: 1px solid #000000;
        border-radius: 50%;
        cursor: pointer;
    }
    @media (max-width: 480px) {
        .input-group input[type="range"]::-webkit-slider-thumb {
            width: 30px;
            height: 30px;
        }
    }
    @media (max-width: 320px) {
        .input-group input[type="range"]::-webkit-slider-thumb {
            width: 34px;
            height: 34px;
        }
    }
}

.results-table .header img {
    display: block;
    margin-left: auto;
    margin-right: auto;
}