/*
 * maDDma Filter Drawer NEXT 0.5.2
 * ================================================================
 * ANSATZ A - DESKTOP + MOBIL
 *
 * Plenty bleibt nur unsichtbares Facetten-Backend.
 * Sichtbar ist auf allen Bildschirmgroessen nur der eigene Drawer.
 */

:root {
    --maddma-filter-a-bottom-offset: 0px;
}

/* ---------------------------------------------------------------
   NATIVE PLENTY-FILTEROBERFLAECHE AUSBLENDEN
   --------------------------------------------------------------- */

body.page-category.maddma-filter-a-enabled
.filter-collapse[id^="filter-collapse_"] {
    display: none !important;
}

html.maddma-filter-a-resume
body.page-category
.filter-collapse[id^="filter-collapse_"] {
    display: none !important;
}

/* ---------------------------------------------------------------
   RELOAD-PREPAINT
   --------------------------------------------------------------- */

html.maddma-filter-a-resume:not(.maddma-filter-a-ready)::before {
    content: "";

    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--maddma-filter-a-bottom-offset, 0px);

    z-index: 11015;

    background: #fff;

    pointer-events: none;
}

/* ---------------------------------------------------------------
   EIGENER DRAWER - BASIS FUER ALLE BREITEN
   --------------------------------------------------------------- */

.maddma-filter-a-backdrop,
.maddma-filter-a-drawer {
    display: none;
}

body.maddma-filter-a-open {
    overflow: hidden;
}

.maddma-filter-a-backdrop {
    position: fixed;
    inset: 0;

    z-index: 11000;

    display: block;

    background: rgba(0,0,0,.32);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition: opacity 160ms ease, visibility 160ms ease;
}

.maddma-filter-a-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.maddma-filter-a-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--maddma-filter-a-bottom-offset, 0px);

    z-index: 11020;

    display: none;
    flex-direction: column;

    width: 100%;
    max-width: none;

    height: auto;

    background: #fff;
}

.maddma-filter-a-drawer.is-open {
    display: flex;
}

.maddma-filter-a-header {
    flex: 0 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 62px;

    padding:
        max(10px, env(safe-area-inset-top))
        18px
        10px;

    border-bottom: 1px solid #e5e5e5;
    background: #fff;
}

.maddma-filter-a-title {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.2;
}

.maddma-filter-a-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 46px;
    height: 46px;
    padding: 0;

    border: 0;
    background: transparent;

    color: inherit;
    font-size: 2rem;
    line-height: 1;

    cursor: pointer;
    touch-action: manipulation;
}

.maddma-filter-a-content {
    flex: 1 1 auto;

    min-height: 0;

    padding: 0 18px 22px;

    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;

    background: #fff;
}

.maddma-filter-a-footer {
    flex: 0 0 auto;

    padding:
        12px
        18px
        max(14px, env(safe-area-inset-bottom));

    border-top: 1px solid #e5e5e5;
    background: #fff;
}

.maddma-filter-a-finish {
    display: block;

    width: 100%;
    min-height: 50px;

    padding: 13px 18px;

    border: 0;
    border-radius: 2px;

    background: #d10816;
    color: #fff;

    font: inherit;
    font-weight: 600;
    line-height: 1.2;

    cursor: pointer;
    touch-action: manipulation;
}

/* ---------------------------------------------------------------
   FILTERGRUPPEN
   --------------------------------------------------------------- */

.maddma-filter-a-group {
    border-bottom: 1px solid #ececec;
}

.maddma-filter-a-group-toggle {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;
    min-height: 54px;

    margin: 0;
    padding: 15px 34px 15px 0;

    border: 0;
    background: transparent;

    color: inherit;
    text-align: left;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;

    cursor: pointer;
    touch-action: manipulation;
}

.maddma-filter-a-group-toggle::after {
    content: "+";

    position: absolute;
    top: 50%;
    right: 3px;

    transform: translateY(-50%);

    font-size: 1.4rem;
    font-weight: 400;
    line-height: 1;
}

.maddma-filter-a-group.is-open
.maddma-filter-a-group-toggle::after {
    content: "−";
}

.maddma-filter-a-values {
    display: none;

    padding: 0 0 12px;
}

.maddma-filter-a-group.is-open
.maddma-filter-a-values {
    display: block;
}

.maddma-filter-a-row {
    display: grid;
    grid-template-columns: 28px minmax(0,1fr) auto;
    align-items: center;
    gap: 8px;

    width: 100%;
    min-height: 44px;

    margin: 0;
    padding: 7px 0;

    cursor: pointer;
    touch-action: manipulation;
}

.maddma-filter-a-checkbox {
    width: 19px;
    height: 19px;

    margin: 0;

    cursor: pointer;
}

.maddma-filter-a-label {
    min-width: 0;

    overflow-wrap: anywhere;
}

.maddma-filter-a-count {
    min-width: 2.7em;

    padding: 3px 7px;

    background: #eef0f2;

    text-align: center;
    white-space: nowrap;

    font-size: .9em;
}

.maddma-filter-a-more {
    display: block;

    width: 100%;
    min-height: 44px;

    margin: 4px 0;
    padding: 9px 0;

    border: 0;
    background: transparent;

    color: inherit;
    text-align: left;
    font: inherit;
    font-weight: 600;

    cursor: pointer;
    touch-action: manipulation;
}

/* ---------------------------------------------------------------
   LADEZUSTAND NACH AUSWAHL
   --------------------------------------------------------------- */

.maddma-filter-a-drawer.is-loading
.maddma-filter-a-content {
    position: relative;
}

.maddma-filter-a-drawer.is-loading
.maddma-filter-a-content::after {
    content: "Filter wird aktualisiert …";

    position: absolute;
    inset: 0;

    z-index: 4;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 30px;

    background: rgba(255,255,255,.97);

    font-weight: 600;
    text-align: center;
}

/* ---------------------------------------------------------------
   DESKTOP
   --------------------------------------------------------------- */

@media (min-width: 768px) {

    html.maddma-filter-a-resume:not(.maddma-filter-a-ready)::before {
        right: auto;

        width: 420px;
        max-width: 92vw;

        box-shadow: 4px 0 18px rgba(0,0,0,.12);
    }

    .maddma-filter-a-drawer {
        right: auto;

        width: 420px;
        max-width: 92vw;

        box-shadow: 4px 0 18px rgba(0,0,0,.12);
    }

    .maddma-filter-a-header {
        min-height: 66px;
        padding: 0 22px;
    }

    .maddma-filter-a-content {
        padding: 0 22px 24px;
    }

    .maddma-filter-a-footer {
        padding: 14px 22px 16px;
    }

    .maddma-filter-a-row {
        grid-template-columns: 22px minmax(0,1fr) auto;
        min-height: 0;
    }

    .maddma-filter-a-checkbox {
        width: 17px;
        height: 17px;
    }
}

/* ---------------------------------------------------------------
   KLEINE MOBILGERAETE
   --------------------------------------------------------------- */

@media (max-width: 420px) {
    .maddma-filter-a-header {
        padding-left: 14px;
        padding-right: 14px;
    }

    .maddma-filter-a-content {
        padding-left: 14px;
        padding-right: 14px;
    }

    .maddma-filter-a-footer {
        padding-left: 14px;
        padding-right: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .maddma-filter-a-backdrop {
        transition: none;
    }
}
