/**
 * Cloud File Picker - 云文件选择器样式
 *
 * @package LightSNS
 * @since 2026-02-08
 */

/* ===== 弹窗主体 ===== */
#ls-cloud-file .ls-modal-content {
    height: 560px;
    max-height: 80vh;
}

#ls-cloud-file .ls-modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== 文件网格 ===== */
.ls-cf-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    align-content: start;
}

.ls-cf-grid::-webkit-scrollbar {
    width: 4px;
}

.ls-cf-grid::-webkit-scrollbar-thumb {
    background: #d4d4d8;
    border-radius: 2px;
}

/* ===== 文件项 ===== */
.ls-cf-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: var(--ls-bg, #f8fafc);
}

.ls-cf-item:hover {
    border-color: var(--ls-border, #e5e7eb);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 选中态 */
.ls-cf-item.selected {
    border-color: var(--ls-primary, #3b82f6);
    box-shadow: 0 0 0 1px var(--ls-primary, #3b82f6);
}

.ls-cf-item.selected .ls-cf-check {
    opacity: 1;
}

/* 勾选图标 */
.ls-cf-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    background: var(--ls-primary, #3b82f6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 3;
    pointer-events: none;
}

/* ===== 缩略图区域 ===== */
.ls-cf-thumb {
    aspect-ratio: 1;
    overflow: hidden;
    position: relative;
    background: #f4f4f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ls-cf-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.ls-cf-item:hover .ls-cf-thumb img {
    transform: scale(1.03);
}

/* 视频播放图标 */
.ls-cf-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    z-index: 2;
    transition: background 0.15s;
}

.ls-cf-item:hover .ls-cf-play {
    background: rgba(0, 0, 0, 0.7);
}

/* 非图片类型的图标展示 */
.ls-cf-icon {
    font-size: 36px;
    color: var(--ls-text-muted, #9ca3af);
}

.ls-cf-icon i {
    font-size: 36px;
}

/* ===== 文件信息 ===== */
.ls-cf-info {
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    min-height: 30px;
}

.ls-cf-name {
    font-size: 11px;
    color: var(--ls-text-secondary, #4b5563);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

/* 引用数 */
.ls-cf-biz {
    font-size: 10px;
    color: var(--ls-text-muted, #9ca3af);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 2px;
}

.ls-cf-biz i {
    font-size: 12px;
}

/* 删除按钮 */
.ls-cf-delete {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 22px;
    height: 22px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    z-index: 3;
    cursor: pointer;
}

.ls-cf-item:hover .ls-cf-delete {
    opacity: 1;
}

.ls-cf-delete:hover {
    background: var(--ls-danger, #ef4444);
}

/* ===== 预览按钮（在缩略图内部右下角） ===== */
.ls-cf-preview {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    z-index: 3;
    cursor: pointer;
}

.ls-cf-item:hover .ls-cf-preview {
    opacity: 1;
}

.ls-cf-preview:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* ===== 底部栏 ===== */
.ls-cf-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-top: 1px solid var(--ls-border, #e5e7eb);
    flex-shrink: 0;
}

.ls-cf-footer-left {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--ls-text-muted, #9ca3af);
}

.ls-cf-selected-count {
    color: var(--ls-primary, #3b82f6);
    font-weight: 500;
}

.ls-cf-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== 分页 ===== */
.ls-cf-pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 4px;
}

.ls-cf-page-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ls-border, #e5e7eb);
    border-radius: 4px;
    background: #fff;
    color: var(--ls-text-secondary, #4b5563);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.ls-cf-page-btn:hover {
    border-color: var(--ls-primary, #3b82f6);
    color: var(--ls-primary, #3b82f6);
}

.ls-cf-page-btn.active {
    background: var(--ls-primary, #3b82f6);
    border-color: var(--ls-primary, #3b82f6);
    color: #fff;
}

.ls-cf-page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== 空状态 ===== */
.ls-cf-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--ls-text-muted, #9ca3af);
    font-size: 13px;
    gap: 8px;
}

.ls-cf-empty i {
    font-size: 40px;
    color: #d4d4d8;
}

/* ===== 加载状态 ===== */
.ls-cf-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

/* ===== 音频预览播放器 ===== */
.ls-cf-audio-player {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10003;
    min-width: 300px;
}

.ls-cf-audio-player audio {
    height: 32px;
    flex: 1;
}

.ls-cf-audio-close {
    cursor: pointer;
    color: var(--ls-text-muted, #9ca3af);
    font-size: 16px;
    transition: color 0.15s;
}

.ls-cf-audio-close:hover {
    color: var(--ls-text, #1f2937);
}

/* ===== 视频预览弹窗 ===== */
.ls-cf-video-preview {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10003;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.ls-cf-video-preview.show {
    opacity: 1;
}

.ls-cf-video-wrap {
    width: 70vw;
    max-width: 800px;
    aspect-ratio: 16 / 9;
    position: relative;
}

.ls-cf-video-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.15s;
}

.ls-cf-video-close:hover {
    color: #fff;
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
    .ls-cf-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 12px 16px;
    }

    .ls-cf-footer {
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
}
