/* ============================================================
   云盘模块（drv- 前缀，深空玻璃拟态）
   ============================================================ */
.drv { height: 100%; overflow-y: auto; padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4); }

/* ---- 顶部工具栏 ---- */
.drv-toolbar {
  display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg);
  background: var(--bg-glass); border: 1px solid var(--line-1);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.drv-crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.drv-crumb {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--r-sm); border: none; background: transparent;
  color: var(--tx-2); font-size: var(--fs-sm); cursor: pointer;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.drv-crumb:hover { background: var(--bg-3); color: var(--tx-1); }
.drv-crumb.is-cur { color: var(--neon-cyan); font-weight: 600; pointer-events: none; }
.drv-crumb-sep { color: var(--tx-3); font-size: var(--fs-xs); user-select: none; }
.drv-actions { display: flex; gap: var(--sp-2); flex: none; align-items: center; }
.drv-actions .btn { display: inline-flex; align-items: center; gap: 6px; }

/* 搜索框 / 视图切换 */
.drv-search-box { position: relative; display: flex; align-items: center; }
.drv-search-ic { position: absolute; left: 10px; display: inline-flex; color: var(--tx-3); pointer-events: none; }
.drv-search-input {
  width: 190px; padding: 8px 12px 8px 32px; border-radius: var(--r-md);
  background: var(--bg-glass); border: 1px solid var(--line-1); color: var(--tx-1);
  font-size: var(--fs-sm); outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), width var(--t-mid) var(--ease);
}
.drv-search-input::placeholder { color: var(--tx-3); }
.drv-search-input:focus { border-color: var(--line-glow); box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.12); width: 230px; }
.drv-view-toggle { display: flex; flex: none; border: 1px solid var(--line-1); border-radius: var(--r-md); overflow: hidden; }
.drv-view-btn { display: inline-flex; align-items: center; padding: 7px 10px; color: var(--tx-3); transition: color var(--t-fast), background var(--t-fast); }
.drv-view-btn:hover { color: var(--tx-1); }
.drv-view-btn.is-active { color: var(--neon-cyan); background: var(--bg-3); }

/* 上传中按钮 loading 态（app.html 未加载 auth.css，局部补一份） */
.drv .btn-loading { pointer-events: none; opacity: 0.85; }
.drv .btn-loading::before {
  content: ''; width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid rgba(4, 18, 26, 0.35); border-top-color: currentColor;
  animation: spin 0.8s linear infinite;
}

/* ---- 空间指示条 ---- */
.drv-quota {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg);
  background: var(--bg-glass); border: 1px solid var(--line-1);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.drv-quota-bar {
  flex: 1; height: 8px; border-radius: var(--r-full);
  background: var(--bg-3); overflow: hidden;
}
.drv-quota-fill {
  height: 100%; width: 0; border-radius: var(--r-full);
  background: var(--grad-brand);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.45);
  transition: width 0.6s var(--ease);
}
.drv-quota-fill.is-danger {
  background: linear-gradient(135deg, #ff5d73, #ff9a5c);
  box-shadow: 0 0 12px rgba(255, 93, 115, 0.5);
}
.drv-quota-text { flex: none; color: var(--tx-2); font-size: var(--fs-sm); white-space: nowrap; }

/* ---- 上传进度条（上传期间显示，含当前文件名 + 总进度百分比） ---- */
.drv-uprog {
  display: none; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg);
  background: var(--bg-glass); border: 1px solid var(--line-1);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.drv-uprog.show { display: block; }
.drv-uprog-info {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-bottom: 8px; font-size: var(--fs-sm); color: var(--tx-2);
}
.drv-uprog-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drv-uprog-pct { flex: none; color: var(--neon-cyan); font-variant-numeric: tabular-nums; }
.drv-uprog-bar { height: 8px; border-radius: var(--r-full); background: var(--bg-3); overflow: hidden; }
.drv-uprog-fill {
  height: 100%; width: 0; border-radius: var(--r-full);
  background: var(--grad-brand);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.45);
  transition: width 0.15s linear;
}

/* ---- 文件列表 ---- */
/* 滚动模型：.drv-list 仅作裁切外框（overflow:hidden），
   列表视图行由 .drv-rows 内部滚动（表头固定），网格视图由 .drv-grid 内部滚动。
   原先行直接作为 .drv-list 子元素 + overflow:hidden，超出部分被裁掉且无任何滚动条。 */
