/*
 * Cookie-Consent (EXT:om_cookie_manager) – Panel-Layout „AP Design" (layout = 2)
 *
 * Das Extension-CSS (cookie_panel.css) bleibt aktiv und liefert die Grundlagen
 * (Ein-/Ausblenden über .active, Toggle-Schalter). Hier wird nur Layout 2
 * überschrieben: aus der Leiste am unteren Rand wird ein zentrierter Dialog
 * über abgedunkeltem Hintergrund. Die doppelte Klasse sorgt für die nötige
 * Spezifität gegenüber dem Extension-CSS.
 *
 * Farbschema wie im Projekt „Pflegeeinrichtung Jürgen Helm": schwarze Buttons
 * und Überschrift, grüner Schalter (an/aus auch ohne Farbwissen lesbar).
 *
 * Bewusst ohne CSS-Nesting (Safari ≤ 17.1, siehe footer.css).
 */

.om-cookie-panel.om-cookie-panel-layout-2 {
    --ap-cookie-black: #262626;
    --ap-cookie-line: #e5e3ea;
    --om-cookie-panel-active-color: #76b828;
    --om-cookie-panel-active-emphasis: #fff;
    --om-cookie-panel-inactive-color: #707070;
    --om-cookie-panel-inactive-emphasis: #fff;
    --om-cookie-panel-border-color: #d9d9d9;
    --om-cookie-panel-border-radius: 0;

    /* Das Panel selbst wird zum Overlay, die weiße Fläche ist .ap-cookie-dialog */
    position: fixed;
    inset: 0;
    left: 0;
    width: auto;
    max-height: none;
    padding: 1rem;
    background: rgb(0 0 0 / .55);
    border: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    overscroll-behavior: contain;
    font-family: var(--font-primary);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ap-cookie-black);
    text-align: center;
    transform: none;
    transition: opacity .3s ease, visibility .3s ease;
    visibility: hidden;
}

.om-cookie-panel.om-cookie-panel-layout-2.active {
    transform: none;
    visibility: visible;
}

/* Das Extension-CSS setzt für h3 und die Beschreibung text-align: left –
   im AP-Design-Layout stehen beide zentriert. */
.om-cookie-panel.om-cookie-panel-layout-2 h3 {
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--ap-cookie-black);
    margin: 0 0 1.5rem;
    padding: 0;
    text-align: center;
}

.om-cookie-panel.om-cookie-panel-layout-2 h3:focus {
    outline: none;
}

.om-cookie-panel.om-cookie-panel-layout-2 .cookie-panel__description {
    margin-bottom: 1.75rem;
    text-align: center;
}

.om-cookie-panel.om-cookie-panel-layout-2 .cookie-panel__description p {
    padding: 0;
    margin: 0 0 1rem;
}

.om-cookie-panel.om-cookie-panel-layout-2 .cookie-panel__description > :last-child {
    margin-bottom: 0;
}

.om-cookie-panel.om-cookie-panel-layout-2 .cookie-panel__description a {
    color: var(--ap-cookie-black);
    text-decoration: underline;
}

.om-cookie-panel.om-cookie-panel-layout-2 .cookie-panel__selection {
    margin: 0;
}

.om-cookie-panel.om-cookie-panel-layout-2 .cookie-panel__selection form {
    margin: 0;
}

/* Der Schalter steht im Label hinter einer visuell versteckten Beschriftung.
   Das Extension-CSS nimmt sein margin-top nur für :first-child zurück. */
.om-cookie-panel.om-cookie-panel-layout-2 .cookie-panel__checkbox + label .checkbox-toggle {
    margin-top: 0;
}

/* Knopf exakt mittig in der Bahn (Extension: top .2em, mittig wären .15em) */
.om-cookie-panel.om-cookie-panel-layout-2 .cookie-panel__checkbox + label .checkbox-toggle::before {
    top: 50%;
    margin-top: -.6em;
}

/* Tastatur-Fokus: deutlicher Ring, auf heller wie farbiger Fläche erkennbar */
.om-cookie-panel.om-cookie-panel-layout-2 a:focus-visible,
.om-cookie-panel.om-cookie-panel-layout-2 button:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / .75), 0 0 0 4px rgb(0 0 0 / .75);
}

/* Die Checkbox der Schalter ist unsichtbar – ihr Fokus wird am umgebenden
   Element sichtbar. :has(:focus-visible) statt :focus-within, damit der Ring
   nach einem Mausklick nicht stehen bleibt. */
.om-cookie-panel.om-cookie-panel-layout-2 .cookie-panel__checkbox-wrap:focus-within {
    box-shadow: none;
}

.om-cookie-panel.om-cookie-panel-layout-2 .cookie-panel__checkbox-wrap:has(.cookie-panel__checkbox:focus-visible) {
    box-shadow: 0 0 0 4px rgb(0 0 0 / .75);
}


