/* ===== FileCodeBox 克隆 — Vercel 设计规范（浅色 + 深色，自适应） ===== */

/* ---------- 设计令牌 ---------- */
:root {
  --page: #ffffff;
  --page-glow: rgba(0, 0, 0, 0.028);
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-muted: #fafafa;   /* 面板底 / hover 底 */
  --surface-hover: #f5f5f5;   /* 更明显的 hover 底 */
  --text: #171717;
  --text-strong: #000000;
  --text-muted: #666666;
  --text-subtle: #888888;
  --border: #eaeaea;
  --border-strong: #d4d4d4;
  --accent: #171717;          /* primary 按钮 */
  --accent-contrast: #ffffff;
  --accent-blue: #0070f3;     /* Vercel 强调蓝 */
  --danger: #ee0000;
  --success: #36a269;
  --warn: #f5a623;
  --focus-ring: rgba(0, 112, 243, 0.25);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-modal: 0 24px 70px -24px rgba(0, 0, 0, 0.3);
}
body.dark {
  --page: #000000;
  --page-glow: rgba(255, 255, 255, 0.035);
  --surface: #000000;
  --surface-solid: #000000;
  --surface-muted: #111111;
  --surface-hover: #1a1a1a;
  --text: #ededed;
  --text-strong: #fafafa;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;
  --border: #2b2b2b;
  --border-strong: #3d3d3d;
  --accent: #fafafa;
  --accent-contrast: #000000;
  --accent-blue: #3291ff;
  --danger: #f85149;
  --success: #2ea043;
  --warn: #f5a623;
  --focus-ring: rgba(0, 112, 243, 0.45);
  --shadow-card: none;
  --shadow-modal: 0 24px 80px -24px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Geist", "Geist Sans", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--page);
  background-image: radial-gradient(
    1100px 500px at 50% -8%, var(--page-glow), transparent 70%
  );
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  transition: background 0.3s, color 0.3s;
}
button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; }
::selection { background: var(--accent-blue); color: #fff; }

/* ---------- 页面容器 ---------- */
.shell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px 16px;
}
.shell > .card-wrap { position: relative; z-index: 10; width: 100%; max-width: 448px; }

/* 主卡片：Vercel 简洁卡片（细边框 + 小圆角 + 无毛玻璃） */
.card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: all 0.3s;
}
.card-inner { padding: 28px 20px 26px; }
@media (min-width: 640px) {
  .card-inner { padding: 40px 32px 34px; }
}

/* ---------- 页头 ---------- */
.page-header { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 26px; }
@media (min-width: 640px) { .page-header { margin-bottom: 34px; } }
.header-icon {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; margin-bottom: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s;
  cursor: pointer;
}
@media (min-width: 640px) { .header-icon { width: 52px; height: 52px; } }
.header-icon:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.header-icon svg { width: 24px; height: 24px; stroke-width: 1.6; }
@media (min-width: 640px) { .header-icon svg { width: 26px; height: 26px; } }

/* 直接显示 LOGO 的页头图标：无白框，黑底圆角 LOGO 本体 */
.header-icon.icon-logo {
  width: 48px; height: 48px; margin-bottom: 16px;
  background: transparent; border: none; padding: 0;
  overflow: visible;
}
.header-icon.icon-logo:hover { background: transparent; border-color: transparent; filter: brightness(1.1); }
.header-icon.icon-logo svg { width: 48px; height: 48px; }
@media (min-width: 640px) {
  .header-icon.icon-logo { width: 52px; height: 52px; }
  .header-icon.icon-logo svg { width: 52px; height: 52px; }
}
.page-header h1 { font-size: 21px; font-weight: 600; letter-spacing: -0.025em; cursor: pointer; }
@media (min-width: 640px) { .page-header h1 { font-size: 24px; } }
.page-header p { font-size: 13px; font-weight: 400; color: var(--text-muted); margin-top: 4px; }
@media (min-width: 640px) { .page-header p { font-size: 14px; } }

