/* =========================================================
   全局浅色主题覆盖 —— 在各页面 </head> 前最后引入，
   统一将系统由深色科技风切换为清爽浅色风格。
   使用 !important 压过各页面内嵌的深色硬编码样式。
   ========================================================= */

/* CSS 变量整体翻转为浅色（变量名保持不变，所有引用处自动生效） */
:root {
    --dark-bg: #f5f7fb;
    --dark-card: #ffffff;
    --dark-hover: #eef2f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e5eaf2;
    --shadow: rgba(15, 23, 42, 0.08);
    --glass: rgba(255, 255, 255, 0.92);
}

body {
    background-color: #f5f7fb !important;
    color: #1e293b !important;
}

/* 去掉深色科技背景（网格 + 光球） */
.tech-bg {
    display: none !important;
}

/* ===== 卡片 / 模态框 / 面板 ===== */
.main-card,
.game-card,
.modal-content,
.stat-card,
.chart-card {
    background: #ffffff !important;
    border: 1px solid #e5eaf2 !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
    backdrop-filter: none !important;
}

.main-card:hover,
.game-card:hover {
    border-color: #c3d0f5 !important;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12) !important;
}

.modal-header {
    border-bottom: 1px solid #e5eaf2 !important;
}

/* ===== 表单控件 ===== */
.form-control,
.form-select,
.form-textarea,
.link-input,
.date-display,
.notification-btn,
.menu-toggle,
.search-input-wrap .form-control {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid #e5eaf2 !important;
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus,
.search-input-wrap .form-control:focus {
    background: #ffffff !important;
    color: #1e293b !important;
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.15) !important;
}

.form-control::placeholder,
.form-select::placeholder,
.form-textarea::placeholder {
    color: #94a3b8 !important;
}

.form-text {
    color: #94a3b8 !important;
}

.text-muted {
    color: #94a3b8 !important;
}

/* ===== 侧边栏（片段样式在 body 内，用 body 前缀提高优先级） ===== */
body .sidebar {
    background: #ffffff !important;
    border-right: 1px solid #e5eaf2 !important;
    backdrop-filter: none !important;
}

body .sidebar .logo {
    border-bottom: 1px solid #e5eaf2 !important;
}

body .sidebar .logo-text h2 {
    color: #1e293b !important;
}

body .sidebar .nav-link {
    color: #64748b !important;
}

body .sidebar .nav-link:hover {
    background: #eef3fe !important;
    color: #4f46e5 !important;
}

body .sidebar .nav-link.active {
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25) !important;
}

body .sidebar .user-profile {
    border-top: 1px solid #e5eaf2 !important;
}

body .sidebar .user-details h4 {
    color: #1e293b !important;
}

body .sidebar .user-details p {
    color: #64748b !important;
}

body .sidebar .logout-btn {
    background: #fef2f2 !important;
    color: #ef4444 !important;
    border: 1px solid #fecaca !important;
}

body .sidebar .logout-btn:hover {
    background: #fee2e2 !important;
}

body .sidebar .menu-toggle {
    background: #ffffff !important;
    border: 1px solid #e5eaf2 !important;
    color: #1e293b !important;
}

/* ===== 按钮 ===== */
.btn-outline {
    background: transparent !important;
    color: #475569 !important;
    border: 1px solid #d7dfeb !important;
}

.btn-outline:hover {
    background: #eef3fe !important;
    border-color: #6366f1 !important;
    color: #4f46e5 !important;
}

/* ===== 提示 / 徽章（半透明色在白底上对比度足够，仅文字微调） ===== */
.badge-success {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #0d9668 !important;
    border: 1px solid rgba(16, 185, 129, 0.25) !important;
}

/* ===== 通知链接块（游戏卡内的监测链接） ===== */
.notify-links {
    background: #f8fafc !important;
    border: 1px solid #eef2f8;
}

/* 游戏卡统计区分隔线 */
.game-stats {
    border-top: 1px solid #eef2f8 !important;
}

/* 回传记录等页面的 JSON/代码预览块 */
.modal-body pre,
pre.code-block {
    background: #f8fafc !important;
    color: #334155 !important;
    border: 1px solid #eef2f8;
}

