/* Модель: Qwen/qwen3 Coder 30b */
/* Данные актуальны на: 23.08.2025 */
/* Ответ сгенерирован: 23.08.2025 */

/* Стили для галереи медиа */

/* Предотвращение моргания */
html {
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

body {
    /* Предотвращение моргания */
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Основная галерея */
.media-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.media-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    background: transparent;
}

.media-thumbnail {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border-radius: 12px;
}

/* Стили для медиа-галереи в story_detail.html */
.media-gallery .gallery-image {
    width: 100%;
    height: 0;
    padding-bottom: 75%; /* Соотношение 4:3 (3/4 = 0.75) */
    position: relative;
    overflow: hidden;
}

.media-gallery .gallery-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: transparent;
    z-index: 1;
    opacity: 1 !important; /* Принудительно показываем изображения */
    visibility: visible !important;
    display: block !important;
}

.media-gallery .gallery-video {
    width: 100%;
    height: 0;
    padding-bottom: 75%; /* Соотношение 4:3 */
    object-fit: cover;
    position: relative;
}

.media-gallery .gallery-video video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    opacity: 1 !important; /* Принудительно показываем видео */
    visibility: visible !important;
    display: block !important;
}

.media-gallery .media-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
    pointer-events: none;
}

/* Показываем иконки только при наведении */
.media-gallery .media-thumbnail:hover .media-overlay {
    opacity: 1;
    pointer-events: auto;
}

.media-gallery .media-overlay i {
    color: var(--accent-color);
    font-size: 1.5rem;
    background: white;
    padding: 0.5rem;
    border-radius: 50%;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.media-gallery .media-thumbnail:hover .media-overlay i {
    transform: scale(1.1);
}

.media-gallery .media-caption {
    padding: 1rem;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    margin-top: 0;
}

.media-gallery .media-caption h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1.1rem;
}

.media-gallery .media-caption p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Простой модальный просмотр изображений */
.image-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.image-modal .modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image {
    max-width: 90%;
    max-height: 80%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-caption {
    margin-top: 1rem;
    text-align: center;
    color: white;
}

.modal-caption h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 500;
}

