/* ============================================
   ГАЛЕРЕЯ ОБУЧЕНИЯ
   ============================================ */

.gallery-section {
    padding: 40px 20px;
    background: #f0f2f5;
}

.gallery-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.06);
}

/* --- Основной слайдер (без кнопок) --- */
.gallery-main {
    position: relative;
    margin-bottom: 15px;
}

.gallery-main-slider {
    overflow: hidden;
    border-radius: 12px;
    aspect-ratio: 16/9;
    background: #f0f2f5;
}

.gallery-main-track {
    display: flex;
    transition: transform 0.5s ease;
    height: 100%;
}

.gallery-main-track .gallery-slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.gallery-main-track .gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Кнопки управления (все в одном ряду) --- */
.gallery-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

/* Навигационные кнопки (в ряду с кнопкой "Увеличить") */
.gallery-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Open Sans', 'Arial', 'Helvetica Neue', sans-serif;
    color: #1951A0;
    background: #f0f2f5;
    border: 2px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

.gallery-nav:hover {
    background: #1951A0;
    color: #ffffff;
    transform: scale(1.03);
}

.gallery-nav:active {
    transform: scale(0.95);
}

.gallery-nav svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Кнопка "Увеличить" */
.gallery-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Open Sans', 'Arial', 'Helvetica Neue', sans-serif;
    color: #1951A0;
    background: #f0f2f5;
    border: 2px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-btn:hover {
    background: #1951A0;
    color: #ffffff;
    transform: scale(1.03);
}

.gallery-btn svg {
    width: 20px;
    height: 20px;
}

/* --- Миниатюры --- */
.gallery-thumbnails {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

.gallery-thumb {
    width: 80px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.gallery-thumb:hover {
    transform: scale(1.05);
    border-color: #1951A0;
}

.gallery-thumb.active {
    border-color: #E4003A;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(228, 0, 58, 0.3);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ============================================
   МОДАЛЬНОЕ ОКНО ДЛЯ УВЕЛИЧЕНИЯ
   ============================================ */

.gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.gallery-modal.active {
    display: flex;
}

.gallery-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-modal-content .modal-image-wrapper {
    width: 100%;
    height: 100%;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gallery-modal-content .modal-image-wrapper img {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

/* --- Кнопки навигации в модалке --- */
.gallery-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.gallery-modal-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-50%) scale(1.05);
}

.gallery-modal-nav-prev {
    left: -60px;
}

.gallery-modal-nav-next {
    right: -60px;
}

.gallery-modal-nav svg {
    width: 28px;
    height: 28px;
}

/* --- Кнопка закрытия модалки --- */
.gallery-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 36px;
    cursor: pointer;
    transition: transform 0.3s ease;
    padding: 10px;
    z-index: 11;
    line-height: 1;
}

.gallery-modal-close:hover {
    transform: rotate(90deg);
}

/* --- Счётчик в модалке --- */
.gallery-modal-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-family: 'Open Sans', 'Arial', 'Helvetica Neue', sans-serif;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

@media (max-width: 768px) {
    .gallery-section {
        padding: 30px 15px;
    }
    
    .gallery-wrapper {
        padding: 15px;
    }
    
    .gallery-thumb {
        width: 60px;
        height: 45px;
    }
    
    .gallery-nav {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .gallery-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .gallery-nav svg,
    .gallery-btn svg {
        width: 16px;
        height: 16px;
    }
    
    /* Модалка на мобильных */
    .gallery-modal-content {
        max-width: 95vw;
        max-height: 90vh;
    }
    
    .gallery-modal-content .modal-image-wrapper img {
        max-height: 80vh;
    }
    
    .gallery-modal-nav {
        width: 36px;
        height: 36px;
    }
    
    .gallery-modal-nav-prev {
        left: 10px;
    }
    
    .gallery-modal-nav-next {
        right: 10px;
    }
    
    .gallery-modal-nav svg {
        width: 20px;
        height: 20px;
    }
    
    .gallery-modal-close {
        top: -45px;
        font-size: 30px;
    }
    
    .gallery-modal-counter {
        bottom: -35px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .gallery-wrapper {
        padding: 10px;
    }
    
    .gallery-thumb {
        width: 50px;
        height: 38px;
    }
    
    .gallery-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .gallery-nav {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .gallery-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .gallery-nav svg,
    .gallery-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .gallery-modal-nav {
        width: 30px;
        height: 30px;
    }
    
    .gallery-modal-nav svg {
        width: 16px;
        height: 16px;
    }
    
    .gallery-modal-close {
        top: -40px;
        font-size: 24px;
    }
}