/* ═══════════════════════════════════════════════════
   个人资料库 — 全局样式
   ═══════════════════════════════════════════════════ */

:root {
  --sidebar-width: 240px;
  --sidebar-bg: #1e2a3a;
  --sidebar-text: rgba(255,255,255,.85);
  --topbar-height: 52px;
  --transition: 0.25s ease;
}

/* ── 布局 ────────────────────────────────────────── */
#wrapper { min-height: 100vh; }

/* 侧边栏 */
#sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  transition: width var(--transition), transform var(--transition);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.2) transparent;
  flex-shrink: 0;
  z-index: 100;
}

#sidebar.collapsed {
  width: 60px;
}
#sidebar.collapsed .fs-5,
#sidebar.collapsed p.text-muted,
#sidebar.collapsed .nav-link span,
#sidebar.collapsed strong {
  display: none !important;
}
#sidebar.collapsed .nav-link {
  justify-content: center;
  padding: .5rem;
}
#sidebar.collapsed .nav-link i { margin: 0 !important; }

/* 侧边栏导航链接 */
#sidebar .nav-link {
  color: var(--sidebar-text);
  border-radius: 6px;
  margin-bottom: 2px;
  transition: background var(--transition);
  padding: .5rem .75rem;
}
#sidebar .nav-link:hover { background: rgba(255,255,255,.08); }
#sidebar .nav-link.active { background: rgba(255,255,255,.15); color: #fff; }

/* 主内容区 */
#main-content {
  min-width: 0;
  min-height: 100vh;
  background: #f8f9fa;
  transition: margin var(--transition);
}

[data-bs-theme="dark"] #main-content { background: #111827; }

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  z-index: 99;
  background: #fff !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
[data-bs-theme="dark"] .topbar { background: #1f2937 !important; }

/* ── 头像 ────────────────────────────────────────── */
.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.avatar-circle.avatar-sm { width: 28px; height: 28px; font-size: .75rem; }
.avatar-circle.avatar-lg { width: 80px; height: 80px; font-size: 2rem; }

/* ── 认证页面 ────────────────────────────────────── */
.auth-wrapper {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  border: none;
}

/* ── 统计卡片 ────────────────────────────────────── */
.stat-card { border-radius: 12px; }
.stat-icon { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }

/* ── 资源卡片 ────────────────────────────────────── */
.resource-card {
  border-radius: 12px !important;
  transition: transform .2s, box-shadow .2s;
  overflow: hidden;
}
.resource-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.12) !important;
}

.resource-thumb {
  height: 160px;
  overflow: hidden;
}
.resource-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── 拖拽上传区 ──────────────────────────────────── */
.upload-drop-zone {
  border: 2px dashed #dee2e6;
  border-radius: 12px;
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.upload-drop-zone:hover,
.upload-drop-zone.drop-active {
  border-color: #0d6efd;
  background: #f0f5ff;
}

/* ── 文本预览 ────────────────────────────────────── */
.text-preview {
  min-height: 400px;
  max-height: 70vh;
  overflow: auto;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  background: #fafafa;
}
[data-bs-theme="dark"] .text-preview { background: #1a1a2e; }

.text-preview-toolbar { background: #f8f9fa; }
[data-bs-theme="dark"] .text-preview-toolbar { background: #1f2937; }

/* ── 棋盘格背景（图片透明背景展示）────────────────── */
.bg-checkerboard {
  background-image:
    linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
    linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* ── 预览容器 ────────────────────────────────────── */
.preview-container { min-height: 300px; }

/* ── 过滤徽章 ────────────────────────────────────── */
.badge-filter {
  padding: .45em .8em;
  font-size: .8rem;
  cursor: pointer;
  transition: opacity .15s;
}
.badge-filter:hover { opacity: .85; }

/* ── Dark mode 支持 ──────────────────────────────── */
[data-bs-theme="dark"] .upload-drop-zone { border-color: #374151; }
[data-bs-theme="dark"] .upload-drop-zone:hover,
[data-bs-theme="dark"] .upload-drop-zone.drop-active {
  border-color: #3b82f6;
  background: #1e2a3a;
}
[data-bs-theme="dark"] .topbar { border-bottom-color: #374151 !important; }
[data-bs-theme="dark"] .resource-thumb { background-color: #1f2937 !important; }

/* ── 响应式：移动端侧边栏 ────────────────────────── */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    transform: translateX(-100%);
    z-index: 1050;
  }
  #sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1040;
  }
  .sidebar-overlay.active { display: block; }
}

/* ── 滚动条美化 ──────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── 过渡动画 ────────────────────────────────────── */
.fade-in {
  animation: fadeIn .3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
