/* ==========================================================================
   个人资料库 —— 样式表
   纯手写 CSS，无框架、无外部字体，1 核 2G 上也没有渲染压力
   ========================================================================== */

:root {
  --bg:        #0e1116;
  --bg-soft:   #151a22;
  --panel:     #1a2029;
  --panel-2:   #212934;
  --line:      #2a3341;
  --text:      #e6ebf2;
  --text-soft: #9aa7b8;
  --text-dim:  #6b7788;
  --accent:    #4c8dff;
  --accent-2:  #3a6fe0;
  --danger:    #ef6b6b;
  --ok:        #4cc38a;
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(1100px 600px at 15% -10%, #1c2740 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #1a2333 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden { display: none !important; }
.muted  { color: var(--text-soft); }

/* ── 按钮 ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
  white-space: nowrap;
}
.btn:hover  { background: #28323f; border-color: #38455a; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(76, 141, 255, .25);
}
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, .06); }
.btn.icon-only { padding: 9px 11px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: rgba(239, 107, 107, .12); border-color: rgba(239, 107, 107, .4); }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ── 登录页 ───────────────────────────────────────────────────────────── */

.gate {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.gate-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 28px 28px;
  text-align: center;
}

.gate-logo { font-size: 40px; line-height: 1; }
.gate-card h1 { margin: 14px 0 4px; font-size: 21px; letter-spacing: .3px; }
.gate-card .muted { margin: 0 0 20px; font-size: 13px; }

.gate-card input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s ease;
}
.gate-card input:focus { border-color: var(--accent); }

.gate-error {
  min-height: 20px;
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--danger);
}

/* ── 备案页脚 ─────────────────────────────────────────────────────────── */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--text-dim);
  text-align: center;
}
.site-footer a {
  color: var(--text-soft);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--text);
  text-decoration: underline;
}
.site-footer .sep { color: #3a4556; }
.site-footer .beian-police {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.site-footer .beian-icon {
  width: 16px;
  height: 16px;
  display: block;
}

/* 登录页的页脚贴着卡片下方一点 */
#login-view .site-footer { padding-top: 22px; }

/* 主界面的页脚跟在内容后面 */
#app-view .site-footer {
  border-top: 1px solid var(--line);
  margin-top: 10px;
}

/* ── 顶栏 ─────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(14, 17, 22, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 16px; }
.brand-logo { font-size: 19px; }

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 420px;
}
.search-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: .55;
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 9px 14px 9px 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.search-wrap input:focus { border-color: var(--accent); }
.search-wrap input::-webkit-search-cancel-button { filter: invert(.6); }

.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.storage { min-width: 120px; font-size: 12px; color: var(--text-soft); }
.storage-bar {
  height: 4px;
  margin-top: 5px;
  border-radius: 999px;
  background: #232c39;
  overflow: hidden;
}
.storage-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #6fd3c7);
  transition: width .3s ease;
}

/* ── 工具栏 ───────────────────────────────────────────────────────────── */

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px 4px;
  flex-wrap: wrap;
}

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tab:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.tab.active {
  background: rgba(76, 141, 255, .14);
  border-color: rgba(76, 141, 255, .35);
  color: #cfe0ff;
  font-weight: 600;
}
.tab em {
  font-style: normal;
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, .06);
  padding: 1px 6px;
  border-radius: 999px;
}
.tab.active em { color: #b9cdf3; background: rgba(76, 141, 255, .2); }

.toolbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.select {
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.viewswitch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.viewswitch button {
  padding: 7px 11px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.viewswitch button.active { background: rgba(76, 141, 255, .16); color: #cfe0ff; }

/* ── 内容区 ───────────────────────────────────────────────────────────── */

#main { padding: 16px 20px 60px; min-height: 60vh; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

/* 列表视图 */
.grid.list {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.grid.list .card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.grid.list .card:last-child { border-bottom: none; }
.grid.list .card:hover { background: rgba(255, 255, 255, .035); }
.grid.list .thumb {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  aspect-ratio: auto;
  border-radius: 10px;
}
.grid.list .thumb .file-ico { font-size: 22px; }
.grid.list .meta { flex: 1; min-width: 0; padding: 0; }
.grid.list .meta .name { -webkit-line-clamp: 1; }
.grid.list .meta .sub { margin-top: 2px; }
.grid.list .card-actions { position: static; opacity: 1; }

/* ── 卡片 ─────────────────────────────────────────────────────────────── */

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.card:hover {
  border-color: #3a4860;
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, .3);
}

.thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, 0)),
    #121822;
  overflow: hidden;
}
.thumb img,
.thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb .file-ico { font-size: 40px; opacity: .85; }

.play-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .22);
  pointer-events: none;
}
.play-badge span {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(10, 14, 20, .68);
  border: 1px solid rgba(255, 255, 255, .25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  padding-left: 3px;
}

.badge-ext {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  border-radius: 5px;
  background: rgba(10, 14, 20, .72);
  color: #d7e2f2;
  backdrop-filter: blur(4px);
}

.meta { padding: 10px 12px 12px; }
.meta .name {
  font-size: 13.5px;
  line-height: 1.4;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.meta .sub {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  gap: 8px;
}

.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity .15s ease;
}
.card:hover .card-actions,
.card:focus-within .card-actions { opacity: 1; }
.card-actions button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(10, 14, 20, .78);
  color: #dfe7f2;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  backdrop-filter: blur(4px);
}
.card-actions button:hover { background: rgba(30, 40, 55, .95); }
.card-actions button.danger:hover { background: rgba(160, 45, 45, .85); }

