.recent-products {
    --rp-bg: #ffffff;
    --rp-card: #ffffff;
    --rp-text: #1a2332;
    --rp-text-muted: #7a8494;
    --rp-border: #e8ecf1;
    --rp-price-bg: #f3f5f8;
    --rp-focus: #2563eb;
    --rp-shadow: 0 12px 28px rgba(26, 35, 50, 0.1);
    --rp-gap: 14px;
    --rp-card-width: calc((100% - (var(--rp-gap) * 4)) / 5.2);
    --rp-radius: 12px;
    box-sizing: border-box;
    width: 100%;
    max-width: 1300px;
    margin: 48px auto;
    padding: 0 16px;
    color: var(--rp-text);
    font-family: "Manrope", "Segoe UI", sans-serif;
}

.recent-products *,
.recent-products *::before,
.recent-products *::after {
    box-sizing: border-box;
}

.recent-products.is-hidden,
.recent-products[hidden] {
    display: none !important;
}

.recent-products.is-visible {
    display: block;
    animation: rp-fade-in 0.35s ease both;
}

.recent-products__inner {
    background: var(--rp-bg);
    padding: 0;
    border: 0;
}

.recent-products__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.recent-products__controls {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.recent-products__clear {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--rp-text-muted);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.recent-products__clear:hover {
    color: var(--rp-text);
}

.recent-products__nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.recent-products__nav-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--rp-border);
    border-radius: 50%;
    background: #fff;
    color: var(--rp-text);
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(26, 35, 50, 0.04);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.recent-products__nav-btn svg {
    width: 18px;
    height: 18px;
}

.recent-products__nav-btn:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #c9d2de;
    box-shadow: 0 4px 10px rgba(26, 35, 50, 0.08);
}

.recent-products__nav-btn:disabled {
    opacity: 0.32;
    cursor: default;
    box-shadow: none;
}

.recent-products__clear:focus-visible,
.recent-products__link:focus-visible,
.recent-products .product a.title:focus-visible,
.recent-products__nav-btn:focus-visible {
    outline: 2px solid var(--rp-focus);
    outline-offset: 3px;
}

.recent-products__viewport.catalog-section.category {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
}

.recent-products__viewport.catalog-section.category .recent-products__track {
    display: flex;
}

.recent-products__card.product {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 0 0 var(--rp-card-width);
    width: var(--rp-card-width);
    min-width: var(--rp-card-width);
    max-width: none;
    margin: 0;
    float: none;
}

.recent-products__track {
    display: flex;
    align-items: stretch;
    gap: var(--rp-gap);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 6px 2px 14px;
    scrollbar-width: none;
}

.recent-products__track::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.recent-products__card {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 0 0 var(--rp-card-width);
    width: var(--rp-card-width);
    min-width: var(--rp-card-width);
    height: auto;
    scroll-snap-align: start;
    background: var(--rp-card);
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    opacity: 0;
    transform: translateY(10px);
    animation: rp-card-in 0.4s ease forwards;
}

.recent-products__card:nth-child(1) { animation-delay: 0.04s; }
.recent-products__card:nth-child(2) { animation-delay: 0.08s; }
.recent-products__card:nth-child(3) { animation-delay: 0.12s; }
.recent-products__card:nth-child(4) { animation-delay: 0.16s; }
.recent-products__card:nth-child(5) { animation-delay: 0.2s; }

.recent-products__card:hover {
    transform: translateY(-5px);
    border-color: #d5dbe4;
    box-shadow: var(--rp-shadow);
}

.recent-products__card--skeleton {
    pointer-events: none;
    opacity: 1;
    transform: none;
    animation: none;
}

.recent-products__media {
    position: relative;
    aspect-ratio: 1 / 1;
    width: 100%;
    background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
    overflow: hidden;
    border-bottom: 1px solid var(--rp-border);
}

.recent-products__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 14px;
    transition: transform 0.3s ease;
}

.recent-products__card:hover .recent-products__media img {
    transform: scale(1.03);
}

