/* Основные стили галерей */
.gallery-container {
    width: 450px;
    background: white;
    border-radius: 15px;
    margin: 0 auto;
    padding: 15px;
    box-sizing: border-box;
}

/* Основное изображение */
.main-image-container {
    width: 100%;
    max-width: 400px;
    height: 300px;
    margin: 0 auto 25px auto;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid #eaeaea;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    transition: transform 0.3s ease;
}

.main-image-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #3498db;
}

.main-image {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}

/* Контейнер для миниатюр */
.thumbnails-container {
    width: 100%;
    padding: 10px 0;
}

.thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.thumbnail {
    width: 70px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    background: white;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.thumbnail:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.thumbnail:hover img {
    transform: scale(1.1);
}

.thumbnail.active {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* ===== МОДАЛЬНОЕ ОКНО ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Полупрозрачный черный фон */
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: hidden;
}

.modal.show {
    display: block;
    opacity: 1;
    z-index: 99999;
}

/* Кнопка закрытия - крестик в правом верхнем углу */
.close-modal-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: all 0.2s ease;
    z-index: 10001;
    padding: 0;
    border-radius: 50%;
    outline: none !important;
}

.close-modal-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.close-modal-btn svg {
    width: 24px;
    height: 24px;
}

/* Контейнер содержимого модального окна */
.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Контейнер для изображения */
.image-container {
    width: 100%;
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#fullsizeImage {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Стрелки навигации по бокам экрана */
.nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    width: 60px;
    height: 60px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    transition: all 0.2s ease;
    z-index: 10001;
    padding: 0;
    border-radius: 50%;
}

.nav-btn:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-50%) scale(1.1);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-btn:disabled:hover {
    background-color: transparent;
    transform: translateY(-50%);
}

.nav-btn svg {
    width: 32px;
    height: 32px;
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

/* Счетчик изображений */
.image-counter {
    position: absolute;
    bottom: -50px;
    color: white;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    font-family: "Roboto", Arial, sans-serif;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .gallery-container {
        padding: 12px;
        width: 400px;
    }
    
    .main-image-container {
        max-width: 350px;
        height: 280px;
        margin-bottom: 20px;
    }
    
    .thumbnails-container {
        padding: 8px;
    }
    
    .thumbnail {
        width: 65px;
        height: 45px;
    }
    
    .thumbnails {
        gap: 8px;
    }
    
    .close-modal-btn {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
    }
    
    .close-modal-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .nav-btn {
        width: 50px;
        height: 50px;
    }
    
    .nav-btn svg {
        width: 24px;
        height: 24px;
    }
    
    .prev-btn {
        left: 10px;
    }
    
    .next-btn {
        right: 10px;
    }
    
    .image-counter {
        bottom: -50px;
        font-size: 14px;
        padding: 6px 12px;
    }
    
    .image-container {
        height: 70vh;
    }
}

@media (max-width: 480px) {
    .gallery-container {
        padding: 0;
        width: 100%;
    }
    
    .main-image-container {
        width: 90%;
        height: 250px;
        padding: 8px;
    }
    
    .thumbnail {
        width: 60px;
        height: 40px;
    }
    
    .thumbnails {
        gap: 6px;
    }
    
    .close-modal-btn {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }
    
    .close-modal-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .nav-btn {
        width: 44px;
        height: 44px;
    }
    
    .nav-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .image-container {
        height: 60vh;
    }
}

@media (max-width: 360px) {
    
    .main-image-container {
        height: 230px;
    }
    
    .thumbnail {
        width: 55px;
        height: 38px;
    }
    
    .thumbnails {
        gap: 5px;
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
    }
}

/* Анимация появления */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-container {
    animation: fadeIn 0.5s ease-out;
}