/* Простой модальный просмотр видео */
.video-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.video-modal .modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-video {
    max-width: 90%;
    max-height: 80%;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Предварительный просмотр в карточках историй */
.story-media-preview {
    position: relative;
    width: 100%;
    height: 200px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    background: transparent;
}

.preview-video {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

.more-media {
    position: absolute;
    bottom: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px 0 0 0;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

/* Действия в карточке истории */
.story-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 8px 16px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Анимации - отключены для быстрой загрузки */
@keyframes fadeIn {
    from { opacity: 1; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from { transform: scale(1); opacity: 1; }
    to { transform: scale(1); opacity: 1; }
}

.image-modal.show,
.video-modal.show {
    animation: none;
}

.modal-image,
.modal-video {
    animation: none;
}

.media-item {
    animation: none;
}

/* Адаптивность */
@media (max-width: 768px) {
    .media-gallery {
        grid-template-columns: 1fr;
    }
    
    .close-btn {
        top: 10px;
        right: 15px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }
    
    .modal-image,
    .modal-video {
        max-width: 95%;
        max-height: 70%;
    }
    
    .image-modal .modal-content,
    .video-modal .modal-content {
        padding: 1rem;
    }
    
    .story-actions {
        flex-direction: column;
    }
    
    .btn-outline {
        text-align: center;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .close-btn {
        top: 5px;
        right: 10px;
        font-size: 25px;
        width: 35px;
        height: 35px;
    }
    
    .modal-image,
    .modal-video {
        max-width: 98%;
        max-height: 60%;
    }
    
    .story-media-preview {
        height: 150px;
    }
}

/* Стили для печати */
@media print {
    .image-modal,
    .video-modal,
    .close-btn {
        display: none !important;
    }
    
    .media-gallery {
        display: block;
    }
    
    .media-item {
        page-break-inside: avoid;
        margin-bottom: 2rem;
    }
    
    .media-item img {
        max-width: 100%;
        height: auto;
    }
}

/* ======================================== */
/* СТИЛИ ДЛЯ ГАЛЕРЕИ (gallery.html) */
/* ======================================== */

/* Основная галерея (gallery.html) */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 столбца для ПК */
    gap: 1.5rem;
    margin: 2rem 0;
}

/* Предотвращение конфликтов между галереями */
.gallery-grid .gallery-image img,
.gallery-grid .gallery-image video {
    opacity: 1 !important; /* Принудительно показываем изображения */
    visibility: visible !important;
    display: block !important;
}

/* Медиа-галерея в story_detail.html всегда показывает изображения */
.media-gallery .gallery-image img,
.media-gallery .gallery-video video {
    opacity: 1 !important;
}

.gallery-item {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    border: 1px solid var(--border-color);
}

.gallery-image {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 75%; /* Соотношение 4:3 (3/4 = 0.75) как в историях */
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

/* Стили для основной галереи (gallery.html) */
.gallery-grid .gallery-image img,
.gallery-grid .gallery-image video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #f5f5f5; /* Фон для миниатюр */
    z-index: 1;
}

/* Стили для миниатюр (только для основной галереи) */
.gallery-grid .gallery-image img[src*="thumbnail"],
.gallery-grid .gallery-image img[data-thumbnail="true"] {
    filter: blur(0.5px); /* Легкое размытие для миниатюр */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Индикатор загрузки (только для основной галереи) */
.gallery-grid .gallery-image::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 1;
    opacity: 0;
    pointer-events: none;
}

.gallery-grid .gallery-image.loading::before {
    opacity: 1;
}

/* Предотвращение моргания при загрузке (только для основной галереи) */
.gallery-grid .gallery-image {
    opacity: 1;
}

.gallery-grid .gallery-image.loading {
    opacity: 0.8;
}

/* Дополнительная защита от моргания */
.gallery-grid .gallery-image img,
.gallery-grid .gallery-image video {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Ссылки в основной галерее */
.gallery-grid .gallery-image-link,
.gallery-grid .gallery-video-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

/* Placeholder для основной галереи */
.gallery-grid .file-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 2rem;
    text-align: center;
}

.gallery-grid .file-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.gallery-grid .file-placeholder span {
    font-size: 0.9rem;
    word-break: break-word;
    max-width: 100%;
}

/* Подписи под картинками для основной галереи */
.gallery-grid .gallery-overlay {
    position: static;
    background: var(--card-bg);
    color: var(--text-color);
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    z-index: 1;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Информация в основной галерее */
.gallery-grid .gallery-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-color);
}

.gallery-grid .gallery-info p {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-secondary);
}

.gallery-grid .gallery-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.gallery-grid .gallery-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.9;
    color: var(--text-secondary);
}

.gallery-grid .gallery-meta i {
    width: 14px;
    color: var(--accent-color);
    font-size: 0.9rem;
}

/* Ссылки на истории в основной галерее */
.gallery-grid .story-link a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.gallery-grid .story-link a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Пагинация */
.pagination-wrapper {
    margin: 3rem 0;
    text-align: center;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.page-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 25px;
    border: 1px solid var(--border-color);
    font-weight: 500;
}

.page-link.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.page-ellipsis {
    padding: 0.75rem 0.5rem;
    color: var(--text-secondary);
}

.page-numbers {
    display: flex;
    gap: 0.25rem;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.empty-state h2 {
    margin: 0 0 1rem 0;
    color: var(--text-color);
}

.empty-state p {
    margin: 0 0 2rem 0;
    font-size: 1.1rem;
}

/* Lightbox стили */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    background: var(--card-bg);
    border-radius: 12px;
    max-width: 90%;
    max-height: 90%;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.lightbox-header h3 {
    margin: 0;
    color: var(--text-color);
}

.lightbox-close {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
}

.lightbox-body {
    padding: 1rem;
    text-align: center;
}

.lightbox-body img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.lightbox-footer p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Адаптивность для галереи */
@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 столбца для планшетов */
        gap: 1.25rem;
    }
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 столбца для планшетов */
        gap: 1rem;
    }
    
    .gallery-overlay {
        padding: 1rem;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr; /* 1 столбец для телефонов */
        gap: 1rem;
    }
    
    .gallery-item {
        margin-bottom: 1rem;
    }
}

