/*
 * Produktauswahlhilfe als Sidebar (Resources/Public/JavaScript/product-finder-sidebar.js)
 * Basis-Styles der Sidebar (.rw-sidebar-overlay, .rw-sidebar-panel, .rw-sidebar-backdrop)
 * kommen aus Partials/Page/UniversalContactPanel.html.
 */
body.rw-finder-sidebar-open {
    overflow: hidden;
}

.rw-finder-sidebar .rw-finder-sidebar__panel {
    max-width: 640px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
}

.rw-finder-sidebar__header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 16px 14px 24px;
    border-bottom: 1px solid var(--rw-border-color, #dee2e6);
    background: #ffffff;
}

.rw-finder-sidebar__title {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.25;
    color: var(--rw-text-on-light-highlight, #212529);
}

.rw-finder-sidebar .rw-finder-sidebar__close {
    position: static;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    line-height: 1;
}

.rw-finder-sidebar__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.rw-finder-sidebar__loading {
    display: grid;
    gap: 14px;
    padding: 28px 24px;
}

.rw-finder-sidebar__loading span {
    display: block;
    height: 18px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f1f1f1 25%, #e7e7e7 37%, #f1f1f1 63%);
    background-size: 400% 100%;
    animation: rw-finder-sidebar-shimmer 1.4s ease infinite;
}

.rw-finder-sidebar__loading span:nth-child(1) { width: 35%; }
.rw-finder-sidebar__loading span:nth-child(2) { width: 85%; height: 28px; }
.rw-finder-sidebar__loading span:nth-child(3) { height: 120px; }
.rw-finder-sidebar__loading span:nth-child(4) { height: 120px; }

@keyframes rw-finder-sidebar-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* Auswahlhilfe im Sidebar-Modus: ohne Hero, ohne Seitenabstände */
.rw-finder-sidebar .rw-product-finder-v2 {
    margin: 0;
    padding: 0;
    min-height: 0;
    overflow: visible;
}

.rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-hero {
    display: none;
}

.rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-app-wrap {
    padding: 20px 20px 32px;
}

.rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-container {
    max-width: none;
    padding-inline: 0;
}

.rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-app {
    box-shadow: none;
}

.rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-stage {
    min-height: 0;
    padding: 22px 20px;
}

.rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Anfrage-Kasten unter dem Ergebnis: Text oben, Buttons darunter.
   Die Original-Styles richten sich nach der Bildschirmbreite und stellen am Desktop
   Text und Buttons nebeneinander, was in der 640px-Sidebar zu eng wird. */
.rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-result-cta {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 22px;
}

.rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-result-cta-title {
    max-width: none;
}

.rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-result-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    width: 100%;
}

.rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-result-actions .rw-btn {
    width: 100%;
    margin: 0;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

.rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-result-actions [data-pfv2-contact] {
    grid-column: 1 / -1;
}

.rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-result-actions [data-pfv2-back] {
    padding-inline: 28px;
}

@media (max-width: 600px) {
    .rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-result-cta {
        padding: 18px;
    }

    .rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-result-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-app-wrap {
        padding: 14px 12px 24px;
    }

    .rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-stage {
        padding: 18px 14px;
    }

    .rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-options,
    .rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-products {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Begleittext im Anfrage-Kasten unter dem Ergebnis: in der schmalen Sidebar weglassen */
.rw-finder-sidebar .rw-product-finder-v2 .rw-pfv2-result-cta-text {
    display: none;
}

/* Gerät der aktuellen Produktseite unter den Empfehlungen */
.rw-finder-sidebar .rw-pfv2-product--current {
    box-shadow: 0 0 0 2px var(--rw-primary-color, #e2382a);
    border-radius: 8px;
}

.rw-finder-sidebar__current {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 14px;
    padding: 8px 12px;
    border: 1px solid rgba(226, 56, 42, 0.28);
    border-radius: 6px;
    background: rgba(226, 56, 42, 0.07);
    color: var(--rw-primary-color, #e2382a);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    -webkit-hyphens: manual;
    hyphens: manual;
    text-wrap: balance;
}

.rw-finder-sidebar__current::before {
    content: "";
    display: inline-block;
    vertical-align: -2px;
    margin-right: 6px;
    width: 14px;
    height: 14px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}

@media (prefers-reduced-motion: reduce) {
    .rw-finder-sidebar__loading span {
        animation: none;
    }
}
