/* ╔══════════════════════════════════════════════════════════════════╗
   ║              🗄️ 文件数据库 — 样式表                             ║
   ╚══════════════════════════════════════════════════════════════════╝ */

/* ========== 变量 ========== */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.03);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-xl: 0 8px 40px rgba(0,0,0,0.12);
    --transition: 0.2s ease;
}

/* ========== 全局 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

#app {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px 60px;
}

/* ========== Header ========== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon { font-size: 32px; }

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.header-right {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn .icon { font-size: 16px; }

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }

.btn-accent {
    background: var(--accent);
    color: white;
}
.btn-accent:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-danger {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}
.btn-danger:hover { background: #fee2e2; color: var(--danger-hover); }

.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-tiny { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

.btn-close {
    width: 32px; height: 32px;
    border: none;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-close:hover { background: #fee2e2; color: var(--danger); }

/* ========== 统计面板 ========== */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform var(--transition);
}
.stat-card:hover { transform: translateY(-2px); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ========== 搜索栏 ========== */
.toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 0 16px;
    transition: border-color var(--transition);
}
.search-box:focus-within { border-color: var(--primary); }
.search-box .icon { font-size: 18px; color: var(--text-secondary); }
.search-box input {
    flex: 1;
    border: none;
    outline: none;
    padding: 14px 12px;
    font-size: 15px;
    background: transparent;
}
.search-box kbd {
    padding: 2px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.select-filter {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    min-width: 140px;
}
.select-filter:focus { border-color: var(--primary); outline: none; }

.active-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.active-filters .filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.active-filters .filter-tag .remove {
    cursor: pointer;
    font-size: 14px;
    opacity: 0.7;
}
.active-filters .filter-tag .remove:hover { opacity: 1; color: var(--danger); }

/* ========== 上传区域 ========== */
.upload-zone {
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    background: var(--card-bg);
    transition: all var(--transition);
    cursor: pointer;
}
.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}
.upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-text { font-size: 16px; color: var(--text); }
.upload-link { color: var(--primary); text-decoration: underline; cursor: pointer; }
.upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

.upload-progress {
    margin-top: 12px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    box-shadow: var(--shadow);
}
.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 6px;
}
.progress-bar {
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #a855f7);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.upload-queue {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
    box-shadow: var(--shadow);
}
.queue-item .q-icon { font-size: 20px; }
.queue-item .q-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item .q-size { color: var(--text-muted); }
.queue-item .q-status { font-weight: 600; }
.queue-item .q-status.done { color: var(--success); }
.queue-item .q-status.error { color: var(--danger); }

/* ========== 批量操作栏 ========== */
.batch-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--primary-light);
    border-radius: var(--radius);
    margin-bottom: 16px;
    animation: slideDown 0.2s ease;
    flex-wrap: wrap;
}
.batch-info { font-size: 13px; color: var(--primary); font-weight: 600; }
.batch-actions { margin-left: auto; display: flex; gap: 6px; }

/* Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
}
.checkbox-wrapper input { display: none; }
.checkmark {
    width: 18px; height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.checkbox-wrapper input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}
.checkbox-wrapper input:checked + .checkmark::after {
    content: "✓";
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* ========== 文件卡片 ========== */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
    animation: cardIn 0.3s ease;
}
.file-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.file-card .card-checkbox {
    flex-shrink: 0;
}

.file-icon {
    font-size: 32px;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

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

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

.file-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    flex-wrap: wrap;
}

.file-badges {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.badge-category {
    font-size: 11px;
    padding: 2px 8px;
    background: #f0fdf4;
    color: #16a34a;
    border-radius: 20px;
    font-weight: 600;
}
.badge-tag {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--bg);
    color: var(--text-secondary);
    border-radius: 20px;
}
.badge-storage {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}
.badge-storage.local { background: #dbeafe; color: #2563eb; }
.badge-storage.s3 { background: #fef3c7; color: #d97706; }

.file-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition);
    flex-shrink: 0;
}
.file-card:hover .file-actions { opacity: 1; }

.file-actions .btn { padding: 4px 8px; font-size: 12px; }

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    font-size: 14px;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}
.empty-icon { font-size: 56px; margin-bottom: 12px; }
.empty-hint { font-size: 13px; margin-top: 4px; color: var(--text-muted); }

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s;
    padding: 20px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--card-bg);
    border-radius: 16px;
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.3s ease;
}
@keyframes modalIn {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; }
.modal-title { display: flex; align-items: center; gap: 10px; }
.file-type-icon { font-size: 28px; }

.modal-body { padding: 20px 24px; }
.modal-footer {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ========== 详情 ========== */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.detail-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.detail-value {
    font-size: 14px;
    color: var(--text);
}
.detail-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.detail-section {
    margin-top: 14px;
}
.detail-section .detail-label {
    display: block;
    margin-bottom: 6px;
}
.tag-list { display: flex; gap: 4px; flex-wrap: wrap; }
.tag-list .tag {
    display: inline-block;
    padding: 2px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* ========== 表单 ========== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.form-group input,
.form-group textarea {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition);
    background: var(--bg);
}
.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    outline: none;
    background: white;
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* 标签输入 */
.tag-input-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    align-items: center;
}
.tag-input-wrapper:focus-within { border-color: var(--primary); }
.tag-input-wrapper input {
    border: none !important;
    outline: none !important;
    padding: 4px 8px !important;
    font-size: 13px;
    flex: 1;
    min-width: 100px;
    background: transparent !important;
}
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    animation: tagIn 0.2s ease;
}
.tag .tag-remove {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0.6;
}
.tag .tag-remove:hover { opacity: 1; color: var(--danger); }
@keyframes tagIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ========== 存储状态弹窗 ========== */
.storage-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.storage-card {
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius);
    text-align: center;
}
.storage-card .s-icon { font-size: 36px; margin-bottom: 8px; }
.storage-card .s-value { font-size: 22px; font-weight: 700; color: var(--text); }
.storage-card .s-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.storage-card .s-detail { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ========== Toast ========== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: white;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: toastIn 0.3s ease;
}
.toast.toast-error { background: var(--danger); }
.toast.toast-success { background: var(--success); }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .stats-panel { grid-template-columns: repeat(2, 1fr); }
    .header { flex-direction: column; align-items: flex-start; }
    .header-right { width: 100%; justify-content: flex-start; }
    .filter-row { flex-direction: column; }
    .select-filter { min-width: 100%; }
    .file-actions { opacity: 1; }
    .detail-grid { grid-template-columns: 1fr; }
    .storage-grid { grid-template-columns: 1fr; }
    .modal { max-width: 100%; }
}

@media (max-width: 480px) {
    #app { padding: 12px 8px 40px; }
    .stats-panel { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 12px 8px; }
    .stat-value { font-size: 22px; }
    .file-card { padding: 10px 12px; gap: 10px; }
    .file-icon { width: 36px; height: 36px; font-size: 24px; }
}
