/* =============================================================================
   ЛАЙТБОКС ДЛЯ ГАЛЕРЕИ ТОВАРОВ - СТИЛИ
============================================================================= */

.product-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.95);
}

.product-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    cursor: pointer;
}

.lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: calc(90vh - 60px);
    width: auto;
    height: auto;
    object-fit: contain;
    transition: opacity 0.3s ease;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Кнопки управления лайтбоксом */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10001;
    line-height: 1;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10001;
    line-height: 1;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-50%) scale(1.1);
}

/* Счетчик изображений */
.lightbox-counter {
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 400;
    text-align: center;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    letter-spacing: 0.5px;
}

/* =============================================================================
   УЛУЧШЕНИЯ ДЛЯ ОСНОВНОЙ ГАЛЕРЕИ
============================================================================= */

/* Курсор zoom-in для главного изображения */
.main-image {
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

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

/* Улучшенные состояния thumbnail'ов */
.thumbnail {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.thumbnail:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.thumbnail.active {
    border-color: #000;
    opacity: 1;
    transform: scale(1.02);
}

.thumbnail:focus {
    outline: 2px solid #000;
    outline-offset: 2px;
}

/* Индикатор загрузки для изображений */
.main-image img {
    transition: opacity 0.3s ease;
}

.loading-image {
    position: relative;
}

.loading-image::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* =============================================================================
   АДАПТИВНЫЕ СТИЛИ ДЛЯ ЛАЙТБОКСА
============================================================================= */

@media (max-width: 768px) {
    .lightbox-container {
        padding: 20px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .lightbox-prev,
    .lightbox-next {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .lightbox-image {
        max-height: calc(95vh - 80px);
    }
    
    .lightbox-counter {
        margin-top: 15px;
        font-size: 12px;
    }
}

/* Анимация появления лайтбокса */
.product-lightbox {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.product-lightbox.active .lightbox-content {
    animation: lightboxFadeIn 0.3s ease;
}

@keyframes lightboxFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}