﻿/* 遮罩层样式 - 修正垂直居中 */
.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: none;
    /* 使用 flex 布局实现完美居中 */
    display: none;  /* 注意：这里保持 none，JS 会改为 flex */
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

/* 图片容器 - 修正居中 */
.preview-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    cursor: default;
    /* 确保容器内容也居中 */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 图片元素 - 确保居中显示 */
.preview-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    transition: transform 0.3s;
    /* 确保图片本身居中 */
    display: block;
    margin: 0 auto;
}

        /* 关闭按钮 */
        .preview-close {
            position: absolute;
            top: -40px;
            right: -40px;
            width: 36px;
            height: 36px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s;
        }

        .preview-close:hover {
            background: rgba(255, 255, 255, 0.4);
            transform: rotate(90deg);
        }

        .preview-close::before,
        .preview-close::after {
            content: '';
            position: absolute;
            width: 20px;
            height: 2px;
            background: white;
        }

        .preview-close::before {
            transform: rotate(45deg);
        }

        .preview-close::after {
            transform: rotate(-45deg);
        }

        /* 导航按钮 */
        .preview-nav {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 50px;
            height: 50px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s;
            z-index: 10;
        }

        .preview-nav:hover {
            background: rgba(255, 255, 255, 0.4);
            transform: translateY(-50%) scale(1.1);
        }

        .preview-nav.prev {
            left: 20px;
        }

        .preview-nav.next {
            right: 20px;
        }

        .preview-nav::before {
            content: '';
            width: 15px;
            height: 15px;
            border-top: 2px solid white;
            border-right: 2px solid white;
        }

        .preview-nav.prev::before {
            transform: rotate(-135deg);
            margin-left: 5px;
        }

        .preview-nav.next::before {
            transform: rotate(45deg);
            margin-right: 5px;
        }

        /* 图片信息 */
        .preview-info {
            position: absolute;
            bottom: -40px;
            left: 0;
            right: 0;
            text-align: center;
            color: white;
            font-size: 14px;
            padding: 10px;
            background: rgba(0,0,0,0.6);
            border-radius: 4px;
        }

        /* 加载动画 */
        .preview-loading {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 40px;
            height: 40px;
            border: 3px solid rgba(255,255,255,0.3);
            border-top-color: white;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

        @keyframes spin {
            to { transform: translate(-50%, -50%) rotate(360deg); }
        }

        /* 响应式 */
        @media (max-width: 768px) {
            .preview-nav {
                width: 40px;
                height: 40px;
            }
            
            .preview-close {
                top: -30px;
                right: -30px;
            }
        }