/* ========================================
   云智汇付 - 公共主题样式表
   紫绿方形风格：主色 #4B3FE3 / 强调色 #32F08C
   覆盖 Bootstrap / GXON 内容页为紫绿方形风格
   ======================================== */

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "SF Pro Text", -apple-system, system-ui, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", Roboto, sans-serif;
  background: #ffffff;
  color: #171717;
  -webkit-font-smoothing: antialiased;
}

/* ===== 覆盖 Bootstrap 主题变量 ===== */
:root {
  --bs-primary: #4B3FE3;
  --bs-primary-rgb: 75, 63, 227;
  --bs-success: #32F08C;
  --bs-success-rgb: 50, 240, 140;
  --bs-danger: #dc2626;
  --bs-danger-rgb: 220, 38, 38;
  --bs-warning: #ea580c;
  --bs-warning-rgb: 234, 88, 12;
  --bs-info: #0891b2;
  --bs-info-rgb: 8, 145, 178;
}

/* ===== Layout ===== */
.app { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  width: 240px;
  background: linear-gradient(165deg, #f6f4ff 0%, #fbfffd 45%, #f3fff8 100%);
  border-right: 1px solid rgba(75, 63, 227, 0.08);
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar::before {
  content: '';
  position: absolute;
  top: -60px;
  left: -80px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(75, 63, 227, 0.14) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.sidebar::after {
  content: '';
  position: absolute;
  bottom: 80px;
  right: -90px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(50, 240, 140, 0.16) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.sidebar > * { position: relative; z-index: 1; }

/* 菜单区域：独立滚动，顶部 logo 与底部登录信息固定 */
.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* ===== Logo + Toggle (顶部区域) ===== */
.logo {
  padding: 13px 16px 13px 24px;
  border-bottom: 1px solid rgba(75, 63, 227, 0.08);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  height: 64px;
  flex-shrink: 0;
}
.logo-mark {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(135deg, #4B3FE3 0%, #6366f1 55%, #32F08C 100%);
}
.logo-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 50%);
}
.logo-mark svg { position: relative; z-index: 1; }
.logo-body { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; }
.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: #171717;
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.logo-text span { color: #4B3FE3; }
.logo-sub {
  font-size: 11px;
  color: #8888a8;
  margin-top: 3px;
}

/* 折叠按钮 - 悬浮在 sidebar 右边缘 */
.sidebar-toggle {
  position: fixed;
  top: 18px;
  left: 226px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid rgba(75, 63, 227, 0.12);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(75, 63, 227, 0.14);
  cursor: pointer;
  color: #6b6b80;
  z-index: 30;
  transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.18s, color 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.sidebar-toggle:hover {
  background: #4B3FE3;
  color: #fff;
  border-color: #4B3FE3;
  box-shadow: 0 4px 14px rgba(75, 63, 227, 0.3);
}
.sidebar-toggle svg { width: 14px; height: 14px; transition: transform 0.28s; }
.sidebar.collapsed .sidebar-toggle {
  left: 50px;
  color: #4B3FE3;
}
.sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* ===== Nav Section Label ===== */
.nav-section {
  padding: 16px 24px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #9b95c7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* ===== Nav Item (基础) ===== */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 21px;
  font-size: 14px;
  color: #4a4a5c;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s;
  margin: 2px 12px;
  border-left: 3px solid transparent;
  white-space: nowrap;
}
.nav-item:hover {
  background: rgba(75, 63, 227, 0.08);
  color: #4B3FE3;
  border-left-color: rgba(75, 63, 227, 0.3);
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(75, 63, 227, 0.12) 0%, rgba(75, 63, 227, 0.02) 100%);
  color: #4B3FE3;
  font-weight: 600;
  border-left-color: #4B3FE3;
}
.nav-item .icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  background: #32F08C;
  color: #0f5a32;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 0;
  box-shadow: 0 1px 4px rgba(50, 240, 140, 0.4);
}

/* ===== 两级菜单：父级 + 展开箭头 ===== */
.nav-arrow {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: #9b95c7;
}
.nav-arrow svg { transition: transform 0.2s ease; }
.nav-group.open > .nav-item .nav-arrow svg {
  transform: rotate(90deg);
}

/* ===== 两级菜单：子菜单容器 ===== */
.nav-children {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease;
}
.nav-group.open > .nav-children {
  max-height: 500px;
}
.nav-child {
  padding: 8px 18px 8px 52px;
  font-size: 13px;
  margin: 1px 12px;
  color: #6b6b7c;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.nav-child:hover {
  background: rgba(75, 63, 227, 0.06);
  color: #4B3FE3;
}
.nav-child.active {
  color: #4B3FE3;
  font-weight: 600;
  border-left-color: #4B3FE3;
  background: rgba(75, 63, 227, 0.06);
}
.nav-child .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c0bcd6;
  flex-shrink: 0;
}
.nav-child:hover .dot { background: #4B3FE3; }
.nav-child.active .dot { background: #4B3FE3; }

/* ===== Sidebar Footer ===== */
.sidebar-footer {
  flex-shrink: 0;
  padding: 20px 24px;
  border-top: 1px solid rgba(75, 63, 227, 0.08);
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #4B3FE3 0%, #6366f1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(75, 63, 227, 0.3);
}
.user-info {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
.user-info .name {
  font-size: 13px;
  font-weight: 600;
  color: #171717;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info .role {
  font-size: 12px;
  color: #737373;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.user-action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(75, 63, 227, 0.12);
  color: #6b6b80;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.user-action-btn:hover {
  background: rgba(75, 63, 227, 0.08);
  border-color: rgba(75, 63, 227, 0.3);
  color: #4B3FE3;
}
.logout-btn:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

/* ===== Main ===== */
.main {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.main.expanded { margin-left: 64px; }

/* ===== Topbar ===== */
.topbar {
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.breadcrumb {
  font-size: 14px;
  color: #737373;
  display: flex;
  align-items: center;
  line-height: 1;
  margin-bottom: 0;
  padding: 0;
}
.breadcrumb .current { color: #171717; font-weight: 500; }
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ===== Search ===== */
.search-box {
  display: flex;
  align-items: center;
  background: #f5f5f5;
  padding: 8px 14px;
  width: 280px;
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 13px;
  color: #171717;
  margin-left: 8px;
}
.search-box input::placeholder { color: #a3a3a3; }

/* ===== Icon Button ===== */
.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  color: #404040;
}
.icon-btn:hover { background: #f5f5f5; }
.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: #32F08C;
}

/* ===== Content ===== */
.content {
  padding: 28px 32px 40px;
  flex: 1;
  background: #ffffff;
}

/* ===== Scrollbar（隐藏滚动条，保留滚动能力）===== */
.sidebar-nav::-webkit-scrollbar { display: none; }

/* ========================================
   折叠态样式
   ======================================== */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .logo-body,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .nav-item .label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-arrow,
.sidebar.collapsed .user-info,
.sidebar.collapsed .user-actions { display: none; }

.sidebar.collapsed .logo {
  padding: 16px 0;
  flex-direction: column;
  gap: 10px;
  height: auto;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
  margin: 2px 8px;
  border-left: none;
}
.sidebar.collapsed .nav-item.active { border-left: none; }
.sidebar.collapsed .nav-children { display: none; }
.sidebar.collapsed .sidebar-footer { padding: 20px 0; }
.sidebar.collapsed .user-card { justify-content: center; }

/* ===== 折叠态：悬停弹出面板 ===== */
.nav-flyout {
  position: fixed;
  background: #ffffff;
  border: 1px solid rgba(75, 63, 227, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  min-width: 180px;
  padding: 8px 0;
  z-index: 9999;
  display: none;
  border-radius: 0;
}
.nav-flyout.show { display: block; }
.nav-flyout .flyout-header {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #4B3FE3;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 4px;
  white-space: nowrap;
}
.nav-flyout .flyout-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  color: #4a4a5c;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s;
}
.nav-flyout .flyout-item:hover {
  background: rgba(75, 63, 227, 0.08);
  color: #4B3FE3;
}
.nav-flyout .flyout-item.active {
  color: #4B3FE3;
  font-weight: 600;
  background: rgba(75, 63, 227, 0.06);
}
.nav-flyout .flyout-item .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c0bcd6;
  flex-shrink: 0;
}
.nav-flyout .flyout-item:hover .dot { background: #4B3FE3; }
.nav-flyout .flyout-item.active .dot { background: #4B3FE3; }

/* ========================================
   Bootstrap / GXON 内容页覆盖层
   ======================================== */

/* 卡片 */
.card {
  background: #ffffff;
  border: 1px solid #f0f0f0;
  border-radius: 0 !important;
  box-shadow: none;
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f5f5f5;
  background: #ffffff;
  border-radius: 0 !important;
}
.card-body { padding: 24px; }
.card-title {
  font-size: 16px;
  font-weight: 600;
  color: #171717;
}

/* 按钮：方形、紫绿 */
.btn {
  border-radius: 0 !important;
  font-weight: 500;
}
.btn-primary {
  background: #32F08C !important;
  border-color: #32F08C !important;
  color: #171717 !important;
}
.btn-primary:hover { background: #26d17a !important; border-color: #26d17a !important; color: #171717 !important; }
.btn-secondary {
  background: #4B3FE3 !important;
  border-color: #4B3FE3 !important;
  color: #ffffff !important;
}
.btn-secondary:hover { background: #3d32c0 !important; border-color: #3d32c0 !important; color: #ffffff !important; }
.btn-success {
  background: #32F08C !important;
  border-color: #32F08C !important;
  color: #0f5a32 !important;
}
.btn-info {
  background: #0891b2 !important;
  border-color: #0891b2 !important;
  color: #ffffff !important;
}
.btn-danger {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
}
.btn-outline-secondary { color: #4B3FE3; border-color: #d4d4d4; }
.btn-outline-secondary:hover { background: #4B3FE3; border-color: #4B3FE3; color: #fff; }

/* 表单 */
.form-control,
.form-select {
  border-radius: 0 !important;
  border: 1px solid #e5e5e5;
  font-size: 13px;
}
.form-control:focus,
.form-select:focus {
  border-color: #4B3FE3 !important;
  box-shadow: 0 0 0 3px rgba(75, 63, 227, 0.08) !important;
}
.form-label { font-size: 13px; color: #404040; }

/* 分页 */
.pagination .page-link { border-radius: 0 !important; color: #4B3FE3; }
.pagination .page-item.active .page-link { background: #4B3FE3; border-color: #4B3FE3; color: #fff; }

/* 表格 */
.table thead th { background: #f9f8ff; font-weight: 600; color: #404040; border-bottom: 2px solid #edeafd; }
.table td, .table th { padding: 12px; }

/* 导航/标签辅助 */
.text-primary { color: #4B3FE3 !important; }
.text-success { color: #1ea85e !important; }
.bg-primary { background-color: #4B3FE3 !important; }
.bg-success { background-color: #32F08C !important; }
.badge { border-radius: 0 !important; }

/* 下拉菜单/弹窗 */
.dropdown-menu { border-radius: 0 !important; border: 1px solid #f0f0f0; }
.modal-content { border-radius: 0 !important; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.collapsed { transform: translateX(-100%); width: 240px; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main, .main.expanded { margin-left: 0; }
  .content { padding: 20px 16px 32px; }
  .topbar { padding: 0 16px; }
  .search-box { display: none; }
}

/* ===== 顶栏用户区 ===== */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
}
.topbar-user:hover { background: #f5f5f5; }
.topbar-user .avatar {
  width: 32px;
  height: 32px;
  font-size: 13px;
}
.topbar-user-info { text-align: left; line-height: 1.25; }
.topbar-user-info .name { font-size: 13px; font-weight: 600; color: #171717; }
.topbar-user-info .role { font-size: 11px; color: #a3a3a3; }

/* ===== 预警红点徽标 ===== */
.alert-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: #dc2626;
  text-align: center;
  border-radius: 0;
}

/* ========================================
   认证页（登录 / 修改密码 / 谷歌验证 / 访问拒绝）
   ======================================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4B3FE3 0%, #6366f1 55%, #32F08C 100%);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(20, 20, 60, 0.25);
  padding: 40px 36px;
}
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}
.auth-brand .logo-mark {
  width: 40px;
  height: 40px;
}
.auth-brand .brand-text {
  font-size: 20px;
  font-weight: 700;
  color: #171717;
}
.auth-brand .brand-text span { color: #4B3FE3; }
.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: #171717;
  text-align: center;
  margin-bottom: 6px;
}
.auth-sub {
  text-align: center;
  font-size: 13px;
  color: #a3a3a3;
  margin-bottom: 28px;
}
.auth-form .form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #404040;
  margin-bottom: 6px;
}
.auth-form .form-control {
  height: 46px;
  font-size: 14px;
  margin-bottom: 18px;
}
.auth-btn {
  width: 100%;
  height: 46px;
  border: none;
  cursor: pointer;
  background: #32F08C;
  color: #171717;
  font-size: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}
.auth-btn:hover { background: #26d17a; color: #171717; }
.auth-btn:disabled { background: #a7f3d0; cursor: not-allowed; }
.auth-error {
  display: none;
  margin-top: 16px;
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  font-size: 13px;
  text-align: center;
}
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: #a3a3a3;
}
.auth-links {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}
.auth-links .auth-btn { flex: 1; }
.auth-qr {
  text-align: center;
  margin-bottom: 20px;
}
.auth-qr img {
  width: 180px;
  height: 180px;
  border: 1px solid #f0f0f0;
  background: #fafafa;
  padding: 8px;
}
.auth-qr .secret {
  margin-top: 12px;
  font-size: 12px;
  color: #737373;
  word-break: break-all;
}
.auth-qr .secret strong { color: #171717; }
.auth-btn .spinner-border {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(23, 23, 23, 0.25);
  border-top-color: #171717;
  border-radius: 50%;
  animation: auth-spin 0.6s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }
