:root {
    --defendo-red: #CC232B;
    --defendo-black: #000000;
    --defendo-white: #FFFFFF;
    --defendo-border: #E2E2E2;
    --defendo-muted: #666666;
}

/* ==================================================
   DEFENDO – Große Zusammenfassung
   ================================================== */

.defendo-summary {
    max-width: 1100px;
    margin: 20px auto 40px;
    font-family: "Kanit", sans-serif;
    color: var(--defendo-black);
    font-size: 17px;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: 0.01em;
}

.defendo-summary__title {
    margin-bottom: 40px;
    text-align: center;
}

.defendo-summary__title,
.defendo-summary__section-title {
    font-family: "Kanit", sans-serif;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.defendo-summary__label {
    color: #252525;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.defendo-summary__value {
    min-width: 0;
    font-weight: 400;
}

.defendo-summary__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.defendo-summary__card {
    padding: 24px;
    border: 1px solid var(--defendo-border);
    border-radius: 12px;
    background: var(--defendo-white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);

    transition:
        box-shadow 0.2s ease,
        transform 0.2s ease,
        border-color 0.2s ease;
}

.defendo-summary__card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.defendo-summary__card--full {
    grid-column: 1 / -1;
}

.defendo-summary__section-title {
    position: relative;

    margin: 0 0 20px;
    padding: 0 0 12px 18px;

    border-bottom: 1px solid var(--defendo-border);

    color: var(--defendo-black);
    font-size: 1.2rem;
}

.defendo-summary__section-title::before {
    content: "";

    position: absolute;
    top: 4px;
    left: 0;

    width: 4px;
    height: 28px;

    background: var(--defendo-red);
}

.defendo-summary__row {
    display: grid;
    grid-template-columns:
        minmax(0, 46fr) minmax(0, 54fr);
    gap: 16px;
    align-items: start;

    margin-bottom: 16px;
}

.defendo-summary__total {
    grid-column: 1 / -1;
}

.defendo-summary__total-value {
    display: flex;
    align-items: center;
    justify-content: center;

    margin: 8px 0 0;
}

.defendo-summary__total-value .defendo-summary__value {
    color: var(--defendo-black);
    font-size: 2rem;
    font-weight: 700;
}

/* ==================================================
   DEFENDO – Live-Sidebar
   ================================================== */

.defendo-sidebar {
    width: 100%;
    padding: 28px;

    border: 1px solid var(--defendo-border);
    border-radius: 12px;

    background: var(--defendo-white);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.defendo-sidebar__title {
    margin: 0 0 28px;
    font-size: 28px;
    line-height: 1.15;
}

.defendo-sidebar__section {
    margin-bottom: 24px;
    padding-bottom: 24px;

    border-bottom: 1px solid #D8D8D8;
}

.defendo-sidebar__section-title {
    margin: 0 0 18px;
    font-size: 20px;
    line-height: 1.25;
}

.defendo-sidebar__label {
    margin-top: 16px;
    margin-bottom: 3px;

    color: var(--defendo-muted);
    font-size: 15px;
    font-weight: 500;
}

.defendo-sidebar__value {
    font-size: 18px;
    line-height: 1.4;
}

.defendo-sidebar__option {
    margin-bottom: 16px;
}

.defendo-sidebar__option:last-of-type {
    margin-bottom: 0;
}

.defendo-sidebar__option-name {
    font-size: 17px;
    line-height: 1.35;
}

.defendo-sidebar__option-price {
    margin-top: 3px;

    color: #555555;
    font-size: 15px;
}

.defendo-sidebar__empty {
    color: #777777;
    font-size: 15px;
}

.defendo-sidebar__total {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.defendo-sidebar__total-label {
    font-size: 18px;
    font-weight: 700;
}

.defendo-sidebar__total-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

/* Auf Desktop ist das vollständige Panel sichtbar. */

.defendo-sidebar__panel {
    display: block;
}

/* Auf Desktop bleibt der mobile Schalter verborgen. */

.defendo-sidebar__mobile-toggle {
    display: none;
}

/* ==================================================
   DEFENDO – Schritt 4 ohne Live-Sidebar
   ================================================== */

.defendo-layout.defendo-layout--summary .defendo-application-sidebar {
    display: none;
}

.defendo-layout.defendo-layout--summary .defendo-application-form {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
}

/* ==================================================
   DEFENDO – Sticky Sidebar auf Desktop
   ================================================== */

.defendo-application-sidebar {
    position: sticky;
    top: 100px;
    align-self: flex-start;
}

/* ==================================================
   DEFENDO – Responsive Zusammenfassung
   ================================================== */

@media (max-width: 768px) {

    .defendo-pdf-section__title {
        font-size: 11pt;

    }

    .defendo-summary__row {
        grid-template-columns: 1fr;
        gap: 4px;
        margin-bottom: 18px;
    }

    .defendo-summary__label,
    .defendo-summary__value {
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: normal;
    }

    .defendo-summary__value {
        line-height: 1.45;
    }

    .defendo-summary__grid {
        grid-template-columns: 1fr;
    }

    .defendo-summary__total {
        grid-column: auto;
    }
}

/* ==================================================
   DEFENDO – Mobile Auswahlleiste
   ================================================== */

@media (max-width: 767px) {

    /*
     * Der Gesamtbeitrag wird mobil ausschließlich
     * in der dauerhaft sichtbaren Auswahlleiste gezeigt.
     */
    .defendo-sidebar__panel .defendo-sidebar__total {
        display: none;
    }

    /*
     * Der Elementor-Sidebar-Container benötigt mobil
     * keinen eigenen Platz mehr im Seitenlayout.
     */
    .defendo-application-sidebar {
        position: static;

        width: 0 !important;
        min-width: 0 !important;
        height: 0;
        min-height: 0;

        flex: 0 0 0 !important;

        margin: 0 !important;
        padding: 0 !important;
    }

    /*
     * Platz am Formularende, damit die feste Leiste
     * keine Buttons oder Inhalte verdeckt.
     */
    .defendo-application-form {
        padding-bottom: 96px;
    }

    /*
     * Mobile Sidebar als feste Komponente
     * am unteren Bildschirmrand.
     */
    .defendo-sidebar {
        position: fixed;
        right: 12px;
        bottom: 12px;
        left: 12px;
        z-index: 9999;

        display: flex;
        flex-direction: column;

        width: auto;
        padding: 0;

        border: 1px solid var(--defendo-border);
        border-radius: 12px;

        background: var(--defendo-white);

        box-shadow:
            0 8px 28px rgba(0, 0, 0, 0.16);

        overflow: hidden;
    }

    /*
     * Kompakte und dauerhaft sichtbare Auswahlleiste.
     */
    .defendo-sidebar__mobile-toggle {
        display: grid;
        grid-template-columns:
            minmax(0, 1fr) auto auto;
        gap: 12px;
        align-items: center;

        width: 100%;
        min-height: 64px;
        padding: 14px 18px;

        border: 0;
        border-radius: 0 0 12px 12px;

        font: inherit;
        text-align: left;
        cursor: pointer;
    }

    /*
     * Theme-Farben für Buttons vollständig überschreiben.
     */
    .defendo-sidebar__mobile-toggle,
    .defendo-sidebar__mobile-toggle:hover,
    .defendo-sidebar__mobile-toggle:focus,
    .defendo-sidebar__mobile-toggle:active {
        appearance: none;

        border-color: var(--defendo-border) !important;

        background: var(--defendo-white) !important;
        background-color: var(--defendo-white) !important;

        color: var(--defendo-black) !important;

        box-shadow: none;
        outline: none;
        text-decoration: none;
    }

    .defendo-sidebar__mobile-label {
        min-width: 0;

        font-size: 16px;
        font-weight: 600;
        line-height: 1.2;
    }

    .defendo-sidebar__mobile-total {
        font-size: 18px;
        font-weight: 700;
        line-height: 1.2;
        white-space: nowrap;
    }

    .defendo-sidebar__mobile-icon {
        display: flex;
        align-items: center;
        justify-content: center;

        width: 24px;
        height: 24px;

        font-size: 13px;
        line-height: 1;

        transition:
            transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .defendo-sidebar__mobile-label,
    .defendo-sidebar__mobile-total,
    .defendo-sidebar__mobile-icon {
        color: var(--defendo-black) !important;
    }

    /*
     * Detailbereich ist mobil zunächst geschlossen.
     * Er bleibt im DOM und kann dadurch weich animiert werden.
     */
    .defendo-sidebar__panel {
        max-height: 0;
        padding: 0 22px;
        overflow: hidden;

        opacity: 0;
        visibility: hidden;
        transform: translateY(12px);
        pointer-events: none;

        border-bottom: 0 solid var(--defendo-border);

        transition:
            max-height 0.65s cubic-bezier(0.22, 1, 0.36, 1),

            padding 0.45s ease,

            opacity 0.4s ease,

            transform 0.65s cubic-bezier(0.22, 1, 0.36, 1),

            visibility 0s linear 0.65s,

            border-width 0.45s ease;
    }

    /*
     * Geöffneter Detailbereich.
     */
    .defendo-sidebar.defendo-sidebar--open .defendo-sidebar__panel {
        max-height: 62vh;
        padding: 22px;
        overflow-y: auto;

        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;

        border-bottom-width: 1px;

        transition:
            max-height 0.65s cubic-bezier(0.22, 1, 0.36, 1),

            padding 0.45s ease,

            opacity 0.4s ease 0.14s,

            transform 0.65s cubic-bezier(0.22, 1, 0.36, 1),

            visibility 0s linear 0s,

            border-width 0.45s ease;
    }

    /*
     * Pfeil beim Öffnen drehen.
     */
    .defendo-sidebar.defendo-sidebar--open .defendo-sidebar__mobile-icon {
        transform: rotate(180deg);
    }

    /*
     * Inhalt des mobilen Panels kompakter darstellen.
     */
    .defendo-sidebar__title {
        margin-bottom: 20px;
        font-size: 22px;
    }

    .defendo-sidebar__section {
        margin-bottom: 18px;
        padding-bottom: 18px;
    }

    .defendo-sidebar__section-title {
        margin-bottom: 14px;
        font-size: 18px;
    }

    .defendo-sidebar__label {
        margin-top: 12px;
    }

    .defendo-sidebar__value {
        font-size: 16px;
    }

    .defendo-sidebar__option-name {
        font-size: 16px;
    }

    .defendo-sidebar__total-value {
        font-size: 22px;
    }

    /*
     * Auch mobil bleibt Schritt 4 vollständig
     * ohne zusätzliche Auswahlleiste.
     */
    .defendo-layout.defendo-layout--summary .defendo-application-sidebar {
        display: none !important;
    }
}

/* ==================================================
   DEFENDO – Formular-Buttons
   ================================================== */

#gform_wrapper_1 .gform_next_button,
#gform_wrapper_1 .gform_previous_button,
#gform_wrapper_1 .gform_button[type="submit"] {
    appearance: none;

    padding: 14px 28px !important;

    border: 0 !important;
    border-radius: 8px !important;

    background: var(--defendo-red) !important;
    background-color: var(--defendo-red) !important;
    color: var(--defendo-white) !important;

    font-family: "Kanit", sans-serif !important;
    font-size: 17px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;

    box-shadow: none !important;
    text-decoration: none !important;
    cursor: pointer;

    transition:
        background-color 0.25s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

#gform_wrapper_1 .gform_next_button:hover,
#gform_wrapper_1 .gform_previous_button:hover,
#gform_wrapper_1 .gform_button[type="submit"]:hover {
    background: #B91D25 !important;
    background-color: #B91D25 !important;
    color: var(--defendo-white) !important;

    transform: translateY(-1px);
}

#gform_wrapper_1 .gform_next_button:focus,
#gform_wrapper_1 .gform_previous_button:focus,
#gform_wrapper_1 .gform_button[type="submit"]:focus {
    background: var(--defendo-red) !important;
    color: var(--defendo-white) !important;

    outline: none !important;
    box-shadow:
        0 0 0 3px rgba(204, 35, 43, 0.25) !important;
}

/* ==================================================
   DEFENDO – Formular CI
   ================================================== */

/* ==================================================
       DEFENDO – Radio- und Checkbox-Farben
       ================================================== */

.gform-theme--framework#gform_wrapper_1 .gfield--type-radio,
.gform-theme--framework#gform_wrapper_1 .gfield--type-checkbox {
    --gf-ctrl-choice-check-color: var(--defendo-red);
}

#gform_wrapper_1 input.gfield-choice-input[type="radio"],
#gform_wrapper_1 input.gfield-choice-input[type="checkbox"] {
    accent-color: var(--defendo-red) !important;
}

