/* Premium Top Deals recently viewed slider */

.recently-viewed-section {
    width: min(1460px, calc(100% - 32px));
    margin: 14px auto 30px;
    padding: 0;
}

.recently-viewed-container {
    position: relative;
    padding: 22px 16px 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, #7c1ff2 0%, #8b35f4 48%, #b877ff 100%);
    box-shadow: 0 22px 54px rgba(124, 31, 242, 0.3);
    overflow: hidden;
}

.recently-viewed-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 14% 18%, rgba(255, 255, 255, 0.16), transparent 34%),
        radial-gradient(circle at 88% 92%, rgba(255, 255, 255, 0.18), transparent 32%);
    pointer-events: none;
}

.recently-viewed-header {
    position: relative;
    z-index: 2;
    margin: 0 0 18px;
    padding: 0 0 0 0;
}

.recently-viewed-title {
    margin: 0;
    color: #fff;
    font-size: clamp(22px, 2.4vw, 30px);
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: 0;
    text-shadow: 0 4px 14px rgba(30, 10, 80, 0.2);
}

.recently-viewed-carousel {
    position: relative;
    z-index: 2;
}

.carousel-track-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 0 34px 0 0;
}

.carousel-track-wrapper::-webkit-scrollbar {
    display: none;
}

.carousel-track {
    display: flex;
    gap: 14px;
    align-items: stretch;
}

.recently-viewed-card {
    flex: 0 0 calc((100% - 56px) / 5);
    max-width: 280px;
    min-width: 210px;
    scroll-snap-align: start;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(31, 18, 74, 0.16);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.recently-viewed-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 36px rgba(31, 18, 74, 0.22);
}

.recently-viewed-link {
    display: block;
    height: 100%;
    padding: 6px 6px 8px;
    color: inherit;
    text-decoration: none;
}

.recently-viewed-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 0.98;
    overflow: hidden;
    border-radius: 10px;
    background: #f8fafc;
}

.recently-viewed-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.32s ease;
}

.recently-viewed-card:hover .recently-viewed-image img {
    transform: scale(1.04);
}

.rv-product-name {
    margin: 7px 2px 0;
    color: #5b6575;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rv-discount-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    box-shadow: 0 8px 16px rgba(22, 163, 74, 0.28);
}

.carousel-nav {
    position: absolute;
    top: 50%;
    z-index: 4;
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.98);
    color: #2b2f38;
    font-size: 23px;
    cursor: pointer;
    box-shadow: 0 14px 30px rgba(31, 18, 74, 0.22);
    transform: translateY(-50%);
    transition: opacity 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.carousel-prev {
    left: 8px;
}

.carousel-next {
    right: 8px;
}

.carousel-nav:hover:not(:disabled) {
    transform: translateY(-50%) scale(1.04);
    box-shadow: 0 18px 34px rgba(31, 18, 74, 0.28);
}

.carousel-nav:disabled {
    opacity: 0;
    pointer-events: none;
}

body.dark-mode .recently-viewed-card {
    background: #162036;
}

body.dark-mode .rv-product-name {
    color: #e5edf8;
}

body.dark-mode .recently-viewed-image {
    background: #0f172a;
}

@media (max-width: 1220px) {
    .recently-viewed-card {
        flex-basis: calc((100% - 42px) / 4);
    }
}

@media (max-width: 920px) {
    .recently-viewed-card {
        flex-basis: calc((100% - 28px) / 3);
    }
}

@media (max-width: 680px) {
    .recently-viewed-section {
        width: min(100% - 20px, 1460px);
        margin-top: 12px;
    }

    .recently-viewed-container {
        padding: 18px 12px 14px;
        border-radius: 16px;
    }

    .recently-viewed-card {
        flex-basis: calc((100% - 12px) / 2);
        min-width: 160px;
    }

    .carousel-track {
        gap: 12px;
    }

    .carousel-nav {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }
}

@media (max-width: 430px) {
    .recently-viewed-card {
        flex-basis: 78%;
        max-width: none;
    }

    .rv-product-name {
        font-size: 15px;
    }
}
