/* Стили для полноэкранного просмотра изображений */

.product-image-container {
    position: relative;
    display: inline-block;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.product-image-container:hover {
    transform: scale(1.02);
}

.product-modal-image {
    transition: all 0.3s ease;
}

.image-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.product-image-container:hover .image-overlay {
    opacity: 1;
}

.fullscreen-image {
    max-height: 95vh !important;
    max-width: 95vw !important;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.3s ease;
    /* Улучшения для мобильных устройств */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Стили для зума изображений */
.fullscreen-image.zoomed {
    cursor: zoom-out;
    transform: scale(1.5);
}

.fullscreen-image.zoomed-out {
    cursor: zoom-in;
    transform: scale(1);
}

.fullscreen-control {
    background: rgba(0, 0, 0, 0.5) !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    border: none !important;
}

.fullscreen-control:hover {
    background: rgba(0, 0, 0, 0.7) !important;
}

.fullscreen-indicators {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
}

.fullscreen-indicators .carousel-indicators {
    margin-bottom: 0;
}

.fullscreen-indicators .carousel-indicators li {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    border: none;
}

.fullscreen-indicators .carousel-indicators li.active {
    background-color: white;
}

.carousel-indicators-wrapper {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
}

.carousel-indicators-wrapper .carousel-indicators {
    margin-bottom: 0;
}

/* Улучшенные стили для карусели в модальном окне */
.modal .carousel-control-prev,
.modal .carousel-control-next {
    background: rgba(0, 0, 0, 0.5) !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    border: none !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.modal .carousel-control-prev {
    left: 10px !important;
}

.modal .carousel-control-next {
    right: 10px !important;
}

.modal .carousel-control-prev:hover,
.modal .carousel-control-next:hover {
    background: rgba(0, 0, 0, 0.7) !important;
}

/* Анимации для модальных окон */
.modal.fade .modal-dialog {
    transform: scale(0.8) translateY(-50px);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.modal.show .modal-dialog {
    transform: scale(1) translateY(0);
}

/* Стили для полноэкранного модального окна */
.modal-fullscreen {
    padding: 0 !important;
}

.modal-fullscreen .modal-dialog {
    width: 100vw;
    max-width: none;
    height: 100vh;
    margin: 0;
    padding: 0;
}

.modal-fullscreen .modal-content {
    height: 100vh;
    border: 0;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.0) !important;
    overflow: hidden;
}

.modal-fullscreen .modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1055;
    border: none;
    padding: 15px 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), transparent);
}

.modal-fullscreen .modal-body {
    height: 100vh;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.modal-fullscreen .image-gallery-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Центрирование изображений в полноэкранном режиме */
.modal-fullscreen .fullscreen-image {
    max-height: 95vh !important;
    max-width: 95vw !important;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0;
    padding: 0;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

/* Стили для карусели в полноэкранном режиме */
.modal-fullscreen .carousel {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    /* Улучшения для мобильных устройств */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: pan-y pinch-zoom;
}

.modal-fullscreen .carousel-inner {
    height: 100vh;
    overflow: hidden;
}

.modal-fullscreen .carousel-item {
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-fullscreen .carousel-item img {
    max-height: 100vh !important;
    max-width: 100vw !important;
    width: auto;
    height: auto;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

/* Показываем только активный слайд, чтобы исключить наложение изображений */
.modal-fullscreen .carousel-item { 
    display: none; 
}
.modal-fullscreen .carousel-item.active { 
    display: flex !important; 
}

/* Исправление для контейнера изображений */
.modal-fullscreen .image-gallery-container {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Исправление для одиночного изображения */
.modal-fullscreen .d-flex.align-items-center.justify-content-center {
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* Кнопка зума */
.zoom-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1060;
    display: flex;
    gap: 10px;
}

.zoom-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.zoom-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .fullscreen-control {
        width: 40px !important;
        height: 40px !important;
    }
    
    .fullscreen-indicators {
        bottom: 20px;
    }
    
    .fullscreen-indicators .carousel-indicators li {
        width: 10px;
        height: 10px;
    }
    
    /* Улучшения для touch-зума на мобильных */
    .zoom-controls {
        top: 10px;
        right: 10px;
        gap: 8px;
    }
    
    .zoom-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
        /* Увеличиваем область касания для лучшего UX */
        min-width: 44px;
        min-height: 44px;
    }
    
    .fullscreen-image {
        /* Улучшаем отзывчивость на мобильных */
        transition: transform 0.2s ease;
        /* Улучшаем перетаскивание на мобильных */
        will-change: transform;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    .modal-fullscreen .carousel {
        /* Улучшаем touch-события для перетаскивания */
        touch-action: pan-y pinch-zoom;
        -webkit-overflow-scrolling: touch;
    }
}
    
    .modal .carousel-control-prev,
    .modal .carousel-control-next {
        width: 35px !important;
        height: 35px !important;
    }
    
    /* Уменьшаем размеры изображений на мобильных для лучшего отображения */
    .modal-fullscreen .fullscreen-image,
    .modal-fullscreen .carousel-item img {
        max-height: 90vh !important;
        max-width: 90vw !important;
    }
    
    .zoom-controls {
        top: 15px;
        right: 15px;
    }
    
    .zoom-btn {
        width: 35px;
        height: 35px;
    }
}

@media (max-width: 576px) {
    .fullscreen-control {
        width: 35px !important;
        height: 35px !important;
    }
    
    .fullscreen-indicators {
        bottom: 15px;
    }
    
    .fullscreen-indicators .carousel-indicators li {
        width: 8px;
        height: 8px;
    }
    
    .modal .carousel-control-prev,
    .modal .carousel-control-next {
        width: 30px !important;
        height: 30px !important;
    }
    
    /* Еще больше уменьшаем размеры изображений на очень маленьких экранах */
    .modal-fullscreen .fullscreen-image,
    .modal-fullscreen .carousel-item img {
        max-height: 85vh !important;
        max-width: 85vw !important;
    }
    
    .zoom-controls {
        top: 10px;
        right: 10px;
    }
    
    .zoom-btn {
        width: 30px;
        height: 30px;
    }
}

/* Стили для главных изображений товара на странице деталей */
.product-gallery .product-image-container {
    position: relative;
    display: block;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* .product-gallery .product-image-container:hover {
    transform: scale(1.02);
} */

.product-gallery .product-main-image {
    transition: all 0.3s ease;
    width: 100%;
    height: auto;
}

.product-gallery .image-overlay {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
    z-index: 10;
}

.product-gallery .product-image-container:hover .image-overlay {
    opacity: 1;
}

.product-gallery .image-overlay i {
    font-size: 16px;
}

/* Адаптивность для главных изображений */
@media (max-width: 768px) {
    .product-gallery .image-overlay {
        width: 35px;
        height: 35px;
        top: 10px;
        right: 10px;
    }
    
    .product-gallery .image-overlay i {
        font-size: 14px;
    }
}

@media (max-width: 576px) {
    .product-gallery .image-overlay {
        width: 30px;
        height: 30px;
        top: 8px;
        right: 8px;
    }
    
    .product-gallery .image-overlay i {
        font-size: 12px;
    }
} 