/* Klemmshop Produktübersicht v1.9
   Ziel: Karten-Proportionen wie in der neuen Produktsuche.
   - große, fast quadratische Bildfläche
   - vier breite Karten mit kleinen Zwischenräumen
   - kompakter Informationsblock
   - 2. Bild beim Hover + komplette Bildergalerie
*/

/* ----------------------------------------------------------
   GRID: weniger Bootstrap-Gutter = sichtbar breitere Karten
   ---------------------------------------------------------- */
#product-list.product-list.layout-gallery {
    margin-left: -5px !important;
    margin-right: -5px !important;
}

#product-list.product-list.layout-gallery > .product-wrapper {
    display: flex !important;
    padding-left: 5px !important;
    padding-right: 5px !important;
    margin-bottom: 10px !important;
    min-width: 0 !important;
}

#product-list.product-list.layout-gallery > .product-wrapper > * {
    width: 100% !important;
}

/* ----------------------------------------------------------
   CARD
   ---------------------------------------------------------- */
#product-list.layout-gallery .productbox.productbox-column {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
    border: 1px solid #dfe4e2 !important;
    border-radius: 8px !important;
    background: #fff !important;
    box-shadow: none !important;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

#product-list.layout-gallery .productbox.productbox-column:hover {
    transform: translateY(-2px);
    border-color: #cfd7d2 !important;
    box-shadow: 0 8px 24px rgba(23, 39, 31, .08) !important;
}

#product-list.layout-gallery .productbox.productbox-column .productbox-inner,
#product-list.layout-gallery .productbox.productbox-column .productbox-inner > .row {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
}

#product-list.layout-gallery .productbox.productbox-column .productbox-inner > .row > [class*="col-"] {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
}

#product-list.layout-gallery .productbox.productbox-column .productbox-image {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
}

/* ----------------------------------------------------------
   GALLERY: gleiche dominante Bildzone wie in der Suche
   ---------------------------------------------------------- */
.ks-product-gallery {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden;
    background: #fff;
    border-bottom: 1px solid #e5e9e7;
    isolation: isolate;
}

.ks-product-gallery__link,
.ks-product-gallery__viewport,
.ks-product-gallery__slide {
    display: block;
    width: 100%;
    height: 100%;
}

.ks-product-gallery__viewport {
    position: relative;
    overflow: hidden;
}

.ks-product-gallery__slide {
    position: absolute;
    inset: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 8px !important;
    opacity: 0;
    visibility: hidden;
    transform: scale(.99);
    transition: opacity .18s ease, transform .22s ease, visibility .18s ease;
}

.ks-product-gallery__slide.is-active {
    z-index: 1;
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

#product-list.layout-gallery .productbox .ks-product-gallery__slide img,
#product-list.layout-gallery .productbox .productbox-image .ks-product-gallery__slide img {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 94% !important;
    max-height: 94% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: auto !important;
    padding: 0 !important;
    object-fit: contain !important;
    object-position: center !important;
}

.ks-product-gallery__nav {
    position: absolute;
    z-index: 6;
    top: 50%;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(48, 58, 53, .12);
    border-radius: 50%;
    color: #34413b;
    background: rgba(255,255,255,.95);
    box-shadow: 0 3px 12px rgba(0,0,0,.10);
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity .16s ease, transform .16s ease;
}

.ks-product-gallery__nav span {
    display: block;
    font-size: 25px;
    line-height: 29px;
    transform: translateY(-1px);
}

.ks-product-gallery__nav--prev { left: 8px; }
.ks-product-gallery__nav--next { right: 8px; }

.ks-product-gallery:hover .ks-product-gallery__nav,
.ks-product-gallery__nav:focus-visible {
    opacity: 1;
}

.ks-product-gallery__nav:hover,
.ks-product-gallery__nav:focus-visible {
    transform: translateY(-50%) scale(1.04);
}

/* Wie im Suchergebnis: heller Bildzähler unten rechts. */
.ks-product-gallery__counter {
    position: absolute;
    z-index: 5;
    right: 7px;
    bottom: 7px;
    padding: 3px 7px;
    border: 1px solid rgba(31,42,36,.08);
    border-radius: 999px;
    color: #39453f;
    background: rgba(255,255,255,.94);
    box-shadow: 0 1px 5px rgba(0,0,0,.05);
    font-size: 10px;
    line-height: 1.2;
    pointer-events: none;
}

/* ----------------------------------------------------------
   INFOBLOCK: Reihenfolge/Proportionen wie neue Produktsuche
   ---------------------------------------------------------- */
#product-list.layout-gallery .ks-product-card__content {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 210px !important;
    height: auto !important;
    padding: 12px 13px 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

#product-list.layout-gallery .ks-product-card__manufacturer {
    margin: 0 0 5px !important;
    overflow: hidden;
    color: #66706b;
    font-size: 10.5px !important;
    line-height: 1.2 !important;
    font-weight: 500 !important;
    letter-spacing: .035em;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#product-list.layout-gallery .ks-product-card__title,
#product-list.layout-gallery .ks-product-card__title a {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

#product-list.layout-gallery .ks-product-card__title {
    min-height: 40px !important;
    margin: 0 0 5px !important;
    font-size: 15px !important;
    line-height: 1.28 !important;
    font-weight: 700 !important;
}

