/* 懒加载图片样式 */

/* 加载中状态 */
.lazy-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 加载完成状态 */
.lazy-loaded {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* 加载失败状态 */
.lazy-error {
    background-color: #ffebee;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 图片容器 */
.lazy-image-container {
    position: relative;
    overflow: hidden;
    background-color: #f5f5f5;
}

.lazy-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.lazy-image-container:hover img {
    transform: scale(1.05);
}

/* 缩略图网格 */
.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    padding: 16px;
}

.thumbnail-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f5f5f5;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.thumbnail-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-item .file-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
}

.thumbnail-item .file-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 选择覆盖层 */
.thumbnail-item .select-overlay {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.thumbnail-item:hover .select-overlay,
.thumbnail-item.selected .select-overlay {
    opacity: 1;
}

.thumbnail-item.selected .select-overlay {
    background: #2196f3;
    border-color: #2196f3;
    color: #fff;
}

/* 文件类型标签 */
.thumbnail-item .file-type-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 10px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* 列表视图 */
.file-list-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.15s ease;
}

.file-list-item:hover {
    background-color: #f5f5f5;
}

.file-list-item .thumbnail {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    margin-right: 16px;
    background-color: #f0f0f0;
}

.file-list-item .thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-list-item .file-info {
    flex: 1;
    min-width: 0;
}

.file-list-item .file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-list-item .file-meta {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* 加载更多按钮 */
.load-more-btn {
    display: block;
    width: 100%;
    padding: 16px;
    margin-top: 16px;
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.load-more-btn:hover {
    background: #e0e0e0;
}

.load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 无限滚动加载指示器 */
.infinite-scroll-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #666;
}

.infinite-scroll-loader .spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #2196f3;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}

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

/* 响应式调整 */
@media (max-width: 768px) {
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
        padding: 8px;
    }
    
    .thumbnail-item .file-name {
        font-size: 10px;
        padding: 4px;
    }
    
    .file-list-item .thumbnail {
        width: 40px;
        height: 40px;
        margin-right: 12px;
    }
}

/* 深色主题 */
[data-theme="dark"] .lazy-loading {
    background: linear-gradient(90deg, #2d2d2d 25%, #3d3d3d 50%, #2d2d2d 75%);
}

[data-theme="dark"] .thumbnail-item {
    background-color: #2d2d2d;
}

[data-theme="dark"] .file-list-item {
    border-bottom-color: #3d3d3d;
}

[data-theme="dark"] .file-list-item:hover {
    background-color: #3d3d3d;
}

[data-theme="dark"] .load-more-btn {
    background: #3d3d3d;
    color: #aaa;
}

[data-theme="dark"] .load-more-btn:hover {
    background: #4d4d4d;
}
