.ms-gallery {
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
}

.ms-gallery__main {
    position: relative;
    height: auto;
    border-bottom: 2px solid #ddd;
}

.ms-gallery .swiper {
    width: 100%;
    height: auto;
}

.ms-gallery .swiper-slide {
    display: block;
    background: #f8f9fa;
    box-sizing: border-box;
    position: relative;
    height: auto;
}

.ms-gallery .swiper-slide img {
    width: 100%;
    height: auto;
    display: block;
    vertical-align: bottom;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.ms-gallery__caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.6));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    padding: 14px 20px;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    z-index: 5;
    word-wrap: break-word;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    border-radius:  0;
    box-shadow: 0 -4px 20px color-mix(in srgb, var(--ms-primary, #00739c) 30%, transparent);
}


.ms-gallery__caption.show {
    opacity: 1;
    visibility: visible;
}



.ms-gallery__thumbs {
    padding: 15px 0;
    overflow: hidden;
}

.ms-gallery__thumbs .swiper {
    height: 80px;
}

.ms-gallery__thumbs .swiper-slide {
    width: auto;
    height: 80px;
    margin-right: 10px;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.ms-gallery__thumbs .swiper-slide:hover {
    opacity: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ms-gallery__thumbs .swiper-slide.swiper-slide-thumb-active {
    border-color: #007bff;
    opacity: 1;
}

.ms-gallery__thumbs .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    vertical-align: bottom;
}

/* Gallery arrows use .ma-swiper-btn from global-styles.css */

.ms-gallery__counter {
    position: absolute;
    top: 15px;
    right: 72px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 12px 12px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10;
}

.ms-gallery__zoom {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 10px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10;
    display: inline-flex;
    transition: .2s;
}

.ms-gallery__zoom:hover {
    background: rgba(0, 0, 0, 0.85);
}

@media (max-width: 768px) {

    .ms-gallery__thumbs {
        padding: 10px;
    }

    .ms-gallery__thumbs .swiper {
        height: 60px;
    }

    .thumbnail-swiper .swiper-slide {
        height: 60px;
        margin-right: 8px;
    }
}

@media (max-width: 480px) {

    .ms-gallery__thumbs .swiper {
        height: 50px;
    }

    .ms-gallery__thumbs .swiper-slide {
        height: 50px;
        margin-right: 6px;
    }

    .ms-gallery__counter {
        top: 10px;
        right: 10px;
        padding: 4px 8px;
        font-size: 12px;
    }

    .ms-gallery__caption {
        padding: 8px 12px;
        font-size: 12px;
    }
}