/* ================================================================
   文件中转站 — 样式表 v3
   设计方向: 现代简约 · 蓝白为主 · 全端响应式
   ================================================================ */

/* ---------- Reset & Variables ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --c-primary: #2563eb;
  --c-primary-soft: #3b82f6;
  --c-primary-light: #eff6ff;
  --c-primary-glow: rgba(37, 99, 235, 0.1);

  --c-bg: #f0f4f9;
  --c-surface: #ffffff;
  --c-border: #e2e8f0;
  --c-border-hover: #cbd5e1;

  --c-text: #0f172a;
  --c-text-2: #475569;
  --c-text-3: #94a3b8;

  --c-red: #ef4444;
  --c-red-light: #fef2f2;
  --c-green: #10b981;
  --c-green-light: #ecfdf5;
  --c-amber: #f59e0b;
  --c-amber-light: #fffbeb;

  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;

  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-modal: 0 20px 50px rgba(0,0,0,0.12);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--c-border);
}
.topbar-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 650;
  color: var(--c-text);
  letter-spacing: -0.3px;
}
.brand-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--c-primary), #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.topbar-stats { display: flex; align-items: center; gap: 12px; }
.stat-item { font-size: 13px; color: var(--c-text-2); }
.stat-item strong { color: var(--c-text); font-weight: 600; }
.stat-divider { width: 1px; height: 16px; background: var(--c-border); }

/* ---------- Container ---------- */
.container { max-width: 820px; margin: 0 auto; padding: 0 24px 80px; }

/* ---------- Upload Area ---------- */
.upload-area { margin-top: 32px; }

.upload-zone {
  display: block;
  background: var(--c-surface);
  border: 2px dashed var(--c-border);
  border-radius: var(--radius);
  padding: 48px 32px;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  position: relative;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.upload-zone:hover {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 4px var(--c-primary-glow);
}
.upload-zone:active { transform: scale(0.99); }
.upload-zone.drag-over {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
  box-shadow: 0 0 0 6px var(--c-primary-glow);
}

/* hide the file input; label click triggers it */
.upload-zone input[type="file"] {
  position: absolute;
  width: 0; height: 0;
  opacity: 0;
  pointer-events: none;
}

.upload-visual { position: relative; z-index: 1; }

.upload-ring {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--c-primary-light);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s var(--ease-spring);
}
.upload-zone:hover .upload-ring,
.upload-zone.drag-over .upload-ring {
  background: var(--c-primary);
  transform: scale(1.12);
}
.upload-arrow {
  width: 30px; height: 30px;
  color: var(--c-primary);
  transition: all 0.35s var(--ease);
}
.upload-zone:hover .upload-arrow,
.upload-zone.drag-over .upload-arrow { color: #fff; }

.upload-heading {
  font-size: 17px;
  font-weight: 650;
  color: var(--c-text);
  margin-bottom: 6px;
}
.upload-desc {
  font-size: 13px;
  color: var(--c-text-3);
  line-height: 1.5;
}

/* ---------- Upload Progress ---------- */
.upload-progress {
  margin-top: 16px;
  display: none;
  animation: fadeIn 0.2s var(--ease);
}
.upload-progress.show { display: block; }

.progress-track {
  height: 6px;
  background: var(--c-border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--c-primary), #6366f1);
  border-radius: 3px;
  transition: width 0.25s var(--ease);
}
.progress-detail {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
}
#progressLabel { color: var(--c-text-3); }
#progressPct  { color: var(--c-primary); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 12px;
  padding: 0 4px;
}
.toolbar.show { display: flex; }
.toolbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-xs);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn-clear {
  background: transparent;
  color: var(--c-text-3);
  border: 1px solid var(--c-border);
}
.btn-clear:hover { color: var(--c-red); background: var(--c-red-light); border-color: var(--c-red); }
.btn-clear:active { transform: scale(0.97); }

/* ---------- File List ---------- */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px 40px;
  color: var(--c-text-3);
}
.empty-state.hidden { display: none; }
.empty-icon { margin-bottom: 16px; opacity: 0.25; color: var(--c-text-3); }
.empty-text { font-size: 14px; }

