/* 横向图片展示库前端样式 */
.horizontal-image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    /*margin: 30px 0;*/
}

.horizontal-image-gallery[data-columns="2"] .hig-item {
    flex: 1 1 calc(50% - 20px);
    max-width: calc(50% - 20px);
}

.horizontal-image-gallery[data-columns="3"] .hig-item {
    flex: 1 1 calc(33.333% - 20px);
    max-width: calc(33.333% - 20px);
}

.horizontal-image-gallery[data-columns="4"] .hig-item {
    flex: 1 1 calc(25% - 20px);
    max-width: calc(25% - 20px);
}

.horizontal-image-gallery[data-columns="5"] .hig-item {
    flex: 1 1 calc(20% - 20px);
    max-width: calc(20% - 20px);
}

/* 3:2 长宽比 (横图) */
.horizontal-image-gallery[data-aspect-ratio="3-2"] .hig-item {
    aspect-ratio: 3 / 2;
}

/* 2:3 长宽比 (竖图) */
.horizontal-image-gallery[data-aspect-ratio="2-3"] .hig-item {
    aspect-ratio: 2 / 3;
}

.hig-item {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    position: relative; /* 为兼容性代码添加 */
}

.hig-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.hig-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
}

.hig-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 保持图片比例，填充整个容器 */
}

/* 响应式设计 */
@media (max-width: 992px) {
    .horizontal-image-gallery[data-columns="3"] .hig-item,
    .horizontal-image-gallery[data-columns="4"] .hig-item,
    .horizontal-image-gallery[data-columns="5"] .hig-item {
        flex: 1 1 calc(50% - 20px);
        max-width: calc(50% - 20px);
    }
}

@media (max-width: 576px) {
    .horizontal-image-gallery .hig-item {
        flex: 1 1 100% !important;
        max-width: 100% !important;
    }
}

/* 优雅灯箱样式 */
.hig-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.hig-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.hig-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hig-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 6px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
}

.hig-lightbox.active .hig-lightbox-image {
    opacity: 1;
    transform: scale(1);
}

/* 改进的关闭按钮 */
.hig-lightbox-close {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.08);
    border: none;
    border-radius: 50%;
    font-size: 22px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    font-weight: 300;
}

.hig-lightbox-close:hover {
    background: rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

/* 增大的导航按钮 */
.hig-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.08);
    border: none;
    border-radius: 50%;
    font-size: 26px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    font-weight: 300;
    opacity: 0.9;
}

.hig-lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.15);
    transform: translateY(-50%) scale(1.08);
    opacity: 1;
}

.hig-lightbox-prev {
    left: 25px;
}

.hig-lightbox-next {
    right: 25px;
}

.hig-lightbox-counter {
    position: absolute;
    bottom: 25px;
    left: 0;
    right: 0;
    text-align: center;
    color: #666;
    font-size: 15px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease 0.1s;
}

.hig-lightbox.active .hig-lightbox-counter {
    opacity: 1;
    transform: translateY(0);
}

/* 加载动画 */
.hig-lightbox-loading .hig-lightbox-image {
    opacity: 0;
}

.hig-lightbox-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: hig-spin 1s linear infinite;
}

@keyframes hig-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 移动端优化 */
@media (max-width: 768px) {
    .hig-lightbox-nav {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
    
    .hig-lightbox-prev {
        left: 15px;
    }
    
    .hig-lightbox-next {
        right: 15px;
    }
    
    .hig-lightbox-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .hig-lightbox-counter {
        bottom: 15px;
    }
    
    .hig-lightbox-image {
        transform: scale(0.92);
    }
}

/* 兼容不支持aspect-ratio的浏览器 */
@supports not (aspect-ratio: 3 / 2) {
    /* 3:2 长宽比兼容方案 */
    .horizontal-image-gallery[data-aspect-ratio="3-2"] .hig-item::before {
        content: '';
        display: block;
        padding-bottom: 66.666%; /* 2/3 = 0.66666 */
    }
    
    /* 2:3 长宽比兼容方案 */
    .horizontal-image-gallery[data-aspect-ratio="2-3"] .hig-item::before {
        content: '';
        display: block;
        padding-bottom: 150%; /* 3/2 = 1.5 */
    }
    
    .hig-image-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}