/* Medical Product Showcase Carousel Styles */
.product-showcase-wrapper {
    padding: 40px 0;
    background: #ffffff;
    position: relative;
}

.product-showcase-wrapper .section-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 30px;
    text-align: left;
}

/* Carousel Container */
.product-carousel-container {
    position: relative;
    overflow: visible; /* Changed from hidden to visible to show arrows */
    margin: 0 auto;
    padding: 0 30px; /* Add padding to make room for arrows */
}

/* Swipe indicator */
.product-carousel-container::after {
    content: '← Kéo để xem thêm →';
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: #4A90E2;
    opacity: 0.9;
    animation: fadeInOut 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 5;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 12px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

.product-carousel-track-container {
    overflow: hidden;
    position: relative;
    margin: 0 -30px; /* Negative margin to compensate for container padding */
}

/* Gradient fade indicators on sides */
.product-carousel-track-container::before,
.product-carousel-track-container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30px;
    z-index: 5;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.product-carousel-track-container::before {
    left: 0;
    background: linear-gradient(to right, rgba(255,255,255,0.9), transparent);
}

.product-carousel-track-container::after {
    right: 0;
    background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
}

.product-carousel-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    cursor: grab;
}

.product-carousel-track:active {
    cursor: grabbing;
}

.product-slide {
    flex: 0 0 auto;
    width: calc(100% / 4); /* Default 4 slides */
    padding: 0 10px;
    box-sizing: border-box;
}

/* Dynamic slide width based on data attribute */
.product-carousel-track[data-slides-to-show="1"] .product-slide { width: 100%; }
.product-carousel-track[data-slides-to-show="2"] .product-slide { width: 50%; }
.product-carousel-track[data-slides-to-show="3"] .product-slide { width: 33.333%; }
.product-carousel-track[data-slides-to-show="4"] .product-slide { width: 25%; }
.product-carousel-track[data-slides-to-show="5"] .product-slide { width: 20%; }
.product-carousel-track[data-slides-to-show="6"] .product-slide { width: 16.666%; }

/* Navigation Arrows - Force visibility */
.carousel-nav {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: #4A90E2 !important;
    color: white !important;
    border: 3px solid white !important;
    border-radius: 50% !important;
    width: 52px !important;
    height: 52px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    z-index: 999 !important;
    opacity: 1 !important;
    visibility: visible !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
    font-size: 0 !important;
}

.product-showcase-wrapper:hover .carousel-nav {
    opacity: 1;
}

.carousel-nav:hover {
    background: #357ABD;
    transform: translateY(-50%) scale(1.1);
}

.carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: translateY(-50%);
}

.carousel-nav.prev-btn {
    left: 5px;
}

.carousel-nav.next-btn {
    right: 5px;
}

/* Pulse animation for arrows to attract attention */
.carousel-nav {
    animation: pulseArrow 3s ease-in-out infinite;
}

.carousel-nav:hover {
    animation: none;
    background: #357ABD !important;
    transform: translateY(-50%) scale(1.1) !important;
}

@keyframes pulseArrow {
    0%, 100% {
        transform: translateY(-50%) scale(1);
        opacity: 0.9;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    }
    50% {
        transform: translateY(-50%) scale(1.08);
        opacity: 1;
        box-shadow: 0 8px 25px rgba(74, 144, 226, 0.4);
    }
}

/* Dots Indicator */
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    background: #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-dot:hover,
.carousel-dot.active {
    background: #4A90E2;
    transform: scale(1.2);
}

/* Product Card Styles */
.product-card-showcase {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
    position: relative;
    height: 100%;
}

.product-card-showcase:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: #e0e0e0;
}

.product-image-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    background: #f8f9fa;
}

.product-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card-showcase:hover .product-image-wrapper img {
    transform: scale(1.05);
}

.wishlist-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.wishlist-btn:hover {
    background: #ff6b6b;
    color: white;
    transform: scale(1.1);
}

.wishlist-btn .heart-icon {
    font-size: 16px;
    transition: all 0.3s ease;
}

.wishlist-btn:hover .heart-icon {
    transform: scale(1.2);
}

.wishlist-btn.active {
    background: #ff6b6b;
    color: white;
}

.wishlist-btn.active .heart-icon {
    content: '♥';
}

.product-info {
    padding: 16px;
    text-align: left;
}

