/* tgDrive Workers — 毛玻璃 / Vision 风格 */

:root {
  --bg: #0a0f1e;
  --bg-soft: #101731;
  --text: #e8ecf8;
  --text-dim: rgba(232, 236, 248, 0.55);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.12);
  --blue: #3b82f6;
  --blue-2: #2563eb;
  --blue-soft: rgba(59, 130, 246, 0.18);
  --danger: #ef4444;
  --ok: #34d399;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 8px 40px rgba(2, 6, 23, 0.45);
}

[data-theme="light"] {
  --bg: #eef2fb;
  --bg-soft: #e3eaf9;
  --text: #101731;
  --text-dim: rgba(16, 23, 49, 0.55);
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.85);
  --blue-soft: rgba(37, 99, 235, 0.12);
  --shadow: 0 8px 40px rgba(37, 64, 143, 0.14);
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

/* ---------- 背景光斑 ---------- */
.bg-glow { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(1200px 800px at 70% -10%, var(--bg-soft), var(--bg)); }
.glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; }
.glow-1 { width: 480px; height: 480px; background: #2563eb; top: -120px; right: -80px; }
.glow-2 { width: 380px; height: 380px; background: #0ea5e9; bottom: -100px; left: -80px; opacity: 0.35; }
.glow-3 { width: 260px; height: 260px; background: #6366f1; top: 40%; left: 55%; opacity: 0.22; }
[data-theme="light"] .glow { opacity: 0.25; }

/* ---------- 玻璃通用 ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: var(--shadow);
}

.hidden { display: none !important; }
.muted { color: var(--text-dim); font-style: normal; font-size: 12px; }

/* ---------- 登录 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 380px; max-width: 100%; padding: 40px 36px 32px; text-align: center; }
.auth-logo { font-size: 44px; }
.auth-title { font-size: 26px; font-weight: 700; letter-spacing: 0.5px; margin-top: 8px; }
.auth-sub { color: var(--text-dim); font-size: 13px; margin: 6px 0 24px; }

.seg { display: flex; background: var(--blue-soft); border-radius: 999px; padding: 4px; margin-bottom: 20px; }
.seg-btn { flex: 1; border: none; background: transparent; color: var(--text-dim); padding: 8px 0; border-radius: 999px; cursor: pointer; font-size: 14px; transition: all 0.25s; }
.seg-btn.active { background: var(--glass-strong); color: var(--text); box-shadow: 0 2px 10px rgba(2, 6, 23, 0.2); }

.input {
  width: 100%; padding: 12px 16px; border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass); color: var(--text);
  font-size: 14px; outline: none; transition: border 0.2s, background 0.2s;
}
.input:focus { border-color: var(--blue); background: var(--glass-strong); }
.input::placeholder { color: var(--text-dim); }
.input-sm { width: 200px; padding: 7px 12px; font-size: 13px; border-radius: 10px; }
#authForm .input { margin-bottom: 12px; text-align: center; }

.btn {
  border: none; cursor: pointer; font-size: 14px; font-weight: 600;
  padding: 11px 22px; border-radius: 999px; transition: all 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--blue-2)); color: #fff; box-shadow: 0 4px 18px rgba(37, 99, 235, 0.35); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--glass); color: var(--text); border: 1px solid var(--glass-border); }
.btn-ghost:hover { background: var(--glass-strong); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 20px; }
.auth-hint { color: var(--text-dim); font-size: 12px; margin-top: 16px; }

/* ---------- 顶栏 ---------- */
.app { max-width: 980px; margin: 0 auto; padding: 20px 20px 60px; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 18px; margin-bottom: 20px;
  position: sticky; top: 16px; z-index: 50;
}
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 6px; }
.nav { display: flex; gap: 6px; flex: 1; }
.pill {
  border: none; cursor: pointer; border-radius: 999px; padding: 8px 18px;
  background: transparent; color: var(--text-dim); font-size: 14px; transition: all 0.2s;
}
.pill.active { background: var(--blue-soft); color: var(--text); }
.pill:hover:not(.active) { color: var(--text); }
.pill-sm { padding: 6px 14px; background: var(--glass); border: 1px solid var(--glass-border); color: var(--text); font-size: 13px; }
.pill-sm:disabled { opacity: 0.4; cursor: default; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.username { font-size: 13px; color: var(--text-dim); }
.icon-btn {
  border: none; background: var(--glass); border: 1px solid var(--glass-border);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
.icon-btn:hover { background: var(--glass-strong); }

/* ---------- 上传区 ---------- */
.dropzone {
  border: 2px dashed var(--glass-border);
  cursor: pointer; transition: all 0.25s; margin-bottom: 16px;
  outline: none;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--blue);
  background: var(--blue-soft);
}
.dz-inner { padding: 34px 20px; text-align: center; }
.dz-icon { font-size: 34px; margin-bottom: 8px; }
.dz-text { font-size: 15px; }
.dz-text strong { color: var(--blue); }
.dz-sub { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

/* ---------- 上传任务 ---------- */
.upload-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.upload-item { padding: 14px 18px; }
.up-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.up-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-status { font-size: 12px; color: var(--text-dim); flex-shrink: 0; }
.up-status.ok { color: var(--ok); }
.up-status.err { color: var(--danger); }
.progress { height: 6px; background: var(--blue-soft); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), #0ea5e9); transition: width 0.25s ease; }

/* ---------- 文件面板 ---------- */
.panel { padding: 20px 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.panel-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.stat-chip { font-size: 12px; font-weight: 500; color: var(--text-dim); background: var(--blue-soft); border-radius: 999px; padding: 4px 12px; }

.file-table { width: 100%; }
.file-row {
  display: grid; grid-template-columns: 1fr 90px 150px 150px;
  gap: 10px; align-items: center; padding: 11px 10px;
  border-radius: var(--radius-sm); font-size: 13.5px;
}
.file-row + .file-row { border-top: 1px solid var(--glass-border); }
.file-head { color: var(--text-dim); font-size: 12px; padding-bottom: 6px; }
.file-row:not(.file-head):hover { background: var(--glass); }
.col-name { display: flex; align-items: center; gap: 9px; overflow: hidden; }
.f-icon { flex-shrink: 0; font-size: 17px; }
.f-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.f-name:hover { color: var(--blue); }
.col-size, .col-time { color: var(--text-dim); font-size: 12.5px; }
.col-ops { display: flex; justify-content: flex-end; gap: 6px; }
.op-btn {
  border: none; cursor: pointer; width: 30px; height: 30px; border-radius: 9px;
  background: transparent; font-size: 14px; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.op-btn:hover { background: var(--blue-soft); }
.op-btn.danger:hover { background: rgba(239, 68, 68, 0.15); }
.empty-row { text-align: center; color: var(--text-dim); padding: 36px 0; font-size: 13px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; font-size: 13px; color: var(--text-dim); }

/* ---------- 设置 ---------- */
.settings-panel { max-width: 640px; margin: 0 auto; }
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.switch-field { display: flex; align-items: center; justify-content: space-between; }
.switch-field .field-label { margin-bottom: 0; }
.switch { position: relative; width: 46px; height: 26px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-border); transition: 0.25s; cursor: pointer; }
.slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: 0.25s; }
.switch input:checked + .slider { background: var(--blue); border-color: var(--blue); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.test-result { font-size: 13px; margin-top: 14px; min-height: 18px; }
.test-result.ok { color: var(--ok); }
.test-result.err { color: var(--danger); }
.settings-tips { margin-top: 22px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--blue-soft); font-size: 12.5px; color: var(--text-dim); line-height: 1.8; }
.settings-tips a { color: var(--blue); }

/* ---------- 预览 ---------- */
.preview-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
}
.preview-body { max-width: 92vw; max-height: 88vh; display: flex; align-items: center; justify-content: center; }
.preview-body img { max-width: 92vw; max-height: 88vh; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.preview-body video { max-width: 92vw; max-height: 88vh; border-radius: var(--radius-sm); outline: none; }
.preview-body iframe, .preview-body audio { width: min(680px, 90vw); }
.preview-close { position: absolute; top: 24px; right: 24px; width: 42px; height: 42px; font-size: 16px; background: var(--glass-strong); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column-reverse; gap: 8px; align-items: center; }
.toast {
  padding: 10px 22px; border-radius: 999px; font-size: 13.5px;
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px); box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
}
.toast.err { border-color: rgba(239, 68, 68, 0.5); color: #fca5a5; }
.toast.ok { border-color: rgba(52, 211, 153, 0.5); color: #6ee7b7; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .file-row { grid-template-columns: 1fr 70px 110px; }
  .col-time { display: none; }
  .file-head .col-time { display: none; }
  .col-ops { grid-column: 3; }
  .username { display: none; }
  .input-sm { width: 130px; }
  .topbar { position: static; }
}
