/* =========================================================================
   digital-form-enhancements.css
   Zusatzstyles fuer das oeffentliche DigitalForm.
   Wird NACH app.css geladen und ueberschreibt gezielt:
     - Desktop: breiterer Container + breiterer Content-Bereich
       fuer ein echtes Mehrspalten-Layout.
     - Mobile:  Sticky Header oben, Sticky Action-Bar unten,
       grosse Touch-Targets, 16px Inputs (kein iOS-Zoom).
   app.scss bleibt unveraendert.
   ========================================================================= */

/* -------------------------------------------------------------------------
   Desktop: full width nutzen
   - Aussenrahmen: keine max-width
   - Content-Bereich: keine max-width
   - Felder regulieren ihre eigene Breite via col-md-* / col-xxl-*
     (siehe FieldType.razor) — verhindert 1m-lange Inputs.
   ------------------------------------------------------------------------- */
.digital-form-component {
    max-width: none;
    box-shadow: 0 18px 50px -20px rgba(15, 23, 42, 0.18);
}

/* Fokus-Spezialfaelle (Kundenidentifikation / Intro) bleiben kompakt */
.digital-form-component:has(.customerForm) {
    max-width: 640px;
}

.digital-form-component:has(.introductionForm) {
    max-width: 760px;
}

.digital-form-content {
    padding: 0 2.5rem 2rem;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .digital-form-content {
        padding: 0 3rem 2.25rem;
    }
}

@media (min-width: 1100px) {
    .digital-form-content {
        padding: 0 4rem 2.75rem;
    }
}

/* -------------------------------------------------------------------------
   Desktop: Scroll nur im Content, Footer bleibt unten fix.
   Original-app.scss hat .digital-form-shell { height: 100% } - das ueberlaeuft
   die Flex-Parent (default-layout) und laesst die ganze Seite scrollen.
   ------------------------------------------------------------------------- */
@media (min-width: 577px) {
    .digital-form-shell {
        height: auto;
        flex: 1 1 auto;
        min-height: 0;
    }

    .digital-form-component {
        height: 100%;
    }
}

/* -------------------------------------------------------------------------
   Desktop: Fortschritts-Header oben sticky (wie auf Mobile).
   Negative horizontale Margins, damit der Header die Container-Paddings
   ueberspannt und sauber von Rand zu Rand sitzt.
   ------------------------------------------------------------------------- */
@media (min-width: 577px) {
    .digital-form-header {
        display: block;
        position: sticky;
        top: 0;
        z-index: 10;
        margin: 0 -2.5rem 1.5rem;
        padding: 1.25rem 2.5rem 1rem;
        background: #fff;
        border-bottom: 1px solid #e2e8f0;
    }

    .digital-form-header__title {
        font-size: 0.9375rem;
    }

    .digital-form-header__step {
        background: rgba(243, 146, 0, 0.08);
        padding: 0.3125rem 0.625rem;
        border-radius: 999px;
        font-size: 0.6875rem;
        white-space: nowrap;
    }
}

@media (min-width: 768px) {
    .digital-form-header {
        margin: 0 -3rem 1.75rem;
        padding: 1.5rem 3rem 1rem;
    }
}

@media (min-width: 1100px) {
    .digital-form-header {
        margin: 0 -4rem 2rem;
        padding: 1.75rem 4rem 1rem;
    }
}

.digital-form-content__container {
    width: 100%;
    max-width: none;
}

.digital-form-content__form {
    gap: 1.5rem;
}

/* Page-Header etwas prominenter, jetzt wo mehr Platz da ist */
.digital-form-content-header__title {
    font-size: 1.375rem;
    line-height: 1.25;
    margin-bottom: 0.375rem;
}

.digital-form-content-header__description {
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* -------------------------------------------------------------------------
   Index/Landing-Page: Liste aller verfuegbaren Formulare.
   Eigene Shell-Variante, weil hier weder Sidebar noch Sticky-Header gebraucht
   werden - nur ein zentrierter Karten-Container mit der Liste.
   ------------------------------------------------------------------------- */
.digital-form-shell--list {
    align-items: center;
    justify-content: center;
}

.digital-form-list-card {
    width: 100%;
    max-width: 720px;
    max-height: 100%;
    min-height: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 18px 50px -20px rgba(15, 23, 42, 0.18);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow: hidden;
}

.digital-form-list-card__header {
    display: flex;
    gap: 1rem;
    align-items: center;
    border-bottom: 1px solid #eef0f3;
    padding-bottom: 1.25rem;
    flex-shrink: 0;
}

/* Scrollbarer Body unterhalb des Headers - die Liste scrollt intern,
   Header bleibt stehen. */
.digital-form-list-card__body {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
}

.digital-form-list-card__icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.875rem;
    background: var(--secondary, #F39200);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(243, 146, 0, 0.3);
    flex-shrink: 0;
    font-size: 1.25rem;
}

.digital-form-list-card__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.25rem 0;
    line-height: 1.2;
}

.digital-form-list-card__description {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
}

