/* Warenkorb-Button Plus (dh_cartbuttonplus) */

/* ---------- Kachel: Mengenfeld + Button ---------- */

.cbp-buybox {
    margin-top: .5rem;
}

.cbp-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: .5rem;
}

/* Zähler als EIN Feld mit einem Rahmen – unabhängig davon, wie das Theme
   Input-Groups, Buttons und Addons einzeln rahmt. */
.cbp-counter {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    align-items: stretch;
    min-width: 0;
    border: 1px solid var(--cbp-counter-border, #707070);
    border-radius: .125rem;
    background: #fff;
    overflow: hidden;
}

.cbp-counter:focus-within {
    box-shadow: 0 0 0 .15rem rgba(0, 0, 0, .1);
}

.cbp-counter > .input-group-prepend,
.cbp-counter > .input-group-append {
    margin: 0 !important;
    display: flex;
    align-items: stretch;
}

.cbp-counter .btn,
.cbp-counter .form-control,
.cbp-counter .input-group-text {
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    height: auto;
}

.cbp-counter .cbp-qty {
    flex: 1 1 3rem;
    width: 3rem;
    min-width: 2.5rem;
    padding: .25rem;
    text-align: center;
    background: transparent;
    -moz-appearance: textfield;
    appearance: textfield;
}

.cbp-counter .cbp-qty::-webkit-outer-spin-button,
.cbp-counter .cbp-qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cbp-counter .cbp-count {
    background: transparent;
    color: inherit;
    padding: 0 .625rem;
    line-height: 1;
}

.cbp-counter .cbp-count:hover,
.cbp-counter .cbp-count:focus {
    background: rgba(0, 0, 0, .06);
}

.cbp-counter .cbp-unit {
    background: transparent;
    font-size: .75rem;
    color: #707070;
    padding: 0 .25rem 0 0;
}

.cbp-submit {
    flex: 0 0 auto;
    white-space: nowrap;
}

.cbp-row-noqty .cbp-submit {
    flex: 1 1 auto;
}

.cbp-submit .cbp-label {
    margin-left: .25rem;
}

/* Slider: Formular sitzt unter dem Kachel-Link */
.cbp-slider-form {
    margin-top: auto;
    padding-top: .25rem;
}

.cbp-ctx-slider .cbp-counter .cbp-count {
    padding-left: .375rem;
    padding-right: .375rem;
}

/* Nur bei Mouseover (Galerie) – auf Touch-Geräten immer sichtbar */
@media (hover: hover) and (min-width: 768px) {
    .cbp-hover-only {
        opacity: 0;
        visibility: hidden;
        transition: opacity .2s ease, visibility .2s ease;
    }

    .productbox:hover .cbp-hover-only,
    .productbox:focus-within .cbp-hover-only {
        opacity: 1;
        visibility: visible;
    }
}

/* ---------- Sticky-Warenkorb-Leiste (mobil) ---------- */

.cbp-fixedbar {
    --cbp-bar-bg: #fff;
    --cbp-bar-fg: inherit;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    padding: .5rem 1rem calc(.5rem + env(safe-area-inset-bottom, 0px));
    background: var(--cbp-bar-bg);
    color: var(--cbp-bar-fg);
    box-shadow: 0 -.25rem 1rem rgba(0, 0, 0, .08);
    transform: translateY(110%);
    transition: transform .3s ease;
    pointer-events: none;
}

.cbp-fixedbar.is-visible {
    transform: translateY(0);
    pointer-events: auto;
}

.cbp-fixedbar[hidden],
.cbp-fixedbar [hidden] {
    display: none !important;
}

.cbp-fixedbar-close {
    position: absolute;
    top: .25rem;
    right: .25rem;
    border: 0;
    background: transparent;
    color: inherit;
    opacity: .6;
    padding: .25rem;
    line-height: 1;
}

.cbp-fixedbar-title {
    font-weight: 600;
    padding-right: 2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cbp-fixedbar-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .25rem 1rem;
    font-size: .875rem;
}

.cbp-fixedbar-meta:empty,
.cbp-fixedbar-price:empty,
.cbp-fixedbar-delivery:empty {
    display: none;
}

/* Übernommenen Preisblock kompakt darstellen */
.cbp-fixedbar-price .price_wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 .5rem;
    margin: 0 !important;
}

/* "ab", Preis und Preishinweis (Grundpreis/MwSt.) bleiben sichtbar – nur Microdata-Tags ausblenden */
.cbp-fixedbar-price .price_wrapper > meta,
.cbp-fixedbar-price .price_wrapper > link,
.cbp-fixedbar-price .bulk-prices {
    display: none;
}

.cbp-fixedbar-price .price-note {
    font-size: .75rem;
    opacity: .85;
}

.cbp-fixedbar-price .price,
.cbp-fixedbar-price .h1 {
    font-size: 1rem !important;
    margin: 0;
    line-height: 1.3;
}

.cbp-fixedbar-actions {
    display: flex;
    gap: .5rem;
    margin-top: .375rem;
}

.cbp-fixedbar-actions .cbp-counter {
    flex: 0 0 8.5rem;
}