/* Темная тема для основной галереи */
[data-theme="dark"] .gallery-grid .gallery-item {
    background: var(--card-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-color: var(--border-color);
}

[data-theme="dark"] .gallery-grid .gallery-overlay {
    background: var(--card-bg);
    border-top-color: var(--border-color);
}

[data-theme="dark"] .gallery-grid .gallery-info h3 {
    color: var(--text-color);
}

[data-theme="dark"] .gallery-grid .gallery-info p {
    color: var(--text-secondary);
}

[data-theme="dark"] .gallery-grid .gallery-meta span {
    color: var(--text-secondary);
}

[data-theme="dark"] .gallery-grid .gallery-image img,
[data-theme="dark"] .gallery-grid .gallery-image video {
    background: var(--bg-secondary);
}

[data-theme="dark"] .gallery-grid .gallery-image-link,
[data-theme="dark"] .gallery-grid .gallery-video-link {
    color: inherit;
}

[data-theme="dark"] .gallery-grid .file-placeholder {
    background: var(--bg-tertiary);
}

/* Темная тема для пагинации */
[data-theme="dark"] .page-link {
    background: var(--card-bg);
    border-color: var(--border-color);
}

/* Темная тема для lightbox */
[data-theme="dark"] .lightbox-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

/* ======================================== */
/* СТИЛИ ДЛЯ STORY_DETAIL.HTML */
/* ======================================== */

/* Стили для асинхронной загрузки туров */
.tour-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    margin: 1rem 0;
    min-height: 100px;
}

.tour-loading i {
    margin-right: 0.5rem;
    color: #007bff;
    font-size: 1.2rem;
}

.tour-loading span {
    color: #666;
    font-size: 0.9rem;
}

.tour-script-container {
    opacity: 1;
}

.tour-script-container.loaded {
    opacity: 1;
}

.tour-error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 8px;
    margin: 1rem 0;
    color: #dc3545;
    font-size: 0.9rem;
}

/* Статистика истории */
.story-stats {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 123, 255, 0.05);
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.story-views, .story-likes {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

.story-views i, .story-likes i {
    color: #007bff;
}

/* Кнопка лайка */
.story-actions {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    padding: 1rem;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.btn-like {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: #fff;
    border: 2px solid #007bff;
    color: #007bff;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    text-decoration: none;
}

.btn-like.liked {
    background: #007bff;
    color: #fff;
}

.btn-like:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Стили для темной темы */
[data-theme="dark"] .btn-like {
    background: var(--bg-secondary);
    border: 2px solid #007bff;
    color: #007bff;
}

[data-theme="dark"] .btn-like.liked {
    background: #007bff;
    color: #fff;
}

[data-theme="dark"] .btn-like:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-secondary);
    color: #666;
}

