/* =========================================================
   Карточка товара (custom-product-card)
   ---------------------------------------------------------
   Общие стили карточки, используемой во всех местах сайта:
   - каталог (catalog.section/main),
   - слайдеры товаров (catalog.section/slider),
   - корзина, избранное, поиск и т.п.

   Подключается один раз в header.php шаблона сайта
   через Asset::getInstance()->addCss(...).
   ========================================================= */

.custom-product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem;
    /* border: 1px solid #eaeaea; */
    border: 1px solid #f1f1f1;
    background: #fff;
    box-sizing: border-box;
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}

.custom-product-card:hover {
    border-color: #ddd;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.custom-product-card__image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 3 / 4;
    margin-bottom: 14px;
    overflow: hidden;
    background: #fafafa;
    text-decoration: none;
}

.custom-product-card__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.custom-product-card__info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 auto;
}

.custom-product-card__brand {
    display: inline-flex;
    align-items: center;
    height: 28px;
    color: #888;
    font-size: 12px;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.custom-product-card__brand-logo {
    display: block;
    max-width: 100px;
    max-height: 28px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Текст, скрытый визуально, но доступный для поисковиков и скринридеров */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

@media (max-width: 991.5px) {
    .custom-product-card__brand {
        height: 24px;
    }

    .custom-product-card__brand-logo {
        max-width: 80px;
        max-height: 24px;
    }
}

.custom-product-card__title {
    color: #222;
    font-size: 15px;
    line-height: 1.35;
    text-decoration: none;
    font-weight: 600;
}

.custom-product-card__title:hover {
    text-decoration: underline;
}

.custom-product-card__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.custom-product-card__prices {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.custom-product-card__price {
    color: #111;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;
    white-space: nowrap;
}

/* ===== Кнопка "В корзину" / "+" ===== */
.custom-product-card__basket-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid #eaeaea;
    background: #fff;
    color: #000;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    box-sizing: border-box;
    transition: background .2s ease, transform .2s ease, opacity .2s ease;
}

.custom-product-card__basket-btn:hover {
    border: 1px solid #000;
}

.custom-product-card__basket-btn:active {
    transform: translateY(0);
    opacity: 0.9;
}

/* ===== Счётчик количества (− N +) ===== */
.js-cart-qty-block {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: flex-end;
}

.js-cart-qty-block .js-qty-minus,
.js-cart-qty-block .js-qty-plus {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #eaeaea;
    background: #fff;
    color: #000;
    cursor: pointer;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    box-sizing: border-box;
}

.js-cart-qty-block .js-qty-minus:hover,
.js-cart-qty-block .js-qty-plus:hover {
    border: 1px solid #000;
}

.custom-product-card__qty-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 40px;
    color: #222;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
}

/* ===== Состояние "достигнут максимальный остаток" ===== */
.custom-product-card__basket-btn.is-max,
.custom-product-card__basket-btn:disabled,
.js-cart-qty-block .js-qty-plus.is-max,
.js-cart-qty-block .js-qty-plus:disabled {
    color: #eaeaea;
    border-color: #eaeaea;
    background: #fff;
    cursor: not-allowed;
    pointer-events: none;
}

.custom-product-card__basket-btn.is-max:hover,
.custom-product-card__basket-btn:disabled:hover,
.js-cart-qty-block .js-qty-plus.is-max:hover,
.js-cart-qty-block .js-qty-plus:disabled:hover {
    border-color: #eaeaea;
    background: #fff;
}

/* ===== Адаптив ===== */
@media (max-width: 991.5px) {
    .custom-product-card {
        padding: 8px;
        /* border-radius: 14px; */
    }

    .custom-product-card__title {
        font-size: 14px;
    }

    .custom-product-card__bottom {
        flex-direction: column;
        margin-top: 0.5rem;
        gap: 8px;

}

    .custom-product-card__price {
        font-size: 16px;
    }

    .custom-product-card__basket-btn,
    .js-cart-qty-block .js-qty-minus,
    .js-cart-qty-block .js-qty-plus,
    .custom-product-card__qty-value {
        height: 36px;
    }

    .custom-product-card__basket-btn,
    .js-cart-qty-block .js-qty-minus,
    .js-cart-qty-block .js-qty-plus {
        min-width: 36px;
        /* border-radius: 10px; */
    }
    .custom-product-card__image {
    margin-bottom: 8px;
    }
}

/* ===== Бейджи на изображении ===== */
.custom-product-card__image {
    position: relative;
    /* display: block; */
}

.custom-product-card__badges {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    gap: 4px;
    z-index: 2;
}

.product-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.4rem;
    padding: 0 5px;
    font-size: 0.75;
    /* font-weight: 700; */
    line-height: 1;
    letter-spacing: .02em;
    color: #fff;
    white-space: nowrap;
}

.product-badge--sale {
    background: #000;
}

.product-badge--discount {
    background: #DA251E;
}

/* ===== Цены ===== */
.custom-product-card__prices {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.2;
}

.custom-product-card__old-price {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
}

.custom-product-card__price {
    font-size: 18px;
    font-weight: 700;
    color: #000;
}
/* ===== Бейджи на изображении ===== */


/* ===== Анти-скачок Swiper (до инициализации JS) ===== */

/* Пока Swiper не инициализирован, задаём слайдам стартовую ширину,
   чтобы первый слайд не растягивался на весь контейнер */
.products-slider__swiper:not(.swiper-initialized) .swiper-wrapper {
    display: flex;
    gap: 16px;               /* примерно как spaceBetween в конфиге Swiper */
}

.products-slider__swiper:not(.swiper-initialized) .swiper-slide {
    flex: 0 0 auto;
    width: calc((100% - 16px * 4) / 5);   /* 5 слайдов на десктопе */
    box-sizing: border-box;
}

/* Прячем «хвост», который вылезает за пределы контейнера до инициализации */
.products-slider__swiper:not(.swiper-initialized) {
    overflow: hidden;
}

/* Планшет — 3 слайда */
@media (max-width: 991.5px) {
    .products-slider__swiper:not(.swiper-initialized) .swiper-slide {
        width: calc((100% - 16px * 2) / 3);
    }
}

/* Мобильные — 2 слайда */
@media (max-width: 575px) {
    .products-slider__swiper:not(.swiper-initialized) .swiper-slide {
        width: calc((100% - 16px) / 2);
    }
}

/* =========================================================
   Карусель картинок в карточке товара
   ========================================================= */

.custom-product-card__slides {
    position: relative;
    width: 100%;
    height: 100%;
}

.custom-product-card__slide {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity .25s ease;
    pointer-events: none;
}

.custom-product-card__slide.is-active {
    opacity: 1;
    position: relative;
    pointer-events: auto;
}

.custom-product-card__image.has-gallery {
    cursor: pointer;
}

/* Точки-индикаторы */
.custom-product-card__dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8px;
    display: flex;
    justify-content: center;
    gap: 5px;
    z-index: 3;
    pointer-events: none;
}

.custom-product-card__dot {
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.05);
    transition: background .2s ease;
}

.custom-product-card__dot.is-active {
    background: rgba(0, 0, 0, 0.4);
}

@media (max-width: 991.5px) {
    .custom-product-card__dot {
        width: 14px;
    }
}