/* 多样式图片展示器样式 */

.multi-gallery-container {
    position: relative;
    margin: 20px auto;
    max-width: 100%;
}

/* 主图片容器 */
.main-image-container {
    position: relative;
    width: 100%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 400px;
}

.main-image {
    max-width: 95%;
    max-height: 95%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    transition: opacity 0.3s ease;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 12px;
}

/* 导航按钮 */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 30px;
    line-height: 1;
    width: 50px;
    height: 50px;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.prev-btn {
    left: 15px;
}

.next-btn {
    right: 15px;
}

/* 缩略图容器 */
.thumbnail-container {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #fff;
    box-sizing: border-box;
}

.thumbnail-container.horizontal {
    overflow-x: auto;
    overflow-y: hidden;
    flex-direction: row;
    justify-content: center; /* 改为居中 */
    align-items: center;
}

.thumbnail-container.vertical {
    overflow-y: auto;
    overflow-x: hidden;
    flex-direction: column;
    max-height: 500px;
    align-items: center;
    justify-content: center; /* 改为居中 */
}

.thumbnail {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    flex-shrink: 0;
    object-fit: cover;
    display: block;
    border-radius: 8px; /* 添加圆角 */
}

.thumbnail-container.horizontal .thumbnail {
    width: 100px;
    height: 100px;
}

.thumbnail-container.vertical .thumbnail {
    width: 100px;
    height: 100px;
}

.thumbnail:hover {
    transform: scale(1.08);
    border-color: #999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.thumbnail.active {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.3);
}

/* 样式1: 上图下缩略图 */
.gallery-style-1 {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center; /* 整体居中 */
}

.gallery-style-1 .main-image-container {
    min-height: 450px;
    margin-bottom: 10px;
    width: 100%;
}

.gallery-style-1 .thumbnail-container {
    width: 100%;
}

/* 样式2: 左缩略图右大图 */
.gallery-style-2 {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
}

.gallery-style-2 .thumbnail-container {
    width: 130px;
    flex-shrink: 0;
}

.gallery-style-2 .main-image-container {
    flex: 1;
    min-height: 500px;
}

/* 样式3: 左大图右缩略图 */
.gallery-style-3 {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
}

.gallery-style-3 .main-image-container {
    flex: 1;
    min-height: 500px;
    order: 1;
}

.gallery-style-3 .thumbnail-container {
    width: 130px;
    flex-shrink: 0;
    order: 2;
}

/* 样式4: 单图横向切换 */
.gallery-style-4 {
    display: flex;
    justify-content: center; /* 居中 */
    align-items: center;
}

.gallery-style-4 .main-image-container {
    min-height: 500px;
    width: 100%;
}

/* 样式5: 单图纵向切换 */
.gallery-style-5 {
    display: flex;
    justify-content: center; /* 居中 */
    align-items: center;
}

.gallery-style-5 .main-image-container.vertical-nav {
    min-height: 500px;
    width: 100%;
}

.gallery-style-5 .nav-btn.top {
    top: 15px;
    left: 50%;
    transform: translateX(-50%) rotate(-90deg);
}

.gallery-style-5 .nav-btn.top:hover {
    transform: translateX(-50%) rotate(-90deg) scale(1.1);
}

.gallery-style-5 .nav-btn.bottom {
    top: auto;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%) rotate(-90deg);
}

.gallery-style-5 .nav-btn.bottom:hover {
    transform: translateX(-50%) rotate(-90deg) scale(1.1);
}

/* 图片计数器 */
.image-counter {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10;
    white-space: nowrap;
}

/* 隐藏的图片数据 */
.hidden-images {
    display: none;
}

/* 滚动条样式 */
.thumbnail-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.thumbnail-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.thumbnail-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.thumbnail-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .gallery-style-2,
    .gallery-style-3 {
        flex-direction: column;
    }
    
    .gallery-style-2 .thumbnail-container,
    .gallery-style-3 .thumbnail-container {
        width: 100%;
        max-height: 130px;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        order: 2;
        justify-content: center; /* 移动端也居中 */
    }
    
    .gallery-style-2 .main-image-container,
    .gallery-style-3 .main-image-container {
        order: 1;
        min-height: 350px;
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .prev-btn {
        left: 10px;
    }
    
    .next-btn {
        right: 10px;
    }
    
    .thumbnail-container .thumbnail {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .main-image-container {
        min-height: 300px !important;
    }
    
    .nav-btn {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .thumbnail-container .thumbnail {
        width: 70px;
        height: 70px;
    }
    
    .image-counter {
        font-size: 12px;
        padding: 6px 15px;
    }
}

/* 加载状态 */
.main-image.loading {
    opacity: 0.5;
}

/* 防止图片拖拽 */
.main-image,
.thumbnail {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

/* 确保按钮可点击 */
.nav-btn {
    pointer-events: auto;
}

/* Lightbox 遮罩层与内容 */
.multi-gallery-lightbox-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
}
.multi-gallery-lightbox-overlay.open {
    display: flex;
}
.multi-gallery-lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 90vh;
}
.multi-gallery-lightbox-image {
    max-width: 95vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    cursor: zoom-out;
}
.multi-gallery-lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    color: #333;
    font-size: 22px;
    line-height: 36px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}
/* 弹窗左右切换按钮 */
.multi-gallery-lightbox-prev,
.multi-gallery-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.9);
    color: #222;
    font-size: 26px;
    line-height: 44px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
    z-index: 2;
}
.multi-gallery-lightbox-prev { left: -18px; }
.multi-gallery-lightbox-next { right: -18px; }
.multi-gallery-lightbox-prev:hover,
.multi-gallery-lightbox-next:hover {
    background: #fff;
}
body.multi-gallery-lightbox-open {
    overflow: hidden;
}

/* 点击主图显示放大提示 */
.main-image {
    cursor: zoom-in;
}