/*
 * Custom Product Blocks – frontend styles.
 *
 * This file contains only plugin-owned layout and fallback rules. Visual
 * styling already defined by the Mirons child theme remains theme-owned.
 */

.cpb-block {
    margin: 0;
}

/* ── Outer Bestsellers carousel ───────────────────────────────────────────── */

.cpb-products-slider-wrap {
    position: relative;
}

.cpb-swiper-products {
    overflow: hidden;
}

.cpb-swiper-products > .swiper-wrapper {
    align-items: stretch;
}

.cpb-swiper-products > .swiper-wrapper > .swiper-slide {
    box-sizing: border-box;
    max-width: none;
}

.cpb-products-nav {
    display: contents;
}

.cpb-products-next {
    z-index: 20;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: #222;
}

.cpb-products-next.swiper-button-disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* ── Static Bestsellers grid ──────────────────────────────────────────────── */

.cpb-products-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: stretch;
}

.cpb-products-grid__item {
    display: flex;
    min-width: 0;
}

.cpb-products-grid__item > .cpb-card {
    width: 100%;
    max-width: none;
}

/* ── Product card ─────────────────────────────────────────────────────────── */

.cpb-card {
    position: relative;
    display: block;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #000;
}

.cpb-card:hover {
    box-shadow: none;
    transform: none;
}

.cpb-card > a {
    color: inherit;
    text-decoration: none;
}

/* ── Per-product image carousel ───────────────────────────────────────────── */

.cpb-card__slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: transparent;
}

.cpb-card__slider > .swiper-wrapper {
    align-items: stretch;
}

.cpb-card__slider .swiper-slide {
    display: block;
    overflow: hidden;
}

.cpb-card__slider .swiper-slide img {
    display: block;
    width: 100%;
    max-width: 100%;
    object-fit: initial;
}

.cpb-card:hover .cpb-card__slider .swiper-slide.swiper-slide-active img {
    transform: none;
}

.cpb-card__slider .swiper-button-prev,
.cpb-card__slider .swiper-button-next {
    background: transparent;
}

.cpb-card__slider .swiper-button-prev::after,
.cpb-card__slider .swiper-button-next::after {
    font-size: 20px;
    font-weight: 400;
}

.cpb-card__slider .swiper-pagination {
    bottom: 5px;
}

.cpb-card__slider .swiper-pagination-bullet {
    margin: 0 4px;
    background: transparent;
    opacity: 1;
}

/* ── Sale badge ───────────────────────────────────────────────────────────── */

.cpb-badge {
    left: auto;
    display: block;
    border-radius: 0;
    color: #000;
    font-weight: 400;
    line-height: 1.5;
    text-transform: none;
}

.cpb-badge--sale {
    color: #000;
}

/* ── Card body ────────────────────────────────────────────────────────────── */

.cpb-card__body {
    display: block;
    padding: 0;
    color: #000;
}

.cpb-card__title {
    margin-top: 0;
    margin-right: 0;
    margin-left: 0;
    padding: 0;
    color: #000;
    font-weight: 400;
    line-height: 1.2;
}

.cpb-card__price {
    margin-top: 0;
    margin-right: 0;
    margin-left: 0;
    padding: 0;
    color: #000;
    font-weight: 400;
    line-height: 1.5;
}

.cpb-card__price del {
    margin: 0;
    color: #000;
    font-weight: 400;
}

.cpb-card__price ins {
    color: #000;
    text-decoration: none;
}

/* ── Hand-picked Products ────────────────────────────────────────────────── */

.cpb-handpicked-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 3%;
    width: 100%;
    max-width: 100%;
    padding: 0;
    list-style: none;
}

.cpb-handpicked-grid__item {
    box-sizing: border-box;
    width: 48.5%;
    margin: 0;
    padding: 0;
}

.cpb-handpicked-grid .cpb-card {
    width: 100%;
    max-width: none;
}

.cpb-handpicked-grid .cpb-card__slider {
    aspect-ratio: 2 / 3;
}

.cpb-handpicked-grid .cpb-card__slider > img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Retained for v2.0 markup while cached pages are refreshed. */

.cpb-featured-product .cpb-card__slider > img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: initial;
}

.cpb-featured-product .cpb-card:hover .cpb-card__slider > img {
    transform: none;
}

/* ── Empty state ───────────────────────────────────────────────────────────── */

.cpb-no-products {
    padding: 2em;
    color: #646970;
    font-style: italic;
    text-align: center;
}

.cpb-no-products--error {
    color: #b32d2e;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .cpb-products-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .cpb-products-grid .cpb-card {
        max-width: none;
    }
}
