/* Стили для модального окна галереи */
.vlz-gallery-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
    animation: vlz-fadeIn 0.3s ease;
}

@keyframes vlz-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.vlz-modal-content {
    position: relative;
    margin: auto;
    display: block;
    width: auto;
    max-width: 90%;
    max-height: 90%;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: vlz-zoomIn 0.3s ease;
}

@keyframes vlz-zoomIn {
    from { transform: translateY(-50%) scale(0.8); opacity: 0; }
    to { transform: translateY(-50%) scale(1); opacity: 1; }
}

.vlz-modal-close {
    position: absolute;
    top: 25px;
    right: 35px;
    color: white;
    font-size: 2.5rem;
    font-weight: 300;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    z-index: 10001;
}

.vlz-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.vlz-modal-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 30px;
    transform: translateY(-50%);
    z-index: 10001;
}

.vlz-modal-prev,
.vlz-modal-next {
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.vlz-modal-prev:hover,
.vlz-modal-next:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.vlz-modal-caption {
    position: absolute;
    bottom: 30px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    font-size: 1.2rem;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

.vlz-modal-counter {
    position: absolute;
    top: 30px;
    left: 35px;
    color: white;
    font-size: 1.1rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Стили для галерей */
.vlz-gallery {
    cursor: pointer;
}

.vlz-gallery .gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.vlz-gallery .gallery-item:hover {
    transform: translateY(-5px);
}

.vlz-gallery .gallery-item img {
    width: 100%;
    height: auto;
    transition: transform 0.5s ease;
    border-radius: 8px;
}

.vlz-gallery .gallery-item:hover img {
    transform: scale(1.05);
}

.vlz-gallery .gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 20px 10px 10px;
    font-size: 0.9rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 0 0 8px 8px;
}

.vlz-gallery .gallery-item:hover .gallery-caption {
    opacity: 1;
}

/* Адаптивность */
@media (max-width: 768px) {
    .vlz-modal-content {
        max-width: 95%;
        max-height: 85%;
    }
    
    .vlz-modal-close {
        top: 15px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 2rem;
    }
    
    .vlz-modal-prev,
    .vlz-modal-next {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .vlz-modal-nav {
        padding: 0 15px;
    }
    
    .vlz-modal-caption {
        bottom: 15px;
        font-size: 1rem;
        padding: 10px 15px;
    }
    
    .vlz-modal-counter {
        top: 20px;
        left: 20px;
        font-size: 1rem;
        padding: 6px 12px;
    }
}

/* Индикатор загрузки */
.vlz-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: vlz-spin 1s linear infinite;
}

@keyframes vlz-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Восстанавливаем нормальное отображение галерей */
.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 2rem 0;
}

.gallery .gallery-item {
    flex: 1 1 calc(33.333% - 15px);
    max-width: calc(33.333% - 15px);
    margin: 0 !important;
    box-sizing: border-box;
}

.gallery.gallery-columns-1 .gallery-item {
    flex: 1 1 100%;
    max-width: 100%;
}

.gallery.gallery-columns-2 .gallery-item {
    flex: 1 1 calc(50% - 15px);
    max-width: calc(50% - 15px);
}

.gallery.gallery-columns-3 .gallery-item {
    flex: 1 1 calc(33.333% - 15px);
    max-width: calc(33.333% - 15px);
}

.gallery.gallery-columns-4 .gallery-item {
    flex: 1 1 calc(25% - 15px);
    max-width: calc(25% - 15px);
}

.gallery.gallery-columns-5 .gallery-item {
    flex: 1 1 calc(20% - 15px);
    max-width: calc(20% - 15px);
}

.gallery.gallery-columns-6 .gallery-item {
    flex: 1 1 calc(16.666% - 15px);
    max-width: calc(16.666% - 15px);
}

.gallery.gallery-columns-7 .gallery-item {
    flex: 1 1 calc(14.285% - 15px);
    max-width: calc(14.285% - 15px);
}

.gallery.gallery-columns-8 .gallery-item {
    flex: 1 1 calc(12.5% - 15px);
    max-width: calc(12.5% - 15px);
}

.gallery.gallery-columns-9 .gallery-item {
    flex: 1 1 calc(11.111% - 15px);
    max-width: calc(11.111% - 15px);
}

/* Стили для изображений в галереях */
.gallery .gallery-item img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    display: block;
    border-radius: 8px;
}

/* Сброс стандартных стилей WordPress */
.gallery br {
    display: none;
}

.gallery .gallery-caption {
    width: 100%;
    text-align: center;
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.5rem;
    line-height: 1.4;
}

/* Стили для Gutenberg галерей */
.wp-block-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 2rem 0;
}

.wp-block-gallery .blocks-gallery-item {
    flex: 1 1 calc(33.333% - 15px);
    max-width: calc(33.333% - 15px);
    margin: 0 !important;
}

.wp-block-gallery.columns-1 .blocks-gallery-item {
    flex: 1 1 100%;
    max-width: 100%;
}

.wp-block-gallery.columns-2 .blocks-gallery-item {
    flex: 1 1 calc(50% - 15px);
    max-width: calc(50% - 15px);
}

.wp-block-gallery.columns-3 .blocks-gallery-item {
    flex: 1 1 calc(33.333% - 15px);
    max-width: calc(33.333% - 15px);
}

.wp-block-gallery.columns-4 .blocks-gallery-item {
    flex: 1 1 calc(25% - 15px);
    max-width: calc(25% - 15px);
}

.wp-block-gallery.columns-5 .blocks-gallery-item {
    flex: 1 1 calc(20% - 15px);
    max-width: calc(20% - 15px);
}

.wp-block-gallery.columns-6 .blocks-gallery-item {
    flex: 1 1 calc(16.666% - 15px);
    max-width: calc(16.666% - 15px);
}

.wp-block-gallery .blocks-gallery-item img {
    width: 100% !important;
    height: auto !important;
    display: block;
    border-radius: 8px;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .gallery .gallery-item,
    .wp-block-gallery .blocks-gallery-item {
        flex: 1 1 calc(50% - 10px) !important;
        max-width: calc(50% - 10px) !important;
    }
    
    .gallery.gallery-columns-4 .gallery-item,
    .gallery.gallery-columns-5 .gallery-item,
    .gallery.gallery-columns-6 .gallery-item,
    .gallery.gallery-columns-7 .gallery-item,
    .gallery.gallery-columns-8 .gallery-item,
    .gallery.gallery-columns-9 .gallery-item,
    .wp-block-gallery.columns-4 .blocks-gallery-item,
    .wp-block-gallery.columns-5 .blocks-gallery-item,
    .wp-block-gallery.columns-6 .blocks-gallery-item {
        flex: 1 1 calc(50% - 10px) !important;
        max-width: calc(50% - 10px) !important;
    }
}

@media (max-width: 480px) {
    .gallery .gallery-item,
    .wp-block-gallery .blocks-gallery-item {
        flex: 1 1 100% !important;
        max-width: 100% !important;
    }
}

/* Убираем стандартные отступы WordPress */
.gallery * {
    box-sizing: border-box;
}

/* Убедимся, что наши миниатюры выглядят правильно */
.vlz-gallery-thumb {
    width: 100% !important;
    height: auto !important;
    object-fit: cover;
}