/* ---------- 分段切换（Vercel segmented control） ---------- */
.seg {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 3px; padding: 3px; margin-bottom: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-muted);
}
.seg button {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; border-radius: calc(var(--radius) - 2px);
  font-size: 14px; font-weight: 500; color: var(--text-subtle);
  transition: all 0.15s;
}
.seg button svg { width: 15px; height: 15px; }
.seg button:hover { color: var(--text); }
.seg button.active {
  background: var(--surface-solid);
  color: var(--text-strong);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
body.dark .seg button.active { background: var(--surface-hover); border-color: var(--border-strong); }

/* ---------- 上传区 ---------- */
.upload-area {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 10rem; padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.upload-area:hover { border-color: var(--text-subtle); background: var(--surface-muted); }
.upload-area.dragover {
  border-color: var(--accent-blue);
  background: rgba(0, 112, 243, 0.045);
}
body.dark .upload-area.dragover { background: rgba(0, 112, 243, 0.12); }
@media (min-width: 640px) { .upload-area { min-height: 11rem; } }
.upload-area .uicon { width: 48px; height: 48px; color: var(--text-muted); }
@media (min-width: 640px) { .upload-area .uicon { width: 52px; height: 52px; } }
.upload-area .uname { margin-top: 12px; font-size: 14px; color: var(--text); word-break: break-all; }
.upload-area .udesc { margin-top: 6px; font-size: 12px; color: var(--text-subtle); line-height: 1.6; }

/* ---------- 上传进度条 ---------- */
.upload-progress { margin-top: 16px; }
.up-track {
  height: 6px; border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-muted);
}
.up-fill {
  height: 100%; width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.25s ease;
}

/* ---------- 文本输入区 ---------- */
.text-area {
  width: 100%; min-height: 10rem; padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px; resize: vertical;
  outline: none; transition: all 0.15s;
}
@media (min-width: 640px) { .text-area { min-height: 11rem; } }
.text-area:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ---------- 通用输入 ---------- */
.input {
  height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: 13px; outline: none; transition: all 0.15s;
}
.input::placeholder { color: var(--text-subtle); }
.input:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 3px var(--focus-ring); }
.input-sm { height: 34px; font-size: 13px; }
.select {
  height: 38px; padding: 0 32px 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 13px;
  outline: none; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 3px var(--focus-ring); }

/* ---------- 过期方式选择（兼容旧样式，不再使用） ---------- */
.field-label { display: block; font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 10px; }
.exp-selector { position: relative; height: 48px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.exp-selector input {
  width: 100%; height: 100%; padding: 0 16px; padding-right: 132px;
  border: none; border-radius: var(--radius); background: transparent;
  font-size: 15px; color: var(--text);
  outline: none; -moz-appearance: textfield; appearance: textfield;
}
.exp-selector input::-webkit-outer-spin-button, .exp-selector input::-webkit-inner-spin-button { -webkit-appearance: none; }
.exp-selector input::placeholder { color: var(--text-subtle); }
.exp-spinner { position: absolute; right: 116px; top: 0; height: 100%; display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.exp-spinner button { flex: 1; padding: 0 8px; display: flex; align-items: center; justify-content: center; color: var(--text-subtle); transition: all 0.15s; }
.exp-spinner button:hover { background: var(--surface-hover); color: var(--text); }
.exp-spinner svg { width: 12px; height: 12px; }
.exp-selector select {
  position: absolute; right: 0; top: 0; height: 100%; width: 112px;
  padding: 0 32px 0 16px; border: none; border-left: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface); color: var(--text);
  font-size: 14px; cursor: pointer; outline: none; appearance: none;
}
.exp-selector select.forever { width: 100%; border-left: none; border-radius: var(--radius); padding: 0 16px; }
.exp-selector .chev { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; width: 14px; height: 14px; color: var(--text-subtle); }

/* ---------- 主按钮（Vercel primary） ---------- */
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px 0; margin-top: 8px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 500; letter-spacing: -0.01em;
  background: var(--accent); color: var(--accent-contrast);
  transition: all 0.15s;
}
@media (min-width: 640px) { .btn-primary { padding: 13px 0; } }
.btn-primary:hover:not(:disabled) { filter: brightness(1.15); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; background: var(--surface-hover); color: var(--text-subtle); }
.btn-primary svg { width: 16px; height: 16px; }
@media (min-width: 640px) { .btn-primary svg { width: 17px; height: 17px; } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 底部栏 ---------- */
.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-top: 1px solid var(--border);
  background: var(--surface-muted);
}
@media (min-width: 640px) { .card-footer { padding: 18px 32px; } }
.footer-link {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--text-subtle);
  transition: color 0.15s; cursor: pointer;
}
@media (min-width: 640px) { .footer-link { font-size: 13px; gap: 7px; } }
.footer-link:hover { color: var(--accent-blue); }
.footer-link svg { width: 14px; height: 14px; }
@media (min-width: 640px) { .footer-link svg { width: 15px; height: 15px; } }

