#related-products-widget,
[data-related-products-widget] {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    color: #1f2937;
    font-size: 16px;
}

.rpw-bestsellers-anchor {
    margin-top: 0;
    margin-bottom: 40px;
    width: 100%;
    clear: both;
}

.rpw-related-anchor {
    margin-top: 40px;
    margin-bottom: 40px;
    width: 100%;
    clear: both;
}

.rpw-similar-anchor {
    margin-top: 40px;
    margin-bottom: 40px;
    width: 100%;
    clear: both;
}

.rpw-container {
    --rpw-primary: #2563eb;
    --rpw-border: #e5e7eb;
    --rpw-bg: #ffffff;
    --rpw-radius: 12px;
    background-color: var(--rpw-bg);
}

.rpw-container a,
.rpw-container a:hover,
.rpw-container a:focus,
.rpw-container a:focus-visible {
    text-decoration: none !important;
}

.rpw-container .rpw-category-link,
.rpw-container .rpw-category-link:hover,
.rpw-container .rpw-category-link:focus,
.rpw-container .rpw-category-link:focus-visible {
    text-decoration: underline !important;
}

.rpw-header {
    margin-bottom: 24px;
}

.rpw-title {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
}

.rpw-icon {
    font-size: 24px;
    display: none;
}

.rpw-subtitle {
    color: #6b7280;
    font-size: 15px;
    margin: 0;
    display: none;
}

.rpw-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.rpw-category-list {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.rpw-category-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.rpw-category-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.rpw-category-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
}

.rpw-category-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--rpw-primary);
    background: rgba(37, 99, 235, 0.12);
    border: 1px solid rgba(37, 99, 235, 0.25);
}

.rpw-carousel-shell {
    position: relative;
    padding: 0 40px;
}

.rpw-carousel-shell::before,
.rpw-carousel-shell::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    z-index: 1;
    background: linear-gradient(to right, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
    transition: opacity 0.2s ease;
}

.rpw-carousel-shell::before {
    left: 0;
}

.rpw-carousel-shell::after {
    right: 0;
    transform: scaleX(-1);
}

.rpw-carousel-shell--at-start::before {
    opacity: 0;
}

.rpw-carousel-shell--at-end::after {
    opacity: 0;
}

.rpw-product-carousel {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
    gap: 16px;
    overflow-x: auto;
    padding: 4px 0 16px;
    scroll-snap-type: x proximity;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.rpw-product-carousel::-webkit-scrollbar {
    display: none;
}

.rpw-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: none;
    background: #999999;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 12px 24px -12px rgba(15, 23, 42, 0.4);
    z-index: 2;
    transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.rpw-carousel-nav:hover,
.rpw-carousel-nav:focus-visible {
    background: #F36931;
}

.rpw-carousel-nav:active {
    transform: translateY(-50%) scale(0.98);
}

.rpw-carousel-nav:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.rpw-carousel-nav--prev {
    left: 12px;
}

.rpw-carousel-nav--next {
    right: 12px;
}

.rpw-carousel-icon {
    font-size: 22px;
    line-height: 1;
}

.rpw-carousel-nav--loading {
    opacity: 0.55;
}

.rpw-product-card {
    min-width: 180px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 12px 24px -18px rgba(15, 23, 42, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    scroll-snap-align: start;
}

.rpw-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px -16px rgba(15, 23, 42, 0.4);
}

.rpw-product-link {
    display: grid;
    grid-template-rows: 1fr auto;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.rpw-product-image {
    position: relative;
    background: #ffffff;
    padding: 0;
    height: clamp(160px, 22vw, 220px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rpw-product-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
}

.rpw-image-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05));
}

.rpw-product-info {
    padding: 14px 14px 17px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    height: 100%;
}

.rpw-product-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 0;
    align-items: center;
    text-align: center;
}

.rpw-add-to-cart {
    margin-top: 7px;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 22px;
    border-radius: 999px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    background: linear-gradient(135deg, #28b46f, #239d60);
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 12px 24px -14px rgba(35, 157, 96, 0.55);
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
    position: relative;
}

.rpw-add-to-cart:hover,
.rpw-add-to-cart:focus-visible {
    background: linear-gradient(135deg, #22965b, #1d844f);
    box-shadow: 0 16px 28px -14px rgba(30, 140, 85, 0.6);
    transform: translateY(-1px);
}

.rpw-add-to-cart:active {
    transform: translateY(0);
    box-shadow: 0 10px 20px -16px rgba(30, 140, 85, 0.65);
}

.rpw-add-to-cart:focus-visible {
    outline: 2px solid rgba(40, 180, 111, 0.35);
    outline-offset: 2px;
}

.rpw-add-to-cart:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.rpw-add-to-cart.loading {
    position: relative;
    color: transparent;
}

.rpw-add-to-cart-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
}

.rpw-add-to-cart-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.rpw-add-to-cart-label {
    display: inline-block;
}

.rpw-add-to-cart.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-top-color: rgba(255, 255, 255, 0.2);
    animation: rpw-spin 0.6s linear infinite;
}

