/* 瀑布流相册样式 */
.masonry-grid {
    width: 100%;
    margin: 30px auto;
    padding: 0 8px;
    box-sizing: border-box;
}

.masonry-grid:after {
    content: '';
    display: block;
    clear: both;
}

/* 网格大小元素，用于Isotope计算列宽 */
.masonry-sizer {
    width: 20% !important; /* 强制5列布局 */
}

.masonry-item {
    width: calc(20% - 16px) !important; /* 强制5列布局 */
    margin: 8px;
    float: left;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    background-color: #f8f8f8;
    position: relative;
    opacity: 0.9;
}

/* 不同比例的照片容器 */
.masonry-item.ratio-1-1 {
    aspect-ratio: 1 / 1;
}

.masonry-item.ratio-2-3 {
    aspect-ratio: 2 / 3;
}

.masonry-item.ratio-3-2 {
    aspect-ratio: 3 / 2;
}

.masonry-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    opacity: 1;
    z-index: 1;
}

.masonry-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
    image-rendering: -webkit-optimize-contrast; /* 提高图片清晰度 */
}

.masonry-item:hover img {
    transform: scale(1.03);
}

/* Lightbox样式覆盖 */
.lb-outerContainer {
    border-radius: 8px 8px 0 0;
    background-color: #000;
}

.lb-dataContainer {
    border-radius: 0 0 8px 8px;
    background-color: #000;
    padding: 15px;
}

.lb-data .lb-caption {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
}

.lb-data .lb-number {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.lb-closeContainer .lb-close {
    opacity: 0.8;
}

.lb-closeContainer .lb-close:hover {
    opacity: 1;
}

.lb-nav a.lb-prev,
.lb-nav a.lb-next {
    opacity: 0.5;
}

.lb-nav a.lb-prev:hover,
.lb-nav a.lb-next:hover {
    opacity: 0.8;
}

/* 筛选按钮样式优化 */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.gallery-filter {
    border-radius: 20px;
    padding: 8px 20px;
    margin: 0 5px 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    position: relative;
    overflow: hidden;
}

.gallery-filter::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    transition: all 0.4s ease;
    z-index: -1;
    opacity: 0.8;
}

.gallery-filter:hover, .gallery-filter.active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gallery-filter:hover::before, .gallery-filter.active::before {
    left: 0;
}

/* 重新排列按钮样式 */
.refresh-gallery {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    color: white;
    border: none;
    margin-left: 15px;
    animation: pulse 2s infinite;
}

.refresh-gallery:hover {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    transform: translateY(-2px) rotate(15deg);
}

.refresh-gallery i {
    margin-right: 5px;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(142, 68, 173, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(142, 68, 173, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(142, 68, 173, 0);
    }
}

/* 响应式调整 - 只在平板和手机上应用不同布局 */
/* 平板竖屏 (2列) */
@media (max-width: 991px) and (min-width: 768px) {
    .masonry-sizer {
        width: 50% !important; /* 2列布局 */
    }
    .masonry-item {
        width: calc(50% - 16px) !important;
    }
}

/* 手机 (1列) */
@media (max-width: 767px) {
    .masonry-sizer {
        width: 100% !important; /* 1列布局 */
    }
    .masonry-item {
        width: calc(100% - 16px) !important;
    }
    
    .gallery-filter {
        padding: 6px 15px;
        font-size: 0.9rem;
        margin: 0 3px 10px;
    }
}
