/* 基础样式 */
html, body { 
  height: 100%; 
  transition: background-color 0.3s ease, color 0.3s ease;
}

.content-section { 
  min-height: calc(100vh - 64px); 
}

#sidebar .list-group-item { 
  border: 0; 
  border-radius: 0; 
  transition: all 0.3s ease;
}

#sidebar .list-group-item.active { 
  background: #0d6efd; 
  color: #fff; 
}

.table td, .table th { 
  vertical-align: middle; 
}

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

/* =========================== */
/* 暗黑模式样式 */
/* =========================== */

/* 根元素和基础背景 */
.dark {
  color-scheme: dark;
}

.dark body {
  background-color: #121212 !important;
  color: #e0e0e0 !important;
}

/* 登录页面 */
.dark #loginView {
  background-color: #121212 !important;
}

.dark .bg-light {
  background-color: #121212 !important;
}

/* 导航栏 */
.dark .navbar {
  background-color: #1f1f1f !important;
  border-bottom: 1px solid #333 !important;
}

.dark .navbar-brand {
  color: #fff !important;
}

/* 侧边栏 */
.dark #sidebar {
  background-color: #1a1a1a !important;
  border-right: 1px solid #333 !important;
}

.dark #sidebar .list-group-item {
  background-color: transparent !important;
  color: #b0b0b0 !important;
  border-bottom: 1px solid #2a2a2a !important;
}

.dark #sidebar .list-group-item:hover {
  background-color: #2a2a2a !important;
  color: #fff !important;
}

.dark #sidebar .list-group-item.active {
  background-color: #0d6efd !important;
  color: #fff !important;
}

/* 卡片组件 */
.dark .card {
  background-color: #1e1e1e !important;
  border: 1px solid #333 !important;
  color: #e0e0e0 !important;
}

.dark .card-header {
  background-color: #252525 !important;
  border-bottom: 1px solid #333 !important;
  color: #fff !important;
}

.dark .card-body {
  background-color: #1e1e1e !important;
}

/* 表格样式 */
.dark .table {
  color: #f0f0f0 !important;
  background-color: transparent !important;
}

.dark .table th {
  background-color: #252525 !important;
  border-color: #404040 !important;
  color: #fff !important;
}

.dark .table td {
  border-color: #404040 !important;
  background-color: #1a1a1a !important;
  color: #f0f0f0 !important;
}

/* 表格内特定元素的颜色优化 */
.dark .table td strong {
  color: #ffffff !important;
}

.dark .table td small {
  color: #cccccc !important;
}

/* 表格内链接和可点击元素 */
.dark .table td a {
  color: #87ceeb !important;
}

.dark .table td a:hover {
  color: #add8e6 !important;
}

/* 表格内代码块 */
.dark .table td code {
  background-color: #333 !important;
  color: #87ceeb !important;
  border: 1px solid #555 !important;
}

.dark .table-striped > tbody > tr:nth-of-type(odd) > td {
  background-color: #222 !important;
}

.dark .table-hover > tbody > tr:hover > td {
  background-color: #2a2a2a !important;
}

.dark .table-success {
  background-color: rgba(25, 135, 84, 0.2) !important;
}

.dark .table-warning {
  background-color: rgba(255, 193, 7, 0.2) !important;
}

.dark .table-danger {
  background-color: rgba(220, 53, 69, 0.2) !important;
}

/* 表单控件 */
.dark .form-control {
  background-color: #2a2a2a !important;
  border: 1px solid #404040 !important;
  color: #e0e0e0 !important;
}