.product-title {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-title a:hover {
    color: #4A90E2;
}

.price {
    color: #28a745;
    font-weight: 600;
    font-size: 14px;
}

.contact-for-price {
    color: #4A90E2;
    font-weight: 500;
    font-size: 13px;
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-for-price:hover {
    color: #357ABD;
    text-decoration: underline;
}

/* Touch/Swipe Support */
.product-carousel-track-container {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.product-carousel-track.dragging {
    transition: none;
    cursor: grabbing;
}

.product-carousel-track.dragging .product-card-showcase {
    pointer-events: none;
}

/* Ensure links and buttons are always clickable */
.product-card-showcase a,
.product-card-showcase button {
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
}

.product-carousel-track.dragging .product-card-showcase a,
.product-carousel-track.dragging .product-card-showcase button {
    pointer-events: auto !important;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .product-carousel-track[data-slides-to-show="4"] .product-slide,
    .product-carousel-track[data-slides-to-show="5"] .product-slide,
    .product-carousel-track[data-slides-to-show="6"] .product-slide {
        width: 33.333%; /* Show 3 slides */
    }

    .carousel-nav {
        width: 44px;
        height: 44px;
    }

    .carousel-nav.prev-btn {
        left: -22px;
    }

    .carousel-nav.next-btn {
        right: -22px;
    }
}

@media (max-width: 992px) {
    .product-carousel-track[data-slides-to-show="4"] .product-slide,
    .product-carousel-track[data-slides-to-show="5"] .product-slide,
    .product-carousel-track[data-slides-to-show="6"] .product-slide {
        width: 50%; /* Show 2 slides */
    }

    .product-showcase-wrapper {
        padding: 30px 0;
    }

    .product-info {
        padding: 14px;
    }

    .product-title {
        font-size: 13px;
    }

    .price {
        font-size: 13px;
    }

    .carousel-nav {
        width: 40px;
        height: 40px;
    }

    .carousel-nav.prev-btn {
        left: -20px;
    }

    .carousel-nav.next-btn {
        right: -20px;
    }
}

@media (max-width: 768px) {
    .product-carousel-track .product-slide {
        width: 50%; /* Always show 2 slides on mobile */
    }

    .product-showcase-wrapper .section-title {
        font-size: 20px;
        margin-bottom: 20px;
    }

    /* Mobile swipe indicator */
    .product-carousel-container::after {
        content: '👆 Vuốt để xem thêm';
        font-size: 11px;
        bottom: -25px;
    }

    .product-info {
        padding: 12px;
    }

    .product-title {
        font-size: 12px;
    }

    .price {
        font-size: 12px;
    }

    .wishlist-btn {
        width: 32px;
        height: 32px;
        top: 8px;
        right: 8px;
    }

    .wishlist-btn .heart-icon {
        font-size: 14px;
    }

    .carousel-nav {
        width: 36px;
        height: 36px;
    }

    .carousel-nav.prev-btn {
        left: -18px;
    }

    .carousel-nav.next-btn {
        right: -18px;
    }

    .carousel-dots {
        margin-top: 20px;
    }

    .carousel-dot {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    .product-slide {
        padding: 0 6px;
    }

    .product-showcase-wrapper {
        padding: 20px 0;
    }

    .product-info {
        padding: 10px;
    }

    .product-title {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .price {
        font-size: 11px;
    }

    .carousel-nav {
        width: 32px;
        height: 32px;
    }

    .carousel-nav.prev-btn {
        left: -16px;
    }

    .carousel-nav.next-btn {
        right: -16px;
    }

    .carousel-dots {
        margin-top: 16px;
        gap: 6px;
    }

    .carousel-dot {
        width: 8px;
        height: 8px;
    }
}

/* Loading animation */
.product-card-showcase.loading {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.product-card-showcase.loading:nth-child(1) { animation-delay: 0.1s; }
.product-card-showcase.loading:nth-child(2) { animation-delay: 0.2s; }
.product-card-showcase.loading:nth-child(3) { animation-delay: 0.3s; }
.product-card-showcase.loading:nth-child(4) { animation-delay: 0.4s; }
.product-card-showcase.loading:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover effects */
.product-card-showcase::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(74, 144, 226, 0.05) 50%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.product-card-showcase:hover::before {
    opacity: 1;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .product-showcase-wrapper {
        background: #1a1a1a;
    }
    
    .product-showcase-wrapper .section-title {
        color: #ffffff;
    }
    
    .product-card-showcase {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .product-card-showcase:hover {
        border-color: #555555;
    }
    
    .product-title a {
        color: #ffffff;
    }
    
    .product-title a:hover {
        color: #5dade2;
    }
    
    .product-image-wrapper {
        background: #404040;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .product-card-showcase {
        border: 2px solid #000;
    }
    
    .product-card-showcase:hover {
        border-color: #0066cc;
    }
    
    .wishlist-btn {
        border: 1px solid #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .product-card-showcase,
    .product-image-wrapper img,
    .wishlist-btn,
    .nav-arrow {
        transition: none;
    }
    
    .product-card-showcase:hover {
        transform: none;
    }
    
    .product-card-showcase:hover .product-image-wrapper img {
        transform: none;
    }
    
    .product-card-showcase.loading {
        animation: none;
        opacity: 1;
    }
}