.digital-form-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.digital-form-list__item {
    display: block;
}

.digital-form-list__link {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.digital-form-list__link:hover {
    border-color: rgba(243, 146, 0, 0.4);
    box-shadow: 0 10px 25px -10px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

.digital-form-list__link:focus-visible {
    outline: 2px solid var(--secondary, #F39200);
    outline-offset: 2px;
}

.digital-form-list__logo {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #fff;
    border: 1px solid #eef0f3;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.digital-form-list__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.digital-form-list__logo--fallback {
    background: rgba(243, 146, 0, 0.08);
    border: none;
    color: var(--secondary, #F39200);
    font-size: 1.125rem;
}

.digital-form-list__text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.digital-form-list__profit-center {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
}

.digital-form-list__name {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}

.digital-form-list__hint {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.4;
    margin-top: 0.125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.digital-form-list__chevron {
    color: #94a3b8;
    flex-shrink: 0;
    font-size: 1rem;
}

.digital-form-list-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #64748b;
}

.digital-form-list-empty__icon {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 0.75rem;
    border-radius: 50%;
    background: #f1f5f9;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

@media (max-width: 576px) {
    .digital-form-list-card {
        max-width: 100%;
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 1.25rem 1.25rem 2rem;
    }

    .digital-form-list-card__header {
        gap: 0.75rem;
        padding-bottom: 1rem;
    }

    .digital-form-list-card__icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }

    .digital-form-list-card__title {
        font-size: 1.0625rem;
    }

    .digital-form-list__link {
        padding: 0.875rem;
    }
}

/* Sticky-Top-Bar Logo: deutlich groesser als das Fallback-Icon, damit der
   Endkunde seinen Makler/Standort sofort wiedererkennt. Weisser Hintergrund +
   leichte Border, damit das Logo auch auf farbigen Headern sauber sitzt. */
.digital-form-header__logo {
    width: 5.25rem;
    height: 5.25rem;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #fff;
    border: 1px solid #eef0f3;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@media (min-width: 1100px) {
    .digital-form-header__logo {
        width: 6rem;
        height: 6rem;
    }
}

@media screen and (max-width: 576px) {
    .digital-form-header__logo {
        width: 4rem;
        height: 4rem;
        border-radius: 0.625rem;
        padding: 0.1875rem;
    }
}

.digital-form-header__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Logo auf der Kundenidentifikations-/Startseite: zentriert und prominent.
   Hier hat der Kunde noch nichts ausgefuellt - das Makler-Logo soll Vertrauen
   schaffen und nicht in der Ecke verschwinden. */
.digital-form-determine-customer-header__logo {
    display: flex;
    justify-content: center;
    margin: 0 auto 1rem;
    max-width: 22rem;
    max-height: 9rem;
}

.digital-form-determine-customer-header__logo img {
    width: 100%;
    height: 100%;
    max-height: 5.5rem;
    object-fit: contain;
    display: block;
}

@media screen and (max-width: 576px) {
    .digital-form-determine-customer-header__logo {
        max-width: 11rem;
        max-height: 4.5rem;
    }

    .digital-form-determine-customer-header__logo img {
        max-height: 4.5rem;
    }
}

/* -------------------------------------------------------------------------
   TextInfo / Infotext: prominenter Default-Callout-Block.
   Standardmaessig hervorgehoben, damit der Kunde den Hinweis bereits beim
   Ausfuellen wahrnimmt (nicht erst in der Zusammenfassung).
   Hintergrund/Textfarbe/Ausrichtung werden direkt im WYSIWYG-Editor pro Wort
   gesetzt - die Inline-Styles (span style="background-color:..." etc.) gewinnen
   gegen die Defaults hier.
   ------------------------------------------------------------------------- */
.digital-form-textinfo {
    background: #fff7e0;
    border: 1px solid #f3c34a;
    border-left: 4px solid #d18d00;
    color: #5b4300;
    padding: 0.875rem 1rem 0.875rem 0.875rem;
    border-radius: 0.625rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    box-shadow: 0 4px 14px -8px rgba(209, 141, 0, 0.45);
}

.digital-form-textinfo *:first-child {
    margin-top: 0;
}

.digital-form-textinfo *:last-child {
    margin-bottom: 0;
}

.digital-form-summary .digital-form-textinfo {
    margin-bottom: 0.5rem;
}

/* -------------------------------------------------------------------------
   Mehrfachauswahl bei Radio-Optionsfeldern: vertikal gestapelte Checkboxen.
   Touch-Targets gross genug fuer Mobile.
   ------------------------------------------------------------------------- */
.digital-form-checkboxgroup {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.digital-form-checkboxgroup__label {
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.25rem;
}

.digital-form-checkboxgroup__option {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    min-height: 44px;
}

.digital-form-checkboxgroup__option:hover {
    border-color: rgba(243, 146, 0, 0.4);
}

.digital-form-checkboxgroup__option input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--secondary, #F39200);
    flex-shrink: 0;
}

.digital-form-checkboxgroup__option:has(input:checked) {
    border-color: var(--secondary, #F39200);
    background: rgba(243, 146, 0, 0.06);
}

@media screen and (max-width: 576px) {
    .digital-form-checkboxgroup__option {
        min-height: 48px;
        padding: 0.75rem;
    }
}

/* -------------------------------------------------------------------------
   Felder-Container: 16px Inputs auf Mobile (verhindert iOS-Auto-Zoom)
   und groessere Tap-Targets in den Office*-Komponenten.
   ------------------------------------------------------------------------- */
@media screen and (max-width: 768px) {
    .digital-form-fields input:not([type="checkbox"]):not([type="radio"]),
    .digital-form-fields select,
    .digital-form-fields textarea {
        font-size: 16px;
    }
}

/* -------------------------------------------------------------------------
   Mobile (<= 576px): Sticky Header + Sticky Action-Bar,
   bessere Touch-Targets, vollflaechiges Layout.
   ------------------------------------------------------------------------- */
@media screen and (max-width: 576px) {

    /* Shell von oben aufbauen, nicht vertikal zentrieren -
       sonst entsteht oben/unten Leerraum bei kurzen Formularen. */
    .digital-form-shell {
        justify-content: flex-start;
        align-items: stretch;
    }

    /* Component fuellt den Bildschirm randlos.
       Auch fuer customerForm/introductionForm die Desktop-Constraints aufheben
       (sonst bleiben sie als kleine Insel vertikal zentriert). */
    .digital-form-component,
    .digital-form-component:has(.customerForm),
    .digital-form-component:has(.introductionForm) {
        max-width: none;
        height: 100%;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }

    /* Inneres Content: kein Aussenpadding, damit Sticky-Bars
       am Viewport-Rand kleben koennen.
       overflow-x: hidden -> Felder/Rows duerfen nie horizontal scrollen. */
    .digital-form-content {
        padding: 0;
        gap: 0;
        overflow-x: hidden;
    }

    .digital-form-content__container {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Sticky Top-Bar: Logo, Titel, Schritt + Progress immer sichtbar */
    .digital-form-header {
        display: block;
        position: sticky;
        top: 0;
        z-index: 20;
        margin: 0;
        padding: 0.75rem 1.25rem 0.625rem;
        background: #fff;
        border-bottom: 1px solid #e2e8f0;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    }

    .digital-form-header__top {
        margin-bottom: 0.625rem;
    }

    .digital-form-header__title {
        font-size: 0.8125rem;
        letter-spacing: 0.01em;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .digital-form-header__step {
        background: rgba(243, 146, 0, 0.08);
        padding: 0.25rem 0.5rem;
        border-radius: 999px;
        white-space: nowrap;
    }

    /* Felder-Bereich: Innen-Padding (statt aussen) */
    .digital-form-content__form {
        padding: 1rem 1.25rem 0.5rem;
        gap: 1rem;
    }

    /* Sticky Action-Bar unten: Zurueck (klein) + Weiter (gross). */
    .digital-form-content__actions {
        position: sticky;
        bottom: 0;
        z-index: 20;
        margin: auto 0 0 0;
        padding: 0.75rem 1.25rem;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
        background: #fff;
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -4px 14px rgba(15, 23, 42, 0.06);
        flex-direction: row;
        align-items: stretch;
        gap: 0.625rem;
    }

    .digital-form-content__continue {
        flex: 1 1 auto;
        width: auto;
        min-height: 52px;
        padding: 0.875rem 1rem;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(243, 146, 0, 0.28);
    }

    .digital-form-content__back {
        flex: 0 0 auto;
        width: auto;
        min-height: 52px;
        min-width: 52px;
        padding: 0.875rem;
        border-radius: 0.75rem;
        background: #f1f5f9;
        color: #475569;
        justify-content: center;
    }

    .digital-form-content__back:hover {
        color: #475569;
    }

    .digital-form-content__back:active {
        background: #e2e8f0;
        color: #0f172a;
    }

    /* Page-Header (Titel + Beschreibung der aktuellen Schritt-Seite,
       sitzt zwischen Sticky-Top-Bar und Formular-Feldern). */
    .digital-form-content-header {
        padding: 0.875rem 1.25rem 0;
        margin-top: 0;
    }

    .digital-form-content-header__title {
        font-size: 1.125rem;
    }

    .digital-form-content-header__description {
        font-size: 0.875rem;
    }

    /* Summary mobile: Innen-Padding */
    .digital-form-summary {
        padding: 1rem 1.25rem 0.5rem;
        gap: 1rem;
    }

    /* File-Upload mobile: vertikal stacken */
    .file-upload {
        padding: 1.25rem 1rem;
    }

    .file-upload__content {
        flex-direction: column;
        gap: 0.625rem;
        text-align: center;
    }

    /* Site-Footer: kompakter, Safe-Area beachten */
    .digital-form-site-footer {
        padding: 0.875rem 1.25rem;
        padding-bottom: calc(0.875rem + env(safe-area-inset-bottom, 0px));
        font-size: 0.8125rem;
        border-top: 1px solid #eef0f3;
    }
}

