/* 📂 file-manager.css — 文件管理器样式 */

.file-manager-panel {
    padding: 0;
}

.file-mgr-layout {
    display: flex;
    height: 580px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

/* ── 左侧边栏 ── */
.file-mgr-sidebar {
    width: 240px;
    min-width: 240px;
    background: #f8f9fa;
    border-right: 1px solid #e5e7eb;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.file-mgr-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.file-mgr-tree-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
    transition: background 0.15s;
}

.file-mgr-tree-item:hover {
    background: #e5e7eb;
}

.tree-icon {
    font-size: 15px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.file-mgr-quick-types {
    border-top: 1px solid #e5e7eb;
    padding-top: 6px;
    margin-top: 6px;
}

.file-mgr-type-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    color: #6b7280;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.file-mgr-type-item:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.file-mgr-type-item.active {
    background: #2563eb;
    color: #fff;
}

/* ── 右侧主区域 ── */
.file-mgr-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-mgr-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.file-mgr-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    flex-wrap: wrap;
}

.breadcrumb-seg {
    cursor: pointer;
    color: #6b7280;
    padding: 3px 6px;
    border-radius: 4px;
    transition: all 0.15s;
}

.breadcrumb-seg:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.breadcrumb-seg.active {
    color: #1f2937;
    font-weight: 600;
}

.breadcrumb-sep {
    color: #9ca3af;
}

.file-mgr-actions {
    display: flex;
    gap: 8px;
}

/* ── 文件列表 ── */
.file-mgr-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.file-mgr-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    transition: background 0.1s;
    border-bottom: 1px solid #f3f4f6;
}

.file-mgr-row:hover {
    background: #f9fafb;
}

.file-mgr-row.dir {
    cursor: pointer;
}

.file-mgr-row.dir:hover {
    background: #e5e7eb;
}

.file-icon {
    font-size: 18px;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.file-name {
    flex: 1;
    font-size: 14px;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-info {
    font-size: 13px;
    color: #9ca3af;
    width: 90px;
    text-align: right;
    flex-shrink: 0;
}

.file-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.file-mgr-row:hover .file-actions {
    opacity: 1;
}

/* ── Loading ── */
.file-mgr-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 8px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.25);
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    margin-top: 14px;
    font-size: 15px;
    color: #fff;
}

/* ── Modal 弹窗 ── */
.file-mgr-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 0;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header span {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
    transition: background 0.15s;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px;
    border-top: 1px solid #e5e7eb;
}

/* ── 进度条 ── */
/* 注意: 必须限定作用域。
   裸 .progress-bar 会泄漏到 抓图固件升级(image-firmware-panel) 的
   .progress-wrap > .progress-bar 上，给它加 12px 上边距，
   导致 20px 高的进度条只露出 8px(颜色只显示一半不到)。 */
.file-mgr-modal .progress-bar {
    margin: 12px 0;
}
