/* ---------------------------------------------------------
   Grundeinstellungen
--------------------------------------------------------- */

* {
    box-sizing: border-box;
}

:root {
    --primary: #ff9b39;
    --primary-light: rgba(255, 155, 57, 0.5);
    --primary-very-light: rgba(255, 155, 57, 0.12);

    --text: #2d2d2d;
    --text-light: #666;
    --border: #dcdcdc;
    --background: #ffffff;
    --white: #ffffff;
}

body {
    margin: 0;
    padding: 40px 20px;
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}


/* Elemente mit HTML-Attribut hidden wirklich ausblenden */
[hidden] {
    display: none !important;
}


/* ---------------------------------------------------------
   Rechner
--------------------------------------------------------- */

.rechner {
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
    padding: 40px;
    background: var(--white);
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.rechner-header {
    margin-bottom: 35px;
}

.rechner-header h1 {
    margin: 0 0 10px;
    font-size: 30px;
    line-height: 1.2;
}

.rechner-header p {
    margin: 0;
    color: var(--text-light);
}


/* ---------------------------------------------------------
   Formularzeilen
--------------------------------------------------------- */

.form-row {
    display: grid;
    grid-template-columns: 220px 1fr 36px;
    gap: 15px;
    align-items: center;

    padding: 18px 0;
    border-bottom: 1px solid #eeeeee;
}

.form-row > label {
    font-weight: 600;
}


/* ---------------------------------------------------------
   Eingabefelder
--------------------------------------------------------- */

.input-area input[type="text"],
.input-area input[type="number"],
.input-area select {
    width: 100%;
    min-height: 46px;

    padding: 10px 12px;

    border: 1px solid var(--border);
    border-radius: 7px;

    background: var(--white);
    color: var(--text);

    font-size: 16px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.input-area input:focus,
.input-area select:focus {
    outline: none;
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px var(--primary-very-light);
}


/* ---------------------------------------------------------
   CHF-Eingabefeld
--------------------------------------------------------- */

.betrag-input {
    display: flex;
    align-items: center;

    border: 1px solid var(--border);
    border-radius: 7px;

    overflow: hidden;
}

.betrag-input > span {
    align-self: stretch;

    display: flex;
    align-items: center;

    padding: 0 13px;

    background: #eeeeee;

    color: var(--text-light);
    font-weight: 600;
}

.betrag-input input[type="number"] {
    border: 0;
    border-radius: 0;
}

.betrag-input:focus-within {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px var(--primary-very-light);
}

.betrag-input input:focus {
    box-shadow: none;
}


/* ---------------------------------------------------------
   Versicherungsmodelle
--------------------------------------------------------- */

.modelle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.modell-option {
    display: flex;
    align-items: center;
    gap: 8px;

    min-height: 42px;

    padding: 9px 12px;

    border: 1px solid var(--border);
    border-radius: 7px;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}

.modell-option:not(.disabled):hover {
    border-color: var(--primary);
    background: var(--primary-very-light);
}

.modell-option input {
    accent-color: var(--primary);
}

.modell-option.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #f4f4f4;
}

#modellHinweis {
    grid-column: 1 / -1;
    margin-top: 3px;
    color: var(--text-light);
}


/* ---------------------------------------------------------
   Info-Button
--------------------------------------------------------- */

.info-button {
    width: 30px;
    height: 30px;

    padding: 0;

    border: 2px solid var(--primary);
    border-radius: 50%;

    background: var(--white);
    color: var(--primary);

    font-family: Georgia, serif;
    font-size: 17px;
    font-weight: bold;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.info-button:hover,
.info-button:focus {
    background: var(--primary);
    color: var(--white);
    outline: none;
}


/* ---------------------------------------------------------
   Hauptbutton
--------------------------------------------------------- */

.form-actions {
    margin-top: 30px;
    text-align: right;
}

#berechnen {
    min-height: 48px;

    padding: 11px 25px;

    border: 0;
    border-radius: 7px;

    background: var(--primary);
    color: #222;

    font-size: 16px;
    font-weight: 700;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        opacity 0.2s ease,
        box-shadow 0.2s ease;
}

#berechnen:not(:disabled):hover {
    transform: translateY(-1px);

    box-shadow:
        0 4px 12px var(--primary-light);
}

#berechnen:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


/* ---------------------------------------------------------
   Info-Popup
--------------------------------------------------------- */

.info-popup {
    position: fixed;
    inset: 0;
    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(0, 0, 0, 0.35);
}

.info-popup[hidden] {
    display: none;
}

.info-popup-content {
    position: relative;

    width: 100%;
    max-width: 480px;

    padding: 30px 45px 30px 30px;

    background: var(--white);

    border-top: 5px solid var(--primary);
    border-radius: 10px;

    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.18);
}

.info-close {
    position: absolute;
    top: 8px;
    right: 12px;

    padding: 0;

    border: 0;
    background: transparent;

    color: #777;

    font-size: 28px;
    line-height: 1;

    cursor: pointer;
}

