/* ============ Q盘 · 百度网盘风格 ============ */
:root {
  --blue: #4080ff;
  --blue-dark: #2f6fe0;
  --blue-light: #eaf2ff;
  --bg: #f7f8fa;
  --card: #ffffff;
  --text: #242933;
  --text-2: #646a73;
  --text-3: #97a0af;
  --line: #e8eaed;
  --red: #f53f3f;
  --shadow: 0 2px 8px rgba(0,0,0,.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14px; -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
input { font: inherit; }
[hidden] { display: none !important; }

/* ---------- 登录页 ---------- */
#loginView {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #eaf2ff 0%, #f7f8fa 55%, #e8f6ef 100%);
  padding: 16px;
}
.login-card {
  width: 100%; max-width: 360px; background: var(--card);
  border-radius: 16px; box-shadow: 0 12px 40px rgba(64,128,255,.15);
  padding: 40px 36px 36px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 22px; margin-top: 10px; font-weight: 600; }
.login-sub { color: var(--text-3); margin-top: 6px; font-size: 13px; }
#loginForm { display: flex; flex-direction: column; gap: 14px; }
#loginForm input {
  height: 46px; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 0 14px; outline: none; transition: border .15s; width: 100%;
}
#loginForm input:focus { border-color: var(--blue); }
.btn-primary {
  height: 46px; border: none; border-radius: 10px; background: var(--blue);
  color: #fff; font-size: 16px; letter-spacing: 4px; transition: background .15s;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.login-err { color: var(--red); font-size: 13px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 18px; background: var(--card);
  border-bottom: 1px solid var(--line);
}
.tb-left { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.tb-right { display: flex; align-items: center; gap: 10px; }
.logo { display: flex; align-items: center; gap: 7px; flex: none; }
.logo-name { font-size: 18px; font-weight: 700; }
.search {
  height: 36px; width: 100%; max-width: 380px;
  border: none; background: var(--bg); border-radius: 8px;
  padding: 0 12px 0 34px; outline: none;
  background-image: url("/search.svg");
  background-repeat: no-repeat; background-position: 11px center;
}
.search:focus { background-color: #fff; box-shadow: inset 0 0 0 1.5px var(--blue); }
.quota { font-size: 12px; color: var(--text-2); background: var(--bg); border-radius: 6px; padding: 4px 9px; }
.userbox { display: flex; align-items: center; gap: 6px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--blue);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; flex: none;
}
.uname { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text-2); }
.iconbtn {
  width: 34px; height: 34px; border: none; background: transparent;
  border-radius: 8px; color: var(--text-2); font-size: 18px; line-height: 1;
}
.iconbtn:hover { background: var(--bg); }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 18px 4px; flex-wrap: wrap;
}
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-width: 0; font-size: 15px; }
.crumbs .crumb {
  color: var(--text-2); padding: 5px 9px; border-radius: 6px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px;
}
.crumbs .crumb:hover { background: var(--blue-light); color: var(--blue); }
.crumbs .crumb.cur { color: var(--text); font-weight: 600; cursor: default; }
.crumbs .sep { color: var(--text-3); font-size: 12px; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn {
  height: 36px; padding: 0 15px; border: none; border-radius: 8px;
  background: var(--blue); color: #fff; font-size: 13px;
  display: inline-flex; align-items: center; gap: 5px; transition: background .15s;
}
.btn:hover { background: var(--blue-dark); }
.btn-ghost { background: var(--card); color: var(--text-2); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: var(--blue); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #d93030; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }

/* ---------- 文件网格 ---------- */
.main { padding: 10px 18px 90px; position: relative; min-height: 60dvh; }
.grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}
.cell {
  background: var(--card); border-radius: 12px; padding: 14px 10px 10px;
  box-shadow: var(--shadow); cursor: pointer; user-select: none; position: relative;
  transition: transform .12s, box-shadow .12s; text-align: center;
}
.cell:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.10); }
.cell.sel { outline: 2px solid var(--blue); outline-offset: -2px; background: var(--blue-light); }
.cell .thumb {
  height: 74px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; overflow: hidden; margin-bottom: 9px; background: #f4f5f7;
}
.cell .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cell .thumb svg { width: 46px; height: 46px; }
.cell .fname {
  font-size: 13px; color: var(--text); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-all;
}
.cell .fmeta { font-size: 11px; color: var(--text-3); margin-top: 5px; }
.cell .check {
  position: absolute; top: 8px; left: 8px; width: 20px; height: 20px;
  border-radius: 50%; border: 1.5px solid var(--text-3); background: #fff;
  display: none; align-items: center; justify-content: center; color: #fff;
}
.cell:hover .check, .cell.sel .check { display: flex; }
.cell.sel .check { background: var(--blue); border-color: var(--blue); }
.cell .badge-more {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px;
  border-radius: 50%; background: rgba(0,0,0,.35); color: #fff; display: none;
  align-items: center; justify-content: center; font-size: 13px; line-height: 1;
}
.cell:hover .badge-more { display: flex; }
.dir-cell .thumb { background: var(--blue-light); }

