/* 前端画廊样式 */
.wp-super-gallery {
    margin: 20px 0;
    clear: both;
    display: grid;
    gap: 15px;
}

/* 列数设置 */
.wp-super-gallery-columns-1 { grid-template-columns: 1fr; }
.wp-super-gallery-columns-2 { grid-template-columns: repeat(2, 1fr); }
.wp-super-gallery-columns-3 { grid-template-columns: repeat(3, 1fr); }
.wp-super-gallery-columns-4 { grid-template-columns: repeat(4, 1fr); }
.wp-super-gallery-columns-5 { grid-template-columns: repeat(5, 1fr); }
.wp-super-gallery-columns-6 { grid-template-columns: repeat(6, 1fr); }
.wp-super-gallery-columns-7 { grid-template-columns: repeat(7, 1fr); }
.wp-super-gallery-columns-8 { grid-template-columns: repeat(8, 1fr); }

.wp-super-gallery-item {
    margin: 0;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent !important; /* 强制移除任何背景色 */
    /* 移除硬编码的aspect-ratio，让动态比例类生效 */
}

/* 确保所有可能的背景都被移除 */
.wp-super-gallery-item,
.wp-super-gallery-item a,
.wp-super-gallery-item figure {
    background: transparent !important;
    background-color: transparent !important;
}