/* ---------- File Card ---------- */
.file-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.2s var(--ease);
  animation: cardIn 0.3s var(--ease) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.file-card:hover {
  border-color: var(--c-border-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

/* file type icon */
.file-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-icon svg { width: 22px; height: 22px; }

/* color-coded per type */
.file-icon[data-type="pdf"]     { background: #fef2f2; color: #ef4444; }
.file-icon[data-type="doc"]     { background: #eff6ff; color: #2563eb; }
.file-icon[data-type="docx"]    { background: #eff6ff; color: #2563eb; }
.file-icon[data-type="xls"]     { background: #f0fdf4; color: #16a34a; }
.file-icon[data-type="xlsx"]    { background: #f0fdf4; color: #16a34a; }
.file-icon[data-type="ppt"]     { background: #fff7ed; color: #ea580c; }
.file-icon[data-type="pptx"]    { background: #fff7ed; color: #ea580c; }
.file-icon[data-type="txt"]     { background: #f8fafc; color: #64748b; }
.file-icon[data-type="md"]      { background: #f8fafc; color: #64748b; }
.file-icon[data-type="img"]     { background: #fdf4ff; color: #a21caf; }
.file-icon[data-type="video"]   { background: #ecfeff; color: #0891b2; }
.file-icon[data-type="audio"]   { background: #fefce8; color: #ca8a04; }
.file-icon[data-type="archive"] { background: #f1f5f9; color: #6366f1; }
.file-icon[data-type="code"]    { background: #f8fafc; color: #334155; }
.file-icon[data-type="exe"]     { background: #f1f5f9; color: #475569; }
.file-icon[data-type="folder"]  { background: #f1f5f9; color: #94a3b8; }

/* file info */
.file-info { flex: 1; min-width: 0; }
.file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.3;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--c-text-3);
}
.file-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.file-meta svg { width: 13px; height: 13px; flex-shrink: 0; }
.file-time {
  color: var(--c-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* action buttons */
.file-actions { display: flex; gap: 4px; flex-shrink: 0; }
.btn-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s var(--ease);
  color: var(--c-text-3);
  -webkit-tap-highlight-color: transparent;
}
.btn-icon svg { width: 17px; height: 17px; }
.btn-icon:hover { background: var(--c-primary-light); border-color: var(--c-primary); color: var(--c-primary); }
.btn-icon.btn-danger:hover { background: var(--c-red-light); border-color: var(--c-red); color: var(--c-red); }
.btn-icon:active { transform: scale(0.93); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 550;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 300;
  transition: all 0.35s var(--ease-spring);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--c-green); }
.toast.error   { background: var(--c-red); }
.toast.info    { background: var(--c-primary); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--c-surface);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-modal);
  animation: modalIn 0.25s var(--ease-spring);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
.modal-title { font-size: 17px; font-weight: 650; margin-bottom: 8px; }
.modal-text  { font-size: 14px; color: var(--c-text-2); margin-bottom: 24px; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-modal {
  padding: 9px 20px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  font-family: inherit;
  border: none;
  transition: all 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn-modal:active { transform: scale(0.97); }
.btn-cancel {
  background: var(--c-bg);
  color: var(--c-text-2);
  border: 1px solid var(--c-border);
}
.btn-cancel:hover { background: var(--c-border); }
.btn-confirm {
  background: var(--c-red);
  color: #fff;
}
.btn-confirm:hover { background: #dc2626; }

/* ---------- Preview Overlay ---------- */
.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 20px;
}
.preview-overlay.hidden { display: none; }
.preview-container {
  background: var(--c-surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.15);
  animation: modalIn 0.25s var(--ease-spring);
}
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.preview-title {
  font-size: 15px;
  font-weight: 650;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-close {
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--radius-xs);
  cursor: pointer;
  color: var(--c-text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.preview-close:hover { background: var(--c-bg); color: var(--c-text); }
.preview-close:active { transform: scale(0.93); }

.preview-body {
  flex: 1;
  overflow: auto;
  padding: 24px;
  -webkit-overflow-scrolling: touch;
}
.preview-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--c-text-3);
  font-size: 14px;
}

/* preview content types */
.preview-body.text-content {
  font-family: "SF Mono", "Fira Code", "Consolas", "Monaco", monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--c-text);
  background: #fafbfc;
  border-radius: var(--radius-xs);
}
.preview-body.image-content { padding: 12px; display: flex; align-items: flex-start; justify-content: center; background: #f1f5f9; }
.preview-body.image-content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-md);
  object-fit: contain;
}

/* docx preview */
.preview-body.docx-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--c-text);
  max-width: 760px;
  margin: 0 auto;
}
.preview-body.docx-content h1 { font-size: 22px; margin: 16px 0 10px; }
.preview-body.docx-content h2 { font-size: 18px; margin: 14px 0 8px; }
.preview-body.docx-content h3 { font-size: 15px; margin: 12px 0 6px; }
.preview-body.docx-content p  { margin: 8px 0; }
.preview-body.docx-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}
.preview-body.docx-content table td,
.preview-body.docx-content table th {
  border: 1px solid var(--c-border);
  padding: 6px 10px;
}
.preview-body.docx-content img { max-width: 100%; }

/* xlsx table preview */
.preview-body.xlsx-content { padding: 0; }
.xlsx-sheet-name {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-primary);
  background: var(--c-primary-light);
  border-bottom: 1px solid var(--c-border);
}
.xlsx-table-wrap {
  overflow: auto;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
}
.xlsx-table {
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}
.xlsx-table td, .xlsx-table th {
  border: 1px solid var(--c-border);
  padding: 5px 10px;
  min-width: 60px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xlsx-table tr:nth-child(even) { background: #f8fafc; }
.xlsx-table tr:hover { background: var(--c-primary-light); }

/* pptx text preview */
.preview-body.pptx-content { padding: 0; }
.pptx-slide {
  padding: 20px 24px;
  border-bottom: 1px solid var(--c-border);
}
.pptx-slide:last-child { border-bottom: none; }
.pptx-slide-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-primary);
  margin-bottom: 6px;
}
.pptx-slide-title {
  font-size: 16px;
  font-weight: 650;
  color: var(--c-text);
  margin-bottom: 6px;
}
.pptx-slide-text {
  font-size: 13px;
  color: var(--c-text-2);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 0 24px 32px;
  font-size: 12px;
  color: var(--c-text-3);
  opacity: 0.5;
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ================================================================
   RESPONSIVE — Mobile First Adjustments
   ================================================================ */

/* Tablet & small screens — 768px */
@media (max-width: 768px) {
  .container { padding: 0 16px 64px; }
  .topbar-inner { padding: 0 16px; }
  .upload-zone { padding: 36px 20px; border-radius: var(--radius-sm); }
  .upload-ring { width: 56px; height: 56px; }
  .upload-heading { font-size: 16px; }
  .upload-desc { font-size: 12px; }
  .file-card { padding: 12px 14px; gap: 10px; }
  .file-icon { width: 40px; height: 40px; }
  .file-icon svg { width: 20px; height: 20px; }
  .file-name { font-size: 13px; }
  .file-meta { gap: 8px; font-size: 11px; }
  .btn-icon { width: 36px; height: 36px; }  /* larger touch target */
  .topbar-stats .stat-divider { display: none; }
  .topbar-stats .stat-item { font-size: 12px; gap: 4px; }

  .preview-overlay { padding: 0; }
  .preview-container { max-width: 100%; max-height: 100vh; border-radius: 0; }
  .preview-header { padding: 12px 16px; }
  .preview-body { padding: 16px; }
}

/* Phone — 480px */
@media (max-width: 480px) {
  .topbar-inner { height: 48px; }
  .topbar-brand { font-size: 14px; }
  .brand-icon { width: 26px; height: 26px; border-radius: 6px; }
  .brand-icon svg { width: 15px; height: 15px; }

  .upload-area { margin-top: 20px; }
  .upload-zone { padding: 28px 16px; }
  .upload-ring { width: 48px; height: 48px; margin-bottom: 12px; }
  .upload-arrow { width: 24px; height: 24px; }
  .upload-heading { font-size: 15px; }
  .upload-desc { font-size: 12px; }

  .file-card { padding: 10px 12px; border-radius: var(--radius-xs); }
  .file-icon { width: 36px; height: 36px; border-radius: 6px; }
  .file-icon svg { width: 18px; height: 18px; }
  .file-name { font-size: 13px; }
  .file-meta { gap: 6px; }

  .modal { padding: 22px 20px; }
  .modal-title { font-size: 16px; }
  .modal-text  { font-size: 13px; margin-bottom: 18px; }

  .toast { bottom: 20px; padding: 9px 20px; font-size: 12px; border-radius: 18px; }

  .toolbar { margin: 20px 0 10px; }
  .toolbar-title { font-size: 13px; }
  .btn-clear { padding: 6px 12px; font-size: 12px; }
}
