/**
 * Shared styles for product detail pages.
 * Use class "product-gallery-carousel" on the Bootstrap carousel element.
 */

.product-gallery-carousel {
    --product-gallery-control-bg: rgba(195, 195, 195, 0.5);
}

/* Product 3D model viewer */
.product-model-viewer {
    width: 100%;
    height: 320px;
    background-color: #ffffff;
    border-radius: 8px;
    display: block;
    margin: 0;
}

/* Prevent carousel swipe when touching model-viewer (so AR button and 3D rotate work on mobile) */
.product-gallery-carousel .product-model-viewer {
    touch-action: none;
}

.product-model-viewer-fallback {
    width: 100%;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: 8px;
    color: #666;
}

/* Carousel indicators: visible pill and dots */
.product-gallery-carousel .carousel-indicators {
    background: rgba(255, 255, 255, 0.5);
    padding: 8px 12px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.product-gallery-carousel .carousel-indicators [data-bs-slide-to] {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--product-gallery-control-bg);
    opacity: 0.8;
}

.product-gallery-carousel .carousel-indicators [data-bs-slide-to].active {
    background-color: #767575;
    opacity: 1;
}

/* Prev/Next control buttons */
.product-gallery-carousel .carousel-control-prev-icon,
.product-gallery-carousel .carousel-control-next-icon {
    background-color: var(--product-gallery-control-bg);
    padding: 12px;
    border-radius: 50%;
}

/* Match model height so no empty band below 3D on mobile */
.product-gallery-carousel .carousel-item {
    height: 320px;
}

/* No large gap under desktop 3D model (override .doc-wrapper margin) */
.product-gallery-stack > .doc-wrapper:first-child {
    margin-bottom: 0;
}

.product-gallery-carousel .carousel-item .doc-wrapper,
.product-gallery-carousel .carousel-item .text-center {
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}

.product-gallery-carousel .carousel-item img {
    max-height: 320px;
    width: auto;
    object-fit: contain;
}

/* Placeholder until model-viewer loads (optional: add .model-viewer-wrapper around placeholder + model-viewer) */
.product-gallery-carousel .model-viewer-wrapper,
.product-gallery-stack .model-viewer-wrapper {
    position: relative;
    min-height: 320px;
}

.product-gallery-carousel .model-viewer-wrapper .model-viewer-placeholder,
.product-gallery-stack .model-viewer-wrapper .model-viewer-placeholder {
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-gallery-carousel .model-viewer-wrapper .model-viewer-reveal,
.product-gallery-stack .model-viewer-wrapper .model-viewer-reveal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.product-gallery-carousel .model-viewer-wrapper.model-viewer-loaded .model-viewer-placeholder,
.product-gallery-stack .model-viewer-wrapper.model-viewer-loaded .model-viewer-placeholder {
    visibility: hidden;
    pointer-events: none;
}

.product-gallery-carousel .model-viewer-wrapper.model-viewer-loaded .model-viewer-reveal,
.product-gallery-stack .model-viewer-wrapper.model-viewer-loaded .model-viewer-reveal {
    position: relative;
    opacity: 1;
    pointer-events: auto;
}

/* Model viewer container: for expand button positioning */
.product-model-viewer-container {
    position: relative;
}

/* Expand button: bottom right, opens model in lightbox */
.product-model-expand-btn {
    position: absolute;
    bottom: 6px;
    right: 6px;
    z-index: 20;
    padding: 8px 10px;
    font-size: 0.9rem;
}

/* 3D model in lightbox: enlarged like images */
.lightbox-model-viewer {
    width: 90vw;
    height: 90vh;
    max-width: 900px;
    max-height: 700px;
    background: #fff;
    border-radius: 8px;
}

/* AR button: icon only */
.product-model-viewer .ar-icon-btn {
    padding: 8px 10px;
    font-size: 1rem;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    cursor: pointer;
    color: #333;
}
.product-model-viewer .ar-icon-btn:hover {
    background: #fff;
    color: #000;
}