.dark .form-control:focus {
  background-color: #333 !important;
  border-color: #0d6efd !important;
  color: #fff !important;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

.dark .form-control::placeholder {
  color: #888 !important;
}

.dark .form-select {
  background-color: #2a2a2a !important;
  border: 1px solid #404040 !important;
  color: #e0e0e0 !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23e0e0e0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e") !important;
}

.dark .form-check-input {
  background-color: #2a2a2a !important;
  border: 1px solid #404040 !important;
}

.dark .form-check-input:checked {
  background-color: #0d6efd !important;
  border-color: #0d6efd !important;
}

/* 按钮样式 */
.dark .btn-outline-primary {
  color: #6ea8fe !important;
  border-color: #6ea8fe !important;
}

.dark .btn-outline-primary:hover {
  background-color: #6ea8fe !important;
  border-color: #6ea8fe !important;
  color: #000 !important;
}

.dark .btn-outline-secondary {
  color: #9ca3af !important;
  border-color: #9ca3af !important;
}

.dark .btn-outline-secondary:hover {
  background-color: #9ca3af !important;
  border-color: #9ca3af !important;
  color: #000 !important;
}

.dark .btn-outline-success {
  color: #75dd75 !important;
  border-color: #75dd75 !important;
}

.dark .btn-outline-success:hover {
  background-color: #75dd75 !important;
  border-color: #75dd75 !important;
  color: #000 !important;
}

.dark .btn-outline-warning {
  color: #ffda6a !important;
  border-color: #ffda6a !important;
}

.dark .btn-outline-warning:hover {
  background-color: #ffda6a !important;
  border-color: #ffda6a !important;
  color: #000 !important;
}

.dark .btn-outline-danger {
  color: #f87171 !important;
  border-color: #f87171 !important;
}

.dark .btn-outline-danger:hover {
  background-color: #f87171 !important;
  border-color: #f87171 !important;
  color: #000 !important;
}

.dark .btn-outline-info {
  color: #6dd5ed !important;
  border-color: #6dd5ed !important;
}

.dark .btn-outline-info:hover {
  background-color: #6dd5ed !important;
  border-color: #6dd5ed !important;
  color: #000 !important;
}

.dark .btn-outline-light {
  color: #f8f9fa !important;
  border-color: #f8f9fa !important;
}

.dark .btn-outline-light:hover {
  background-color: #f8f9fa !important;
  border-color: #f8f9fa !important;
  color: #000 !important;
}

/* 徽章样式 */
.dark .badge {
  color: #000 !important;
  font-weight: 500 !important;
}

.dark .text-bg-primary {
  background-color: #0d6efd !important;
  color: #ffffff !important;
}

.dark .text-bg-secondary {
  background-color: #6c757d !important;
  color: #ffffff !important;
}

.dark .text-bg-success {
  background-color: #198754 !important;
  color: #ffffff !important;
}

.dark .text-bg-warning {
  background-color: #ffc107 !important;
  color: #000000 !important;
}

.dark .text-bg-danger {
  background-color: #dc3545 !important;
  color: #ffffff !important;
}

.dark .text-bg-info {
  background-color: #0dcaf0 !important;
  color: #000000 !important;
}

/* 确保徽章在暗色背景下清晰可见 */
.dark .badge.bg-primary {
  background-color: #0d6efd !important;
  color: #ffffff !important;
}

.dark .badge.bg-success {
  background-color: #198754 !important;
  color: #ffffff !important;
}

.dark .badge.bg-warning {
  background-color: #ffc107 !important;
  color: #000000 !important;
}

/* 模态框 */
.dark .modal-content {
  background-color: #1e1e1e !important;
  border: 1px solid #404040 !important;
  color: #e0e0e0 !important;
}

.dark .modal-header {
  background-color: #252525 !important;
  border-bottom: 1px solid #404040 !important;
}

.dark .modal-footer {
  background-color: #252525 !important;
  border-top: 1px solid #404040 !important;
}

.dark .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* 下拉菜单 */
.dark .dropdown-menu {
  background-color: #2a2a2a !important;
  border: 1px solid #404040 !important;
}

.dark .dropdown-item {
  color: #e0e0e0 !important;
}

.dark .dropdown-item:hover {
  background-color: #404040 !important;
  color: #fff !important;
}

/* 警告框 */
.dark .alert {
  border-color: #404040 !important;
}

.dark .alert-info {
  background-color: rgba(13, 202, 240, 0.1) !important;
  border-color: rgba(13, 202, 240, 0.3) !important;
  color: #6dd5ed !important;
}

.dark .alert-warning {
  background-color: rgba(255, 193, 7, 0.1) !important;
  border-color: rgba(255, 193, 7, 0.3) !important;
  color: #ffda6a !important;
}

.dark .alert-danger {
  background-color: rgba(220, 53, 69, 0.1) !important;
  border-color: rgba(220, 53, 69, 0.3) !important;
  color: #f87171 !important;
}

.dark .alert-success {
  background-color: rgba(25, 135, 84, 0.1) !important;
  border-color: rgba(25, 135, 84, 0.3) !important;
  color: #75dd75 !important;
}

/* 进度条 */
.dark .progress {
  background-color: #404040 !important;
}

/* 代码块 */
.dark code {
  background-color: #2a2a2a !important;
  color: #6dd5ed !important;
  border: 1px solid #404040 !important;
}

/* 文本颜色 */
.dark .text-muted {
  color: #b8b8b8 !important;
}

.dark .text-primary {
  color: #87ceeb !important;
}

.dark .text-success {
  color: #90ee90 !important;
}

.dark .text-info {
  color: #87ceeb !important;
}

.dark .text-warning {
  color: #ffd700 !important;
}

.dark .text-danger {
  color: #ff6b6b !important;
}

.dark .text-light {
  color: #f8f9fa !important;
}

.dark .text-dark {
  color: #f0f0f0 !important;
}

/* 增强文本对比度 */
.dark {
  color: #f0f0f0 !important;
}

.dark h1, .dark h2, .dark h3, .dark h4, .dark h5, .dark h6 {
  color: #ffffff !important;
}

.dark p {
  color: #e8e8e8 !important;
}

.dark span {
  color: inherit !important;
}

.dark .fw-bold,
.dark strong,
.dark b {
  color: #ffffff !important;
}

/* 边框样式 */
.dark .border {
  border-color: #404040 !important;
}

.dark .border-top {
  border-top-color: #404040 !important;
}

.dark .border-bottom {
  border-bottom-color: #404040 !important;
}

.dark .border-left {
  border-left-color: #404040 !important;
}

.dark .border-right {
  border-right-color: #404040 !important;
}

/* 输入组 */
.dark .input-group-text {
  background-color: #404040 !important;
  border-color: #404040 !important;
  color: #e0e0e0 !important;
}

/* 分页 */
.dark .page-link {
  background-color: #2a2a2a !important;
  border-color: #404040 !important;
  color: #6ea8fe !important;
}

.dark .page-link:hover {
  background-color: #404040 !important;
  border-color: #404040 !important;
  color: #fff !important;
}

.dark .page-item.active .page-link {
  background-color: #0d6efd !important;
  border-color: #0d6efd !important;
}

/* 工具提示和弹出框 */
.dark .tooltip-inner {
  background-color: #2a2a2a !important;
  color: #e0e0e0 !important;
}

.dark .popover {
  background-color: #2a2a2a !important;
  border-color: #404040 !important;
}

.dark .popover-header {
  background-color: #404040 !important;
  border-bottom-color: #666 !important;
  color: #e0e0e0 !important;
}

.dark .popover-body {
  color: #e0e0e0 !important;
}

/* 列表组 */
.dark .list-group-item {
  background-color: #1e1e1e !important;
  border-color: #404040 !important;
  color: #e0e0e0 !important;
}

.dark .list-group-item:hover {
  background-color: #2a2a2a !important;
}

/* 折叠组件 */
.dark .collapse {
  color: #e0e0e0 !important;
}

/* 导航标签 */
.dark .nav-tabs .nav-link {
  color: #b0b0b0 !important;
  border-color: #404040 !important;
}

.dark .nav-tabs .nav-link.active {
  background-color: #1e1e1e !important;
  border-color: #404040 !important;
  color: #fff !important;
}

.dark .nav-tabs {
  border-bottom-color: #404040 !important;
}

/* 手风琴 */
.dark .accordion-item {
  background-color: #1e1e1e !important;
  border-color: #404040 !important;
}

.dark .accordion-header .accordion-button {
  background-color: #252525 !important;
  color: #e0e0e0 !important;
  border-color: #404040 !important;
}

.dark .accordion-button:not(.collapsed) {
  background-color: #404040 !important;
  color: #fff !important;
}

/* 主内容区域背景 */
.dark .main-content {
  background-color: #121212 !important;
}

/* 通用背景色覆盖 */
.dark .bg-white {
  background-color: #1e1e1e !important;
}

.dark .bg-body {
  background-color: #121212 !important;
}

.dark .bg-body-secondary {
  background-color: #1a1a1a !important;
}

.dark .bg-body-tertiary {
  background-color: #252525 !important;
}

/* 容器背景 */
.dark .container,
.dark .container-fluid {
  background-color: transparent !important;
}

/* 分隔线 */
.dark hr {
  border-color: #404040 !important;
}

/* 小组件 */
.dark .badge.text-bg-light {
  background-color: #6c757d !important;
  color: #fff !important;
}

/* 图标颜色调整 */
.dark .text-black {
  color: #e0e0e0 !important;
}

/* 表格响应式容器 */
.dark .table-responsive {
  border-color: #404040 !important;
}

/* 日期时间和特殊内容样式 */
.dark .small {
  color: #d0d0d0 !important;
}

.dark .text-secondary {
  color: #c0c0c0 !important;
}

/* 优化所有文本的基础对比度 */
.dark div,
.dark span:not(.badge),
.dark td:not(.badge),
.dark th {
  color: #f0f0f0 !important;
}

/* 确保时间戳等小字体可见 */
.dark .text-xs,
.dark .small,
.dark small {
  color: #d5d5d5 !important;
}

/* 应用名称和重要信息高亮 */
.dark .fw-semibold {
  color: #ffffff !important;
  font-weight: 600 !important;
}

/* 特定页面元素颜色修复 */
/* 软件管理页面 */
.dark #section-apps .table td:first-child,
.dark #section-apps .table td:nth-child(2) {
  color: #ffffff !important;
  font-weight: 500 !important;
}

