/* ===== 拆分自 dark-mode.css（第 4 部分，原第 1262-1531 行）—— 必须紧跟在上一部分之后按序加载，顺序影响层叠结果 ===== */
/* ===================================
   992–1199：左栏收成 72px 图标栏
   固定 240 栏在该区间会把内容宽压到约 720，反而小于 991px 时的 959；
   收成图标栏后内容宽回到约 888，且不改动 <992 的抽屉行为。
   搜索框收起（/explore 仍可搜索），用户区压缩为「头像 + 退出登录」。
   =================================== */
@media (min-width: 992px) and (max-width: 1199.98px) {
  [data-theme="dark"] body.has-three-col:not(.no-sidebar) .layout-main-row {
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
  }
  [data-theme="dark"] .sidebar-left {
    width: var(--rail-w);
    padding: 10px 6px;
  }
  [data-theme="dark"] .sidebar-left .sidebar-logo {
    justify-content: center;
    gap: 0;
    padding-inline: 0;
    font-size: 0;
  }
  [data-theme="dark"] .sidebar-left .sidebar-search,
  [data-theme="dark"] .sidebar-left .nav-section-label {
    display: none;
  }
  [data-theme="dark"] .sidebar-left .nav-link-item {
    position: relative;
    justify-content: center;
    gap: 0;
    padding: 9px 0;
    font-size: 0;
  }
  [data-theme="dark"] .sidebar-left .nav-link-item > i {
    width: auto;
    font-size: 18px;
  }
  [data-theme="dark"] .sidebar-left .nav-link-item .badge {
    position: absolute;
    top: 1px;
    right: 1px;
    margin-left: 0;
    padding: 0 5px;
  }
  /* 图标栏下悬停不再右移，避免整列抖动 */
  [data-theme="dark"] .sidebar-left .nav-link-item:hover {
    transform: none;
  }
  /* 用户区压缩：隐藏用户名，保留头像与退出入口 */
  [data-theme="dark"] .sidebar-left .sidebar-user {
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
  }
  [data-theme="dark"] .sidebar-left .sidebar-user > div {
    flex: 0 0 auto !important;
    width: 100%;
    text-align: center;
  }
  [data-theme="dark"] .sidebar-left .sidebar-user > div > div {
    display: none;
  }
}

/* 页脚与主内容同轴：左栏占位后，footer 的容器不再按整视口居中
   只作用于 layouts/main.php 的页脚（.tuquan-layout 直接子级），
   layouts/user.php 的页脚不在该容器内，不受影响 */
@media (min-width: 992px) {
  body.has-three-col:not(.no-sidebar) .tuquan-layout > .site-footer {
    padding-left: var(--nav-w);
  }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
  body.has-three-col:not(.no-sidebar) .tuquan-layout > .site-footer {
    padding-left: var(--rail-w);
  }
}

/* ===================================
   无左栏页面（登录 / 注册）：视图传 $noSidebar = true，左栏整块不渲染。
   桌面端须把两列 grid 收回单列，否则主内容会掉进 240px 的第一列；
   同时恢复顶栏——has-three-col 桌面端默认隐藏顶栏（导航已合并进左栏），
   左栏不在时若不恢复，页面上将没有任何导航入口。
   =================================== */
