/* 图片查看器样式 */
.image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-viewer.active {
    display: flex;
    opacity: 1;
}

.image-viewer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.image-viewer-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1;
}

.image-viewer-wrapper {
    max-width: 90%;
    max-height: 85%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.image-viewer-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    transition: transform 0.3s ease;
    cursor: zoom-in;
    -webkit-user-drag: none;
}

/* 关闭按钮 */
.image-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.image-viewer-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

/* 导航按钮 */
.image-viewer-prev,
.image-viewer-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.image-viewer-prev {
    left: 30px;
}

.image-viewer-next {
    right: 30px;
}

.image-viewer-prev:hover,
.image-viewer-next:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.image-viewer-prev:hover {
    transform: translateY(-50%) translateX(-5px);
}

.image-viewer-next:hover {
    transform: translateY(-50%) translateX(5px);
}

/* 图片描述 */
.image-viewer-caption {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80%;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 5px;
    font-size: 14px;
    text-align: center;
    z-index: 2;
    display: none;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    .image-viewer-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .image-viewer-prev,
    .image-viewer-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .image-viewer-prev {
        left: 10px;
    }

    .image-viewer-next {
        right: 10px;
    }

    .image-viewer-wrapper {
        max-width: 95%;
        max-height: 90%;
    }

    .image-viewer-caption {
        bottom: 15px;
        max-width: 90%;
        padding: 8px 15px;
        font-size: 12px;
    }
}

/* 打开动画 - 仅使用opacity避免与JS缩放transform冲突 */
.image-viewer.active .image-viewer-img {
    animation: imageFadeIn 0.3s ease;
}

@keyframes imageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 暗色主题适配 */
html[theme="dark"] .image-viewer-close,
html[theme="dark"] .image-viewer-prev,
html[theme="dark"] .image-viewer-next {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

html[theme="dark"] .image-viewer-close:hover,
html[theme="dark"] .image-viewer-prev:hover,
html[theme="dark"] .image-viewer-next:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
}

html[theme="dark"] .image-viewer-caption {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}