.info-close:hover {
    color: var(--primary);
}


/* ---------------------------------------------------------
   Ergebnisbereich – wird später benötigt
--------------------------------------------------------- */

#ergebnis {
    margin-top: 35px;
}


/* ---------------------------------------------------------
   Responsive
--------------------------------------------------------- */

@media (max-width: 700px) {

    body {
        padding: 15px;
    }

    .rechner {
        padding: 25px 20px;
    }

    .rechner-header h1 {
        font-size: 25px;
    }

    .form-row {
        grid-template-columns: 1fr 36px;
        gap: 8px 12px;
    }

    .form-row > label {
        grid-column: 1 / -1;
    }

    .input-area {
        grid-column: 1;
    }

    .info-button {
        grid-column: 2;
    }

    .modelle {
        grid-template-columns: 1fr;
    }

    .form-actions {
        text-align: stretch;
    }

    #berechnen {
        width: 100%;
    }
}


/* ---------------------------------------------------------
   Ergebnis
--------------------------------------------------------- */

.ergebnis-kopf {
    margin-top: 40px;
    padding: 28px;
    border: 2px solid var(--primary);
    border-radius: 12px;
    background: var(--primary-very-light);
}

.ergebnis-label {
    margin-bottom: 5px;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ergebnis-kopf h2 {
    margin: 0 0 8px;
    font-size: 26px;
}

.ergebnis-preis {
    color: var(--text);
    font-size: 30px;
    font-weight: 700;
}

.ergebnis-preis span {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-light);
}

.ergebnis-kopf p {
    margin: 12px 0 0;
}

.ergebnis-tabelle-wrap {
    margin-top: 25px;
    overflow-x: auto;
}

.ergebnis-tabelle {
    width: 100%;
    border-collapse: collapse;
}

.ergebnis-tabelle th,
.ergebnis-tabelle td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
    white-space: nowrap;
}

.ergebnis-tabelle th {
    background: #f2f2f2;
    font-size: 14px;
}

.ergebnis-tabelle .beste-variante td {
    background: var(--primary-very-light);
}

.ergebnis-tabelle .beste-variante td:first-child {
    border-left: 4px solid var(--primary);
}

.ergebnis-hinweis {
    margin-top: 20px;
    padding: 15px 18px;
    background: #f5f5f5;
    border-radius: 7px;
    color: var(--text-light);
    font-size: 14px;
}


/* =========================================================
   Links im Infofenster
========================================================= */

.info-popup-content h3 {
    margin-top: 0;
    padding-right: 30px;
}

.info-popup-content p {
    line-height: 1.5;
}

.info-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.info-links a {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--primary-very-light);
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.info-links a:hover {
    background: var(--primary-light);
}


/* =========================================================
   Mobile Darstellung
========================================================= */

@media (max-width: 700px) {

    .berechnung-erklaerung {
        grid-template-columns: 1fr;
    }

    .berechnung-box {
        padding: 18px;
    }

    .berechnung-zeile {
        grid-template-columns: 24px 1fr;
    }

    .berechnung-zeile strong {
        grid-column: 2;
        padding-bottom: 3px;
    }

}

/* =========================================================
   Kompakte Berechnung unter der günstigsten Variante
========================================================= */

.kompakt-berechnung {
    max-width: 430px;
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    font-size: 13px;
}

.kompakt-berechnung > div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 3px 0;
}

.kompakt-berechnung strong {
    white-space: nowrap;
}

.kompakt-total {
    margin-top: 4px;
    padding-top: 7px !important;
    border-top: 1px solid rgba(0, 0, 0, 0.18);
}

.berechnung-info-link {
    margin-top: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
}

.berechnung-info-link:hover {
    color: var(--primary);
}

.vergleich-titel {
    margin-top: 30px;
    margin-bottom: 0;
}


/* =========================================================
   Inhalte im Infofenster
========================================================= */

.info-popup-content h3 {
    margin-top: 0;
    padding-right: 30px;
}

.info-popup-content h4 {
    margin-top: 22px;
    margin-bottom: 6px;
}

.info-popup-content p {
    line-height: 1.5;
}

.info-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.info-links a {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--primary-very-light);
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.info-links a:hover {
    background: var(--primary-light);
}


/* =========================================================
   Mobile
========================================================= */

@media (max-width: 700px) {

    .kompakt-berechnung {
        max-width: 100%;
    }

    .kompakt-berechnung > div {
        gap: 12px;
    }

}

/* =========================================================
   Popup auf Mobilgeräten
========================================================= */

@media (max-width: 700px) {

    .info-popup {
        padding: 15px;
        align-items: flex-start;
        overflow-y: auto;
    }

    .info-popup-content {
        position: relative;
        width: 100%;
        max-height: calc(100dvh - 30px);
        margin: auto;
        overflow-y: auto;
        box-sizing: border-box;
    }

    .info-close {
        position: sticky;
        top: 0;
        z-index: 10;
        float: right;
    }

}