#gform_wrapper_1 input.gfield-choice-input[type="radio"]:focus,
#gform_wrapper_1 input.gfield-choice-input[type="radio"]:focus-visible,
#gform_wrapper_1 input.gfield-choice-input[type="checkbox"]:focus,
#gform_wrapper_1 input.gfield-choice-input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--defendo-red) !important;
    outline-offset: 2px;

    border-color: var(--defendo-red) !important;

    box-shadow:
        0 0 0 2px var(--defendo-white),
        0 0 0 4px var(--defendo-red) !important;
}

/* ==================================================
   DEFENDO – Gravity-Forms-Akzentfarben
   ================================================== */

#gform_wrapper_1 {
    --gf-color-in-ctrl-primary: var(--defendo-red) !important;
    --gf-color-in-ctrl-primary-rgb: 204, 35, 43 !important;
    --gf-color-in-ctrl-primary-darker: #A91D24 !important;
    --gf-color-in-ctrl-primary-lighter: #E05259 !important;

    --gf-color-primary: var(--defendo-red) !important;
    --gf-color-primary-rgb: 204, 35, 43 !important;

    --gf-ctrl-accent-color: var(--defendo-red) !important;
    --gf-ctrl-border-color-focus: var(--defendo-red) !important;
    --gf-ctrl-shadow-focus:
        0 0 0 3px rgba(204, 35, 43, 0.18) !important;
}

