/* gallery.css */

/* Модальное окно */
.modal {
    display: none; /* Скрыт по умолчанию */
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); /* Темный фон */
    overflow: auto; /* Добавляем прокрутку, если контент выходит за пределы экрана */
}

.modal-content {
    opacity: 0; /* Начальная невидимость */
    display: block;
    max-width: 100%; /* Максимальная ширина */
    max-height: 80vh; /* Максимальная высота (80% от высоты экрана) */
    margin: auto; /* Центрирование по горизонтали */
    position: absolute;
    top: 50%; /* Позиционирование по вертикали */
    left: 50%; /* Позиционирование по горизонтали */
    transform: translate(-50%, -50%); /* Корректировка позиции */
    object-fit: contain; /* Сохранение пропорций */
    animation: fadeIn 0.3s ease-out forwards; /* Плавное появление */
    user-select: none; /* Запрещаем выделение текста */
    touch-action: manipulation; /* Улучшаем взаимодействие с тачскрином */
    cursor: pointer; /* Курсор указывает на возможность клика */
    -webkit-user-drag: none; /* Отключаем перетаскивание изображения */
    -webkit-tap-highlight-color: transparent; /* Убираем подсветку при клике на мобильных устройствах */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Кнопка закрытия */
.close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
}

/* Иконка для открытия галереи */
.gallery-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.8) url("/uploads/icons/gallery-icon.svg") center/40px no-repeat;
    border-radius: 50%; /* Круглая форма */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
}

.gallery-icon:hover {
    background-color: rgba(255, 255, 255, 1); /* Темнее при наведении */
}

/* Кнопки "Назад" и "Вперед" */
.gallery-btn {
    position: absolute;
    top: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    font-size: 24px;
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    transform: translateY(-50%);
}

.gallery-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.prev {
    left: 0px;
}

.next {
    right: 0px;
}

#gallery-modal #modal-image[src=""] {
    display: none; /* Hide image when src is empty */
}

#gallery-modal #caption {
    display: none;
    margin: auto;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 40px 0;
    font-size: 1.2rem;
}