.mg-recently-viewed-plugin {
    position: relative;
    margin: 40px 0 20px 0;
    padding: 0 10px;
}

.hide-slider {
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

/* Заголовок секции */
.mg-recently-viewed-plugin h2 {
    font-weight: 700;
    font-size: 18px;
    margin: 0 0 20px 0;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #0f172a;
    display: block;
}

.mg-recently-viewed-plugin h2 .custom-arrow {
    display: none;
}

.mg-recently-viewed-plugin .bx-viewport {
    overflow: hidden !important;
    padding: 6px 0 !important;
}

/* Карточка товара */
.mg-recently-product-wrapper {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 10px 14px 10px;
    box-sizing: border-box;
    text-align: center;
    min-height: 300px;
    height: 100%;
    margin: 0 auto;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mg-recently-product-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

/* Блок картинки — чистый, без теней */
.mg-recently-viewed .mg-recently-product-image a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    height: 125px;
    text-align: center;
    position: relative;
    margin-bottom: 8px;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

.mg-recently-viewed .mg-recently-product-image a img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    width: auto;
    height: auto;
    margin: auto;
    box-shadow: none !important;
    filter: none !important;
    background: transparent !important;
}

/* Название товара: строго 2 строки с центрированием и многоточием */
.mg-recently-viewed .mg-recently-product-name {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 38px !important;
    max-height: 38px !important;
    margin: 0 0 10px 0 !important;
    overflow: hidden;
}

.mg-recently-viewed .mg-recently-product-name a {
    color: #1e293b;
    font-size: 12.5px;
    line-height: 1.35;
    font-weight: 500;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s ease;
}

.mg-recently-viewed .mg-recently-product-name a:hover {
    color: #0088cc;
    text-decoration: none;
}

/* Блок цены — прижимается к низу на единый уровень */
.mg-recently-viewed .mg-recently-product-price,
.mg-recently-viewed .mg-recently-product-wrapper .product-price {
    margin-top: auto !important;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: #D21919;
    font-size: 16px;
    font-weight: 700;
    display: block;
    text-align: center;
    height: 24px;
    line-height: 24px;
    margin-bottom: 10px !important;
}

/* Кнопка "Добавить / В корзине" */
.mg-recently-viewed .addToCart,
.mg-recently-viewed .product-info {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #0088cc !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    text-shadow: none !important;
    box-shadow: none !important;
    width: calc(100% - 8px) !important;
    margin: 0 auto !important;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.mg-recently-viewed .addToCart:hover,
.mg-recently-viewed .product-info:hover {
    background: #0077b3 !important;
    color: #ffffff !important;
}

.mg-recently-viewed .addToCart:active,
.mg-recently-viewed .product-info:active {
    transform: scale(0.98);
}

/* Стрелки слайдера BX-Slider */
.mg-recently-viewed-plugin .bx-prev,
.mg-recently-viewed-plugin .bx-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #ffffff !important;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    display: block;
    z-index: 10;
    text-indent: -999999px;
}

.mg-recently-viewed-plugin .bx-prev {
    left: -12px;
}

.mg-recently-viewed-plugin .bx-next {
    right: -12px;
}

@media (max-width: 640px) {
    .mg-recently-viewed-plugin .bx-prev { left: 0; }
    .mg-recently-viewed-plugin .bx-next { right: 0; }
}
/* 1. Жестко скрываем слайдер ДО инициализации JavaScript */
.mg-recently-viewed.hide-slider,
.mg-recently-viewed-plugin .hide-slider,
.mg-recently-viewed-plugin ul.mg-recently-viewed:not(.bxslider) {
    opacity: 0 !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

/* 2. Плавное появление слайдера после запуска bxSlider */
.mg-recently-viewed-plugin .bx-wrapper,
.mg-recently-viewed-plugin .bx-viewport {
    opacity: 1 !important;
    visibility: visible !important;
    height: auto !important;
    transition: opacity 0.25s ease-in-out;
}

/* 3. Предотвращаем вертикальное схлопывание списка */
.mg-recently-viewed-plugin ul.mg-recently-viewed {
    display: flex;
    flex-wrap: nowrap;
    overflow: hidden;
    list-style: none;
    margin: 0;
    padding: 0;
}