#gform_wrapper_1 input.gfield-choice-input[type="radio"],
#gform_wrapper_1 input.gfield-choice-input[type="checkbox"] {
    --gf-color-in-ctrl-primary:
        var(--defendo-red) !important;

    --gf-color-in-ctrl-primary-rgb:
        204, 35, 43 !important;

    --gf-ctrl-accent-color:
        var(--defendo-red) !important;

    accent-color:
        var(--defendo-red) !important;
}

#gform_wrapper_1 select:focus,
#gform_wrapper_1 select:focus-visible {
    border-color:
        var(--defendo-red) !important;

    outline:
        2px solid var(--defendo-red) !important;

    outline-offset: 2px;

    box-shadow:
        0 0 0 3px rgba(204, 35, 43, 0.18) !important;
}

/* ==================================================
   DEFENDO – Einheitliche Überschriften
   ================================================== */

#gform_wrapper_1 h2,
#gform_wrapper_1 .gform_title {
    font-size: 1.8rem;
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 1rem;
}

@media (max-width: 767px) {

    #gform_wrapper_1 h2,
    #gform_wrapper_1 .gform_title {
        font-size: 1.8rem;
        line-height: 1.2;
    }

}

/* --------------------------------------------------
 * Gravity Forms – Grid-Korrekturen
 * --------------------------------------------------
 *
 * Verhindert, dass das Feld Immobilien-Rechtsschutz
 * in die freie rechte Spalte des Verkehrs-Rechtsschutzes
 * hochrutscht, wenn dessen Preisfeld ausgeblendet ist.
 */

