/* Простая галерея для карточки товара */

.product-gallery {
    position: relative;
}

.product-gallery-main {
    position: relative;
    width: 100%;
    max-width: 21pc;
    height: 21pc;
    margin-bottom: 10px;
    border: 1px solid #e5e5e5;
    -webkit-border-radius: 7px;
    -moz-border-radius: 7px;
    border-radius: 7px;
    padding: 3px;
    background-color: #fff;
    cursor: pointer;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.product-gallery-main img {
    max-width: calc(100% - 8px);
    max-height: calc(100% - 8px);
    width: auto;
    height: auto;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    -o-object-fit: contain;
    object-fit: contain;
}

.product-gallery-thumbnails {
    list-style: none;
    margin: 0;
    padding: 0;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin: -4.5px;
}

.product-gallery-thumbnails li {
    width: 77px;
    height: 77px;
    position: relative;
    border: 1px solid #e5e5e5;
    cursor: pointer;
    display: inline-block;
    background-color: #fff;
    padding: 3px;
    margin: 4.5px;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    -webkit-transition: border-color 0.2s ease;
    -moz-transition: border-color 0.2s ease;
    -o-transition: border-color 0.2s ease;
    transition: border-color 0.2s ease;
}

.product-gallery-thumbnails li:hover {
    border-color: #444;
}

.product-gallery-thumbnails li.active {
    border-color: #444;
    border-width: 2px;
}

.product-gallery-thumbnails li img {
    max-width: calc(100% - 8px);
    max-height: calc(100% - 8px);
    width: auto;
    height: auto;
    position: absolute;
    left: 50%;
    top: 50%;
    -webkit-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    -o-object-fit: contain;
    object-fit: contain;
}

/* Модальное окно */
.product-gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
}

.product-gallery-modal-open {
    overflow: hidden;
}

.product-gallery-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.product-gallery-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    padding: 80px 120px;
    box-sizing: border-box;
}

.product-gallery-modal-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    box-sizing: border-box;
    pointer-events: none;
}

.product-gallery-modal-image-container img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    -o-object-fit: contain;
    object-fit: contain;
    pointer-events: auto;
}

.product-gallery-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #fff;
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
    z-index: 1051;
    padding: 10px;
    opacity: 0.8;
    -webkit-transition: opacity 0.2s ease;
    -moz-transition: opacity 0.2s ease;
    -o-transition: opacity 0.2s ease;
    transition: opacity 0.2s ease;
}

.product-gallery-modal-close:hover {
    opacity: 1;
}

.product-gallery-modal-prev,
.product-gallery-modal-next {
    position: absolute;
    top: 50%;
    -webkit-transform: translateY(-50%);
    -ms-transform: translateY(-50%);
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 50px;
    line-height: 1;
    cursor: pointer;
    z-index: 1051;
    padding: 20px 15px;
    opacity: 0.8;
    -webkit-transition: opacity 0.2s ease, background-color 0.2s ease;
    -moz-transition: opacity 0.2s ease, background-color 0.2s ease;
    -o-transition: opacity 0.2s ease, background-color 0.2s ease;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.product-gallery-modal-prev:hover,
.product-gallery-modal-next:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.3);
}

.product-gallery-modal-prev {
    left: 20px;
}

.product-gallery-modal-next {
    right: 20px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .product-gallery-thumbnails {
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
    }
    
    .product-gallery-modal-content {
        padding: 50px 30px;
    }
    
    .product-gallery-modal-prev,
    .product-gallery-modal-next {
        font-size: 30px;
        padding: 15px 10px;
    }
    
    .product-gallery-modal-close {
        font-size: 30px;
        top: 5px;
        right: 5px;
    }
    
    .product-gallery-modal-prev {
        left: 5px;
    }
    
    .product-gallery-modal-next {
        right: 5px;
    }
}