.recent-products__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 14px 14px 16px;
    min-height: 168px;
    background: #fff;
}

.recent-products .product .title,
.recent-products .product a.title,
.recent-products__card .title,
.recent-products__card a.title {
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
    text-overflow: ellipsis;
    min-height: 2.6em;
    max-height: 2.6em;
    margin: 0 0 10px !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
    letter-spacing: 0 !important;
    text-align: left !important;
    text-transform: none !important;
    color: var(--card-text, #1a2332) !important;
    text-decoration: none !important;
    transition: color 0.2s ease;
}

.recent-products .product a.title:hover,
.recent-products__card a.title:hover {
    color: #0b1220 !important;
    text-decoration: none !important;
}

.recent-products__props {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
}

.recent-products__prop {
    display: block;
    padding: 7px 0;
    border-top: 1px solid #eef2f6;
    font-size: 0.8rem;
    line-height: 1.4;
}

.recent-products__prop:last-child {
    border-bottom: 1px solid #eef2f6;
}

.recent-products__prop-label {
    color: #6f7a8a;
    font-weight: 400;
}

.recent-products__prop-value {
    color: #1a2332;
    font-weight: 700;
}

.recent-products__price-box {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--rp-price-bg);
    border: 1px solid #e7ebf0;
    color: inherit;
    line-height: 1.3;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.recent-products__card:hover .recent-products__price-box {
    background: #eef1f5;
    border-color: #dde3ea;
}

.recent-products__price-label {
    color: #7a8494;
    font-weight: 500;
    font-size: 0.82rem;
}

.recent-products__price-value {
    color: #1a2332;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.recent-products__empty {
    margin: 8px 0 0;
    padding: 22px;
    text-align: center;
    color: var(--rp-text-muted);
    font-size: 0.98rem;
    border: 1px dashed var(--rp-border);
    border-radius: var(--rp-radius);
    background: #fafbfc;
}

.skeleton-block,
.skeleton-line,
.skeleton-button {
    background: linear-gradient(
        90deg,
        #f1f5f9 0%,
        #e2e8f0 50%,
        #f1f5f9 100%
    );
    background-size: 200% 100%;
    animation: rp-shimmer 1.2s linear infinite;
    border-radius: 6px;
}

.skeleton-block {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 0;
    border-bottom: 1px solid var(--rp-border);
}

.skeleton-line {
    height: 14px;
    margin-bottom: 12px;
}

.skeleton-line--sm { width: 42%; }
.skeleton-line--lg { width: 92%; height: 18px; }
.skeleton-line--md { width: 78%; }
.skeleton-line--price { width: 100%; height: 44px; margin-top: 8px; border-radius: 10px; }

.skeleton-button {
    display: none;
}

@keyframes rp-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rp-card-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rp-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (max-width: 1100px) {
    .recent-products {
        --rp-card-width: calc((100% - (var(--rp-gap) * 2)) / 3.2);
    }
}

@media (max-width: 900px) {
    .recent-products {
        --rp-card-width: calc((100% - var(--rp-gap)) / 2.2);
    }
}

@media (max-width: 640px) {
    .recent-products {
        --rp-card-width: 78%;
        margin: 28px auto;
        padding: 0 12px;
        --rp-radius: 10px;
    }

    .recent-products__header {
        flex-wrap: wrap;
        gap: 12px;
        margin-bottom: 16px;
    }

    .recent-products__controls {
        width: 100%;
        justify-content: space-between;
    }

    .recent-products__body {
        padding: 12px 12px 14px;
        min-height: 150px;
    }

    .recent-products .product .title,
    .recent-products .product a.title,
    .recent-products__card .title,
    .recent-products__card a.title {
        font-size: 14px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .recent-products,
    .recent-products__card,
    .recent-products__clear,
    .recent-products__media img,
    .skeleton-block,
    .skeleton-line {
        animation: none !important;
        transition: none !important;
    }

    .recent-products__card {
        opacity: 1;
        transform: none;
    }

    .recent-products__card:hover .recent-products__media img {
        transform: none;
    }
}