.wp-super-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.wp-super-gallery-item img {
    width: 100%;
    height: 100%; /* 让图片填满整个容器 */
    display: block;
    object-fit: cover; /* 确保图片覆盖整个容器，保持比例并裁剪多余部分 */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.wp-super-gallery-item:hover img {
    transform: scale(1.08);
}

.wp-super-gallery-item a {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.wp-super-gallery-item a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.wp-super-gallery-item:hover a::before {
    opacity: 1;
}

.wp-super-gallery-caption {
    padding: 15px;
    margin: 0;
    font-size: 0.9em;
    color: #333; /* 调整文字颜色以便在透明背景上阅读 */
    text-align: center;
    background: rgba(255, 255, 255, 0.9); /* 半透明白色背景，保持可读性 */
    border-top: none; /* 移除边框 */
    position: absolute; /* 将标题覆盖在图片上 */
    bottom: 0;
    left: 0;
    right: 0;
    backdrop-filter: blur(5px); /* 背景模糊效果 */
}

/* Lightbox 样式 */
/* 灯箱样式 - 全面升级版 */
.wp-super-gallery-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.wp-super-gallery-lightbox-overlay.active {
    display: flex;
}

.wp-super-gallery-lightbox-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    background: transparent;
    border-radius: 12px;
    overflow: visible;
    box-shadow: 0 8px 50px rgba(0,0,0,0.8);
}

/* 左上角计数器 - 固定在窗口左上角 */
.wp-super-gallery-lightbox-counter {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10001;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 右上角工具栏 - 固定在窗口右上角 */
.wp-super-gallery-lightbox-toolbar {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 10001;
}

.wp-super-gallery-lightbox-btn {
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.wp-super-gallery-lightbox-btn svg {
    width: 38px;
    height: 38px;
}

.wp-super-gallery-lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.wp-super-gallery-lightbox-btn.active {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

.wp-super-gallery-lightbox-btn.playing {
    background: #d63638;
    border-color: #d63638;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* PC端导航按钮 - 优化版 */
.wp-super-gallery-lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 55px;
    height: 55px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    font-size: 22px;
    font-weight: bold;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
}

.wp-super-gallery-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.wp-super-gallery-lightbox-prev {
    left: 30px;
}

.wp-super-gallery-lightbox-next {
    right: 30px;
}

/* 移动端导航按钮 - 左上角和右上角 */
.wp-super-gallery-lightbox-nav-mobile {
    position: fixed;
    top: 70px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.wp-super-gallery-lightbox-nav-mobile:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.wp-super-gallery-lightbox-prev-mobile {
    left: 15px;
}

.wp-super-gallery-lightbox-next-mobile {
    right: 15px;
}

.wp-super-gallery-lightbox-overlay.has-multiple .wp-super-gallery-lightbox-nav {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 图片容器 */
.wp-super-gallery-lightbox-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: grab;
}

.wp-super-gallery-lightbox-image-container:active {
    cursor: grabbing;
}

.wp-super-gallery-lightbox-image-container.zoomed {
    cursor: zoom-out;
    overflow: auto;
}

.wp-super-gallery-lightbox-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.wp-super-gallery-lightbox-image-container.zoomed .wp-super-gallery-lightbox-image {
    transform: scale(1.5);
    cursor: move;
}

.wp-super-gallery-lightbox-image-container.dragging {
    cursor: grabbing !important;
}

.wp-super-gallery-lightbox-image-container.dragging .wp-super-gallery-lightbox-image {
    cursor: grabbing !important;
}

/* 缩略图面板 - 固定在窗口底部 */
.wp-super-gallery-lightbox-thumbnails-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    height: 100px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 12px;
    padding: 10px;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10002;
    max-width: calc(100vw - 40px);
}

.wp-super-gallery-lightbox-thumbnails-panel.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.thumbnails-grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    height: 80px;
    padding: 5px 0;
    scroll-behavior: smooth;
}

/* 优化缩略图滚动条样式 */
.thumbnails-grid {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1);
}

.thumbnails-grid::-webkit-scrollbar {
    height: 4px;
}

.thumbnails-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.thumbnails-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.thumbnails-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.thumbnail-item {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.thumbnail-item:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.thumbnail-item.active {
    border-color: #007cba;
    box-shadow: 0 0 15px rgba(0, 124, 186, 0.5);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 图片说明 */
.wp-super-gallery-lightbox-caption {
    padding: 15px 20px;
    text-align: center;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    border-top: none;
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 0 0 12px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    font-size: 14px;
    line-height: 1.5;
}

/* 瀑布流布局样式 */
.wp-super-gallery.layout-masonry {
    display: block !important;
    column-gap: 20px; /* 增加列间距 */
    column-fill: balance; /* 平衡填充所有列 */
    column-count: 3; /* 默认3列 */
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* JavaScript增强版瀑布流 */
.wp-super-gallery.layout-masonry.js-masonry {
    column-count: unset; /* JavaScript接管时禁用CSS columns */
    height: auto;
}

.wp-super-gallery.layout-masonry.js-masonry .wp-super-gallery-item {
    position: absolute;
    margin-bottom: 0;
}

.wp-super-gallery.layout-masonry .wp-super-gallery-item {
    break-inside: avoid;
    page-break-inside: avoid; /* 兼容性 */
    -webkit-column-break-inside: avoid; /* Safari兼容性 */
    margin-bottom: 20px; /* 增加底部间距 */
    display: inline-block;
    width: 100%;
    vertical-align: top;
    box-sizing: border-box;
    overflow: hidden;
    background: transparent !important; /* 强制移除白色背景 */
    background-color: transparent !important;
    border-radius: 12px; /* 添加圆角 */
    box-shadow: 0 4px 15px rgba(0,0,0,0.08); /* 添加阴影 */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* 添加过渡效果 */
}

.wp-super-gallery.layout-masonry .wp-super-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.wp-super-gallery.layout-masonry .wp-super-gallery-item img {
    width: 100%;
    height: auto !important;
    display: block;
    /* 移除任何强制的aspect-ratio */
    aspect-ratio: unset !important;
    max-width: 100%;
    object-fit: cover; /* 确保图片正确填充 */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.wp-super-gallery.layout-masonry .wp-super-gallery-item:hover img {
    transform: scale(1.05);
}

/* 瀑布流列数设置 */
.wp-super-gallery.layout-masonry.wp-super-gallery-columns-1 { column-count: 1; }
.wp-super-gallery.layout-masonry.wp-super-gallery-columns-2 { column-count: 2; }
.wp-super-gallery.layout-masonry.wp-super-gallery-columns-3 { column-count: 3; }
.wp-super-gallery.layout-masonry.wp-super-gallery-columns-4 { column-count: 4; }
.wp-super-gallery.layout-masonry.wp-super-gallery-columns-5 { column-count: 5; }
.wp-super-gallery.layout-masonry.wp-super-gallery-columns-6 { column-count: 6; }
.wp-super-gallery.layout-masonry.wp-super-gallery-columns-7 { column-count: 7; }
.wp-super-gallery.layout-masonry.wp-super-gallery-columns-8 { column-count: 8; }

/* 两端对齐布局样式 */
.wp-super-gallery.layout-justified {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.wp-super-gallery.layout-justified .wp-super-gallery-item {
    flex: 0 0 auto;
    margin: 0;
    box-sizing: border-box;
    background: transparent !important; /* 强制移除白色背景 */
    background-color: transparent !important;
    aspect-ratio: 4/3; /* 为对齐布局设置默认比例 */
}

/* 对齐布局也应用动态比例设置 */
.wp-super-gallery.layout-justified.aspect-ratio-1-1 .wp-super-gallery-item { aspect-ratio: 1/1 !important; }
.wp-super-gallery.layout-justified.aspect-ratio-4-3 .wp-super-gallery-item { aspect-ratio: 4/3 !important; }
.wp-super-gallery.layout-justified.aspect-ratio-3-2 .wp-super-gallery-item { aspect-ratio: 3/2 !important; }
.wp-super-gallery.layout-justified.aspect-ratio-16-9 .wp-super-gallery-item { aspect-ratio: 16/9 !important; }
.wp-super-gallery.layout-justified.aspect-ratio-21-9 .wp-super-gallery-item { aspect-ratio: 21/9 !important; }
.wp-super-gallery.layout-justified.aspect-ratio-3-4 .wp-super-gallery-item { aspect-ratio: 3/4 !important; }
.wp-super-gallery.layout-justified.aspect-ratio-2-3 .wp-super-gallery-item { aspect-ratio: 2/3 !important; }
.wp-super-gallery.layout-justified.aspect-ratio-9-16 .wp-super-gallery-item { aspect-ratio: 9/16 !important; }
.wp-super-gallery.layout-justified.aspect-ratio-golden .wp-super-gallery-item { aspect-ratio: 1.618 !important; }

.wp-super-gallery.layout-justified .wp-super-gallery-item img {
    width: 100%;
    height: 100%; /* 填满容器 */
    object-fit: cover; /* 确保图片覆盖整个容器 */
}

/* 两端对齐布局列数控制 */
.wp-super-gallery.layout-justified.wp-super-gallery-columns-1 .wp-super-gallery-item {
    width: 100%;
}

.wp-super-gallery.layout-justified.wp-super-gallery-columns-2 .wp-super-gallery-item {
    width: calc((100% - 15px) / 2);
}

.wp-super-gallery.layout-justified.wp-super-gallery-columns-3 .wp-super-gallery-item {
    width: calc((100% - 30px) / 3);
}

.wp-super-gallery.layout-justified.wp-super-gallery-columns-4 .wp-super-gallery-item {
    width: calc((100% - 45px) / 4);
}

.wp-super-gallery.layout-justified.wp-super-gallery-columns-5 .wp-super-gallery-item {
    width: calc((100% - 60px) / 5);
}

.wp-super-gallery.layout-justified.wp-super-gallery-columns-6 .wp-super-gallery-item {
    width: calc((100% - 75px) / 6);
}

.wp-super-gallery.layout-justified.wp-super-gallery-columns-7 .wp-super-gallery-item {
    width: calc((100% - 90px) / 7);
}

.wp-super-gallery.layout-justified.wp-super-gallery-columns-8 .wp-super-gallery-item {
    width: calc((100% - 105px) / 8);
}

/* 响应式设计 - 平板端 (769px-1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .wp-super-gallery {
        gap: 12px;
    }
    
    /* 平板端瀑布流间距优化 */
    .wp-super-gallery.layout-masonry {
        column-gap: 18px !important; /* 平板端列间距 */
        gap: unset !important; /* 覆盖基础gap设置 */
    }
    
    .wp-super-gallery.layout-masonry .wp-super-gallery-item {
        margin-bottom: 18px !important; /* 平板端底部间距 */
    }
    
    /* 平板端列数覆盖 */
    .wp-super-gallery.wp-super-gallery-tablet-1 { grid-template-columns: repeat(1, 1fr) !important; }
    .wp-super-gallery.wp-super-gallery-tablet-2 { grid-template-columns: repeat(2, 1fr) !important; }
    .wp-super-gallery.wp-super-gallery-tablet-3 { grid-template-columns: repeat(3, 1fr) !important; }
    .wp-super-gallery.wp-super-gallery-tablet-4 { grid-template-columns: repeat(4, 1fr) !important; }
    .wp-super-gallery.wp-super-gallery-tablet-5 { grid-template-columns: repeat(5, 1fr) !important; }
    .wp-super-gallery.wp-super-gallery-tablet-6 { grid-template-columns: repeat(6, 1fr) !important; }
    .wp-super-gallery.wp-super-gallery-tablet-7 { grid-template-columns: repeat(7, 1fr) !important; }
    .wp-super-gallery.wp-super-gallery-tablet-8 { grid-template-columns: repeat(8, 1fr) !important; }
    
    /* 平板端瀑布流 */
    .wp-super-gallery.layout-masonry.wp-super-gallery-tablet-1 { column-count: 1 !important; }
    .wp-super-gallery.layout-masonry.wp-super-gallery-tablet-2 { column-count: 2 !important; }
    .wp-super-gallery.layout-masonry.wp-super-gallery-tablet-3 { column-count: 3 !important; }
    .wp-super-gallery.layout-masonry.wp-super-gallery-tablet-4 { column-count: 4 !important; }
    .wp-super-gallery.layout-masonry.wp-super-gallery-tablet-5 { column-count: 5 !important; }
    .wp-super-gallery.layout-masonry.wp-super-gallery-tablet-6 { column-count: 6 !important; }
    .wp-super-gallery.layout-masonry.wp-super-gallery-tablet-7 { column-count: 7 !important; }
    .wp-super-gallery.layout-masonry.wp-super-gallery-tablet-8 { column-count: 8 !important; }
    
    /* 平板端两端对齐 */
    .wp-super-gallery.layout-justified.wp-super-gallery-tablet-1 .wp-super-gallery-item { width: 100% !important; }
    .wp-super-gallery.layout-justified.wp-super-gallery-tablet-2 .wp-super-gallery-item { width: calc((100% - 12px) / 2) !important; }
    .wp-super-gallery.layout-justified.wp-super-gallery-tablet-3 .wp-super-gallery-item { width: calc((100% - 24px) / 3) !important; }
    .wp-super-gallery.layout-justified.wp-super-gallery-tablet-4 .wp-super-gallery-item { width: calc((100% - 36px) / 4) !important; }
    
    .wp-super-gallery-lightbox-content {
        max-width: 90%;
        max-height: 90%;
    }
}

/* 响应式设计 - 移动端 (≤768px) */
@media (max-width: 768px) {
    .wp-super-gallery {
        gap: 10px;
    }
    
    /* 移动端网格布局 - 强制应用！ */
    .wp-super-gallery:not(.layout-masonry):not(.layout-justified).wp-super-gallery-mobile-1 { 
        grid-template-columns: repeat(1, 1fr) !important; 
    }
    .wp-super-gallery:not(.layout-masonry):not(.layout-justified).wp-super-gallery-mobile-2 { 
        grid-template-columns: repeat(2, 1fr) !important; 
    }
    .wp-super-gallery:not(.layout-masonry):not(.layout-justified).wp-super-gallery-mobile-3 { 
        grid-template-columns: repeat(3, 1fr) !important; 
    }
    .wp-super-gallery:not(.layout-masonry):not(.layout-justified).wp-super-gallery-mobile-4 { 
        grid-template-columns: repeat(4, 1fr) !important; 
    }
    
    /* 移动端瀑布流 - 强制应用！ */
    .wp-super-gallery.layout-masonry.wp-super-gallery-mobile-1 { column-count: 1 !important; }
    .wp-super-gallery.layout-masonry.wp-super-gallery-mobile-2 { column-count: 2 !important; }
    .wp-super-gallery.layout-masonry.wp-super-gallery-mobile-3 { column-count: 3 !important; }
    .wp-super-gallery.layout-masonry.wp-super-gallery-mobile-4 { column-count: 4 !important; }
    
    /* 移动端两端对齐 */
    .wp-super-gallery.layout-justified.wp-super-gallery-mobile-1 .wp-super-gallery-item { width: 100% !important; }
    .wp-super-gallery.layout-justified.wp-super-gallery-mobile-2 .wp-super-gallery-item { width: calc((100% - 10px) / 2) !important; }
    .wp-super-gallery.layout-justified.wp-super-gallery-mobile-3 .wp-super-gallery-item { width: calc((100% - 20px) / 3) !important; }
    .wp-super-gallery.layout-justified.wp-super-gallery-mobile-4 .wp-super-gallery-item { width: calc((100% - 30px) / 4) !important; }
    
    .wp-super-gallery-lightbox-content {
        max-width: 98%;
        max-height: 98%;
    }
    
    /* 移动端计数器和工具栏调整 */
    .wp-super-gallery-lightbox-counter {
        top: 10px;
        left: 10px;
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .wp-super-gallery-lightbox-toolbar {
        top: 10px;
        right: 10px;
        gap: 6px;
    }
    
    .wp-super-gallery-lightbox-btn {
        width: 40px;
        height: 40px;
    }
    
    .wp-super-gallery-lightbox-btn svg {
        width: 34px;
        height: 34px;
    }
    
    /* 移动端隐藏PC端导航按钮 */
    .wp-super-gallery-lightbox-nav {
        display: none !important;
    }
    
    /* 移动端显示移动端导航按钮 */
    .wp-super-gallery-lightbox-overlay.has-multiple .wp-super-gallery-lightbox-nav-mobile {
        display: flex;
    }
    
    /* 移动端缩略图面板 */
    .wp-super-gallery-lightbox-thumbnails-panel {
        bottom: 10px;
        left: 10px;
        right: 10px;
        height: 80px;
        padding: 8px;
        max-width: calc(100vw - 20px);
    }
    
    /* 移动端导航按钮尺寸优化 */
    .wp-super-gallery-lightbox-nav-mobile {
        width: 48px;
        height: 48px;
        font-size: 18px;
        top: 60px;
    }
    
    .wp-super-gallery-lightbox-prev-mobile {
        left: 10px;
    }
    
    .wp-super-gallery-lightbox-next-mobile {
        right: 10px;
    }
    
    .thumbnails-grid {
        height: 64px;
    }
    
    .thumbnail-item {
        width: 50px;
        height: 50px;
    }
    
    .wp-super-gallery-caption {
        padding: 10px;
        font-size: 0.8em;
        bottom: 10px;
        left: 10px;
        right: 10px;
    }
}

/* 图片高度优化 - 网格布局 */
.wp-super-gallery:not(.layout-masonry):not(.layout-justified) .wp-super-gallery-item {
    aspect-ratio: 4/3; /* 默认比例：4:3 比较美观 */
}

.wp-super-gallery:not(.layout-masonry):not(.layout-justified) .wp-super-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 确保图片完全填充容器，可能会裁剪 */
    object-position: center; /* 居中裁剪 */
}

/* 图片比例设置 - 支持多种比例，使用高优先级 */
.wp-super-gallery.aspect-ratio-1-1:not(.layout-masonry) .wp-super-gallery-item {
    aspect-ratio: 1/1 !important; /* 正方形 */
}

.wp-super-gallery.aspect-ratio-4-3:not(.layout-masonry) .wp-super-gallery-item {
    aspect-ratio: 4/3 !important; /* 默认比例 */
}

.wp-super-gallery.aspect-ratio-3-2:not(.layout-masonry) .wp-super-gallery-item {
    aspect-ratio: 3/2 !important; /* 经典相机比例 */
}

.wp-super-gallery.aspect-ratio-16-9:not(.layout-masonry) .wp-super-gallery-item {
    aspect-ratio: 16/9 !important; /* 宽屏比例 */
}

.wp-super-gallery.aspect-ratio-21-9:not(.layout-masonry) .wp-super-gallery-item {
    aspect-ratio: 21/9 !important; /* 超宽屏 */
}

.wp-super-gallery.aspect-ratio-3-4:not(.layout-masonry) .wp-super-gallery-item {
    aspect-ratio: 3/4 !important; /* 竖向比例 */
}

.wp-super-gallery.aspect-ratio-2-3:not(.layout-masonry) .wp-super-gallery-item {
    aspect-ratio: 2/3 !important; /* 竖向照片 */
}

.wp-super-gallery.aspect-ratio-9-16:not(.layout-masonry) .wp-super-gallery-item {
    aspect-ratio: 9/16 !important; /* 手机竖屏 */
}

.wp-super-gallery.aspect-ratio-golden:not(.layout-masonry) .wp-super-gallery-item {
    aspect-ratio: 1.618 !important; /* 黄金比例 */
}

/* 瀑布流布局不受比例限制 */
.wp-super-gallery.layout-masonry .wp-super-gallery-item {
    aspect-ratio: unset !important;
}

/* 最后一行处理样式 - 预留给JavaScript动态处理 */

.wp-super-gallery.last-row-hide .wp-super-gallery-item.last-row-incomplete {
    display: none; /* 隐藏不完整的最后一行 */
}

/* 最后一行铺满效果的样式 */
.wp-super-gallery.last-row-fill .last-row-wrapper {
    display: flex !important;
    width: 100% !important;
    grid-column: 1 / -1; /* 跨越所有网格列 */
}

.wp-super-gallery.last-row-fill .wp-super-gallery-item.last-row-item {
    flex-grow: 1; /* 让最后一行的图片扩展填满 */
    flex-shrink: 0;
    margin: 0; /* 移除默认margin */
}

.wp-super-gallery.last-row-fill .last-row-wrapper .wp-super-gallery-item {
    margin: 0; /* 移除默认margin */
}

/* 移动端比例优化 */
@media (max-width: 768px) {
    .wp-super-gallery:not(.layout-masonry):not(.layout-justified):not(.aspect-ratio-1-1):not(.aspect-ratio-3-4):not(.aspect-ratio-2-3):not(.aspect-ratio-9-16) .wp-super-gallery-item {
        aspect-ratio: 3/2; /* 移动端使用更宽的比例，除非特别指定竖向比例 */
    }
    
    /* 移动端瀑布流间距优化 */
    .wp-super-gallery.layout-masonry {
        column-gap: 15px !important; /* 移动端列间距 */
        gap: unset !important; /* 覆盖基础gap设置 */
    }
    
    .wp-super-gallery.layout-masonry .wp-super-gallery-item {
        margin-bottom: 15px !important; /* 移动端底部间距 */
        break-inside: avoid !important; /* 强制避免断行 */
        page-break-inside: avoid !important;
        -webkit-column-break-inside: avoid !important;
    }
}

/* 超小屏幕（手机）瀑布流进一步优化 */
@media (max-width: 480px) {
    .wp-super-gallery.layout-masonry {
        column-gap: 12px !important; /* 手机端列间距 */
        gap: unset !important; /* 覆盖基础gap设置 */
    }
    
    .wp-super-gallery.layout-masonry .wp-super-gallery-item {
        margin-bottom: 12px !important; /* 手机端底部间距 */
        border-radius: 8px; /* 手机端减小圆角 */
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        -webkit-column-break-inside: avoid !important;
    }
}

/* 加载动画 */
.wp-super-gallery-item img[data-loading] {
    opacity: 0.5;
    filter: blur(2px);
}

.wp-super-gallery-item img[data-loaded] {
    opacity: 1;
    filter: none;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

/* 无障碍功能 */
.wp-super-gallery-item a:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.wp-super-gallery-lightbox-close:focus,
.wp-super-gallery-lightbox-nav:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* 打印样式 */
@media print {
    .wp-super-gallery-lightbox-overlay {
        display: none !important;
    }
    
    .wp-super-gallery-item:hover {
        transform: none;
        box-shadow: none;
    }
    
    .wp-super-gallery-item:hover img {
        transform: none;
    }
}

/* 确保JavaScript版本在移动端也能正确工作 */
@media (max-width: 768px) {
    .wp-super-gallery.layout-masonry.js-masonry {
        /* JavaScript版本在移动端的备用CSS设置 */
        column-count: unset !important;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .wp-super-gallery.layout-masonry.js-masonry {
        /* JavaScript版本在平板端的备用CSS设置 */
        column-count: unset !important;
    }
} 