/**
 * 现代化图片灯箱样式
 * @version 2.0.0
 */

/* 灯箱容器 */
.modern-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modern-lightbox.active {
    display: block;
    opacity: 1;
}

/* 遮罩层 */
.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

/* 主容器 */
.lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 关闭按钮 */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* 图片容器 */
.lightbox-image-wrapper {
    position: relative;
    width: 90%;
    height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-image:active {
    cursor: grabbing;
}

/* 加载动画 */
.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #3470ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 导航按钮 */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:active {
    transform: translateY(-50%) scale(0.95);
}

/* 工具栏 */
.lightbox-toolbar {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.8);
    padding: 12px 20px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.toolbar-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.toolbar-btn:active {
    transform: scale(0.95);
}

.toolbar-counter {
    color: white;
    font-size: 14px;
    font-weight: 500;
    padding: 0 12px;
    white-space: nowrap;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    margin-left: 8px;
}

/* 缩略图栏 */
.lightbox-thumbnails {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90%;
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 10;
    padding: 10px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.lightbox-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.lightbox-thumbnails::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.thumbnails-wrapper {
    display: flex;
    gap: 10px;
    padding: 5px;
}

.thumbnails-wrapper .thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s;
    opacity: 0.6;
}

.thumbnails-wrapper .thumbnail:hover {
    opacity: 1;
    transform: scale(1.05);
}

.thumbnails-wrapper .thumbnail.active {
    border-color: #3470ff;
    opacity: 1;
}

.thumbnails-wrapper .thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
    
    .lightbox-nav {
        width: 44px;
        height: 44px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-toolbar {
        bottom: 100px;
        padding: 8px 12px;
        gap: 4px;
    }
    
    .toolbar-btn {
        width: 36px;
        height: 36px;
    }
    
    .toolbar-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .toolbar-counter {
        font-size: 12px;
        padding: 0 8px;
    }
    
    .lightbox-thumbnails {
        bottom: 10px;
        max-width: 95%;
    }
    
    .thumbnails-wrapper .thumbnail {
        width: 60px;
        height: 60px;
    }
    
    .lightbox-image-wrapper {
        width: 95%;
        height: 70%;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modern-lightbox.active .lightbox-container {
    animation: fadeIn 0.3s ease;
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .lightbox-image {
        cursor: default;
    }
    
    .toolbar-btn:hover {
        background: transparent;
        transform: none;
    }
    
    .toolbar-btn:active {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* 打印时隐藏 */
@media print {
    .modern-lightbox {
        display: none !important;
    }
}

