/* ===================================
   3D Product Carousel Overhaul
   =================================== */

.carousel-3d-wrapper {
    position: relative;
    width: 100%;
    height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    /* Crucial for 3D visibility */
    perspective: 1200px;
}

.carousel-3d-container {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    will-change: transform;
}

/* Individual Carousel Items */
.carousel-3d-item {
    position: absolute;
    width: 280px;
    height: 280px;
    left: 50%;
    top: 50%;
    margin-left: -140px;
    margin-top: -140px;
    backface-visibility: visible;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.8s, filter 0.8s;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.carousel-3d-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Visual Depth Effects */
.carousel-3d-item:not(.active) {
    opacity: 0.6;
    filter: blur(2px) grayscale(20%);
    scale: 0.9;
}

.carousel-3d-item.active {
    opacity: 1;
    filter: none;
    scale: 1.1;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* 3D Positioning - 4 items */
.carousel-3d-item:nth-child(1) {
    transform: rotateY(0deg) translateZ(250px);
}

.carousel-3d-item:nth-child(2) {
    transform: rotateY(90deg) translateZ(250px);
}

.carousel-3d-item:nth-child(3) {
    transform: rotateY(180deg) translateZ(250px);
}

.carousel-3d-item:nth-child(4) {
    transform: rotateY(270deg) translateZ(250px);
}

/* Navigation Controls - Premium Glassmorphism */
.carousel-3d-controls {
    position: absolute;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 100;
    pointer-events: none;
}

.carousel-3d-prev,
.carousel-3d-next {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    pointer-events: all;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.carousel-3d-prev:hover,
.carousel-3d-next:hover {
    background: #dc3545;
    color: white;
    transform: scale(1.1);
}

/* Indicators */
.carousel-3d-indicators {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 100;
}

.carousel-3d-indicator {
    width: 8px;
    height: 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-3d-indicator.active {
    width: 24px;
    background: #dc3545;
}

/* Responsive */
@media (max-width: 768px) {
    .carousel-3d-wrapper {
        height: 350px;
    }

    .carousel-3d-item {
        width: 220px;
        height: 220px;
        margin-left: -110px;
        margin-top: -110px;
    }
}

@media (max-width: 480px) {
    .carousel-3d-wrapper {
        height: 300px;
    }

    .carousel-3d-item {
        width: 180px;
        height: 180px;
        margin-left: -90px;
        margin-top: -90px;
    }
}

/* Product Detail Integration Overlay */
.product-detail-carousel {
    background: #f8f9fa;
    border-radius: 20px;
    padding: 20px;
    border: 1px solid #eee;
    overflow: visible;
    /* Ensure 3D radius isn't cut */
}