/* ---------- 取件码 5 格输入 ---------- */
.code-row { display: flex; justify-content: space-between; gap: 8px; padding: 0 2px; }
@media (min-width: 640px) { .code-row { gap: 14px; padding: 0 6px; } }
.code-slot {
  flex: 1; max-width: 64px;
  height: 56px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-strong);
  text-align: center; font-size: 22px; font-weight: 500;
  outline: none; transition: all 0.15s;
}
@media (min-width: 640px) { .code-slot { height: 72px; font-size: 28px; } }
.code-slot:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.code-slot.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(238, 0, 0, 0.12); }
.code-slot[readonly] { opacity: 0.55; }

/* ---------- 结果卡片 / 取件信息 ---------- */
.result-card { margin-top: 24px; }
.box-panel {
  display: flex; flex-direction: column; gap: 10px; text-align: center;
  padding: 16px; margin-top: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface-muted);
}
.box-panel .box-icon { font-size: 30px; line-height: 1; }
.box-panel .box-icon svg { width: 30px; height: 30px; }
.box-panel .box-name { font-size: 13px; font-weight: 500; color: var(--text); word-break: break-all; }
.box-panel .box-meta { font-size: 12px; color: var(--text-muted); }
.box-panel .file-list {
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  max-height: 160px; overflow: auto; padding: 8px 10px; margin-top: 2px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.box-panel .file-list-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text); word-break: break-all;
}
.box-panel .file-list-item svg { width: 14px; height: 14px; flex: none; color: var(--text-muted); }
.box-panel .file-list-item .muted { flex: none; }
.box-panel .box-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

/* ---------- 通知横幅 ---------- */
.notice {
  margin-bottom: 16px; padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-muted); font-size: 13px; color: var(--text);
  word-break: break-word;
}

/* ---------- 主题切换按钮（浮动） ---------- */
.theme-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); transition: all 0.15s;
}
.theme-toggle:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.theme-toggle svg { width: 17px; height: 17px; }

/* ---------- 管理入口链接（已移除，保留占位） ---------- */

/* ---------- 侧边抽屉 ---------- */
.drawer-mask {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.drawer-mask.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 90;
  width: min(360px, 92vw);
  background: var(--surface-solid);
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 50px -30px rgba(0, 0, 0, 0.3);
  transform: translateX(100%); transition: transform 0.25s ease;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.drawer-header h3 { font-size: 14px; font-weight: 600; color: var(--text-strong); }
.drawer-close { width: 30px; height: 30px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: all 0.15s; }
.drawer-close:hover { background: var(--surface-hover); color: var(--text); }
.drawer-close svg { width: 15px; height: 15px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px; }

/* ---------- 记录列表 ---------- */
.rec-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; margin-bottom: 6px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-muted);
}
.rec-item .rec-main { min-width: 0; flex: 1; }
.rec-item .rec-name { font-size: 13px; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-item .rec-sub { font-size: 11px; color: var(--text-subtle); margin-top: 2px; }
.rec-item .rec-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all 0.15s;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn svg { width: 14px; height: 14px; }

/* ---------- 模态框 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-mask.open { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 420px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden; transform: translateY(12px) scale(0.98); transition: transform 0.2s;
}
.modal-mask.open .modal { transform: translateY(0) scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 14px; font-weight: 600; color: var(--text-strong); }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--accent); color: var(--accent-contrast);
  padding: 10px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  opacity: 0; pointer-events: none; transition: all 0.2s; z-index: 120;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- 通用 ---------- */
.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.muted { color: var(--text-muted); }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.fade-enter { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.hidden { display: none !important; }

/* 成功提示 */
.success-box {
  display: flex; align-items: center; gap: 8px;
  color: var(--success); font-size: 14px; font-weight: 500;
}
.success-box svg { width: 18px; height: 18px; }

/* ---------- 通用按钮（Vercel ghost） ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; transition: all 0.15s;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn svg { width: 14px; height: 14px; }
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); border-color: transparent; }
.btn-primary:hover { filter: brightness(1.15); background: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn-danger:hover { filter: brightness(1.1); background: var(--danger); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: var(--radius-sm); }

/* ---------- 响应式微调 ---------- */
@media (max-width: 400px) {
  .shell { padding: 12px; }
  .card-inner { padding: 24px 16px 22px; }
  .code-row { gap: 6px; padding: 0; }
  .code-slot { max-width: 52px; height: 50px; font-size: 20px; }
}
