:root {
  color-scheme: dark;
  --bg: #070b12;
  --bg-2: #0b111c;
  --panel: #101826;
  --panel-2: #151f30;
  --border: #1e2a3d;
  --border-2: #2a3a54;
  --text: #e6edf7;
  --muted: #8a9bb3;
  --accent: #37e0c6;
  --accent-2: #6ea8ff;
  --accent-soft: rgba(55, 224, 198, 0.12);
  --danger: #ff6b7a;
  --danger-soft: rgba(255, 107, 122, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------------- 登录 ---------------- */
.login-view {
  height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: calc(34vh + 210px);
  background: url(/static/login-bg.png?v=20261026) center / cover no-repeat;
}

.login-card {
  width: 340px;
  padding: 58px 32px 28px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  text-align: center;
  animation: rise 0.35s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.login-card input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-sm);
  color: #0b2239;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-card input::placeholder { color: rgba(8, 32, 50, 0.45); }
.login-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(55, 224, 198, 0.3);
}

.login-card button {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(180deg, #37e0c6, #23b8a0);
  color: #062a26;
  border: none;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s, transform 0.05s;
}
.login-card button:hover { opacity: 0.92; }
.login-card button:active { transform: translateY(1px); }
.login-card button:disabled { opacity: 0.5; cursor: not-allowed; }

.login-err { color: #c0392b; font-size: 12px; margin-top: 12px; min-height: 16px; }

/* ---------------- 布局 ---------------- */
.app-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: url(/static/app-bg.jpg?v=20261027) center / cover no-repeat;
}

.topbar {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(7, 11, 18, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 16px;
  color: var(--accent);
}
.brand img { width: 22px; height: 22px; border-radius: 5px; }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.storage-hint { color: var(--muted); font-size: 12px; }

.toolbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  flex-wrap: wrap;
}

.toolbar-sep {
  width: 1px; height: 24px;
  background: var(--border-2);
  margin: 0 4px;
}
.toolbar-spacer { flex: 1; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: rgba(21, 31, 48, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, opacity 0.15s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover:not(:disabled) { background: rgba(21, 31, 48, 0.6); border-color: var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.primary {
  background: linear-gradient(180deg, rgba(55, 224, 198, 0.18), rgba(55, 224, 198, 0.08));
  border-color: rgba(55, 224, 198, 0.4);
  color: var(--accent);
}
.btn.primary:hover:not(:disabled) {
  background: rgba(55, 224, 198, 0.22);
  border-color: var(--accent);
}

.btn.danger { color: var(--danger); }
.btn.danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: rgba(21, 31, 48, 0.5); color: var(--text); }

/* ---------------- 面包屑 ---------------- */
.breadcrumb {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 20px;
  font-size: 13px;
  color: var(--muted);
  overflow-x: auto;
  white-space: nowrap;
}
.breadcrumb .crumb {
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.breadcrumb .crumb:hover { background: rgba(21, 31, 48, 0.5); color: var(--text); }
.breadcrumb .crumb.current { color: var(--text); font-weight: 500; }
.breadcrumb .sep { opacity: 0.5; }

/* ---------------- 内容 ---------------- */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 30px;
}

.drop-zone {
  min-height: 100%;
  border-radius: var(--radius);
  transition: background 0.15s, box-shadow 0.15s;
}
.drop-zone.dragging {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  padding-top: 8px;
}

/* ---------------- 文件卡片 ---------------- */
.file-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius);
  cursor: default;
  transition: border-color 0.15s, background 0.15s, transform 0.08s;
  user-select: none;
}
.file-card:hover { border-color: rgba(255, 255, 255, 0.22); background: rgba(21, 31, 48, 0.4); }
.file-card.selected {
  border-color: var(--accent);
  background: rgba(16, 24, 38, 0.55);
}
.file-card .icon {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-2);
}
.file-card .icon svg { width: 46px; height: 46px; }
.file-card.folder .icon { color: var(--accent); }
.file-card .name {
  width: 100%;
  text-align: center;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.file-card .meta {
  font-size: 11px;
  color: var(--muted);
}
.file-card .more {
  position: absolute;
  top: 6px; right: 6px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  border-radius: 6px;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
}
.file-card:hover .more { opacity: 1; }
.file-card .more:hover { background: rgba(255, 255, 255, 0.14); color: var(--text); }
.file-card .more svg { width: 16px; height: 16px; }

/* ---------------- 空状态 ---------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 80px 0;
  color: var(--muted);
  text-align: center;
}
.empty svg { color: var(--border-2); }
.empty p { font-size: 15px; }
.empty .empty-sub { font-size: 12px; opacity: 0.7; }

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 50;
  animation: fade 0.15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: 340px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.modal-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.modal-message { color: var(--muted); font-size: 13px; margin-bottom: 16px; line-height: 1.5; }
.modal-card input {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.modal-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 11px 20px;
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 60;
  animation: rise 0.2s ease;
}
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.ok { border-color: var(--accent); color: var(--accent); }

/* ---------------- 下拉菜单 ---------------- */
.menu {
  position: fixed;
  min-width: 140px;
  padding: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 55;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
}
.menu-item:hover { background: var(--border); }
.menu-item.danger { color: var(--danger); }
.menu-item svg { width: 15px; height: 15px; }

/* ---------------- 滚动条 ---------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a4c6b; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 磁盘空间 ---------------- */
.storage { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.storage-text { color: var(--muted); font-size: 11px; white-space: nowrap; }
.storage-bar { width: 140px; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.storage-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 3px;
  transition: width 0.4s ease;
}
.storage-bar-fill.warn { background: linear-gradient(90deg, #f6c344, #ff9f43); }
.storage-bar-fill.danger { background: linear-gradient(90deg, #ff6b7a, #ff4d5e); }

/* ---------------- 预览弹窗 ---------------- */
.preview-card {
  position: relative;
  width: min(1100px, 92vw);
  height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.preview-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.preview-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.preview-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #060a11;
}
.preview-body img, .preview-body video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.preview-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.preview-audio { width: 100%; padding: 40px; text-align: center; }
.preview-audio .audio-icon { color: var(--accent); margin-bottom: 20px; }
.preview-audio audio { width: 100%; max-width: 480px; }
.preview-text {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.preview-text pre, .preview-text textarea {
  flex: 1;
  width: 100%;
  height: 100%;
  padding: 16px 20px;
  margin: 0;
  border: 0;
  resize: none;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: transparent;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}
.preview-text textarea { background: var(--bg); }
.preview-loading { color: var(--muted); font-size: 14px; padding: 40px; }
.preview-fallback { color: var(--muted); text-align: center; padding: 40px; }
.preview-fallback p { margin-bottom: 14px; }

/* ---------------- 移动弹窗 ---------------- */
.move-card { width: 420px; max-height: 70vh; display: flex; flex-direction: column; }
.move-path { color: var(--accent); font-size: 12px; margin: -8px 0 10px; word-break: break-all; }
.move-actions-row { margin-bottom: 8px; }
.move-list { flex: 1; overflow-y: auto; max-height: 40vh; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; }
.move-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.move-item:hover { background: rgba(21, 31, 48, 0.5); }
.move-item svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.move-empty { color: var(--muted); font-size: 12px; padding: 16px; text-align: center; }

/* ---------------- 压缩包弹窗 ---------------- */
.archive-card { width: 480px; max-height: 74vh; display: flex; flex-direction: column; }
.archive-list { flex: 1; overflow-y: auto; max-height: 46vh; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; }
.archive-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 6px; font-size: 13px;
}
.archive-item svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
.archive-item .dir { color: var(--accent); }
.archive-item .aname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-item .asize { margin-left: auto; color: var(--muted); font-size: 11px; flex: none; }
