/* === 文件管理（网格 / 列表 / 面包屑 / 操作按钮） === */

/* ---- 内容区 ---- */
.content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    height: 56px; padding: 0 16px;
    border-bottom: 1px solid #e5e7eb; flex-shrink: 0;
}
.toolbar-left { display: flex; align-items: center; gap: 8px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

.upload-label { cursor: pointer; }
.upload-label input { display: none; }

.view-toggle {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 9px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #b0b8c8;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.view-btn:hover {
    background: #f4f6f9;
    color: #6b7280;
}
.view-btn:hover svg {
    transform: scale(1.1);
}
.view-btn.active {
    color: #4a9eff;
    background: linear-gradient(180deg, #eff6ff, #e8f2ff);
}
.view-btn.active svg {
    transform: scale(1.05);
}
.view-btn.inactive { color: #b0b8c8; }
.view-btn svg {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-list { flex: 1; overflow-y: auto; padding: 16px; }

/* ---- 文件网格视图 ---- */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
@media (min-width: 640px) {
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (min-width: 1024px) {
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
@media (min-width: 1280px) {
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

.file-card {
    position: relative;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
    padding: 16px; cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: cardFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--card-index, 0) * 0.04s);
    will-change: transform, box-shadow;
}
.file-card:hover {
    border-color: #4a9eff; background: #fafcff;
    transform: translateY(-4px) scale(1.02);
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.08),
        0 4px 12px rgba(74, 158, 255, 0.08);
    z-index: 2;
}
.file-card.selected {
    border-color: #4a9eff;
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.15);
}
.file-card:active {
    transform: translateY(-1px) scale(0.99);
    transition-duration: 0.1s;
}

.file-card-inner {
    display: flex; flex-direction: column; align-items: center; text-align: center;
}
.file-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
}
.file-card:hover .file-card-icon {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.05);
}
/* 文件卡片图标外发光 */
.file-card-icon::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 18px;
    z-index: -1;
    filter: blur(12px);
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.file-card:hover .file-card-icon::after {
    opacity: 0.25;
}
.file-card-icon svg {
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.08));
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.file-card:hover .file-card-icon svg {
    transform: scale(1.06);
}
.file-card-name {
    font-size: 13px; color: #111827;
    width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-card-meta {
    font-size: 12px; color: #9ca3af; margin-top: 4px;
}

/* 快捷操作按钮区：始终占据固定高度，仅用 opacity 切换显示/隐藏，避免高度变化导致闪烁 */
.file-card-actions {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
    height: 32px;
    min-height: 32px;
    margin-top: 2px;
    margin-bottom: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}
.file-card:hover .file-card-actions {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.file-card-actions .action-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}
.file-card-actions .action-btn:hover {
    transform: scale(1.12);
}

/* ---- 文件列表视图 ---- */
.file-table { border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; }
.file-table-header {
    display: flex; align-items: center; height: 40px; padding: 0 12px;
    background: #f9fafb; border-bottom: 1px solid #e5e7eb;
    font-size: 12px; font-weight: 500; color: #6b7280;
}
.file-table-header .col-name { flex: 1; min-width: 0; }
.file-table-header .col-time { width: 144px; display: none; }
.file-table-header .col-size { width: 96px; text-align: right; display: none; }
.file-table-header .col-action { width: 128px; text-align: right; }

.file-list-row {
    display: flex; align-items: center; height: 48px; padding: 0 12px;
    border-radius: 8px; cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    animation: rowFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--row-index, 0) * 0.035s);
    will-change: transform, background;
}
.file-list-row:nth-child(even) { background: rgba(249, 250, 251, 0.6); }
.file-list-row:hover {
    background: #f3f4f6;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.file-list-row.selected {
    background: #eff6ff;
    box-shadow: inset 3px 0 0 0 #4a9eff, 0 2px 8px rgba(74, 158, 255, 0.06);
}

.row-name { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.row-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.row-icon svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.06));
}
.file-list-row:hover .row-icon {
    transform: scale(1.08);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}
.row-name-text { font-size: 13px; color: #111827; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-time { width: 144px; font-size: 12px; color: #6b7280; display: none; }
.row-size { width: 96px; font-size: 12px; color: #6b7280; text-align: right; display: none; }
.row-action { width: 128px; display: flex; justify-content: flex-end; }

.file-row-actions {
    display: flex;
    gap: 3px;
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.file-list-row:hover .file-row-actions {
    opacity: 1;
    transform: translateX(0);
}
.file-row-actions .action-btn:hover {
    transform: scale(1.12);
}

@media (min-width: 640px) {
    .file-table-header .col-time, .row-time { display: block; }
}
@media (min-width: 768px) {
    .file-table-header .col-size, .row-size { display: block; }
}

/* ---- 操作小按钮 ---- */
.action-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e8eaed;
    color: #7b8494;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.action-btn:hover {
    background: #f4f6f9;
    color: #475569;
    transform: scale(1.12);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    border-color: #d8dce3;
}
.action-btn svg {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.action-btn:hover svg {
    transform: scale(1.05);
}
.action-btn.danger {
    color: #94a3b8;
}
.action-btn.danger:hover {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #dc2626;
    border-color: #fecaca;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.12);
}
.action-btn.read-btn {
    color: #34d399;
}
.action-btn.read-btn:hover {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #059669;
    border-color: #a7f3d0;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.12);
}

/* ---- 空状态 ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #b0b8c8;
    animation: breathe 3s ease-in-out infinite;
}
.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.25;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.04));
}

/* ---- 拖拽上传高亮 ---- */
.file-list {
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.file-list.drag-over {
    outline: 2px dashed #4a9eff;
    outline-offset: -3px;
    background: rgba(239, 246, 255, 0.4);
    border-radius: 8px;
    box-shadow: inset 0 0 24px rgba(74, 158, 255, 0.08);
}

/* ---- 文件拖拽移动 ---- */
.file-card.dragging {
    opacity: 0.65;
    transform: scale(0.94) rotate(1deg);
    border-color: #4a9eff;
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.3), 0 8px 24px rgba(74, 158, 255, 0.15);
    cursor: grabbing;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.file-list-row.dragging {
    opacity: 0.65;
    background: #eff6ff;
    border: 1px dashed #4a9eff;
    transform: translateX(6px) scale(0.98);
    cursor: grabbing;
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
/* AI 面板拖拽高亮 */
.ai-panel.ai-drag-over {
    border-color: #4a9eff;
    box-shadow: 0 0 0 2px rgba(74,158,255,0.4), 0 8px 32px rgba(0,0,0,0.15);
}
.ai-drop-zone.drag-over {
    background: #eff6ff;
}
.ai-drop-zone.drag-over .ai-drop-hint {
    border-color: #4a9eff;
    color: #4a9eff;
    background: rgba(239,246,255,0.8);
}
