/* =========================================================
   网盘系统 全局样式
   ========================================================= */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --cyan: #06b6d4;
  --grad: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.actions.center { justify-content: center; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px; padding: 9px 18px;
  font-size: 14px; cursor: pointer; transition: all .15s; text-decoration: none; line-height: 1.4;
}
.btn:hover { text-decoration: none; opacity: .92; }
.btn-primary { background: var(--grad); color: #fff; border-color: transparent; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 12px 26px; font-size: 16px; }
.btn-block { width: 100%; }

/* ---------- 顶栏 ---------- */
.site-header {
  background: var(--grad); color: #fff; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 10px rgba(37, 99, 235, .25);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 62px; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.2);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px;
}
.logo-text { font-size: 19px; font-weight: 700; }
.nav { display: flex; gap: 6px; flex: 1; }
.nav a { color: rgba(255,255,255,.85); padding: 6px 12px; border-radius: 8px; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.14); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; }
.nav a.nav-admin { background: rgba(255,255,255,.12); border: 1px dashed rgba(255,255,255,.4); }
.header-user { display: flex; align-items: center; gap: 10px; }
.user-chip { font-size: 13px; background: rgba(255,255,255,.16); padding: 5px 12px; border-radius: 999px; }
.header-user .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }

.main { padding: 26px 16px 40px; min-height: calc(100vh - 200px); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 22px;
}
.card-title { margin: 0 0 16px; font-size: 18px; font-weight: 700; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head .card-title { margin: 0; }
.list-hint { font-size: 12.5px; margin: -8px 0 12px; }
.guest-quota {
  margin: -4px 0 14px; padding: 9px 12px; font-size: 13px; color: #334155;
  background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px;
}
.guest-quota b { color: var(--primary); }

/* ---------- Flash ---------- */
.flash {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; border: 1px solid;
}
.flash-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.flash-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.flash-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* ---------- Hero ---------- */
.hero {
  background: var(--grad); border-radius: var(--radius); color: #fff;
  padding: 44px 28px; text-align: center; margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.hero h1 { margin: 0 0 8px; font-size: 30px; }
.hero p { margin: 0; opacity: .92; }

/* ---------- 布局 ---------- */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 820px) { .grid-2col { grid-template-columns: 1fr; } }

/* ---------- 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: #fff; color: var(--text); outline: none; transition: border .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.checkbox-label, .radio-label { font-size: 14px; font-weight: 400; color: var(--text); display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.radio-label { margin-right: 14px; }

/* 拖拽上传 */
.dropzone {
  border: 2px dashed #cbd5e1; border-radius: 10px; padding: 26px 16px; text-align: center;
  cursor: pointer; display: flex; flex-direction: column; gap: 4px; align-items: center;
  transition: all .15s; background: #f8fafc;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: #eff6ff; }
.dz-icon { font-size: 26px; }
.dz-text { font-weight: 600; }
.dz-hint { font-size: 12px; color: var(--muted); }
.file-input { display: none; }
.file-selected { font-size: 13px; color: var(--primary); min-height: 18px; }

/* ---------- 文件列表 ---------- */
.file-list { display: flex; flex-direction: column; }
.file-row {
  display: flex; align-items: center; gap: 14px; padding: 13px 6px;
  border-bottom: 1px solid var(--border);
}
.file-row:last-child { border-bottom: none; }
.file-badge {
  flex: none; width: 52px; height: 40px; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
  color: #fff; background: var(--badge-color, #64748b); letter-spacing: .5px;
}
.file-badge.big { width: 64px; height: 52px; font-size: 14px; }
.file-meta { flex: 1; min-width: 0; }
.file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-sub { font-size: 12.5px; color: var(--muted); }
.file-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lock-tag {
  display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: #fffbeb; color: #b45309; border: 1px solid #fde68a; margin-left: 6px; vertical-align: 2px;
}
.lock-tag.danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.empty { text-align: center; color: var(--muted); padding: 26px 0; margin: 0; }
.inline-form { display: inline-flex; margin: 0; }
/* 后台文件管理：批量选择 */
.batch-bar { display: flex; align-items: center; gap: 12px; }
.batch-bar .checkbox-label { margin: 0; }
.th-check { width: 30px; text-align: center; }
.th-check input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; vertical-align: middle; }

/* 分页 */
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; padding-top: 16px; }

