/**
 * Product Gallery Styles
 * E-commerce style: Main image top, thumbnails slider bottom
 */

.product-gallery-container {
    width: 100%;
    margin: 23px 0 0 0;
}

.product-gallery-item {
    margin-bottom: 40px;
    padding: 0 20px 20px 20px;
    background: #fff;
    width: 100%;
}

.product-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

/* Main Image Area - Top */
.product-gallery-main {
    width: 100%;
    margin-bottom: 20px;
}

.product-gallery-item .product-main-image-wrapper,
.product-gallery-container .product-main-image-wrapper {
    position: relative;
    width: 100% !important;
    overflow: hidden;
    background: #f5f5f5;
    aspect-ratio: 4 / 3;
    max-width: 100% !important;
}

.product-main-image-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    cursor: pointer;
}

.product-gallery-item .product-main-image,
.product-gallery-container .product-main-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
    transition: opacity 0.3s ease;
    max-width: none !important;
    max-height: none !important;
}

.product-main-image-link:hover .product-main-image {
    opacity: 0.9;
}

/* Thumbnail Slider Wrapper */
.product-gallery-thumbnails-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding: 0;
}

/* Thumbnail Slider Container */
.product-gallery-thumbnails {
    position: relative;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    flex: 1;
    padding: 10px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
}

.product-gallery-thumbnails::-webkit-scrollbar {
    display: none;
}

.product-gallery-thumbnails:active {
    cursor: grabbing;
}

/* Slider Navigation Buttons */
.thumbnail-slider-btn {
    background: #fff;
    border: none;
    /* border-radius: 50%; */
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    user-select: none;
    position: absolute;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* Correct vertical alignment of navigation arrows */
.thumbnail-slider-prev,
.thumbnail-slider-next {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 10 !important;
}

/* Left button aligned properly */
.thumbnail-slider-prev {
    left: 0 !important;
    border-radius: 0 50% 50% 0;
}

/* Right button aligned properly */
.thumbnail-slider-next {
    right: 0 !important;
    border-radius: 50% 0 0 50%;
}

.thumbnail-slider-btn:hover {
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.thumbnail-slider-btn:active {
    transform: translateX(-50%) scale(0.95);
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.2);
}

.thumbnail-slider-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    pointer-events: none;
    background: #666;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.thumbnail-slider-btn svg {
    width: 14px;
    height: 14px;
    stroke: #ffffff;
}

.thumbnail-slider-btn:hover svg {
    stroke: #000000;
}

.thumbnail-slider-btn:disabled svg {
    stroke: #b3b3b3;
}

/* Thumbnail Items */
.product-gallery-item .product-thumbnail-wrapper,
.product-gallery-container .product-thumbnail-wrapper {
    position: relative;
    width: calc((100% - 56px - 40px) / 5) !important;
    min-width: calc((100% - 56px - 40px) / 5) !important;
    max-width: calc((100% - 56px - 40px) / 5) !important;
    height: calc((100% - 56px - 40px) / 5) !important;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    overflow: hidden;
    background: #f5f5f5;
    cursor: pointer;
    transition: all 0.3s ease;
}

.product-thumbnail-wrapper:hover {
    opacity: 0.8;
}

.product-thumbnail-wrapper.active {
    opacity: 1;
    background: #eef2ff;
    box-shadow: 0 0 0 2px #ff00008a, 0 6px 16px rgba(75, 75, 75, 0.049);
    transform: translateY(-2px);
}

.product-thumbnail-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.product-gallery-item .product-thumbnail,
.product-gallery-container .product-thumbnail {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
    transition: opacity 0.3s ease;
    max-width: none !important;
    max-height: none !important;
}

.product-thumbnail-wrapper:hover .product-thumbnail {
    opacity: 0.8;
}

/* No products message */
.pg-no-products {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

/* Error message */
.pg-error {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin: 10px 0;
    text-align: left;
}

/* Debug information */
.pg-debug {
    background: #f0f0f0;
    padding: 15px;
    margin: 10px 0;
    border-left: 4px solid #0073aa;
    font-family: monospace;
    font-size: 12px;
    text-align: left;
    overflow-x: auto;
}

/* Responsive design */
@media (max-width: 1024px) {

    .product-gallery-item .product-thumbnail-wrapper,
    .product-gallery-container .product-thumbnail-wrapper {
        width: calc((100% - 60px - 40px) / 5) !important;
        min-width: calc((100% - 60px - 40px) / 5) !important;
        max-width: calc((100% - 60px - 40px) / 5) !important;
        height: calc((100% - 60px - 40px) / 5) !important;
    }

    .thumbnail-slider-btn {
        width: 26px;
        height: 26px;
        font-size: 0;
        top: -38px;
    }



    .product-gallery-thumbnails-wrapper {
        padding: 0;
    }
}

@media (max-width: 768px) {
    .product-title {
        font-size: 20px;
    }

    .product-gallery-item .product-thumbnail-wrapper,
    .product-gallery-container .product-thumbnail-wrapper {
        width: calc((100% - 56px - 32px) / 5) !important;
        min-width: calc((100% - 56px - 32px) / 5) !important;
        max-width: calc((100% - 56px - 32px) / 5) !important;
        height: calc((100% - 56px - 32px) / 5) !important;
    }

    .product-gallery-thumbnails {
        gap: 8px;
    }

    .thumbnail-slider-btn {
        width: 28px;
        height: 28px;
        font-size: 0;
        top: -36px;
    }



    .product-gallery-thumbnails-wrapper {
        padding: 0;
    }
}

@media (max-width: 480px) {
    .product-gallery-item {
        padding: 15px;
    }

    .product-gallery-item .product-thumbnail-wrapper,
    .product-gallery-container .product-thumbnail-wrapper {
        width: calc((100% - 52px - 24px) / 5) !important;
        min-width: calc((100% - 52px - 24px) / 5) !important;
        max-width: calc((100% - 52px - 24px) / 5) !important;
        height: calc((100% - 52px - 24px) / 5) !important;
    }

    .product-gallery-thumbnails {
        gap: 6px;
    }

    .thumbnail-slider-btn {
        width: 26px;
        height: 26px;
        font-size: 0;
        top: -34px;
    }



    .product-gallery-thumbnails-wrapper {
        padding: 0;
    }
}