.empty-icon {
    background: #eef3fe !important;
    color: #6366f1 !important;
}

/* ===== 通用表格 ===== */
.table {
    color: #1e293b !important;
}

.table > :not(caption) > * > * {
    background-color: transparent !important;
    color: #1e293b !important;
    border-bottom-color: #e5eaf2 !important;
}

/* ===== 各页面自定义深色组件 ===== */
/* 数据表格（实时数据/回传记录/流量主查询/游戏用户管理） */
.data-table {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid #eef2f8 !important;
}

.data-table th {
    background: #f8fafc !important;
    color: #475569 !important;
    border-bottom: 1px solid #e5eaf2 !important;
}

.data-table td {
    color: #1e293b !important;
    border-bottom: 1px solid #eef2f8 !important;
}

.data-table tbody tr:hover td {
    background: #fafbff !important;
}

/* 过滤区（游戏用户管理） */
.filter-container {
    background: #f8fafc !important;
    border: 1px solid #eef2f8 !important;
}

.filter-select {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid #e5eaf2 !important;
}

.filter-select:focus {
    background: #ffffff !important;
    color: #1e293b !important;
    border-color: #6366f1 !important;
}

/* 数据导出页 */
.export-card {
    background: #ffffff !important;
    border: 1px solid #e5eaf2 !important;
}

.feature-item {
    background: #f8fafc !important;
    border: 1px solid #eef2f8;
}

.progress {
    background: #eef2f9 !important;
}

/* 游戏编辑页 eCPM 数据块 */
.ecpm-data {
    background: #f8fafc !important;
    border: 1px solid #eef2f8 !important;
}

/* 分页按钮（回传记录） */
.pagination button {
    background: #ffffff !important;
    color: #475569 !important;
    border: 1px solid #e5eaf2 !important;
}

