.leasing-rechner {
    max-width: 900px;
    padding: 30px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.1);
    font-family: 'Arial', sans-serif;
    transition: all 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: start;
}

.form-grid > div {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: bold;
    color: #222;
    font-size: 16px;
    text-transform: none;
    margin-bottom: 8px;
    display: block;
}

input, select {
    width: 100%;
    padding: 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    background: #fff;
    transition: all 0.3s ease-in-out;
    margin-bottom: 15px;
    appearance: none;
    position: relative;
}

select {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px;
}

input:focus, select:focus {
    border-color: #ff4605;
    box-shadow: 0px 0px 8px rgba(255, 70, 5, 0.3);
}

#ergebnis {
    margin-top: 25px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    font-size: 18px;
    text-align: center;
    border: 1px solid #ddd;
    box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.05);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

#ergebnis p {
    margin: 0;
}

#monatlicheRateContainer {
    grid-column: 1 / 2;
}

#restwertContainer {
    grid-column: 2 / 3;
}

#ergebnis:has(#restwertContainer[style*="display: none"]) #monatlicheRateContainer {
    grid-column: 1 / 3; /* Span all columns when Restwert is hidden */
}

#error-message {
    font-size: 14px;
    color: #ff0000;
    font-weight: bold;
    text-align: center;
    padding: 10px;
    border: 1px solid #ff0000;
    border-radius: 8px;
    background: #ffe6e6;
}

span#monatlicheRate {
    font-weight: 900;
    color: #ff4605;
}

span#restwert {
    font-weight: 900;
    color: #ff4605;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    #ergebnis {
        grid-template-columns: 1fr;
    }
    
    #monatlicheRateContainer, #restwertContainer {
        grid-column: auto;
    }
}