/**
 * 图片查看器组件样式
 * 支持左右滑动切换、缩放、下载等功能
 */

/* 主容器 */
.image-viewer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* 图片容器 */
.image-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* 图片主体 */
.image-viewer-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    user-select: none;
    transition: transform 0.3s ease;
    cursor: grab;
}

.image-viewer-image.dragging {
    cursor: grabbing;
    transition: none;
}

/* 顶部工具栏 */
.image-viewer-toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
}

/* 图片信息 */
.image-viewer-info {
    color: #fff;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.image-viewer-counter {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.image-viewer-title {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 工具按钮组 */
.image-viewer-actions {
    display: flex;
    gap: 10px;
}

.image-viewer-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.image-viewer-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

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

/* 左右切换按钮 */
.image-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.image-viewer-nav:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
}

.image-viewer-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.image-viewer-nav.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

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

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

/* 底部缩略图 */
.image-viewer-thumbnails {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 10;
}

.image-viewer-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.image-viewer-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.image-viewer-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s ease;
    flex-shrink: 0;
    border: 2px solid transparent;
}

.image-viewer-thumbnail:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

.image-viewer-thumbnail.active {
    opacity: 1;
    border-color: #fff;
    transform: scale(1.1);
}

/* 加载动画 */
.image-viewer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 16px;
    display: none;
}

.image-viewer-loading.active {
    display: block;
}

.image-viewer-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 缩放提示 */
.image-viewer-zoom-tip {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

.image-viewer-zoom-tip.show {
    opacity: 1;
}

/* 手势提示 */
.image-viewer-gesture-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-viewer-gesture-hint.show {
    opacity: 1;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .image-viewer-toolbar {
        height: 50px;
        padding: 0 10px;
    }
    
    .image-viewer-info {
        font-size: 12px;
        gap: 10px;
    }
    
    .image-viewer-title {
        max-width: 150px;
    }
    
    .image-viewer-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .image-viewer-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .image-viewer-prev {
        left: 10px;
    }
    
    .image-viewer-next {
        right: 10px;
    }
    
    .image-viewer-thumbnails {
        height: 80px;
        padding: 0 10px;
        gap: 8px;
    }
    
    .image-viewer-thumbnail {
        width: 50px;
        height: 50px;
    }
    
    .image-viewer-image {
        max-width: 95%;
        max-height: 95%;
    }
}

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

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.image-viewer-image.slide-in-right {
    animation: slideInFromRight 0.3s ease;
}

.image-viewer-image.slide-in-left {
    animation: slideInFromLeft 0.3s ease;
}
