/* ============================================================
   file-item.css — 详情页文件列表项组件
   覆盖：files-section 容器、file-item 卡片（可展开预览）、
        文件图标、预览区域（图片/视频/音频）、下载/wget 按钮
   依赖：site.css 中的 --primary-color / --border-color 等变量
   ============================================================ */

.files-section {
    background: var(--card-bg);
    padding: calc(var(--spacing-unit) * 5);
    border-radius: var(--border-radius);
    margin-bottom: calc(var(--spacing-unit) * 3);
    border: 1px solid var(--border-color);
}

.files-section h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: calc(var(--spacing-unit) * 3.5);
    color: var(--text-primary);
    padding-bottom: calc(var(--spacing-unit) * 1.5);
    border-bottom: 2px solid var(--primary-color);
}

.disclaimer-box {
    display: flex;
    align-items: flex-start;
    gap: calc(var(--spacing-unit) * 2);
    padding: calc(var(--spacing-unit) * 2.5) calc(var(--spacing-unit) * 3);
    background: #fff9e6;
    border: 1px solid #ffd966;
    border-left: 4px solid #f59e0b;
    border-radius: var(--border-radius);
    margin-bottom: calc(var(--spacing-unit) * 3);
    font-size: 14px;
    line-height: 1.6;
    color: #856404;
}

.disclaimer-box svg {
    color: #f59e0b;
    margin-top: 2px;
}

.disclaimer-box strong {
    font-weight: 600;
    color: #664d03;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 2);
}

/* 文件项（详情页可展开预览版） */
.files-list .file-item {
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    transition: border-color 0.15s;
    border: 1px solid var(--border-color);
}

.files-list .file-item:hover {
    border-color: var(--primary-color);
}

.files-list .file-item.previewable .file-header {
    cursor: pointer;
}

.files-list .file-item.expanded {
    border-color: var(--primary-color);
}

.file-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(var(--spacing-unit) * 2.5) calc(var(--spacing-unit) * 3);
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 2);
}

.file-header-right {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 2);
}

.preview-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.preview-toggle-icon svg {
    transition: transform 0.2s;
}

.file-info {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 2);
    flex: 1;
    min-width: 0;
}

.file-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    line-height: 1;
}

.file-icon .fiv-viv {
    display: block;
}

.file-info > div:not(.file-icon) {
    min-width: 0;
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
}

.file-size {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: calc(var(--spacing-unit) * 0.5);
}

.file-actions {
    display: flex;
    gap: calc(var(--spacing-unit) * 1.5);
    flex-shrink: 0;
}

/* 文件预览区域 */
.file-preview {
    padding: calc(var(--spacing-unit) * 3);
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.file-preview.collapsed {
    display: none;
}

.preview-loading {
    text-align: center;
    padding: calc(var(--spacing-unit) * 4);
    color: var(--text-secondary);
}

.preview-error {
    text-align: center;
    padding: calc(var(--spacing-unit) * 4);
    color: var(--danger-color);
}

.preview-image {
    max-width: 100%;
    max-height: 600px;
    display: block;
    margin: 0 auto;
    border-radius: var(--border-radius);
    cursor: zoom-in;
}

.preview-video {
    width: 100%;
    max-height: 500px;
    border-radius: var(--border-radius);
    background: #000;
}

.preview-audio {
    width: 100%;
    margin: calc(var(--spacing-unit) * 2) 0;
}

.btn-download {
    padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 3.5);
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s;
    display: inline-block;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-download:hover {
    background: var(--primary-hover);
}

.btn-wget {
    padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 2.5);
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 1);
    white-space: nowrap;
    font-family: inherit;
}

.btn-wget:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-wget svg {
    flex-shrink: 0;
}

/* 响应式（仅文件项相关） */
@media (max-width: 768px) {
    .file-header {
        flex-direction: column;
        align-items: stretch;
        gap: calc(var(--spacing-unit) * 2);
    }

    .file-header-right {
        width: 100%;
        flex-direction: column;
        gap: calc(var(--spacing-unit) * 1.5);
    }

    .preview-toggle-icon {
        display: none;
    }

    .file-info {
        width: 100%;
    }

    .file-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: calc(var(--spacing-unit) * 1.5);
    }

    .file-actions .btn-download,
    .file-actions .btn-wget {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .disclaimer-box {
        flex-direction: column;
        gap: calc(var(--spacing-unit) * 1.5);
        padding: calc(var(--spacing-unit) * 2);
        font-size: 13px;
    }

    .disclaimer-box svg {
        width: 18px;
        height: 18px;
    }

    .btn-download,
    .btn-wget {
        padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 2);
        font-size: 13px;
    }

    .preview-image {
        max-height: 400px;
    }

    .preview-video {
        max-height: 300px;
    }
}
