/* Best Seller Compact Slider Styles */

.bestseller-section {
    background: #f0f0f2;
    padding: 3rem 0;
}

.bestseller-header {
    padding-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.bestseller-viewall {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #4b5563;
    font-size: 1.1rem;
    font-weight: 600;
    transition: color 0.3s ease;
    margin-left: 3px;
}

.bestseller-viewall:hover {
    color: #111;
}

.bestseller-viewall-btn {
    width: 32px;
    height: 32px;
    background: #e5e5ea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bestseller-viewall:hover .bestseller-viewall-btn {
    background: #111;
    color: #fff;
    transform: translateX(4px);
}

.bestseller-viewall-btn .material-symbols-outlined {
    font-size: 1.2rem;
}

/* Slider Track */
.bestseller-slider-track {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 1rem;
    padding: 0.5rem 1.25rem 2rem;
    scroll-snap-type: x mandatory;
    scroll-padding: 1.25rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
    width: 100%;
    box-sizing: border-box;
}

.bestseller-slider-track::-webkit-scrollbar {
    display: none;
}

/* Compact Card Styles */
.bs-card {
    background: #fff;
    border-radius: 1rem;
    overflow: hidden;
    flex-shrink: 0;
    width: clamp(160px, 45vw, 230px);
    /* Perfectly matched to the laptop cards slider width */
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease;
}

.bs-card:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.bs-card-img-wrap {
    position: relative;
    background: #f8f8f8;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    /* Reduced padding */
    overflow: hidden;
}

.bs-card-img-wrap img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    mix-blend-mode: multiply;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bs-card-body {
    padding: 1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.bs-card-name {
    font-size: 0.95rem;
    /* Slightly smaller typography */
    font-weight: 700;
    line-height: 1.4;
    color: #1a1c1d;
    height: 2.8em;
    /* Fixed height for name to ensure alignment */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bs-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.25rem;
}

.bs-card-rating {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #4b5563;
}

.bs-star {
    font-size: 0.9rem;
    color: #fbbf24;
    font-variation-settings: 'FILL' 1;
}

.bs-card-price {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1c1d;
}

/* Swatches */
.bs-swatches {
    display: flex;
    gap: 4px;
    margin-top: 0.5rem;
}

.bs-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #fff;
    box-shadow: 0 0 0 1px #e5e7eb;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.bs-swatch.active {
    box-shadow: 0 0 0 1.5px #1a1c1d;
}

/* Badge */
.bs-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: #1a1c1d;
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.7rem;
    font-weight: 700;
    z-index: 5;
}

.bs-badges-container {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    z-index: 10;
    pointer-events: none;
}

.bs-badges-container .bs-badge {
    position: static !important;
    display: inline-block;
    width: max-content;
}

/* Desktop Slider Styles */
@media (min-width: 1024px) {
    .bestseller-slider-track {
        display: flex;
        /* Changed from grid to flex to keep slider functionality */
        overflow-x: auto;
        gap: 1.5rem;
        padding: 0.5rem 0;
        max-width: 100%;
        margin: 0;
        scroll-padding: 0;
    }

    /* Force the cards to take up roughly 1/5th of the width minus gaps */
    .bestseller-slider-track .bs-card {
        width: calc((100% - (4 * 1.5rem)) / 5);
        min-width: 220px;
        /* Ensure they don't get TOO small */
    }

    .slider-nav-btn {
        display: flex !important;
        /* Ensure arrows are visible on desktop slider */
    }
}

/* Tabs Switcher for Mobiles Section */
.slider-header-actions-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 0.5rem;
    padding-right: 40px; /* Offset margin-left to align with slider cards */
    box-sizing: border-box;
}

.slider-tabs-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
}

.slider-tab {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #1a1c1d;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    outline: none;
}

.slider-tab.active {
    background: #111827;
    color: #ffffff;
    border-color: #111827;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.slider-tab:not(.active):hover {
    color: #111827;
    border-color: #111827;
    background: rgba(0, 0, 0, 0.02);
}

@media (max-width: 768px) {
    .slider-header-actions-wrapper {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
        padding-right: 0 !important;
    }
    .slider-tabs-container {
        order: 1 !important; /* Tab buttons first */
    }
    .slider-header-actions-wrapper .bestseller-viewall {
        order: 2 !important; /* View all second */
        margin-top: 0.25rem !important;
    }
}

/* Hide/show transition for tracks */
.bestseller-slider-track.mobile-track {
    opacity: 0;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.bestseller-slider-track.mobile-track.active {
    opacity: 1;
    visibility: visible;
    height: auto;
    overflow-x: auto;
    pointer-events: auto;
    padding: 0.5rem 1.25rem 2rem !important;
}

@media (min-width: 1024px) {
    .bestseller-slider-track.mobile-track.active {
        padding: 0.5rem 0 2rem !important;
    }
}