/**
 * 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;
}
/* Mobil: Logo im Hero kompakter (muss das !important oben überschreiben) */
@media (max-width: 720px) {
    body .asg .asg-hero__logo img {
        height: min(var(--asg-logo-single, 48px), 36px) !important;
        max-width: 140px !important;
    }
    /* Hero-Bild füllt IMMER die ganze Box – auch gegen Theme-/Lazyload-Styles
       (z. B. EWWW/Uncode setzen img { height: auto }), sonst bleibt unter dem
       Bild eine leere dunkle Fläche stehen. */
    body .asg .asg-hero > img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        object-fit: cover !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;
}
/* Neue Google-Places-Komponente an das Feld-Design angleichen (Google setzt sonst
   schwarzen Rahmen + eckige Ecken auf dem Host). */
body .asg .asg-search__place {
    border: 1px solid var(--asg-border) !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-sizing: border-box !important;
    font-family: inherit !important;
    font-size: inherit !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; }
/* Checkboxen: native, sichtbare, anklickbare Kontrollkästchen erzwingen.
   Manche Themes (z. B. Uncode) setzen appearance:none / opacity:0 / position:absolute
   und zeichnen einen eigenen Haken per :before – dadurch ist die echte Checkbox
   unsichtbar bzw. nicht anklickbar. Hier zurück auf Standard. */
body .asg .asg-apply-form input[type="checkbox"] {
    -webkit-appearance: checkbox !important;
    -moz-appearance: checkbox !important;
    appearance: auto !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    max-width: 18px !important;
    margin: 2px 8px 0 0 !important;
    padding: 0 !important;
    position: static !important;
    left: auto !important;
    top: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    clip: auto !important;
    clip-path: none !important;
    pointer-events: auto !important;
    box-shadow: none !important;
    background: none !important;
    border: initial !important;
    border-radius: 3px !important;
    flex: 0 0 auto !important;
    vertical-align: baseline !important;
    transform: none !important;
    accent-color: var(--asg-primary) !important;
    cursor: pointer !important;
}
body .asg .asg-apply-form input[type="checkbox"]::before,
body .asg .asg-apply-form input[type="checkbox"]::after {
    content: none !important;
    display: none !important;
    background: none !important;
}
/* Label + Klickfläche freigeben (falls Theme pointer-events unterbindet) */
body .asg .asg-apply-form .asg-apply-form__check,
body .asg .asg-apply-form .asg-apply-form__check span {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* === Keine Silbentrennung / Mitten-im-Wort-Umbrüche in Plugin-Inhalten ===
   Manche Themes (z. B. Uncode-Child-Themes) setzen global auf Überschriften/Buttons
   { hyphens: auto; word-break: break-word; overflow-wrap: anywhere; } – dadurch
   werden Wörter mitten im Wort getrennt („Stel-len“, „Dei-nen“). Hier neutralisieren:
   ganze Wörter umbrechen, nur echte Überlänge notfalls am Wort brechen. */
body .asg,
body .asg * {
    -webkit-hyphens: manual !important;
            hyphens: manual !important;
    word-break: normal !important;
}
body .asg h1, body .asg h2, body .asg h3, body .asg h4,
body .asg .asg-search__title,
body .asg .asg-card__title,
body .asg .asg-hero__title,
body .asg .asg-applybox__title,
body .asg .asg-btn,
body .asg .asg-cta {
    overflow-wrap: break-word !important;
}

/* Karten/Suche nie breiter als der Bildschirm (gegen Builder-Container mit Überbreite) */
.asg .asg-grid,
.asg .asg-card,
.asg .asg-card__media,
.asg .asg-search,
.asg .asg-search__inner {
    max-width: 100% !important;
    min-width: 0 !important;
}

/* Karten-Auszug: immer umbrechen, nie breiter als die Karte (gegen Theme-nowrap) */
.asg .asg-card__excerpt {
    white-space: normal !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

/* Teilen-Buttons (AddToAny-Stil): einfarbig in der Akzentfarbe (#46c0ec via --asg-accent),
   Hover = weiß. Kein Hintergrund/Unterstreichung – gegen Theme-Link-Styles. */
.asg .asg-share__btn,
.asg .asg-share__btn:link,
.asg .asg-share__btn:visited {
    color: var(--asg-share-icon, var(--asg-accent, var(--asg-primary))) !important;
    background: none !important;
    text-decoration: none !important;
    box-shadow: none !important;
}
.asg .asg-share__btn:hover,
.asg .asg-share__btn:focus,
.asg .asg-share__btn:active {
    color: var(--asg-share-icon-hover, #fff) !important;
    background: none !important;
    text-decoration: none !important;
    box-shadow: none !important;
}
.asg .asg-share__btn svg { fill: currentColor !important; }

/* Rechtliche Dokumente: Links in Akzentfarbe, kein Theme-Underline/Hintergrund */
.asg .asg-legal__links a,
.asg .asg-legal__links a:link,
.asg .asg-legal__links a:visited {
    color: var(--asg-accent, var(--asg-primary)) !important;
    background: none !important;
    text-decoration: none !important;
    box-shadow: none !important;
}
.asg .asg-legal__links a:hover,
.asg .asg-legal__links a:focus,
.asg .asg-legal__links a:active {
    color: var(--asg-accent, var(--asg-primary)) !important;
    text-decoration: underline !important;
    background: none !important;
    box-shadow: none !important;
}
.asg .asg-legal__links a svg { stroke: currentColor !important; fill: 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;
}