/* 空状态 */
.empty { text-align: center; padding: 80px 0; color: var(--text-3); }
.empty-icon { font-size: 54px; margin-bottom: 14px; opacity: .8; }
.empty p { font-size: 13px; }

/* 批量操作条 */
.batchbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; padding: 10px 18px;
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
}
.batch-info { font-size: 13px; color: var(--text-2); margin-right: 6px; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal-card {
  position: relative; background: var(--card); border-radius: 14px;
  max-width: 520px; width: 100%; max-height: 86dvh; overflow: auto;
  padding: 22px; box-shadow: 0 18px 60px rgba(0,0,0,.25);
}
.modal-card h3 { font-size: 17px; margin-bottom: 14px; word-break: break-all; }
.modal-card h3 .ms { color: var(--text-3); font-size: 12px; font-weight: 400; }
.mbtns { display: flex; gap: 9px; margin-top: 16px; flex-wrap: wrap; }
.field { margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--text-2); display: block; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; height: 40px; border: 1.5px solid var(--line); border-radius: 8px;
  padding: 0 11px; outline: none; background: #fff;
}
.field input:focus, .field select:focus { border-color: var(--blue); }
.pwd-row { display: flex; gap: 8px; }
.share-link-box {
  display: flex; gap: 8px; margin-top: 12px;
  background: var(--bg); border-radius: 8px; padding: 10px;
}
.share-link-box input { flex: 1; border: none; background: transparent; outline: none; font-size: 13px; color: var(--text); min-width: 0; }
.copybtn { flex: none; }

/* 预览层 */
.preview-big { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.preview-big img, .preview-big video { max-width: 100%; max-height: 84dvh; border-radius: 6px; }
.preview-cap { color: #cfd6e0; margin-top: 14px; font-size: 13px; max-width: 90%; text-align: center; word-break: break-all; }
.preview-cap a { color: #7fa8ff; text-decoration: none; font-size: 15px; font-weight: 600; display: inline-block; margin-top: 8px; }
.text-preview {
  background: #1f2329; color: #d8dee8; font: 12.5px/1.7 SFMono-Regular, Menlo, Consolas, monospace;
  max-width: 100%; max-height: 84dvh; overflow: auto; white-space: pre-wrap; word-break: break-all;
  border-radius: 10px; padding: 18px; width: min(860px, 100%);
}

/* ---------- toast ---------- */
.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  background: rgba(36,41,51,.94); color: #fff; padding: 10px 18px;
  border-radius: 9px; font-size: 13px; z-index: 90; max-width: 84vw;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
}

/* ---------- 上传面板 ---------- */
.upload-panel {
  position: fixed; right: 18px; bottom: 18px; z-index: 80;
  width: 340px; max-width: calc(100vw - 36px);
  background: var(--card); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.18);
  overflow: hidden;
}
.up-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.up-head b { flex: 1; }
.up-head button { border: none; background: none; color: var(--text-3); font-size: 15px; }
.up-list { max-height: 220px; overflow: auto; }
.up-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.up-item:last-child { border-bottom: none; }
.up-item .up-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-item .up-bar { width: 74px; height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; flex: none; }
.up-item .up-bar i { display: block; height: 100%; background: var(--blue); width: 0; transition: width .15s; }
.up-item .up-pct { width: 40px; text-align: right; color: var(--text-3); flex: none; }
.up-item.done .up-pct { color: #00b365; }
.up-item.err .up-pct { color: var(--red); }

/* 拖拽遮罩 */
.drop-overlay {
  position: fixed; inset: 0; z-index: 85; background: rgba(64,128,255,.94);
  display: flex; align-items: center; justify-content: center; color: #fff;
  font-size: 20px; font-weight: 600; letter-spacing: 1px;
}

/* ---------- 分享页 ---------- */
.share-pwd { display: flex; justify-content: center; padding: 90px 18px; }
.share-pwd-card { background: var(--card); border-radius: 14px; padding: 28px; width: 100%; max-width: 340px; box-shadow: var(--shadow); text-align: center; }
.share-pwd-card h3 { margin-bottom: 16px; font-size: 15px; }
.share-pwd-card input { width: 100%; height: 42px; border: 1.5px solid var(--line); border-radius: 8px; padding: 0 12px; margin-bottom: 12px; outline: none; }
.share-pwd-card input:focus { border-color: var(--blue); }
.share-pwd-card .btn-primary { width: 100%; }
.share-exp { font-size: 12px; color: var(--text-3); margin-top: 10px; }

/* 搜索横幅 */
.search-banner {
  background: var(--blue-light); color: var(--blue-dark);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; font-size: 13px;
}
.search-banner button { border: none; background: none; color: var(--blue); font-weight: 600; }

/* ---------- 移动端 ---------- */
@media (max-width: 720px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
  .cell { padding: 10px 6px 8px; }
  .cell .thumb { height: 58px; }
  .main { padding: 8px 10px 90px; }
  .toolbar { padding: 10px 12px 2px; }
  .crumbs { font-size: 13px; }
  .search { max-width: 150px; }
  .quota, .uname { display: none; }
  .topbar { padding: 0 12px; }
}