#product-list.layout-gallery .ks-product-card__title a,
#product-list.layout-gallery .ks-product-card__title .text-clamp-2 {
    display: -webkit-box !important;
    overflow: hidden !important;
    color: #3e4541 !important;
    line-height: 1.28 !important;
    text-decoration: none !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    overflow-wrap: anywhere;
}

#product-list.layout-gallery .ks-product-card__title a:hover {
    color: #1e6840 !important;
}

#product-list.layout-gallery .ks-product-card__sku {
    margin: 0 0 8px !important;
    overflow: hidden;
    color: #6e7772;
    font-size: 10.5px !important;
    line-height: 1.25 !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#product-list.layout-gallery .ks-product-card__description {
    display: block !important;
    width: 100% !important;
    margin: 0 0 10px !important;
    overflow: hidden !important;
    color: #656e69;
    font-size: 11px !important;
    line-height: 1.3 !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#product-list.layout-gallery .ks-product-card__delivery {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 31px !important;
    margin: auto 0 7px !important;
    overflow: hidden !important;
    color: #68716c;
    font-size: 11px !important;
    line-height: 1.25 !important;
    text-align: left !important;
    white-space: normal !important;
}

#product-list.layout-gallery .ks-product-card__delivery * {
    max-width: 100% !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    font-size: inherit !important;
    line-height: inherit !important;
}

#product-list.layout-gallery .ks-product-card__price {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 0 10px !important;
    padding: 0 !important;
    overflow: hidden !important;
    line-height: 1.1 !important;
}

#product-list.layout-gallery .ks-product-card__price .price_wrapper,
#product-list.layout-gallery .ks-product-card__price .price,
#product-list.layout-gallery .ks-product-card__price .price.h1,
#product-list.layout-gallery .ks-product-card__price .price.h2,
#product-list.layout-gallery .ks-product-card__price .price.h3 {
    margin: 0 !important;
    color: #444b47 !important;
    font-size: 17px !important;
    line-height: 1.1 !important;
    font-weight: 700 !important;
    white-space: nowrap;
}

/* Warenkorb bleibt erhalten, sitzt aber kompakt am Kartenende. */
#product-list.layout-gallery .ks-product-card__actions {
    width: calc(100% + 26px) !important;
    max-width: calc(100% + 26px) !important;
    margin: 0 -13px !important;
    box-sizing: border-box !important;
}

#product-list.layout-gallery .ks-product-card__actions .btn {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 7px 10px !important;
    border-radius: 0 0 7px 7px !important;
    font-size: 12px !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
}

#product-list.layout-gallery .ks-product-card__cart.btn,
#product-list.layout-gallery .ks-product-card__cart.btn-primary,
#product-list.layout-gallery .ks-product-card__cart.btn-primary:not(:disabled):not(.disabled) {
    color: #fff !important;
    background: #1e6840 !important;
    border-color: #1e6840 !important;
}

#product-list.layout-gallery .ks-product-card__cart.btn:hover,
#product-list.layout-gallery .ks-product-card__cart.btn:focus,
#product-list.layout-gallery .ks-product-card__cart.btn:active {
    color: #fff !important;
    background: #185735 !important;
    border-color: #185735 !important;
}

#product-list.layout-gallery .ks-product-card__cart.btn *,
#product-list.layout-gallery .ks-product-card__cart.btn-primary * {
    color: #fff !important;
    fill: currentColor !important;
}

/* NOVA Quick-Actions / Badges sauber innerhalb der Card. */
#product-list.layout-gallery .productbox.productbox-column .productbox-quick-actions {
    z-index: 9;
    top: 10px;
    right: 10px;
}

#product-list.layout-gallery .productbox.productbox-column .ribbon {
    z-index: 8;
    left: 0 !important;
    max-width: calc(100% - 8px);
}

/* ----------------------------------------------------------
   LISTENANSICHT: bestehende JTL-Details erhalten
   ---------------------------------------------------------- */
.is-item-list .productbox.productbox-row {
    overflow: hidden;
    border: 1px solid #dfe4e2;
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
}

.productbox-row .ks-product-gallery--list {
    border-radius: 7px;
}

/* ----------------------------------------------------------
   RESPONSIVE
   ---------------------------------------------------------- */
@media (max-width: 1199.98px) {
    #product-list.product-list.layout-gallery {
        margin-left: -4px !important;
        margin-right: -4px !important;
    }
    #product-list.product-list.layout-gallery > .product-wrapper {
        padding-left: 4px !important;
        padding-right: 4px !important;
        margin-bottom: 8px !important;
    }
    #product-list.layout-gallery .ks-product-card__title {
        font-size: 14px !important;
    }
}

@media (max-width: 767.98px) {
    #product-list.layout-gallery .ks-product-card__content {
        min-height: 190px !important;
        padding: 10px 10px 0 !important;
    }
    #product-list.layout-gallery .ks-product-card__actions {
        width: calc(100% + 20px) !important;
        max-width: calc(100% + 20px) !important;
        margin-left: -10px !important;
        margin-right: -10px !important;
    }
    .ks-product-gallery__nav {
        width: 32px;
        height: 32px;
        opacity: .85;
    }
}

@media (prefers-reduced-motion: reduce) {
    #product-list.layout-gallery .productbox.productbox-column,
    .ks-product-gallery__slide,
    .ks-product-gallery__nav {
        transition: none;
    }
}