.dark #section-apps .table td:nth-child(5) {
  color: #d5d5d5 !important; /* 创建时间列 */
}

/* 公告管理页面 */
.dark #section-announcements .table td {
  color: #f0f0f0 !important;
}

.dark #section-announcements .table td:nth-child(2) {
  color: #e8e8e8 !important; /* 公告内容 */
}

/* 激活码管理页面 */
.dark #section-activation-codes .table td {
  color: #f0f0f0 !important;
}

/* 账号管理页面 */
.dark #section-acl .table td {
  color: #f0f0f0 !important;
}

/* 会话管理页面 */
.dark #section-sessions .table td {
  color: #f0f0f0 !important;
}

/* 通用表格文本强化 */
.dark table tbody tr td {
  color: #f0f0f0 !important;
}

.dark table tbody tr td * {
  color: inherit !important;
}

/* APP标识高亮 */
.dark .text-primary strong,
.dark strong.text-primary {
  color: #87ceeb !important;
}

/* 确保所有普通文本都有足够对比度 */
.dark body,
.dark body * {
  color: #f0f0f0;
}

/* 强制覆盖Bootstrap默认的文字颜色 */
.dark .table-dark {
  --bs-table-color: #f0f0f0 !important;
  --bs-table-bg: #1a1a1a !important;
}

