/* ============================================================
 * test01 管理员后台 - 自定义样式（基于 Bootstrap 5）
 * ============================================================ */
:root {
  --t1-primary: #1f5fbf;
  --t1-primary-dark: #173f7a;
  --t1-sidebar-bg: #1e2a3a;
  --t1-sidebar-hover: #16202d;
  --t1-sidebar-text: #c3ccd9;
  --t1-bg: #f3f6fa;
  --t1-radius: 10px;
}

* { box-sizing: border-box; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--t1-bg);
  color: #333;
  margin: 0;
}

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #173f7a 0%, #1f5fbf 45%, #3a8dff 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before,
.login-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}
.login-page::before { width: 480px; height: 480px; top: -140px; right: -120px; }
.login-page::after { width: 380px; height: 380px; bottom: -120px; left: -100px; }
.login-box {
  position: relative;
  z-index: 2;
  width: 420px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  padding: 40px 44px 30px;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .logo {
  width: 60px; height: 60px; border-radius: 14px;
  background: linear-gradient(135deg, #1f5fbf, #3a8dff);
  color: #fff; font-size: 28px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.login-brand h1 { font-size: 20px; font-weight: 700; margin: 0; color: #1e2a3a; }
.login-brand p { color: #8a94a6; font-size: 13px; margin: 6px 0 0; }
.login-tip {
  background: #f0f7ff; border: 1px solid #cfe4ff; color: #1f5fbf;
  border-radius: 8px; padding: 8px 12px; font-size: 12px; margin-bottom: 18px;
  text-align: center;
}
.login-box .form-control:focus { border-color: var(--t1-primary); box-shadow: 0 0 0 3px rgba(31, 95, 191, 0.12); }
.login-btn { background: linear-gradient(135deg, #1f5fbf, #3a8dff); border: none; height: 46px; font-weight: 600; }
.login-btn:hover { filter: brightness(1.08); }
.login-footer { text-align: center; color: #a0a8b6; font-size: 12px; margin-top: 20px; }

/* ---------- 后台整体布局 ---------- */
.admin-body { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--t1-sidebar-bg); color: var(--t1-sidebar-text);
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
  display: flex; flex-direction: column; transition: width 0.25s;
}
.sidebar-brand {
  height: 60px; display: flex; align-items: center; gap: 10px;
  padding: 0 18px; color: #fff; font-weight: 700; font-size: 16px;
  background: rgba(255, 255, 255, 0.04); border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-brand .logo-mini {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 34px;
  background: linear-gradient(135deg, #1f5fbf, #3a8dff);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700;
}
.sidebar-menu { flex: 1; overflow-y: auto; padding: 10px 0 30px; }
.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.nav-item { list-style: none; margin: 2px 8px; }
.group-title {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; color: var(--t1-sidebar-text);
  text-decoration: none; font-size: 14px; cursor: pointer; transition: all 0.2s;
}
.group-title:hover { background: var(--t1-sidebar-hover); color: #fff; }
.group-title i:first-child { width: 18px; text-align: center; }
.group-title .group-arrow { margin-left: auto; transition: transform 0.2s; font-size: 12px; }
.nav-group.open > .group-title { color: #fff; background: rgba(31, 95, 191, 0.35); }
.nav-group.open > .group-title .group-arrow { transform: rotate(180deg); }
.nav-sub { display: none; padding: 2px 0 6px; }
.nav-group.open .nav-sub { display: block; }
.sub-link {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px 8px 30px; border-radius: 8px; margin: 1px 0;
  color: #aeb9c8; text-decoration: none; font-size: 13.5px;
}
.sub-link:hover { color: #fff; background: var(--t1-sidebar-hover); }
.sub-link.active { color: #fff; background: linear-gradient(90deg, #1f5fbf, #2a6fd0); }
.sub-link i { font-size: 10px; opacity: 0.6; }

/* 折叠侧栏 */
.sidebar-collapsed .sidebar { width: 64px; }
.sidebar-collapsed .sidebar-brand span, .sidebar-collapsed .group-title span, .sidebar-collapsed .group-arrow { display: none; }
.sidebar-collapsed .group-title { justify-content: center; padding: 10px 0; }
.sidebar-collapsed .nav-sub { display: none !important; }
.sidebar-collapsed .main-wrap { margin-left: 64px; }

.main-wrap {
  flex: 1; margin-left: 240px; display: flex; flex-direction: column;
  min-height: 100vh; transition: margin-left 0.25s;
}

/* 顶栏 */
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid #e8edf3;
  display: flex; align-items: center; padding: 0 20px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .page-title { font-size: 17px; font-weight: 700; color: #1e2a3a; }
.topbar .breadcrumb-box { color: #8a94a6; font-size: 13px; }
.topbar .icon-btn {
  width: 38px; height: 38px; border-radius: 8px; border: none; background: #f4f6fa;
  color: #4a5568; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.topbar .icon-btn:hover { background: #e8eef6; }
.avatar-box { display: flex; align-items: center; gap: 10px; cursor: pointer; position: relative; }
.avatar-circle {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #1f5fbf, #3a8dff); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.dropdown-menu-custom {
  position: absolute; right: 0; top: 48px; min-width: 200px;
  background: #fff; border: 1px solid #e8edf3; border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12); padding: 8px; display: none;
}
.dropdown-menu-custom.show { display: block; }
.dropdown-menu-custom .drop-header { padding: 10px 12px; border-bottom: 1px solid #f0f2f5; margin-bottom: 6px; }
.dropdown-menu-custom a { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px; color: #4a5568; text-decoration: none; font-size: 14px; }
.dropdown-menu-custom a:hover { background: #f4f6fa; }
.dropdown-menu-custom a.text-danger { color: #dc3545; }

/* 内容区 */
.content-wrap { padding: 20px; flex: 1; }
.page-card {
  background: #fff; border-radius: var(--t1-radius);
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.06); border: 1px solid #eef1f6;
  padding: 18px;
}

/* 筛选区 */
.filter-bar { background: #fff; border-radius: var(--t1-radius); padding: 14px 16px; margin-bottom: 16px; border: 1px solid #eef1f6; }
/* 搜索项布局：PC 端每行 4 个，自动对齐 */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 14px;
  align-items: center;
}
.filter-bar .col-auto { width: 100%; flex: none; max-width: none; padding: 0; }
.filter-bar .form-select, .filter-bar .form-control { width: 100%; }
/* 搜索/重置按钮独立一行，靠右对齐 */
.filter-bar .filter-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
@media (max-width: 1199.98px) { .filter-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 991.98px) { .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .filter-bar { grid-template-columns: 1fr; } }
.toolbar-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.toolbar-bar .btn { border-radius: 6px; }

/* 表格 */
.app-table { font-size: 13.5px; }
.app-table thead th { font-size: 13px; color: #4a5568; font-weight: 600; white-space: nowrap; }
.app-table tbody td { vertical-align: middle; }
.app-table tbody tr:hover { background: #f8fafd; }
/* 操作列按钮强制一行显示，避免换行凌乱 */
.app-table td:last-child { white-space: nowrap; }
.badge-status { font-weight: 500; font-size: 12px; padding: 4px 8px; }
.btn-act { width: 30px; height: 30px; padding: 0; margin: 0 2px; }
.btn-act i { font-size: 13px; }

/* 详情 */
.detail-item { background: #f7f9fc; border-radius: 8px; padding: 10px 14px; height: 100%; }
.detail-label { font-size: 12px; color: #8a94a6; margin-bottom: 4px; }
.detail-value { font-size: 14px; font-weight: 600; color: #1e2a3a; word-break: break-all; }

/* 统计卡片 */
.stat-card { border: none; border-radius: var(--t1-radius); box-shadow: 0 1px 4px rgba(16,24,40,.06); border: 1px solid #eef1f6; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16,24,40,.1); transition: all .2s; }
.stat-icon {
  width: 52px; height: 52px; border-radius: 12px; flex: 0 0 52px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.stat-icon.text-primary { background: #e8f1ff; }
.stat-icon.text-success { background: #e4f8ee; }
.stat-icon.text-info { background: #e2f6fb; }
.stat-icon.text-warning { background: #fff5e0; }
.stat-icon.text-danger { background: #fdeaea; }

/* 时间线 */
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; margin-right: 12px; flex: 0 0 10px; }

/* 销控 */
.room-legend { width: 20px; height: 14px; border-radius: 3px; display: inline-block; }
.sell-group-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; color: #1e2a3a; }
.sell-building { margin-bottom: 14px; }
.sell-building-name { font-size: 13px; color: #4a5568; font-weight: 600; margin-bottom: 6px; }
.sell-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.sell-room {
  width: 96px; height: 44px; color: #fff; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer; transition: transform .15s, box-shadow .15s;
  box-shadow: 0 2px 4px rgba(16,24,40,.1);
}
.sell-room:hover { transform: scale(1.08); box-shadow: 0 4px 10px rgba(16,24,40,.18); }

/* 在线用户/软件卡片 */
.online-card, .software-card { border: 1px solid #eef1f6; border-radius: 10px; }
.online-avatar {
  width: 42px; height: 42px; border-radius: 50%; background: #e8f1ff; color: #1f5fbf;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px;
}
.software-icon {
  width: 52px; height: 52px; border-radius: 12px; background: linear-gradient(135deg, #1f5fbf, #3a8dff);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px;
}

/* Toast */
.app-toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 9999; opacity: 0; pointer-events: none; transition: opacity .25s, top .25s;
}
.app-toast.show { opacity: 1; top: 26px; }

/* 弹窗 */
.modal-content { border: none; border-radius: 14px; }
.modal-header { border-bottom: 1px solid #f0f2f5; }
.modal-footer { border-top: 1px solid #f0f2f5; }

/* 小屏适配 */
@media (max-width: 992px) {
  .sidebar { width: 64px; }
  .sidebar-brand span, .group-title span, .group-arrow { display: none; }
  .group-title { justify-content: center; padding: 10px 0; }
  .nav-sub { display: none !important; }
  .main-wrap { margin-left: 64px; }
  .nav-group.open .nav-sub { display: block !important; position: absolute; left: 64px; background: var(--t1-sidebar-bg); border-radius: 8px; min-width: 160px; padding: 6px; }
  .nav-group.open .nav-sub a { padding: 8px 12px; }
}