/* Стили для сообщения о отключенных cookie */
.cookie-disabled-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 193, 7, 0.1);
    border: 2px solid #ffc107;
    border-radius: 25px;
    color: #856404;
    font-size: 0.9rem;
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.cookie-disabled-message i {
    color: #ffc107;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Стили для темной темы */
[data-theme="dark"] .cookie-disabled-message {
    background: rgba(255, 193, 7, 0.15);
    border-color: #ffc107;
    color: #ffd54f;
}

[data-theme="dark"] .cookie-disabled-message i {
    color: #ffd54f;
}

/* Простой модальный просмотр изображений */
.image-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

/* Поддержка темной темы для модальных окон */
[data-theme="dark"] .image-modal {
    background-color: rgba(0, 0, 0, 0.95);
}

.image-modal .modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image {
    max-width: 90%;
    max-height: 80%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-caption {
    margin-top: 1rem;
    text-align: center;
    color: white;
}

.modal-caption h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 500;
}

/* Простой модальный просмотр видео */
.video-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

/* Поддержка темной темы для видео модальных окон */
[data-theme="dark"] .video-modal {
    background-color: rgba(0, 0, 0, 0.95);
}

.video-modal .modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-video {
    max-width: 90%;
    max-height: 80%;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Адаптивность для story_detail */
@media (max-width: 768px) {
    .close-btn {
        top: 10px;
        right: 15px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }
    
    .modal-image,
    .modal-video {
        max-width: 95%;
        max-height: 70%;
    }
    
    .image-modal .modal-content,
    .video-modal .modal-content {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .close-btn {
        top: 5px;
        right: 10px;
        font-size: 25px;
        width: 35px;
        height: 35px;
    }
    
    .modal-image,
    .modal-video {
        max-width: 98%;
        max-height: 60%;
    }
}

/* ============================================================================
   ГОРИЗОНТАЛЬНЫЙ РЕЖИМ ДЛЯ ГАЛЕРЕИ НА МОБИЛЬНЫХ УСТРОЙСТВАХ
   ============================================================================ */

/* Горизонтальный режим для галереи */
@media (max-width: 768px) and (orientation: landscape) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .gallery-image {
        height: 0;
        padding-bottom: 60%; /* Уменьшаем соотношение сторон для горизонтального режима */
    }
    
    .gallery-image img {
        height: 120px;
    }
    
    .gallery-overlay {
        padding: 0.75rem;
    }
    
    .gallery-info h3 {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }
    
    .gallery-info p {
        font-size: 0.75rem;
        margin-bottom: 0.4rem;
        line-height: 1.3;
    }
    
    .gallery-meta {
        font-size: 0.7rem;
        gap: 0.5rem;
    }
    
    .gallery-meta span {
        display: flex;
        align-items: center;
        gap: 0.3rem;
    }
    
    .gallery-meta i {
        font-size: 0.8rem;
    }
    
    .gallery-meta a {
        font-size: 0.7rem;
    }
    
    /* Пагинация в горизонтальном режиме */
    .pagination-wrapper {
        margin-top: 1.5rem;
    }
    
    .pagination {
        gap: 0.3rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-link {
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
    }
    
    .page-numbers {
        display: flex;
        gap: 0.3rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* Модальные окна в горизонтальном режиме */
    .close-btn {
        top: 8px;
        right: 12px;
        font-size: 28px;
        width: 38px;
        height: 38px;
    }
    
    .modal-image,
    .modal-video {
        max-width: 92%;
        max-height: 75%;
    }
    
    .image-modal .modal-content,
    .video-modal .modal-content {
        padding: 1.5rem;
    }
}

/* Очень маленькие экраны в горизонтальном режиме */
@media (max-width: 568px) and (orientation: landscape) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .gallery-image img {
        height: 100px;
    }
    
    .gallery-overlay {
        padding: 0.5rem;
    }
    
    .gallery-info h3 {
        font-size: 0.8rem;
        margin-bottom: 0.3rem;
    }
    
    .gallery-info p {
        font-size: 0.7rem;
        margin-bottom: 0.3rem;
    }
    
    .gallery-meta {
        font-size: 0.65rem;
        gap: 0.4rem;
    }
    
    .gallery-meta i {
        font-size: 0.7rem;
    }
    
    .gallery-meta a {
        font-size: 0.65rem;
    }
    
    .page-link {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .close-btn {
        top: 5px;
        right: 8px;
        font-size: 24px;
        width: 32px;
        height: 32px;
    }
    
    .modal-image,
    .modal-video {
        max-width: 95%;
        max-height: 70%;
    }
    
    .image-modal .modal-content,
    .video-modal .modal-content {
        padding: 1rem;
    }
}
