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

:root {
  --blue: #3370FF;
  --blue-hover: #2860E1;
  --red: #F54A45;
  --red-hover: #CB2634;
  --text-1: #1F2329;
  --text-2: #646A73;
  --text-3: #8F959E;
  --border: #DEE0E3;
  --bg-page: #F7F8FA;
  --bg-card: #FFFFFF;
  --bg-hover: #F2F3F5;
  --radius: 6px;
  --shadow-sm: 0 2px 4px rgba(0,0,0,.04);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-page);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ========== 登录页 ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
}
.login-card {
  width: 360px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 48px 40px 40px;
  text-align: center;
}
.login-logo { margin-bottom: 20px; }
.login-card h2 { font-size: 20px; font-weight: 600; color: var(--text-1); margin-bottom: 6px; }
.login-subtitle { font-size: 14px; color: var(--text-3); margin-bottom: 28px; }
.login-card input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
  margin-bottom: 16px;
}
.login-card input:focus { border-color: var(--blue); }
.btn-login {
  width: 100%;
  padding: 9px 0;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
}
.btn-login:hover { background: var(--blue-hover); }
.login-error { color: var(--red); font-size: 13px; margin-top: 12px; }

/* ========== Header ========== */
.header {
  height: 56px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-title { font-size: 16px; font-weight: 600; color: var(--text-1); }
.header-right { display: flex; align-items: center; gap: 8px; }

/* ========== 按钮通用 ========== */
.btn-primary {
  padding: 5px 16px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
  line-height: 22px;
}
.btn-primary:hover { background: var(--blue-hover); }

.btn-outline {
  padding: 5px 16px;
  background: var(--bg-card);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s;
  line-height: 22px;
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }

.btn-ghost {
  padding: 5px 12px;
  background: transparent;
  color: var(--text-2);
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 22px;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-1); }

.btn-text {
  background: transparent;
  border: none;
  color: var(--blue);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background .15s;
}
.btn-text:hover { background: rgba(51,112,255,.06); }

.btn-text-danger {
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.btn-text-danger:hover { color: var(--red); background: rgba(245,74,69,.06); }

/* ========== Main Body ========== */
.main-body {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ========== 工具栏 ========== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 8px;
  flex-wrap: wrap;
  gap: 8px;
}
.toolbar-actions { display: flex; gap: 8px; align-items: center; }

/* ========== 面包屑 ========== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
}
.breadcrumb a {
  color: var(--text-2);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.breadcrumb a:hover { color: var(--blue); background: rgba(51,112,255,.06); }
.breadcrumb .sep { color: var(--text-3); margin: 0 2px; }
.breadcrumb .current { color: var(--text-1); font-weight: 500; padding: 2px 4px; }

/* ========== 表头 ========== */
.file-table-header {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.col-name { flex: 1; min-width: 0; }
.col-size { width: 90px; text-align: right; }
.col-time { width: 170px; padding-left: 20px; }
.col-actions { width: 150px; text-align: right; }

/* ========== 文件列表 ========== */
.file-list {
  background: var(--bg-card);
  border-radius: 0 0 var(--radius) var(--radius);
}

.file-item {
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 48px;
  border-bottom: 1px solid #F2F3F5;
  transition: background .1s;
  cursor: default;
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--bg-hover); }

/* 拖动移动 */
.file-item[draggable="true"] { cursor: grab; }
.file-item[draggable="true"]:active { cursor: grabbing; }
.file-item.dragging { opacity: 0.4; background: var(--bg-hover); }
.file-item.drop-target {
  background: rgba(51,112,255,.06);
  outline: 2px solid var(--blue);
  outline-offset: -2px;
  border-radius: 4px;
}

.file-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-right: 10px;
}
.file-icon svg { display: block; }

.file-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  color: var(--text-1);
}
.file-name:hover { color: var(--blue); }

.file-size {
  width: 90px;
  text-align: right;
  font-size: 12px;
  color: var(--text-3);
  flex-shrink: 0;
}

.file-time {
  width: 170px;
  padding-left: 20px;
  font-size: 12px;
  color: var(--text-3);
  flex-shrink: 0;
}

.file-actions {
  width: 150px;
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s;
}
.file-item:hover .file-actions { opacity: 1; }

/* 空状态 */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-3);
  font-size: 14px;
}
.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
  font-size: 14px;
}

/* ========== 弹窗 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31,35,41,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 24px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 6px 30px rgba(0,0,0,.1);
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 20px;
}
.modal-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.modal-input:focus { border-color: var(--blue); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ========== 上传进度 ========== */
.toast-progress {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 500;
  min-width: 240px;
  font-size: 13px;
}
.toast-label { color: var(--text-2); white-space: nowrap; }
.progress-bar {
  flex: 1;
  height: 4px;
  background: #E8E9EB;
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 2px;
  transition: width .2s;
  width: 0;
}
#progressText { color: var(--text-3); font-size: 12px; white-space: nowrap; }

/* ========== 拖拽 ========== */
.drop-active::after {
  content: "拖放文件到此处上传";
  position: fixed;
  inset: 0;
  background: rgba(51,112,255,.04);
  border: 2px dashed var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--blue);
  z-index: 999;
  pointer-events: none;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .main-body { padding: 0 12px 40px; }
  .header { padding: 0 12px; }
  .col-size, .col-time, .file-size, .file-time { display: none; }
  .col-actions, .file-actions { width: auto; }
  .file-actions { opacity: 1; }
  .toolbar { flex-direction: column; align-items: flex-start; }
}