.cbp-fixedbar-submit,
.cbp-fixedbar-choose {
    flex: 1 1 auto;
    white-space: nowrap;
}

.cbp-fixedbar *:not(.btn):not(.form-control):not(.input-group-text) {
    color: inherit;
}

/* Platz schaffen, damit die Leiste keinen Footer-Inhalt verdeckt */
body.cbp-fixedbar-open {
    padding-bottom: var(--cbp-bar-height, 6rem);
}

/* Schwebende Buttons (Nach-oben, JTL-Consent, Händlerbund-Consent) über die Leiste schieben */
body.cbp-fixedbar-open .smoothscroll-top,
body.cbp-fixedbar-open #consent-manager.mini,
body.cbp-fixedbar-open .ccm-settings-summoner {
    bottom: calc(var(--cbp-bar-height, 6rem) + .75rem) !important;
    transition: bottom .3s ease;
}

.cbp-fixedbar-summary {
    font-weight: 600;
}

@media (min-width: 992px) {
    .cbp-fixedbar:not(.cbp-fixedbar--desktop) {
        display: none !important;
    }

    body.cbp-fixedbar-open:not(:has(.cbp-fixedbar--desktop)) {
        padding-bottom: 0;
    }

    /* Desktop-Variante (Variationsmatrix): eine Zeile, zentriert */
    .cbp-fixedbar--desktop {
        display: flex;
        align-items: center;
        gap: 1.5rem;
        padding-left: max(1rem, calc((100vw - 1250px) / 2));
        padding-right: max(3rem, calc((100vw - 1250px) / 2));
    }

    .cbp-fixedbar--desktop .cbp-fixedbar-title {
        flex: 0 1 auto;
        max-width: 40%;
    }

    .cbp-fixedbar--desktop .cbp-fixedbar-meta {
        flex: 1 1 auto;
    }

    .cbp-fixedbar--desktop .cbp-fixedbar-actions {
        margin-top: 0;
        flex: 0 0 auto;
    }

    .cbp-fixedbar--desktop .cbp-fixedbar-close {
        top: 50%;
        right: .75rem;
        transform: translateY(-50%);
    }
}

/* ---------- Listen-Matrix (viele Varianten) ---------- */

.cbp-matrix {
    border-top: 1px solid rgba(0, 0, 0, .08);
}

.cbp-mrow {
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr) auto 11rem;
    grid-template-areas: "img info price qty";
    align-items: center;
    gap: .25rem 1rem;
    padding: .5rem .25rem;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    transition: background-color .15s ease;
}

.cbp-mrow.is-selected {
    background-color: rgba(40, 167, 69, .07);
}

.cbp-mrow.has-error {
    background-color: rgba(220, 53, 69, .08);
}

.cbp-mrow.is-unavailable {
    opacity: .6;
}

.cbp-mrow-img {
    grid-area: img;
}

.cbp-mrow-img .square {
    margin: 0;
}

.cbp-mrow-info {
    grid-area: info;
    min-width: 0;
}

.cbp-mrow-name {
    font-weight: 600;
    display: block;
    overflow-wrap: anywhere;
}

.cbp-mrow-stock .delivery-status ul {
    margin: 0;
}

.cbp-mrow-price {
    grid-area: price;
    text-align: right;
    white-space: nowrap;
}

.cbp-mrow-price .price_wrapper {
    margin: 0 !important;
}

.cbp-mrow-price .price {
    font-size: 1rem;
    margin: 0;
}

.cbp-mrow-price .base-price,
.cbp-mrow-price .price-note {
    font-size: .75rem;
}

.cbp-mrow-qty {
    grid-area: qty;
}

.cbp-tier-hint {
    font-size: .75rem;
    color: #28a745;
    font-weight: 600;
}

.cbp-tier-hint:empty {
    display: none;
}

.cbp-mrow.cbp-tier-active .cbp-mrow-price .price {
    color: #28a745;
}

.bulk-prices tr.cbp-tier-current td {
    background-color: rgba(40, 167, 69, .12);
    font-weight: 600;
}

.cbp-matrix-total {
    font-weight: 600;
    padding-top: .5rem;
}

/* Mobil: Bild | Name/Lager, darunter Preis links neben dem Mengenfeld */
@media (max-width: 767.98px) {
    .cbp-mrow {
        grid-template-columns: 3rem minmax(0, 1fr) auto;
        grid-template-areas:
            "img info  info"
            "img price qty";
        gap: .375rem .75rem;
    }

    .cbp-mrow-price {
        text-align: left;
        white-space: normal;
    }

    .cbp-mrow-qty {
        justify-self: end;
        max-width: 11rem;
    }
}

/* iOS zoomt bei Fokus auf Felder < 16px */
@media (max-width: 991.98px) {
    .cbp-qty:focus {
        font-size: 16px;
    }
}

/* ---------- Fix: Galeriebild bei NOVA 5.2.x auf Shop 5.8 ----------
   Der Slider setzt die Slides auf display:block. Bei NOVA 5.2 ist das Slide selbst das
   .square-Element, dessen Bild-Container dann unter den Platzhalter rutscht (Bild unsichtbar). */
#gallery .square.slick-slide,
#gallery_preview .square.slick-slide {
    display: flex !important;
}