.drv-list {
  flex: 1; min-height: 0; border-radius: var(--r-lg); overflow: hidden;
  background: var(--bg-glass); border: 1px solid var(--line-1);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; flex-direction: column;
}
/* 列表视图：数据行滚动容器（表头 .drv-head 固定在顶部不参与滚动） */
.drv-rows { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.drv-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 120px 160px 132px;
  align-items: center; gap: var(--sp-3);
  padding: 10px var(--sp-4); border-bottom: 1px solid var(--line-1);
  font-size: var(--fs-sm); color: var(--tx-2);
  transition: background var(--t-fast);
}
.drv-row:last-child { border-bottom: none; }
.drv-row.is-folder { cursor: pointer; }
.drv-row:not(.drv-head):hover { background: var(--bg-3); color: var(--tx-1); }
.drv-row.drv-head {
  color: var(--tx-3); font-size: var(--fs-xs); letter-spacing: 1px; font-weight: 600;
  background: rgba(120, 140, 255, 0.04);
}
.drv-row.drv-head:hover { background: rgba(120, 140, 255, 0.04); }

.drv-cell { min-width: 0; }
.drv-name { display: flex; align-items: center; gap: 10px; }
.drv-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tx-1); }
.drv-row.is-folder .drv-name-text { font-weight: 600; }
.drv-size, .drv-time { font-variant-numeric: tabular-nums; color: var(--tx-3); }

/* 类型图标着色 */
.drv-t-ic { display: inline-flex; flex: none; }
.drv-t-ic .i { width: 18px; height: 18px; }
.drv-t-ic.t-folder { color: var(--neon-gold); filter: drop-shadow(0 0 6px rgba(255, 200, 87, 0.35)); }
.drv-t-ic.t-image { color: var(--neon-magenta); }
.drv-t-ic.t-file { color: var(--neon-cyan); }