/* ---------- 文件详情 ---------- */
.file-detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.file-detail > .card { min-width: 0; }
@media (max-width: 820px) { .file-detail { grid-template-columns: minmax(0, 1fr); } }
.detail-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.detail-name { margin: 0 0 4px; font-size: 21px; word-break: break-all; }
.detail-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
@media (max-width: 640px) { .detail-meta { grid-template-columns: 1fr 1fr; } }
.meta-cell { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.meta-cell span { display: block; font-size: 12px; color: var(--muted); }
.meta-cell b { font-size: 14px; }
.meta-cell.wide { grid-column: 1 / -1; }
.notice { border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px; }
.notice-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.notice-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.notice-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.unlock-form .form-row { display: flex; gap: 10px; }
.unlock-form .form-row .input { flex: 1; }
.qr-wrap { display: flex; justify-content: center; padding: 8px 0; }
.qr-wrap canvas, #qr-code canvas { border: 1px solid var(--border); border-radius: 10px; }

/* ---------- 上传成功 ---------- */
.success-card { text-align: center; }
.success-icon {
  width: 64px; height: 64px; border-radius: 50%; background: #f0fdf4; color: var(--ok);
  font-size: 30px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 6px;
  border: 2px solid #bbf7d0;
}
.success-title { margin: 0 0 6px; font-size: 24px; }
.share-panel { display: grid; grid-template-columns: 220px 1fr; gap: 22px; text-align: left; margin: 22px 0; padding: 20px; background: #f8fafc; border-radius: 12px; }
@media (max-width: 640px) { .share-panel { grid-template-columns: 1fr; text-align: center; } }
.share-qr { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.share-info { display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.info-row { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px dashed var(--border); padding-bottom: 8px; }
.info-row:last-child { border-bottom: none; padding-bottom: 0; }
.link-box { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.link-row { display: flex; align-items: center; gap: 10px; }
.link-row > .muted { width: 80px; flex: none; text-align: right; }
.link-copy { display: flex; gap: 8px; flex: 1; }
.link-copy .input { flex: 1; }
.link-copy.vertical { flex-direction: column; margin-top: 12px; }

/* ---------- 登录/注册 ---------- */
.auth-wrap { display: flex; justify-content: center; padding: 30px 0; }
.auth-card { width: 100%; max-width: 430px; }
.auth-title { margin: 0 0 14px; font-size: 22px; text-align: center; }
.auth-foot { text-align: center; margin: 16px 0 0; font-size: 14px; }

/* ---------- 提示 ---------- */
.feature-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.feature-list li { padding-left: 22px; position: relative; font-size: 14px; }
.feature-list li::before { content: "✔"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.admin-tip { margin: 16px 0 0; }
.upload-locked { text-align: center; padding: 26px 0; color: var(--muted); }
.upload-locked p:first-child { font-size: 15px; }
.upload-locked .actions { justify-content: center; }

/* ---------- 页脚 ---------- */
.site-footer { background: #0f172a; color: #94a3b8; padding: 22px 0; text-align: center; font-size: 13px; }
.site-footer p { margin: 0; }
.site-footer .site-beian { margin-top: 8px; }
.site-footer .site-beian a { color: #cbd5e1; text-decoration: none; }
.site-footer .site-beian a:hover { color: #fff; text-decoration: underline; }
.site-footer .beian-sep { margin: 0 4px; opacity: .6; }
.site-footer .site-footer-ver { margin-top: 6px; font-size: 12px; opacity: .55; }

/* ---------- 首页公告 ---------- */
.announce-bar {
  background: #0f172a; color: #fbbf24; overflow: hidden; white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.announce-track {
  display: inline-block; padding: 9px 0; font-size: 14px;
  animation: announce-marquee 28s linear infinite; will-change: transform;
}
.announce-bar:hover .announce-track { animation-play-state: paused; }
.announce-label {
  display: inline-block; background: #fbbf24; color: #0f172a; font-weight: 700;
  border-radius: 4px; padding: 0 8px; margin-right: 12px; font-size: 12px;
}
@keyframes announce-marquee {
  0%   { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}
@media (prefers-reduced-motion: reduce) {
  .announce-track { animation: none; }
}

.announce-popup {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.announce-popup[hidden] { display: none; }
.announce-popup-box {
  background: #fff; border-radius: 14px; width: 100%; max-width: 480px;
  padding: 26px 26px 22px; box-shadow: 0 24px 70px rgba(0,0,0,.28);
  position: relative; max-height: 82vh; overflow: auto;
}
.announce-popup-close {
  position: absolute; top: 10px; right: 14px; border: none; background: #f1f5f9;
  color: #64748b; width: 30px; height: 30px; border-radius: 50%; font-size: 18px;
  line-height: 1; cursor: pointer;
}
.announce-popup-close:hover { background: #e2e8f0; color: #0f172a; }
.announce-popup-title { margin: 0 0 10px; font-size: 19px; padding-right: 28px; }
.announce-popup-content { font-size: 14px; color: #334155; line-height: 1.8; word-break: break-word; }

/* ---------- 在线预览 ---------- */
.file-preview-box {
  margin-bottom: 18px; background: #f8fafc; border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; text-align: center;
  max-width: 100%; min-width: 0; overflow: hidden;
}
.file-preview-title { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 10px; text-align: left; }
.file-preview.media { max-width: 100%; height: auto; max-height: 520px; border-radius: 8px; background: #fff; }
/* 音频播放器必须固定控件高度：height:auto 会把 <audio> 高度压为 0，控件被隐藏，只显示「在线预览」标题 */
audio.file-preview.media { width: 100%; height: 54px; max-height: none; display: block; }
.file-preview.pdf { width: 100%; height: 560px; border: none; border-radius: 8px; background: #fff; }
.file-preview.office { width: 100%; height: 560px; border: none; border-radius: 8px; background: #fff; }
.text-preview-box { max-height: 420px; overflow: auto; text-align: left; background: #0f172a; border-radius: 8px; }
.text-preview {
  margin: 0; padding: 14px 16px; color: #e2e8f0; font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
  font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-all;
}
/* 手机端：预览内容不超过屏幕 */
@media (max-width: 640px) {
  .file-preview.media { max-height: 62vh; }
  audio.file-preview.media { height: 54px; max-height: none; }
  .file-preview.pdf, .file-preview.office { height: 55vh; }
  .text-preview-box { max-height: 50vh; }
}

/* ---------- 表格在线预览（xls/xlsx，SheetJS 前端渲染） ---------- */
.sheet-preview-box {
  text-align: left; background: #fff; border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; max-width: 100%; min-width: 0;
}
.sheet-tabs {
  display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border);
  background: #f1f5f9; overflow-x: auto;
}
.sheet-tab {
  border: 1px solid var(--border); background: #fff; border-radius: 6px;
  padding: 4px 12px; font-size: 12.5px; cursor: pointer; color: #334155; flex: none;
}
.sheet-tab.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.sheet-panel { display: none; }
.sheet-panel.active { display: block; }
.sheet-scroll { max-height: 480px; overflow: auto; padding: 10px; }
.sheet-scroll table { border-collapse: collapse; font-size: 13px; }
.sheet-scroll th, .sheet-scroll td {
  border: 1px solid #e2e8f0; padding: 6px 10px; white-space: nowrap; max-width: 360px;
  overflow: hidden; text-overflow: ellipsis;
}
.sheet-scroll th { background: #f8fafc; font-weight: 600; }
@media (max-width: 640px) { .sheet-scroll { max-height: 55vh; } }
.preview-tip { margin-top: 8px; font-size: 12.5px; }