@media (min-width: 992px) {
  [data-theme="dark"] body.no-sidebar .layout-main-row {
    display: block;
  }
  /* 特异度 (0,4,1) 高于上方隐藏顶栏规则的 (0,3,1) */
  [data-theme="dark"] body.has-three-col.no-sidebar .site-topbar {
    display: block;
  }
}
/* 顶栏抽屉按钮指向 #sidebarLeft，左栏不存在时它是死键，不显示 */
[data-theme="dark"] body.no-sidebar #sidebarLeftToggle {
  display: none;
}
/* 登录/注册卡片垂直居中：主内容仅此一卡，撑满顶栏与底部 TabBar 之间的视口高度后纵向居中 */
[data-theme="dark"] body.no-sidebar .main-content-three-col > main {
  min-height: calc(100vh - var(--chrome-top) - var(--chrome-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
}
/* 全局 .card 带 margin-bottom:1.5rem，会让居中后的卡片视觉上偏上，无左栏页面归零 */
[data-theme="dark"] body.no-sidebar .main-content-three-col .card {
  margin-bottom: 0;
}

/* 平滑过渡 */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ===== 评论区 .btn-link 举报链接：去 Bootstrap 默认蓝，默认低调灰、hover 危险红 ===== */
[data-theme="dark"] .report-trigger.btn-link {
  color: var(--text-muted);
}
[data-theme="dark"] .report-trigger.btn-link:hover {
  color: var(--danger-color);
}

/* ===================================
   用户中心（layouts/user.php 布局）：侧栏/内容区 兔圈紫粉化
   user-sidebar.css 自带的 dark 块为蓝灰色板，这里统一为兔圈深紫
   =================================== */
[data-theme="dark"] .user-sidebar {
  --user-sidebar-bg: #1D172B;
  --user-sidebar-border-color: #3A2F45;
  --user-sidebar-text-color: #F4F4F5;
  --user-sidebar-text-muted: #ACAFBC;
  --user-sidebar-hover-bg: #2A2233;
  --user-sidebar-active-bg: #7c3aed;
  box-shadow: none;
}
[data-theme="dark"] .user-menu-group-header:hover { background: var(--bg-muted); }
[data-theme="dark"] .user-menu-submenu a:hover { color: #c084fc; }
[data-theme="dark"] .user-menu-submenu a.active {
  background: var(--gift-gradient);
  color: #fff;
}

/* user-content.css 亮色硬编码残留：表头/hover/未读通知 蓝 -> 紫粉 */
[data-theme="dark"] .table thead th {
  background-color: #191426;
  color: var(--text-secondary);
  border-bottom-color: #3A2F45;
}
[data-theme="dark"] .table tbody tr:hover { background-color: #221b30; }
[data-theme="dark"] .list-group-item:hover {
  background-color: #221b30;
  transform: none;
}
[data-theme="dark"] .notif-item.unread {
  background: rgba(124, 58, 237, 0.10);
  border-left-color: #7c3aed;
}

/* style.css 遗留的亮色 hover：评论区悬停会闪出近白底 */
[data-theme="dark"] .comment-item:hover { background: var(--bg-hover); }

/* style.css 遗留的亮色硬编码：帖子列表/通知悬停闪白、标签云与上传区浅底、
   以及全屏 loading 遮罩的 90% 白幕 */
[data-theme="dark"] .post-item { border-bottom-color: var(--border-divider); }
[data-theme="dark"] .post-item:hover { background-color: var(--bg-hover); }
[data-theme="dark"] .notification-item { border-bottom-color: var(--border-divider); }
[data-theme="dark"] .notification-item:hover { background-color: var(--bg-hover); }
[data-theme="dark"] .tag-cloud a { background: var(--bg-muted); color: var(--text-secondary); }
[data-theme="dark"] .upload-area {
  background: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--text-secondary);
}
[data-theme="dark"] .upload-area:hover,
[data-theme="dark"] .upload-area.dragover { background: rgba(124, 58, 237, 0.1); }
[data-theme="dark"] .loading-overlay {
  background: rgba(18, 13, 28, 0.85);
  color: var(--text-primary);
}

/* ===================================
   管理后台（layouts/admin.php）：只保留无法用 token 表达的
   紫粉装饰、暗底可读性提亮与结构性修补。
   admin.css / admin-sidebar.css 的蓝灰字面值已改为 var(token, fallback)，
   原先在此整体替换 --sidebar-* 变量的补丁已随之删除。
   =================================== */
[data-theme="dark"] .sidebar .logo-icon { color: #a78bfa; }
[data-theme="dark"] .sidebar-menu a.active {
  background: var(--gift-gradient);
  border-left-color: #ec4899;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.4);
}
[data-theme="dark"] .sidebar-menu a.group-active {
  background: rgba(124, 58, 237, 0.22);
  border-left-color: #7c3aed;
}
[data-theme="dark"] .sidebar-menu a.group-active:hover { background: rgba(124, 58, 237, 0.32); }

/* 顶栏 */
[data-theme="dark"] .admin-layout .top-bar {
  background: rgba(25, 20, 38, 0.92);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .admin-layout .top-bar .user-avatar {
  background: var(--gift-gradient);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}

/* 统计卡 / 面板 / 卡片：只补回 admin.css 在暗底丢失的描边与投影
   （admin.css 里 border:none / 0.08 浅阴影，以及全局 .card{box-shadow:none}）；
   h3 与 .blue 因全局 h1-h6 规则和特异性关系仍需在此覆盖 */
[data-theme="dark"] .admin-layout .stat-card,
[data-theme="dark"] .admin-layout .stats-grid .stat-card {
  border: 1px solid var(--border-color);
  border-left-width: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .admin-layout .stat-card h3 { color: var(--text-secondary); }
[data-theme="dark"] .admin-layout .stat-card.blue { border-left-color: #7c3aed; }
[data-theme="dark"] .admin-layout .panel,
[data-theme="dark"] .admin-layout .card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 主按钮：全站 .btn-primary 是紫粉渐变，后台沿用实心紫，需在此压回 */
[data-theme="dark"] .admin-layout .btn-primary {
  background: var(--primary-color);
  border-color: var(--primary-color);
}
[data-theme="dark"] .admin-layout .btn-primary:hover {
  background: #6d28d9;
  border-color: #6d28d9;
}

/* 暗底下 .text-primary(#7C3AED) 对比不足，提亮为浅紫 */
[data-theme="dark"] .admin-layout .text-primary { color: #a78bfa !important; }

/* 提示框：浅色底 -> 深色半透明 */
[data-theme="dark"] .admin-layout .alert-success { background: rgba(16, 185, 129, 0.14); color: #6ee7b7; }
[data-theme="dark"] .admin-layout .alert-danger { background: rgba(239, 68, 68, 0.14); color: #fca5a5; }
[data-theme="dark"] .admin-layout .alert-warning { background: rgba(245, 158, 11, 0.14); color: #fcd34d; }
[data-theme="dark"] .admin-layout .alert-info { background: rgba(124, 58, 237, 0.14); color: #c4b5fd; }

/* 分页：暗底紫粉强调，并压回全站 .page-item.active 的渐变 */
[data-theme="dark"] .admin-layout .page-link {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: #c084fc;
}
[data-theme="dark"] .admin-layout .page-link:hover { background: #2A2233; color: #ec4899; }
[data-theme="dark"] .admin-layout .page-item.active .page-link {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}
[data-theme="dark"] .admin-layout h1 i,
[data-theme="dark"] .admin-layout h2 i,
[data-theme="dark"] .admin-layout h3 i,
[data-theme="dark"] .admin-layout h4 i { color: #a78bfa; }

/* admin-sidebar.css 的全局裸选择器（裸 table / 自定义徽章） */
[data-theme="dark"] .admin-layout table th,
[data-theme="dark"] .admin-layout table td { border-bottom-color: var(--border-divider); }
[data-theme="dark"] .admin-layout table th {
  background: #191426;
  color: var(--text-secondary);
}
[data-theme="dark"] .admin-layout table tr:hover { background: #221b30; }
[data-theme="dark"] .badge-success { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
[data-theme="dark"] .badge-warning { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
[data-theme="dark"] .badge-danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
[data-theme="dark"] .badge-info { background: rgba(124, 58, 237, 0.15); color: #c4b5fd; }