@media (max-width: 767px) {
    .rpw-add-to-cart {
        padding: 10px 18px;
        gap: 10px;
        font-size: 15px;
    }

    .rpw-product-carousel {
        gap: 10px;
        padding: 0;
    }

    .rpw-carousel-shell {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "carousel carousel"
            "prev next";
        align-items: center;
        row-gap: 14px;
        column-gap: 16px;
    }

    .rpw-carousel-shell::before,
    .rpw-carousel-shell::after {
        display: none;
    }

    .rpw-product-carousel {
        grid-area: carousel;
    }

    .rpw-carousel-nav {
        position: static;
        top: auto;
        transform: none;
        width: 100%;
        height: 44px;
        box-shadow: none;
        justify-content: center;
        gap: 8px;
        font-size: 15px;
        border-radius: 999px;
    }

    .rpw-carousel-nav:active {
        transform: none;
    }

    .rpw-carousel-nav--prev {
        grid-area: prev;
    }

    .rpw-carousel-nav--next {
        grid-area: next;
    }

    .rpw-carousel-icon {
        font-size: 20px;
    }
}


.rpw-category-link {
    margin-top: 6px;
    display: block;
    font-size: 12.5px;
    line-height: 1.3;
    color: #6b7280;
    text-decoration: underline !important;
    text-underline-offset: 2px;
    align-self: center;
    transition: color 0.2s ease;
    overflow: hidden;
    min-height: 2.6em;
    max-height: 2.6em;
    text-overflow: ellipsis;
}

.rpw-category-link:hover,
.rpw-category-link:focus-visible {
    color: #111827;
}

@supports (-webkit-line-clamp: 2) {
    .rpw-category-link {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}

.rpw-product-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: #0f172a;
    margin: 0;
    display: block;
    text-align: center;
    overflow: hidden;
    min-height: 5.2em;
    max-height: 5.2em;
    text-overflow: ellipsis;
}

@supports (-webkit-line-clamp: 4) {
    .rpw-product-name {
        display: -webkit-box;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
    }
}

.rpw-product-price {
    font-size: 17px;
    font-weight: 700;
    color: #E31E53;
    text-align: center;
}

.rpw-product-availability {
    font-size: 14px;
    color: #16a34a;
    text-align: center;
}

.rpw-product-stats {
    display: none;
    font-size: 13px;
    color: #475569;
    margin-top: auto;
}

.rpw-category-footer {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.rpw-categories-footer {
    text-align: center;
}

.rpw-load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: #000000;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rpw-load-more-btn:hover,
.rpw-load-more-btn:focus {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px -12px rgba(0, 0, 0, 0.35);
}

.rpw-load-more-btn.rpw-loading {
    opacity: 0.6;
    pointer-events: none;
}

.rpw-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-top-color: rgba(255, 255, 255, 1);
    animation: rpw-spin 0.7s linear infinite;
}

@keyframes rpw-spin {
    to { transform: rotate(360deg); }
}

.rpw-message,
.rpw-empty {
    text-align: center;
    padding: 24px;
    color: #64748b;
    font-size: 15px;
}

.rpw-message-error,
.rpw-empty-error {
    color: #dc2626;
}

.rpw-sentinel {
    height: 1px;
}

@media (min-width: 640px) {
    .rpw-product-carousel {
        grid-auto-columns: minmax(200px, 1fr);
    }
}

@media (min-width: 1024px) {
    .rpw-product-carousel {
        grid-auto-columns: minmax(220px, 1fr);
    }
}

@media (max-width: 640px) {
    .rpw-carousel-shell {
        padding: 0;
        column-gap: 12px;
        row-gap: 12px;
    }

    .rpw-carousel-nav {
        height: 42px;
        font-size: 14px;
    }

    .rpw-carousel-icon {
        font-size: 18px;
    }
}