.dark .table > :not(caption) > * > * {
  color: #f0f0f0 !important;
}

/* 强制所有表格单元格文字为亮色 */
.dark td,
.dark th {
  color: #f0f0f0 !important;
}

.dark td *,
.dark th * {
  color: inherit !important;
}

/* 重要元素高优先级样式 */
.dark .table tbody tr td strong {
  color: #ffffff !important;
  font-weight: 600 !important;
}

.dark .table tbody tr td small {
  color: #d5d5d5 !important;
}

.dark .table tbody tr td code {
  background-color: #2a2a2a !important;
  color: #87ceeb !important;
  padding: 2px 4px !important;
  border-radius: 3px !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .dark #sidebar {
    background-color: #1a1a1a !important;
  }
}

/* 滚动条样式（WebKit浏览器） */
.dark ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.dark ::-webkit-scrollbar-track {
  background: #1a1a1a;
}

.dark ::-webkit-scrollbar-thumb {
  background: #404040;
  border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* 选择文本时的背景色 */
.dark ::selection {
  background-color: rgba(13, 110, 253, 0.3);
  color: #fff;
}

.dark ::-moz-selection {
  background-color: rgba(13, 110, 253, 0.3);
  color: #fff;
}

.dark .table tbody tr:hover td {
  background-color: #2d2d2d !important;
  color: #ffffff !important;
}

/* 在线会话表格悬停效果优化 */
/* 普通模式下的灰色悬停效果 */
.table-hover > tbody > tr:hover > td {
  background-color: #e9ecef !important;
  color: #495057 !important;
}

/* 在线会话：账号汇总行固定灰色背景 */
/* 普通模式下的灰色背景 */
.account-summary-row td {
  background-color: #f8f9fa !important;
  color: #495057 !important;
}
.account-summary-row:hover td {
  background-color: #e9ecef !important;
  color: #000000 !important;
}
.account-summary-row:hover td *,
.account-summary-row:hover td strong,
.account-summary-row:hover td span,
.account-summary-row:hover td small,
.account-summary-row:hover td button,
.account-summary-row:hover .badge,
.account-summary-row:hover .text-primary,
.account-summary-row:hover .text-muted {
  color: #000000 !important;
}

/* 特别针对表格悬停状态的强制样式 - v1.0 */
.table tbody .account-summary-row:hover td,
.table tbody .account-summary-row:hover td * {
  color: #000000 !important;
}

/* 覆盖所有可能的文字颜色样式 */
.account-summary-row:hover td,
.account-summary-row:hover td *:not(.badge):not(.btn) {
  color: #000000 !important;
}

/* 覆盖Bootstrap表格警告样式 */
.table-warning.account-summary-row:hover td,
.table-warning.account-summary-row:hover td *,
.table-success.account-summary-row:hover td,
.table-success.account-summary-row:hover td *,
tr.account-summary-row:hover td,
tr.account-summary-row:hover td * {
  color: #000000 !important;
}

/* 普通模式下强制黑色文字 */
:not(.dark) .account-summary-row:hover td,
:not(.dark) .account-summary-row:hover td *,
:not(.dark) tr.account-summary-row:hover td,
:not(.dark) tr.account-summary-row:hover td * {
  color: #000000 !important;
}

/* 暗黑模式下的账号汇总行 */
.dark .account-summary-row td {
  background-color: #2a2a2a !important;
  color: #f0f0f0 !important;
}
.dark .account-summary-row:hover td {
  background-color: #3a3a3a !important;
  color: #ffffff !important;
}
/* 展开状态（有 chevron-down 时）进一步加深 */
.dark .account-summary-row.expanded td {
  background-color: #404040 !important;
  color: #ffffff !important;
}

/* 暗黑模式下的灰色悬停效果 */
.dark .table-hover > tbody > tr:hover > td {
  background-color: #2d2d2d !important;
  color: #ffffff !important;
}