/* 增强版图片查看器样式 */
.enhanced-image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.enhanced-image-modal.show {
    opacity: 1;
    visibility: visible;
}

.enhanced-image-overlay {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.enhanced-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.enhanced-image-modal .enhanced-image {
    max-width: none;
    max-height: none;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease;
    transform-origin: center;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    /* 在性能模式下也强制允许图片应用变换，避免被 transform: none !important 覆盖 */
    transform: translate(0, 0) scale(1) !important;
    will-change: transform;
}

/* 在 performance-mode 下，显式允许查看器内元素使用 transform */
.performance-mode .enhanced-image-modal,
.performance-mode .enhanced-image-modal * {
    -webkit-transform: initial !important;
    transform: initial !important;
}

/* 工具栏样式 */
.image-toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-group:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    padding-right: 15px;
}

.toolbar-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.toolbar-btn:active {
    transform: scale(0.95);
}

.zoom-level {
    color: white;
    font-size: 14px;
    font-weight: 500;
    min-width: 45px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 10px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 加载指示器 */
.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: white;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 16px;
    font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .enhanced-image-overlay {
        padding: 10px;
    }
    
    .image-toolbar {
        bottom: 10px;
        padding: 8px 15px;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .toolbar-group {
        gap: 6px;
    }
    
    .toolbar-group:not(:last-child) {
        border-right: none;
        padding-right: 0;
    }
    
    .toolbar-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .zoom-level {
        font-size: 12px;
        min-width: 40px;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .image-toolbar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        border-radius: 0;
        border-radius: 15px 15px 0 0;
        padding: 15px;
    }
    
    .toolbar-group {
        flex: 1;
        justify-content: center;
    }
}

/* 暗色主题适配 */
body.dark-theme .enhanced-image-modal {
    background: rgba(0, 0, 0, 0.95);
}

body.dark-theme .image-toolbar {
    background: rgba(20, 20, 20, 0.9);
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark-theme .toolbar-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark-theme .toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

body.dark-theme .zoom-level {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

/* 动画效果 */
.enhanced-image-modal.show .enhanced-image {
    animation: imageZoomIn 0.3s ease-out;
}

@keyframes imageZoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.enhanced-image-modal.show .image-toolbar {
    animation: toolbarSlideUp 0.4s ease-out 0.1s both;
}

@keyframes toolbarSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .enhanced-image-modal {
        background: rgba(0, 0, 0, 0.98);
    }
    
    .image-toolbar {
        background: rgba(0, 0, 0, 0.95);
        border: 2px solid white;
    }
    
    .toolbar-btn {
        background: black;
        border: 2px solid white;
    }
    
    .toolbar-btn:hover {
        background: white;
        color: black;
    }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    .enhanced-image-modal,
    .enhanced-image,
    .toolbar-btn {
        transition: none;
    }
    
    .enhanced-image-modal.show .enhanced-image,
    .enhanced-image-modal.show .image-toolbar {
        animation: none;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: transparent;
    }
}

/* 打印样式 */
@media print {
    .enhanced-image-modal {
        display: none;
    }
}