/* === 侧边栏 / 导航 / 文件夹树 / 存储空间 === */

/* ---- 主应用布局 ---- */
.app-container {
    display: flex; flex-direction: column;
    width: 100%; height: 100vh;
    background: #f3f4f6;
}
.app-container.hidden { display: none !important; }

.topbar {
    display: flex; align-items: center;
    height: 56px; padding: 0 16px;
    background: #fff; border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: linear-gradient(135deg, #4a9eff, #3a7eef);
    color: #fff;
    box-shadow: 0 2px 6px rgba(74, 158, 255, 0.25);
    position: relative;
}
.brand-icon svg {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}
.brand-text { font-size: 14px; font-weight: 600; color: #111827; letter-spacing: -0.3px; }

.breadcrumb {
    flex: 1; margin: 0 24px;
    display: flex; align-items: center; gap: 4px;
    overflow: hidden; font-size: 13px;
}
.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #7b8494;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 3px 8px;
    border-radius: 7px;
    margin: 0 -2px;
    font-weight: 500;
}
.breadcrumb-item svg {
    color: #a0a8b8;
    transition: color 0.2s;
}
.breadcrumb-item:hover {
    color: #4a9eff;
    background: rgba(74, 158, 255, 0.06);
    transform: translateY(-1px);
}
.breadcrumb-item:hover svg {
    color: #4a9eff;
}
.breadcrumb-item:last-child {
    color: #1e293b;
    cursor: default;
    background: transparent;
    transform: none;
    font-weight: 600;
}
.breadcrumb-item:last-child svg {
    color: #4a9eff;
}
.breadcrumb-separator {
    color: #d0d5dd;
    margin: 0 2px;
    flex-shrink: 0;
    font-weight: 300;
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

/* ---- 侧边栏 ---- */
.sidebar {
    width: 260px; min-width: 260px;
    background: linear-gradient(180deg, #fafbfc 0%, #f8f9fa 100%);
    border-right: 1px solid #e8eaed;
    display: flex; flex-direction: column;
    flex-shrink: 0;
    position: relative;
}
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px 10px 0 10px;
}
/* 固定区域：文件夹头部 + 全部文件按钮 + 分隔线 */
.sidebar-nav > .nav-header,
.sidebar-nav > .nav-item,
.sidebar-nav > .folder-separator {
    flex-shrink: 0;
}
/* 可滚动区域：文件夹树 */
.sidebar-nav .folder-tree {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 0 4px;
    margin: 0 -4px;
}
.nav-header {
    padding: 0 6px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-header::before {
    content: "";
    width: 3px;
    height: 12px;
    background: linear-gradient(180deg, #4a9eff, #3a7eef);
    border-radius: 2px;
}
.nav-header p {
    font-size: 11px;
    font-weight: 600;
    color: #8b95a5;
    letter-spacing: 0.8px;
}
/* 全部文件 导航项 */
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #5c6370;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    margin-bottom: 2px;
}
.nav-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 20px;
    background: linear-gradient(180deg, #4a9eff, #3a7eef);
    border-radius: 0 3px 3px 0;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-item:hover {
    background: rgba(74, 158, 255, 0.06);
    color: #2c3e50;
}
.nav-item.active {
    background: linear-gradient(135deg, #e8f2ff, #eff6ff);
    color: #3a7eef;
}
.nav-item.active::before {
    transform: translateY(-50%) scaleY(1);
}
.nav-item.drop-target {
    background: #eff6ff;
    color: #4a9eff;
    border: 1px dashed #bfdbfe;
    animation: pulseGlow 1.5s ease-in-out infinite;
}
/* 图标圆形背景 */
.nav-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #eef1f5, #e4e8ed);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}
.nav-item-icon svg {
    color: #8b95a5;
    transition: color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-item:hover .nav-item-icon {
    background: linear-gradient(135deg, #e4eaf3, #d8e0ec);
}
.nav-item:hover .nav-item-icon svg { color: #6b7280; }
.nav-item.active .nav-item-icon {
    background: linear-gradient(135deg, #cce0ff, #d4e6ff);
    box-shadow: 0 2px 6px rgba(74, 158, 255, 0.15);
}
.nav-item.active .nav-item-icon svg { color: #4a9eff; }

/* 文件夹分隔线 */
.folder-separator {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 12px 6px 8px 6px;
    padding: 0 2px;
}
.folder-separator::before,
.folder-separator::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d8dce3 50%, transparent);
}
.folder-separator span {
    font-size: 10px;
    font-weight: 600;
    color: #b0b8c8;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ---- 文件夹树（支持多级展开折叠） ---- */
.folder-tree {
    display: flex;
    flex-direction: column;
    padding: 0 2px;
    user-select: none;
    gap: 1px;
}

/* 树节点容器 */
.folder-tree-node {
    display: flex;
    flex-direction: column;
}

/* 树节点头部 */
.folder-tree-item {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    border-radius: 8px;
    color: #5c6370;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    margin: 1px 0;
}
.folder-tree-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 18px;
    background: linear-gradient(180deg, #4a9eff, #3a7eef);
    border-radius: 0 3px 3px 0;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 展开/折叠指示器 */
.folder-tree-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #b0b8c8;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s;
    cursor: pointer;
    border-radius: 4px;
}
.folder-tree-toggle:hover {
    color: #6b7280;
    background: rgba(0, 0, 0, 0.04);
}
.folder-tree-toggle.expanded { transform: rotate(90deg); }
.folder-tree-toggle.leaf {
    visibility: hidden;
    pointer-events: none;
}

/* 文件夹图标 */
.folder-tree-item svg.tree-folder-icon {
    flex-shrink: 0;
    color: #f5b041;
    filter: drop-shadow(0 1px 1px rgba(245, 176, 65, 0.15));
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.folder-tree-item:hover svg.tree-folder-icon {
    transform: scale(1.12);
    filter: drop-shadow(0 2px 3px rgba(245, 176, 65, 0.25));
}

/* Hover 状态 */
.folder-tree-item:hover {
    background: rgba(74, 158, 255, 0.06);
    color: #2c3e50;
}

/* Active 状态 */
.folder-tree-item.active {
    background: linear-gradient(135deg, #e8f2ff, #eff6ff);
    color: #3a7eef;
}
.folder-tree-item.active::before {
    transform: translateY(-50%) scaleY(1);
}
.folder-tree-item.active svg.tree-folder-icon {
    color: #f5b041;
    filter: drop-shadow(0 2px 3px rgba(245, 176, 65, 0.25));
}

/* 拖放目标高亮 */
.folder-tree-item.drop-target {
    background: #eff6ff !important;
    color: #4a9eff !important;
    box-shadow: inset 0 0 0 1px #bfdbfe, 0 0 12px rgba(74, 158, 255, 0.15);
    animation: pulseGlow 1.5s ease-in-out infinite;
}

/* 子节点容器 */
.folder-tree-children {
    display: flex;
    flex-direction: column;
    position: relative;
    padding-left: 16px;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.folder-tree-children.collapsed {
    max-height: 0;
    opacity: 0;
}
.folder-tree-children.expanded {
    max-height: 2000px;
    opacity: 1;
}

/* 左侧竖线连接线 */
.folder-tree-children::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 0;
    bottom: 10px;
    width: 1.5px;
    background: linear-gradient(180deg, #dce0e6 0%, #dce0e6 70%, transparent 100%);
    border-radius: 1px;
}

/* 空状态 */
.folder-tree-empty {
    padding: 16px 12px;
    font-size: 12px;
    color: #c0c8d5;
    text-align: center;
    font-style: italic;
}

/* ---- 存储空间 ---- */
.storage-bar-wrap {
    margin: 10px;
    padding: 14px;
    background: linear-gradient(135deg, #f5f7fa, #eef1f6);
    border: 1px solid #e2e6ec;
    border-radius: 12px;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.8),
                0 1px 2px rgba(0, 0, 0, 0.03);
}
.storage-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.storage-label span:first-child {
    font-size: 12px;
    font-weight: 600;
    color: #7b8494;
    letter-spacing: 0.3px;
}
.storage-label span:last-child {
    font-size: 11px;
    font-weight: 500;
    color: #a0a8b8;
    background: rgba(255, 255, 255, 0.7);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid #e2e6ec;
}
.storage-track {
    height: 5px;
    background: linear-gradient(90deg, #e8ecf1, #e2e6ec);
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}
.storage-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #4a9eff, #3a7eef, #60a5fa);
    background-size: 200% 100%;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    animation: storageShimmer 2.5s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(74, 158, 255, 0.2);
}
@keyframes storageShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.sidebar-mask {
    position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: -1;
}