.pagination button:hover {
    background: #eef3fe !important;
    color: #4f46e5 !important;
    border-color: #6366f1 !important;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d3dbe7; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b9c5d6; }

/* ===== 紧凑密度：更多数据 ===== */
body { font-size: 13px; line-height: 1.45; }
.page-header { margin-bottom: 16px; padding-bottom: 10px; }
.page-header h2 { font-size: 20px; }
.card { padding: 16px; border-radius: 8px; }
.data-table td, .data-table th { padding: 8px 10px; font-size: 13px; }
.table th { padding: 9px 10px; font-size: 12px; text-transform: uppercase; }
.form-control, .filter-select { padding: 5px 10px; font-size: 13px; height: 32px; }
.btn { padding: 6px 14px; font-size: 13px; }
.export-card { padding: 14px; }
.ecpm-data .small { font-size: 16px; }
.d-flex { gap: 10px; }
.mb-4 { margin-bottom: 14px !important; }
.mb-3 { margin-bottom: 10px !important; }
.mt-4 { margin-top: 14px !important; }
.mt-3 { margin-top: 10px !important; }
.gap-2 { gap: 8px !important; }
.pagination .page-link { padding: 5px 10px; font-size: 13px; }

/* ===== 各页面内联 rem 覆盖 ===== */
.page-header h2, .page-title h2 { font-size: 20px !important; margin-bottom: 4px !important; }
.card { padding: 16px !important; border-radius: 8px !important; }
.card h3 { font-size: 18px !important; margin-bottom: 8px !important; }
.stat-card { padding: 14px !important; }
.stat-card .stat-value { font-size: 22px !important; }
.stat-card .stat-label { font-size: 12px !important; }
.table th, .table td, .data-table th, .data-table td { padding: 8px 10px !important; font-size: 13px !important; }
.form-control, .filter-select { padding: 5px 10px !important; font-size: 13px !important; height: 32px !important; }
.btn { padding: 6px 14px !important; font-size: 13px !important; }
.filter-bar { padding: 12px !important; margin-bottom: 16px !important; }
.mb-4 { margin-bottom: 14px !important; }
.mb-3 { margin-bottom: 10px !important; }
.mt-4 { margin-top: 14px !important; }
.mt-3 { margin-top: 10px !important; }
.d-flex { gap: 10px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }
.ecpm-data .small { font-size: 16px !important; }
.ecpm-data .large { font-size: 24px !important; }
.game-card { padding: 16px !important; }
.game-card h4 { font-size: 17px !important; }
.game-card .game-info { font-size: 12px !important; }
.game-card .actions .btn { padding: 5px 12px !important; font-size: 12px !important; }

/* ===== 广告配置表格 ===== */
.config-table thead th { padding: 0.4rem 0.5rem !important; font-size: 0.75rem !important; }
.config-table tbody td { padding: 0.45rem 0.5rem !important; font-size: 0.82rem !important; }
.cell-input { width: 56px !important; padding: 0.25rem 0.35rem !important; font-size: 0.78rem !important; }
.id-input { min-width: 140px !important; padding: 0.25rem 0.4rem !important; font-size: 0.74rem !important; }
.id-label { font-size: 0.68rem !important; margin-bottom: 0.1rem !important; }
.id-block + .id-block { margin-top: 0.35rem !important; }
.btn-edit-link { padding: 0.3rem 0.55rem !important; font-size: 0.76rem !important; }
.game-mpid { font-size: 0.72rem !important; }
.switch-state { font-size: 0.72rem !important; }
.form-switch .form-check-input { width: 2.2em !important; height: 1.2em !important; }
td.switch-cell { min-width: 100px !important; }

/* ===== 游戏管理卡片 ===== */
.game-card { padding: 12px !important; border-radius: 8px !important; }
.game-card h5 { font-size: 15px !important; margin-bottom: 4px !important; }
.game-card .game-meta { font-size: 0.72rem !important; }
.game-card .game-meta div { line-height: 1.3 !important; }
.game-card .sync-indicator { font-size: 0.72rem !important; margin-bottom: 8px !important; }
.game-card .game-stats { gap: 8px !important; margin-top: 8px !important; }
.game-card .stat-item .stat-value { font-size: 14px !important; font-weight: 600 !important; }
.game-card .stat-item .stat-label { font-size: 0.68rem !important; color: #6b7280 !important; }
.game-card .d-flex.mb-3 { margin-bottom: 6px !important; }
.game-card .mb-3 { margin-bottom: 6px !important; }
.badge { font-size: 0.68rem !important; padding: 0.25em 0.5em !important; }

/* ===== 实时数据页面 ===== */
.main-card { padding: 14px !important; margin-bottom: 14px !important; }
.main-card-header { margin-bottom: 10px !important; padding-bottom: 8px !important; border-bottom: 1px solid #e5eaf2 !important; }
.main-card-title { font-size: 15px !important; margin-bottom: 0 !important; }
.main-card-title i { font-size: 14px !important; }
.stats-grid { gap: 10px !important; }
.stat-card { padding: 12px !important; }
.stat-card .stat-value { font-size: 18px !important; margin-bottom: 2px !important; }
.stat-card .stat-label { font-size: 0.72rem !important; }
.data-table thead th { padding: 6px 8px !important; font-size: 0.75rem !important; }
.data-table tbody td { padding: 6px 8px !important; font-size: 0.8rem !important; }
.form-label { font-size: 0.8rem !important; margin-bottom: 4px !important; }
.btn-outline { padding: 5px 12px !important; font-size: 0.8rem !important; }
.date-picker-buttons .btn { padding: 4px 10px !important; font-size: 0.75rem !important; }
.badge { font-size: 0.68rem !important; }
#recordsInfo { font-size: 0.78rem !important; }
#recordsCount { font-size: 0.72rem !important; }
.table-responsive { max-height: none !important; overflow-y: visible !important; }

/* ===== 搜索框：恢复图标占位 ===== */
.search-input-wrap { position: relative; }
.search-input-wrap .form-control { padding: 5px 32px 5px 34px !important; height: 34px !important; }
.search-input-wrap .fa-search,
.search-input-wrap > i:first-child { left: 11px !important; font-size: 0.8rem !important; }
.search-input-wrap .search-clear { right: 9px !important; font-size: 0.85rem !important; }
