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

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===== 顶栏 ===== */
.topbar {
  /* 科技感浅色渐变：浅蓝紫 -> 淡青 */
  background: linear-gradient(135deg, #e8edff 0%, #f0f9ff 60%, #e6f7f4 100%);
  border-bottom: 1px solid rgba(79, 70, 229, 0.18);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 6px rgba(79, 70, 229, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--primary), #0891b2);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand .icon {
  font-size: 24px;
  -webkit-text-fill-color: initial;
  background: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.user-badge {
  background: var(--primary);
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--card);
  color: var(--text);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  opacity: 0.9;
}

.btn-outline {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--bg);
}

.btn-sm {
  padding: 4px 12px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

/* ===== 页面容器 ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 20px;
}

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===== 表单 ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  background: #fff;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ===== 表格 ===== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  background: #f9fafb;
  font-weight: 600;
  color: var(--text-light);
  font-size: 13px;
}

tr:hover td {
  background: #f9fafb;
}

/* ===== 标签 ===== */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.tag-pending {
  background: #fef3c7;
  color: var(--warning);
}

.tag-active {
  background: #dcfce7;
  color: var(--success);
}

.tag-disabled {
  background: #fee2e2;
  color: var(--danger);
}

.tag-admin {
  background: #e0e7ff;
  color: var(--primary);
}

.tag-user {
  background: #e5e7eb;
  color: var(--text-light);
}

.tag-note {
  background: #ede9fe;
  color: #7c3aed;
}

/* 可点击的文件名（打开注释弹窗） */
.file-name-link {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dashed rgba(79, 70, 229, 0.4);
}

.file-name-link:hover {
  text-decoration: underline;
}

/* 注释文本域 */
textarea.form-control {
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
}

/* ===== 进度条 ===== */
.progress {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.3s;
}

/* ===== 上传区 ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: #eef2ff;
}

.upload-zone .upload-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.upload-zone p {
  color: var(--text-light);
  font-size: 14px;
}

/* 上传进度条 */
.upload-progress {
  margin-top: 16px;
  padding: 12px 16px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.upload-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
  gap: 12px;
}

.upload-progress-info span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress-info span:last-child {
  color: var(--primary);
  font-weight: 600;
  white-space: nowrap;
}

.upload-progress .progress {
  margin-top: 0;
}

/* ===== 提示框 ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 20px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.toast-success {
  background: var(--success);
}

.toast-error {
  background: var(--danger);
}

.toast-info {
  background: var(--primary);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal h3 {
  margin-bottom: 20px;
  font-size: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

/* ===== 文件预览弹窗 ===== */
.preview-overlay {
  align-items: center;
}

.preview-modal {
  width: min(860px, 92vw);
  max-width: 92vw;
}

.preview-title {
  word-break: break-all;
  margin-bottom: 16px !important;
}

.preview-body {
  background: #111827;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 70vh;
  overflow: auto;
}

.preview-loading {
  color: #9ca3af;
  font-size: 14px;
  padding: 24px;
}

.preview-image {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  display: block;
}

.preview-video {
  max-width: 100%;
  max-height: 65vh;
  display: block;
}

.preview-text {
  width: 100%;
  max-height: 65vh;
  overflow: auto;
  margin: 0;
  padding: 16px;
  color: #e5e7eb;
  background: transparent;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

.preview-error {
  color: #fca5a5;
  font-size: 14px;
  padding: 24px;
  text-align: center;
}

.preview-unsupported {
  color: #9ca3af;
  font-size: 14px;
  text-align: center;
  padding: 32px 24px;
}

.preview-unsupported-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.preview-unsupported-sub {
  color: #6b7280;
  font-size: 13px;
  margin-top: 8px;
  word-break: break-all;
}

.hidden {
  display: none !important;
}

/* ===== 认证页面 ===== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  padding: 40px;
  width: 400px;
  max-width: 100%;
}

.auth-card .brand {
  justify-content: center;
  margin-bottom: 24px;
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 20px;
}

.auth-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-light);
}

/* ===== 算术验证码 ===== */
.captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.captcha-question {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  background: #fff7ec;
  border: 1px solid #fcd9b8;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #b45309;
}


/* ===== 空间统计 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 22px;
  font-weight: 700;
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ===== 分享链接 ===== */
.share-link-box {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.share-link-box input {
  flex: 1;
}

.file-icon {
  font-size: 20px;
  margin-right: 6px;
}

/* ===== 分享页 ===== */
.share-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.share-card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  padding: 40px;
  width: 460px;
  max-width: 100%;
  text-align: center;
}

.share-file-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.share-file-name {
  font-size: 18px;
  font-weight: 600;
  word-break: break-all;
  margin-bottom: 8px;
}

.share-file-meta {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 24px;
}

.share-password-box {
  margin-bottom: 20px;
  text-align: left;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state .empty-icon {
  font-size: 56px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* 空状态 SVG 图标 */
.empty-state .empty-icon-img {
  width: 72px;
  height: 72px;
  opacity: 0.6;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.empty-state:hover .empty-icon-img {
  transform: scale(1.08);
  opacity: 0.85;
}

/* ===== 登录统计（管理后台） ===== */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-item {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #eef2ff 0%, #e0f2fe 100%);
  border: 1px solid rgba(79, 70, 229, 0.15);
  border-radius: 12px;
  padding: 16px 20px;
}

/* 卡片右下角科技感光斑装饰 */
.stat-item::after {
  content: '';
  position: absolute;
  right: -18px;
  bottom: -18px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.stat-item .stat-value {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--primary) 0%, #0891b2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--primary);
}

.stat-item .stat-label {
  font-size: 13px;
  color: #4f46a5;
  margin-top: 4px;
}

.stats-section {
  margin-bottom: 20px;
}

.stats-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.stats-daily {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
  padding: 10px 4px 0;
  border-bottom: 1px solid rgba(79, 70, 229, 0.2);
}

.stats-daily-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
}

.stats-daily-bar {
  width: 100%;
  max-width: 40px;
  min-height: 4px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #818cf8 0%, #4f46e5 55%, #4338ca 100%);
  box-shadow: 0 0 8px rgba(79, 70, 229, 0.25);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.stats-daily-bar span {
  font-size: 11px;
  color: #3730a3;
  margin-top: 2px;
}

.stats-daily-label {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
}

.stats-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 8px;
}

.stats-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%);
  color: #3730a3;
  font-size: 12px;
  font-weight: 700;
  margin-right: 6px;
}

.stats-empty {
  color: var(--text-light);
  font-size: 13px;
  padding: 12px 0;
}

/* ===== 模态框副标题 ===== */
.modal-subtitle {
  color: var(--text-light);
  font-size: 13px;
  margin: -12px 0 16px;
}

/* ===== 用户"更多"操作弹窗 ===== */
.user-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-actions .action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.user-actions .action-item:hover {
  background: var(--bg);
  border-color: #d1d5db;
}

.user-actions .action-item:active {
  transform: scale(0.99);
}

.user-actions .action-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #eef2ff;
  font-size: 17px;
}

.user-actions .action-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-actions .action-title {
  font-size: 14px;
  font-weight: 600;
}

.user-actions .action-desc {
  font-size: 12px;
  color: var(--text-light);
}

.user-actions .action-arrow {
  margin-left: auto;
  color: #9ca3af;
  font-size: 20px;
  line-height: 1;
  transition: transform 0.15s;
}

.user-actions .action-item:hover .action-arrow {
  transform: translateX(3px);
  color: var(--primary);
}

/* 危险操作项 */
.user-actions .action-item-danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

.user-actions .action-item-danger .action-icon {
  background: #fee2e2;
}

.user-actions .action-item-danger:hover .action-title {
  color: var(--danger);
}

.user-actions .action-item-danger:hover .action-arrow {
  color: var(--danger);
}
