/* Модальное окно - белый фон */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.98);
    overflow: hidden;
}

/* Контейнер для изображения */
.modal-image-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.modal-content {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
    animation: zoom 0.3s ease;
}

@keyframes zoom {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Кнопки навигации - темные на светлом фоне */
.modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.08);
    color: #333;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    width: 55px;
    height: 55px;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.modal-nav:hover {
    background: rgba(0, 0, 0, 0.15);
    border-color: rgba(0, 0, 0, 0.3);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.2);
}

.modal-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.modal-nav.prev {
    left: 25px;
}

.modal-nav.next {
    right: 25px;
}

/* Кнопка закрытия - темная */
.close-modal {
    position: fixed;
    top: 25px;
    right: 35px;
    color: #333;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    line-height: 0.5;
    padding: 13px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Информация о фото - темный текст */
.modal-caption {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: #555;
    background: rgba(255, 255, 255, 0.92);
    padding: 15px 30px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    max-width: 80%;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.modal-caption h3 {
    color: #222;
    margin: 0 0 5px 0;
    font-size: 20px;
}

.modal-caption p {
    margin: 5px 0;
    font-size: 20px;
    color: #666;
}

.modal-counter {
    color: #999;
    font-size: 13px;
    margin-top: 8px;
    letter-spacing: 1px;
}

/* Индикатор загрузки - светлый */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #555;
    font-size: 18px;
    z-index: 10001;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 40px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.loading::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

/* Увеличенная область клика для кнопок */
.modal-nav::before {
    content: '';
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    border-radius: 50%;
}

/* Адаптивность */
@media (max-width: 768px) {
    .modal-image-container {
        width: 95%;
        height: 70vh;
    }
    
    .modal-nav {
        width: 45px;
        height: 45px;
        font-size: 22px;
    }
    
    .modal-nav.prev {
        left: 10px;
    }
    
    .modal-nav.next {
        right: 10px;
    }
    
    .close-modal {
        top: 15px;
        right: 15px;
        padding: 10px;
        font-size: 28px;
        width: 40px;
        height: 40px;
    }
    
    .modal-caption {
        padding: 10px 20px;
        bottom: 15px;
        max-width: 90%;
    }
    
    .modal-caption h3 {
        font-size: 16px;
    }
    
    .modal-caption p {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .modal-nav {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }
    
    .modal-nav.prev {
        left: 5px;
    }
    
    .modal-nav.next {
        right: 5px;
    }
    
    .modal-nav::before {
        top: -10px;
        left: -10px;
        right: -10px;
        bottom: -10px;
    }
}