/* 操作列 */
.drv-ops { display: flex; gap: 4px; justify-content: flex-end; }
.drv-op {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent;
  color: var(--tx-3); cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.drv-op:hover { color: var(--neon-cyan); background: var(--bg-2); border-color: var(--line-1); }
.drv-op.danger:hover { color: var(--danger); background: rgba(255, 93, 115, 0.12); }
.drv-op .i { width: 15px; height: 15px; }

/* ---- 缩略图（百度网盘式小图，与类型图标同尺寸） ---- */
.drv-thumb {
  width: 32px; height: 32px; flex: none; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; background: var(--bg-3);
}
.drv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.drv-thumb .drv-t-ic .i { width: 18px; height: 18px; }

/* ---- 网格视图（flex:1 + min-height:0 使其在 .drv-list 内获得有界高度从而内部滚动） ---- */
.drv-grid {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: var(--sp-2); padding: var(--sp-3); align-content: start; overflow-y: auto;
  overscroll-behavior: contain;
}
.drv-card {
  position: relative; display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 14px 8px 10px; border-radius: var(--r-md);
  border: 1px solid transparent; text-align: center;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.drv-card:hover { background: var(--bg-3); border-color: var(--line-1); }
.drv-card-thumb {
  width: 56px; height: 56px; border-radius: var(--r-md);
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; background: var(--bg-3);
}
.drv-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.drv-card-thumb .drv-t-ic .i { width: 34px; height: 34px; }
.drv-card-name {
  width: 100%; font-size: var(--fs-sm); color: var(--tx-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.drv-card.is-folder .drv-card-name { font-weight: 600; }
.drv-card-sub { font-size: var(--fs-xs); color: var(--tx-3); }
.drv-card-ops { position: absolute; top: 4px; right: 4px; opacity: 0; transition: opacity var(--t-fast); }
.drv-card:hover .drv-card-ops, .drv-card-ops:focus-within { opacity: 1; }
.drv-card-ops .drv-ops { gap: 2px; }
.drv-card-ops .drv-op {
  width: 24px; height: 24px; background: var(--bg-2); border-color: var(--line-1);
}
@media (hover: none) { .drv-card-ops { opacity: 1; } }

/* ---- 空状态 ---- */
.drv-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3); padding: var(--sp-7) var(--sp-5); text-align: center;
}
.drv-empty-art { color: var(--neon-cyan); opacity: 0.7; filter: drop-shadow(0 0 18px rgba(0, 229, 255, 0.4)); }
.drv-empty-art .i { width: 64px; height: 64px; }
.drv-empty-title { font-size: var(--fs-lg); color: var(--tx-2); font-weight: 600; }
.drv-empty-desc { font-size: var(--fs-sm); color: var(--tx-3); }

/* ---- 移动端适配 ---- */
@media (max-width: 860px) {
  .drv { padding: var(--sp-3); gap: var(--sp-3); }
  /* 工具栏上下两行：面包屑一行横滑，操作区一行 */
  .drv-toolbar { flex-direction: column; align-items: stretch; gap: var(--sp-3); padding: var(--sp-3); }
  .drv-crumbs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .drv-crumbs::-webkit-scrollbar { display: none; }
  .drv-crumb { flex: none; max-width: 120px; }
  .drv-actions { width: 100%; }
  .drv-search-box { flex: 1; min-width: 0; }
  .drv-search-input { width: 100%; font-size: 16px; } /* ≥16px 防 iOS 聚焦缩放 */
  .drv-search-input:focus { width: 100%; }
  .drv-row { grid-template-columns: minmax(0, 1fr) 72px 108px; }
  .drv-time { display: none; }
  .drv-actions .btn span { display: none; } /* 操作按钮图标化 */
  .drv-actions .btn { padding: 6px 10px; }
  .drv-quota { flex-direction: column; align-items: stretch; gap: var(--sp-2); padding: var(--sp-3); }
}
@media (max-width: 560px) {
  .drv-row { grid-template-columns: minmax(0, 1fr) 96px; }
  .drv-size { display: none; }
  .drv-crumb { max-width: 96px; }
  .drv-upload-dir { display: none; } /* 手机端隐藏「上传文件夹」（浏览器支持差，减少拥挤） */
  .drv-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* ---- 图片灯箱预览：全屏遮罩 + 居中面板；Esc / 点击遮罩 / 关闭按钮均可关闭 ---- */
.drv-lightbox {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 20px;
  background: rgba(6, 10, 18, 0.86); backdrop-filter: blur(4px);
}
.drv-lb-head { display: flex; align-items: center; gap: 8px; width: min(880px, 100%); }
.drv-lb-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #fff; font-size: var(--fs-sm);
}
.drv-lightbox .drv-op {
  width: 36px; height: 36px; flex: none; text-decoration: none;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}
.drv-lightbox .drv-op:hover { color: #fff; background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.3); }
.drv-lightbox .drv-op .i { width: 18px; height: 18px; }
.drv-lb-body {
  width: min(880px, 100%); height: min(72vh, 660px);
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-md); overflow: hidden;
}
.drv-lb-body img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.drv-lb-foot { width: min(880px, 100%); color: rgba(255, 255, 255, 0.6); font-size: var(--fs-xs); text-align: center; }
@media (max-width: 560px) {
  .drv-lightbox { padding: 12px; }
  .drv-lb-body { height: 66vh; }
}
/* ---- 任务9：批量选择 / 批量操作栏 / 移动选择框 ---- */
.drv-check {
  width: 16px; height: 16px; flex: none; accent-color: var(--neon-cyan, #00e5ff);
  cursor: pointer; margin: 0;
}
.drv-name .drv-check { margin-right: 2px; }
.drv-checkcell { flex: none; width: 30px; display: flex; align-items: center; justify-content: center; }
.drv-card { position: relative; }
.drv-card .drv-check {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: var(--bg-1, #111); border-radius: 4px;
}

.drv-batchbar {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 76px);
  z-index: 40; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--r-md, 12px);
  opacity: 0; pointer-events: none;
  transition: transform .22s ease, opacity .22s ease;
  box-shadow: var(--shadow-2, 0 8px 30px rgba(0,0,0,.35));
}
.drv-batchbar.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.drv-batch-count { font-size: var(--fs-sm, 13px); color: var(--tx-2); white-space: nowrap; }
.drv-batch-del { color: var(--danger, #ff5d73); }

.drv-move-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 50vh; overflow-y: auto; margin: 4px -4px 0;
}
.drv-move-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 12px; border-radius: var(--r-sm, 8px);
  font-size: var(--fs-sm, 13px); color: var(--tx-1); text-align: left;
  transition: background .12s ease;
}
.drv-move-item:hover:not(:disabled) { background: var(--bg-3, rgba(255,255,255,.06)); }
.drv-move-item:disabled { opacity: 0.4; cursor: not-allowed; }
.drv-move-item .i { flex: none; }

@media (max-width: 768px) {
  .drv-batchbar { gap: 6px; padding: 8px 10px; max-width: calc(100vw - 20px); flex-wrap: wrap; justify-content: center; }
}
