/* ============================================
   PRODUCT CAROUSEL - ISOLATED STYLES
   ============================================ */

/* Carousel Section */
.carousel-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 2.5rem 0;
    width: 100%;
    margin-bottom: 3rem;
}

[data-theme="dark"] .carousel-section {
    background: linear-gradient(135deg, #1a1d20 0%, #2d3238 100%);
}

/* Carousel Header */
.carousel-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.carousel-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color, #212529);
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.carousel-title i {
    font-size: 1.5rem;
}

.carousel-subtitle {
    text-align: center;
}

/* Carousel Wrapper */
.product-carousel-wrapper {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 80px;
}

/* CRITICAL: Force Horizontal Layout */
.product-carousel {
    display: -webkit-box !important;
    display: -ms-flexbox !important;
    display: flex !important;
    -webkit-box-orient: horizontal !important;
    -webkit-box-direction: normal !important;
    -ms-flex-direction: row !important;
    flex-direction: row !important;
    -ms-flex-wrap: nowrap !important;
    flex-wrap: nowrap !important;
    gap: 1.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 1.5rem 10px;
    cursor: grab;
    user-select: none;
}

.product-carousel:active {
    cursor: grabbing;
}

/* Prevent text selection while dragging */
.product-carousel * {
    pointer-events: none;
}

.product-carousel a {
    pointer-events: auto;
}

.product-carousel::-webkit-scrollbar {
    display: none;
}

/* Carousel Card - 5 cards visible on desktop */
.product-carousel .carousel-card {
    -webkit-box-flex: 0 !important;
    -ms-flex: 0 0 auto !important;
    flex: 0 0 auto !important;
    width: calc((100% - 4 * 1.25rem) / 5) !important;
    min-width: 220px !important;
    max-width: 280px !important;
    scroll-snap-align: start;
    display: inline-block !important;
}

/* Product Card Compact */
.product-carousel .product-card-compact {
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    display: block;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.product-carousel .product-card-compact:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: #0d6efd;
}

[data-theme="dark"] .product-carousel .product-card-compact {
    background: #2d3238;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .product-carousel .product-card-compact:hover {
    border-color: #0d6efd;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* Image Wrapper */
.product-carousel .card-img-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: hidden;
}

[data-theme="dark"] .product-carousel .card-img-wrapper {
    background: #1a1d20;
}

.product-carousel .card-img-top {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-carousel .product-card-compact:hover .card-img-top {
    transform: scale(1.05);
}

/* Card Body */
.product-carousel .card-body {
    padding: 1rem;
    display: block;
}

.product-carousel .card-title {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-color, #212529);
    margin: 0 0 0.5rem 0;
    min-height: 2.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-carousel .price-tag {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.product-carousel .price-amount {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0d6efd;
    line-height: 1;
}

/* Navigation Buttons */
.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    color: #333;
}

[data-theme="dark"] .carousel-nav-btn {
    background: #2d3238;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.carousel-nav-prev {
    left: 15px;
}

.carousel-nav-next {
    right: 15px;
}

/* Show on hover */
.product-carousel-wrapper:hover .carousel-nav-btn:not(:disabled) {
    opacity: 1;
    visibility: visible;
}

.carousel-nav-btn:hover:not(:disabled) {
    background: #0d6efd;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

[data-theme="dark"] .carousel-nav-btn:hover:not(:disabled) {
    background: #0d6efd;
}

.carousel-nav-btn:disabled {
    opacity: 0 !important;
    visibility: hidden !important;
    cursor: not-allowed;
}

.carousel-nav-btn i {
    font-size: 1.25rem;
}

/* Responsive */
@media (max-width: 1200px) {
    /* 4 cards on medium screens */
    .product-carousel .carousel-card {
        width: calc((100% - 3 * 1.25rem) / 4) !important;
    }
}

@media (max-width: 991px) {
    .carousel-section {
        padding: 2rem 0;
    }
    
    .product-carousel-wrapper {
        padding: 0 60px;
    }
    
    .carousel-nav-btn {
        opacity: 1;
        visibility: visible;
        width: 40px;
        height: 40px;
    }
    
    .carousel-nav-prev {
        left: 10px;
    }
    
    .carousel-nav-next {
        right: 10px;
    }
    
    /* 3 cards on tablets */
    .product-carousel .carousel-card {
        width: calc((100% - 2 * 1.25rem) / 3) !important;
        min-width: 200px !important;
    }
    
    .product-carousel .card-img-wrapper {
        height: 160px;
    }
    
    .product-carousel {
        padding: 1.5rem 10px;
    }
}

@media (max-width: 767px) {
    .product-carousel-wrapper {
        padding: 0 55px;
    }
    
    /* 2 cards on small tablets */
    .product-carousel .carousel-card {
        width: calc((100% - 1.25rem) / 2) !important;
        min-width: 180px !important;
    }
    
    .product-carousel .card-img-wrapper {
        height: 140px;
    }
    
    .carousel-nav-btn {
        width: 36px;
        height: 36px;
    }
    
    .carousel-nav-prev {
        left: 8px;
    }
    
    .carousel-nav-next {
        right: 8px;
    }
    
    .product-carousel {
        padding: 1.5rem 8px;
    }
}

@media (max-width: 575px) {
    .product-carousel-wrapper {
        padding: 0 50px;
    }
    
    .carousel-nav-prev {
        left: 5px;
    }
    
    .carousel-nav-next {
        right: 5px;
    }
    
    /* 1 card on mobile - full width */
    .product-carousel .carousel-card {
        width: 100% !important;
        min-width: 280px !important;
        max-width: 100% !important;
    }
    
    .product-carousel .card-img-wrapper {
        height: 200px;
    }
    
    .product-carousel .card-body {
        padding: 1.25rem;
    }
    
    .product-carousel .card-title {
        font-size: 0.95rem;
        min-height: 2.8rem;
    }
    
    .product-carousel .price-amount {
        font-size: 1.5rem;
    }
    
    .product-carousel {
        padding: 1.5rem 5px;
    }
}
