/**
 * Theme-Kompatibilität (Divi, enge Spalten, kleine Root-Fonts).
 * Wird geladen, sobald der Shortcode gerendert wird.
 */

/* Eigene Typo-Basis (unabhängig von html { font-size: 62.5% } o. ä.) */
.asg {
    font-size: calc(16px * var(--asg-font-scale, 1));
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.asg-list {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* === Sichtbarkeit erzwingen ===
   Manche Themes/Page-Builder (Divi-Animationen, Scroll-Effekte) setzen das
   umgebende Modul auf opacity:0 und blenden es per JS ein. Klappt das auf dem
   Handy nicht, bleibt alles unsichtbar. Diese Regeln erzwingen die Anzeige. */
.asg,
.asg-list,
.asg-grid,
.asg-card,
.asg-beispiel-liste,
.asg-beispiel-liste__items,
.asg-beispiel-liste__item {
    opacity: 1 !important;
    visibility: visible !important;
}
.asg-grid {
    display: grid !important;
}

@supports selector(:has(*)) {
    .et_pb_module:has(.asg),
    .et_pb_text:has(.asg),
    .et_pb_text_inner:has(.asg),
    .et_pb_code:has(.asg),
    .et_pb_code_inner:has(.asg),
    .et_pb_column:has(.asg),
    .et_pb_row:has(.asg),
    .et_pb_section:has(.asg),
    .elementor-widget:has(.asg),
    .elementor-widget-container:has(.asg),
    .wp-block-shortcode:has(.asg),
    .widget:has(.asg) {
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        animation: none !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

/* === WPBakery (Visual Composer) ===
   - hebt "Auf Telefon ausblenden" (vc_hidden-xs/-sm) für unsere Inhalte auf
   - erzwingt Sichtbarkeit gegen WPBakery-Animationen (wpb_animate_when_almost_visible)
   body-Präfix erhöht die Spezifität, um das !important der Hide-Klassen zu schlagen. */
@supports selector(:has(*)) {
    body .vc_row:has(.asg),
    body .vc_row-inner:has(.asg),
    body .vc_column_container:has(.asg),
    body .vc_column-inner:has(.asg),
    body .wpb_column:has(.asg),
    body .wpb_wrapper:has(.asg),
    body .wpb_text_column:has(.asg),
    body .wpb_raw_code:has(.asg),
    body .wpb_raw_html:has(.asg),
    body [class*="vc_col-"]:has(.asg),
    body [class*="vc_hidden"]:has(.asg) {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        animation: none !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    body .wpb_animate_when_almost_visible:has(.asg) {
        opacity: 1 !important;
    }
}

/* Responsive über Viewport-Media-Queries (sicher, kein Containment) */
@media (max-width: 900px) {
    .asg-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 24px !important;
    }
}

@media (max-width: 600px) {
    .asg-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .asg-card__body {
        padding: 18px 16px 16px !important;
    }

    .asg-card__title {
        font-size: 18px !important;
    }

    .asg-card__excerpt {
        font-size: 15px !important;
    }

    .asg-card__meta {
        font-size: 14px !important;
    }

    .asg-cta {
        font-size: 14px !important;
        padding: 10px 10px 10px 16px !important;
    }
}

/* Divi: Modul/Spalte volle Breite, kein Quetschen */
.et_pb_section .asg,
.et_pb_row .asg,
.et_pb_column .asg,
.et_pb_module .asg,
.et_pb_text_inner .asg,
.et_pb_code_inner .asg {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

.et_pb_row .et_pb_column .asg-grid,
.et_pb_row .et_pb_column .asg-card {
    min-width: 0;
}

@supports selector(:has(*)) {
    @media only screen and (max-width: 980px) {
        .et_pb_row:has(.asg) > .et_pb_column {
            width: 100% !important;
            margin-right: 0 !important;
            margin-bottom: 24px !important;
        }

        .et_pb_row:has(.asg) {
            display: flex !important;
            flex-wrap: wrap !important;
        }
    }
}

/* Themes (Listen-Styles) auf Plugin-Listen zurücksetzen */
.asg ul.asg-card__meta,
.asg .asg-card__meta {
    list-style: none !important;
    margin: 4px 0 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
}
.asg .asg-card__meta li {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    line-height: 1.4 !important;
    text-indent: 0 !important;
}
.asg .asg-card__meta li::before,
.asg .asg-card__meta li::marker {
    content: none !important;
    display: none !important;
}
.asg .asg-card__meta li span {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
    max-width: 100% !important;
}
.asg .asg-card__meta li svg {
    flex: 0 0 auto !important;
    margin-top: 2px !important;
}

/* Logo (Karte/Liste, Hero, Inhalt) gegen Theme-img-Styles (z. B. width:100%) absichern */
.asg .asg-card__brand img {
    height: var(--asg-logo-card, 28px) !important;
    width: auto !important;
    max-width: 100% !important;
    margin: 0 !important;
    display: block !important;
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
}
.asg .asg-hero__logo img,
.asg .asg-single__brand img {
    height: var(--asg-logo-single, 48px) !important;
    width: auto !important;
    max-width: 220px !important;
    margin: 0 !important;
    display: block !important;
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
}

/* Titel-Link: Theme-Override der Hover-Farbe verhindern */
.asg .asg-card__title a,
.asg .asg-card__title a:link,
.asg .asg-card__title a:visited {
    color: inherit !important;
    text-decoration: none !important;
    transition: color .25s ease !important;
}
.asg .asg-card__title a:hover,
.asg .asg-card__title a:focus,
.asg .asg-card__title a:active,
.et_pb_section .asg .asg-card__title a:hover,
.et_pb_section .asg .asg-card__title a:focus {
    color: var(--asg-primary) !important;
    text-decoration: none !important;
}
.asg .asg-beispiel-liste__title a,
.asg .asg-beispiel-liste__title a:link,
.asg .asg-beispiel-liste__title a:visited {
    color: inherit !important;
    text-decoration: none !important;
}
.asg .asg-beispiel-liste__title a:hover,
.asg .asg-beispiel-liste__title a:focus {
    color: var(--asg-bl-accent, var(--asg-primary)) !important;
}

/* === Suchleiste: Textfelder, Dropdown und Button einheitlich ===
   Themes/Builder (z. B. Divi) stylen <input>/<select>/<button> mit eigenem
   Rahmen, Hintergrund und Höhe. Diese Regeln erzwingen, dass alle Felder –
   inkl. des Sprach-Dropdowns – exakt gleich aussehen wie die Suchfelder. */
body .asg .asg-search__field,
body .asg .asg-search__submit {
    box-sizing: border-box !important;
    margin: 0 !important;
    font-family: inherit !important;
    font-size: 1rem !important;
    font-weight: 400 !important;
    line-height: 1.4 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    text-shadow: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    -webkit-appearance: none !important;
       -moz-appearance: none !important;
            appearance: none !important;
}
body .asg .asg-search__field {
    padding: 13px 18px !important;
    color: #1f2937 !important;
    background-color: #fff !important;
    border: 1px solid var(--asg-border) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
}
body .asg .asg-search__field::placeholder {
    color: #6b7280 !important;
    opacity: 1 !important;
}
body .asg .asg-search__select {
    padding-right: 42px !important;
    background-color: #fff !important;
    background-image: var(--asg-search-chevron) !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 16px !important;
}
body .asg .asg-search__field:focus,
body .asg .asg-search__select:focus {
    outline: none !important;
    border-color: var(--asg-primary) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--asg-primary) 18%, transparent) !important;
}
body .asg .asg-search__submit {
    padding: 13px 28px !important;
    font-weight: 700 !important;
    color: #fff !important;
    background: var(--asg-search-btn, var(--asg-primary)) !important;
    border: 1px solid var(--asg-search-btn, var(--asg-primary)) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    cursor: pointer !important;
}
body .asg .asg-search__submit:hover {
    background: color-mix(in srgb, var(--asg-search-btn, var(--asg-primary)) 82%, #000) !important;
    border-color: color-mix(in srgb, var(--asg-search-btn, var(--asg-primary)) 82%, #000) !important;
    box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--asg-search-btn, var(--asg-primary)) 70%, transparent) !important;
}

/* === Bewerbungsformular-Felder gegen Theme-/Builder-Styles absichern === */
body .asg .asg-apply-form input[type="email"],
body .asg .asg-apply-form input[type="text"],
body .asg .asg-apply-form input[type="file"] {
    box-sizing: border-box !important;
    width: 100% !important;
    margin: 0 !important;
    font-family: inherit !important;
    line-height: 1.4 !important;
    color: #1f2937 !important;
    background-color: #fff !important;
    border: 1px solid var(--asg-border) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    height: auto !important;
    min-height: 0 !important;
}
body .asg .asg-apply-form input[type="email"],
body .asg .asg-apply-form input[type="text"] { padding: 11px 14px !important; }
body .asg .asg-apply-form input[type="file"] { padding: 9px 12px !important; }
body .asg .asg-apply-form input[type="checkbox"] {
    width: auto !important;
    margin: 2px 0 0 !important;
    box-shadow: none !important;
}

/* Divi setzt oft underline auf alle Links */
.et_pb_section .asg a.asg-cta,
.et_pb_section .asg a.asg-cta:hover,
.et_pb_section .asg a.asg-cta:focus,
.et_pb_section .asg a.asg-cta:active,
.et_pb_section .asg a.asg-cta:visited,
.et_pb_section .asg a.asg-btn,
.et_pb_section .asg a.asg-btn:hover,
.et_pb_section .asg a.asg-btn:focus,
.et_pb_section .asg a.asg-btn:active,
.et_pb_section .asg a.asg-btn:visited,
.et_pb_section .asg .asg-cta__label,
.et_pb_section .asg .asg-beispiel-liste__cta,
.et_pb_section .asg .asg-beispiel-liste__cta:hover,
.et_pb_section .asg .asg-beispiel-liste__cta:focus,
.et_pb_section .asg .asg-beispiel-liste__cta:active,
.et_pb_section .asg .asg-beispiel-liste__cta:visited {
    text-decoration: none !important;
}