/* Dialogfläche */
.ap-cookie-dialog {
    position: relative;
    width: 100%;
    max-width: 50rem; /* 800px */
    margin: auto;
    background: var(--om-cookie-panel-background);
    text-align: center;
}

.ap-cookie-dialog__body {
    padding: 2.5rem 1.25rem;
}

@media (min-width: 768px) {
    .ap-cookie-dialog__body {
        padding: 3.125rem;
    }
}

.ap-cookie-view[hidden] {
    display: none;
}

/* Schließen-Kreuz: setzt den grauen Button-Stil aus blueprint.css zurück */
.om-cookie-panel .ap-cookie-dialog__close {
    position: absolute;
    top: .5rem;
    right: .5rem;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    background: transparent;
    border-radius: 0;
    color: var(--ap-cookie-black);
    font-size: 1.5rem;
    line-height: 1;
}

.om-cookie-panel .ap-cookie-dialog__close:hover {
    background: transparent;
    color: #000;
}

.ap-cookie-dialog__privacy-hint {
    margin-top: 1rem;
}

/* Buttons zentriert untereinander */
.ap-cookie-dialog__control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    margin-top: 1.75rem;
}

.om-cookie-panel .ap-cookie-dialog__control .btn {
    justify-content: center;
    width: 100%;
    padding-block: .875rem;
    background-color: var(--ap-cookie-black);
    border: 1px solid var(--ap-cookie-black);
    border-radius: 0;
    color: #fff;
    font-size: 1.0625rem;
    font-weight: 700;
    text-transform: none;
    transition: background-color .15s ease, color .15s ease;
}

.om-cookie-panel .ap-cookie-dialog__control .btn:hover,
.om-cookie-panel .ap-cookie-dialog__control .btn:active {
    background-color: #fff;
    color: var(--ap-cookie-black);
}

@media (min-width: 768px) {
    .om-cookie-panel .ap-cookie-dialog__control .btn {
        width: auto;
        min-width: 20rem;
    }

    /* Einstellungs-Ansicht: beide Buttons nebeneinander */
    .ap-cookie-dialog__control--row {
        flex-direction: row;
        justify-content: center;
    }

    .om-cookie-panel .ap-cookie-dialog__control--row .btn {
        min-width: 15rem;
    }
}


/* Gruppenliste in der Einstellungs-Ansicht */
.ap-cookie-group {
    border-top: 1px solid var(--ap-cookie-line);
    text-align: left;
}

.ap-cookie-group:last-child {
    border-bottom: 1px solid var(--ap-cookie-line);
}

.ap-cookie-group__head {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 0;
}

.ap-cookie-group__name {
    flex: 1 1 auto;
    font-size: .9375rem;
    font-weight: 400;
    letter-spacing: .03em;
    text-transform: uppercase;
}

/* Details-Umschalter: setzt den grauen Button-Stil aus blueprint.css zurück */
.om-cookie-panel .ap-cookie-group__toggle {
    flex: 0 0 auto;
    padding: .25rem 0;
    background: none;
    border-radius: 0;
    color: var(--ap-cookie-black);
    font-size: .9375rem;
    text-transform: none;
}

.om-cookie-panel .ap-cookie-group__toggle:hover {
    background: none;
    color: #000;
    text-decoration: underline;
}

/* Pfeil als CSS-Dreieck */
.ap-cookie-group__toggle::after {
    content: "";
    display: inline-block;
    margin-left: .4em;
    border-left: .3em solid transparent;
    border-right: .3em solid transparent;
    border-top: .35em solid currentColor;
    transition: transform .2s ease;
    vertical-align: middle;
}

.ap-cookie-group__toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

.om-cookie-panel.om-cookie-panel-layout-2 .ap-cookie-group .cookie-panel__checkbox-wrap {
    flex: 0 0 auto;
    margin-right: 0;
}

.ap-cookie-group__details {
    padding: 0 0 1.25rem;
    font-size: .9375rem;
}

.ap-cookie-group__details[hidden] {
    display: none;
}

.om-cookie-panel.om-cookie-panel-layout-2 .ap-cookie-group__details p {
    padding: 0;
    margin: 0 0 .75rem;
}

.ap-cookie-group__table {
    overflow-x: auto;
    margin-top: 1rem;
}

.ap-cookie-group__table table {
    margin-bottom: 0;
    font-size: .875rem;
}

.ap-cookie-group__table th,
.ap-cookie-group__table td {
    padding: .5rem .75rem;
    vertical-align: top;
    border-bottom: 1px solid var(--ap-cookie-line);
}

.om-cookie-panel.om-cookie-panel-layout-2 .ap-cookie-group__table td p {
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    .om-cookie-panel.om-cookie-panel-layout-2,
    .ap-cookie-group__toggle::after {
        transition: none;
    }
}