#field_1_23 {
    grid-column: 1 / span 6 !important;
}

@media (max-width: 767px) {
    #field_1_23 {
        grid-column: 1 / -1 !important;
    }
}

/* ==================================================
   DEFENDO – Bestätigung nach Antragstellung
   ================================================== */

/*
 * Nach erfolgreichem Versand wird die bisherige
 * Zwei-Spalten-Antragsansicht aufgehoben und die
 * Abschlusskarte mittig ausgerichtet.
 */
.defendo-layout--confirmed {
    display: flex !important;
    justify-content: center;
}

/*
 * Kompakte Abschlusskarte.
 */
.defendo-confirmation {
    width: min(760px, calc(100% - 40px));
    height: auto !important;
    min-height: 0 !important;

    margin: 60px 0;
    padding: 44px 48px;

    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);

    text-align: center;
    box-sizing: border-box;
}

.defendo-confirmation h2 {
    margin: 0 0 22px;
    font-size: 2rem;
    line-height: 1.2;
}

.defendo-confirmation p {
    margin: 0;
    line-height: 1.5;
}

.defendo-confirmation__lead {
    margin-bottom: 16px !important;
    font-size: 1.1rem;
    font-weight: 600;
}

.defendo-confirmation__download {
    margin-top: 26px;
}

.defendo-confirmation__download a {
    display: inline-block;
    padding: 15px 26px;

    background: #d92332;
    color: #fff;

    text-decoration: none;
    font-weight: 600;
    border-radius: 6px;
}

.defendo-confirmation__download a:hover {
    opacity: 0.9;
}

@media (max-width: 767px) {

    .defendo-confirmation {
        width: calc(100% - 30px);
        margin: 30px 0;
        padding: 30px 22px;
    }

    .defendo-confirmation h2 {
        font-size: 1.6rem;
    }

    .defendo-confirmation__download a {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
}