/* ── 空状态 / 加载更多 ────────────────────────────────────────────────── */

.empty { text-align: center; padding: 80px 20px; color: var(--text-soft); }
.empty-ico { font-size: 44px; margin-bottom: 10px; opacity: .8; }

.loadmore-wrap { display: flex; justify-content: center; padding: 26px 0 10px; }

/* ── 拖拽浮层 ─────────────────────────────────────────────────────────── */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 14, 20, .78);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.drop-inner {
  padding: 34px 52px;
  border: 2px dashed var(--accent);
  border-radius: 20px;
  font-size: 17px;
  font-weight: 600;
  color: #cfe0ff;
  background: rgba(76, 141, 255, .07);
}

/* ── 上传面板 ─────────────────────────────────────────────────────────── */

.upload-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 55;
  width: 330px;
  max-width: calc(100vw - 40px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 600;
}
.upload-list { max-height: 260px; overflow-y: auto; padding: 6px 0; }
.upload-item { padding: 7px 14px; font-size: 12.5px; }
.upload-item .line1 {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.upload-item .nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-item .pc { color: var(--text-dim); flex: 0 0 auto; }
.upload-item .bar {
  height: 3px;
  margin-top: 5px;
  border-radius: 999px;
  background: #232c39;
  overflow: hidden;
}
.upload-item .bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .2s ease;
}
.upload-item.done .bar i { background: var(--ok); }
.upload-item.fail .bar i { background: var(--danger); }
.upload-item.fail .pc { color: var(--danger); }

/* ── 预览弹层 ─────────────────────────────────────────────────────────── */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(8, 10, 14, .94);
  display: flex;
  flex-direction: column;
}
.viewer-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  flex: 0 0 auto;
}
.viewer-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.viewer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
}
.viewer-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}
.viewer-body video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  background: #000;
}
.viewer-body audio { width: min(560px, 100%); }
.viewer-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
  background: #fff;
}
.viewer-body pre {
  width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 16px;
  overflow: auto;
  background: #10151d;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.viewer-fallback { text-align: center; color: var(--text-soft); }
.viewer-fallback .big { font-size: 46px; margin-bottom: 10px; }

/* ── 提示条 ───────────────────────────────────────────────────────────── */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(28, 35, 46, .96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  animation: toast-in .18s ease;
}
.toast.ok   { border-color: rgba(76, 195, 138, .5); }
.toast.err  { border-color: rgba(239, 107, 107, .5); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 响应式 ───────────────────────────────────────────────────────────── */

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; padding: 10px 12px; gap: 10px; }
  .search-wrap { order: 3; flex: 1 1 100%; max-width: none; }
  .storage { display: none; }
  .toolbar { padding: 10px 12px 0; }
  #main { padding: 12px 12px 60px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .card-actions { opacity: 1; }
  .upload-panel { right: 12px; left: 12px; width: auto; bottom: 12px; }
}
