/**
 * 暗色模式覆盖样式（html[data-theme="dark"] 时生效）
 * 版本号: V.0002
 *
 * 策略说明：覆盖式暗色主题——背景/卡片/表格/表单/弹窗等切换为深色，
 * ECharts 经 qaInitChart 使用内置 dark 主题渲染，容器透明继承卡片深色背景。
 */

html[data-theme="dark"] body {
    background: #14171c;
    color: #cfd6e1;
}

/* ---------- 卡片与容器 ---------- */
html[data-theme="dark"] .card,
html[data-theme="dark"] .info-card,
html[data-theme="dark"] .highlight-card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .analysis-toc,
html[data-theme="dark"] .toast {
    background-color: #1d2128;
    color: #cfd6e1;
    border-color: #2c323c;
}
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .info-card .card-header,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
    background-color: #22272f;
    color: #dbe2ec;
    border-color: #2c323c;
}
html[data-theme="dark"] .card-header.bg-light,
html[data-theme="dark"] .card-header.bg-white { background-color: #22272f !important; color: #dbe2ec; }
html[data-theme="dark"] .bg-light { background-color: #22272f !important; color: #cfd6e1; }
html[data-theme="dark"] .bg-white { background-color: #1d2128 !important; color: #cfd6e1; }
html[data-theme="dark"] footer.bg-light { background-color: #181b20 !important; }

/* 导航栏保持品牌深蓝，无需覆盖 */

/* ---------- 文字 ---------- */
html[data-theme="dark"] .text-muted { color: #8b94a3 !important; }
html[data-theme="dark"] .text-dark { color: #dbe2ec !important; }
html[data-theme="dark"] .text-body { color: #cfd6e1 !important; }
html[data-theme="dark"] h1, html[data-theme="dark"] h2, html[data-theme="dark"] h3,
html[data-theme="dark"] h4, html[data-theme="dark"] h5, html[data-theme="dark"] h6 { color: #e2e8f2; }
html[data-theme="dark"] .home-hero h1 { color: #e2e8f2; }
html[data-theme="dark"] .home-hero p.lead { color: #8b94a3; }

/* ---------- 表格 ---------- */
html[data-theme="dark"] .table {
    color: #cfd6e1;
    border-color: #2c323c;
    --bs-table-bg: transparent;
    --bs-table-striped-bg: #21262e;
    --bs-table-hover-bg: #262c36;
    --bs-table-hover-color: #dbe2ec;
}
html[data-theme="dark"] .table th, html[data-theme="dark"] .table td { border-color: #2c323c; }
html[data-theme="dark"] .table-light, html[data-theme="dark"] thead.table-light {
    background-color: #22272f; color: #dbe2ec;
    --bs-table-bg: #22272f; --bs-table-color: #dbe2ec;
}
html[data-theme="dark"] .table-secondary {
    --bs-table-bg: #2a303a; --bs-table-color: #dbe2ec;
}
html[data-theme="dark"] .table-warning {
    --bs-table-bg: #4a3c14; --bs-table-color: #ffe69c;
}

/* ---------- 表单 ---------- */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .input-group-text {
    background-color: #22272f; color: #dbe2ec; border-color: #3a414d;
}
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    background-color: #242a33; color: #e2e8f2;
    border-color: #4e6cff; box-shadow: 0 0 0 0.2rem rgba(78, 108, 255, 0.2);
}
html[data-theme="dark"] .form-control::placeholder { color: #6b7484; }
html[data-theme="dark"] .form-check-input:not(:checked) { background-color: #2c323c; border-color: #4a5260; }

/* ---------- 按钮 ---------- */
html[data-theme="dark"] .btn-light,
html[data-theme="dark"] .btn-outline-secondary {
    background-color: #262c36; color: #cfd6e1; border-color: #3a414d;
}
html[data-theme="dark"] .btn-light:hover,
html[data-theme="dark"] .btn-outline-secondary:hover { background-color: #2f3641; color: #e2e8f2; }
html[data-theme="dark"] .btn-outline-primary { color: #7d96ff; border-color: #4e6cff; }
html[data-theme="dark"] .btn-outline-primary:hover { background-color: #4e6cff; color: #fff; }

/* ---------- 标签页 / 折叠 / 列表 ---------- */
html[data-theme="dark"] .nav-tabs { border-color: #2c323c; }
html[data-theme="dark"] .nav-tabs .nav-link { color: #8b94a3; }
html[data-theme="dark"] .nav-tabs .nav-link.active {
    background-color: #1d2128; color: #7d96ff; border-color: #2c323c #2c323c #1d2128;
}
html[data-theme="dark"] .nav-tabs .nav-link:hover:not(.active) { border-color: #2c323c; color: #b6c0cf; }

/* ---------- 弹窗 / 警示框 / 徽章 ---------- */
html[data-theme="dark"] .alert-light { background-color: #22272f; color: #cfd6e1; border-color: #2c323c; }
html[data-theme="dark"] .alert-info { background-color: #15303f; color: #9fd4ee; border-color: #1d4356; }
html[data-theme="dark"] .alert-warning { background-color: #3d3014; color: #f3df9d; border-color: #54441e; }
html[data-theme="dark"] .badge.text-bg-light,
html[data-theme="dark"] .badge.bg-light { background-color: #2c323c !important; color: #cfd6e1 !important; }
html[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(180%); }

/* ---------- 首页定制区块 ---------- */
html[data-theme="dark"] .home-search-wrap .input-group { border-color: #2c323c; box-shadow: 0 6px 24px rgba(0,0,0,0.4); }
html[data-theme="dark"] .home-search-wrap .form-control { background: #1d2128; }
html[data-theme="dark"] #searchResults { background: #1d2128; border-color: #2c323c; color: #cfd6e1; }
html[data-theme="dark"] #searchResults .suggest-item { color: #cfd6e1; border-color: #262c36; }
html[data-theme="dark"] #searchResults .suggest-item:hover,
html[data-theme="dark"] #searchResults .suggest-item.active { background: #262c36; }
html[data-theme="dark"] .hero-hints .hint-chip { background: #1f2633; border-color: #2e3a52; }
html[data-theme="dark"] .history-chip { background: #22272f; border-color: #2c323c; color: #cfd6e1; }
html[data-theme="dark"] .history-chip:hover { background: #262c36; border-color: #3e5279; color: #7d96ff; }
html[data-theme="dark"] .highlight-card .feat-title { color: #dbe2ec; }
html[data-theme="dark"] .highlight-card .feat-tag { background: #1f2633; border-color: #2e3a52; }
html[data-theme="dark"] .section-title h5 { color: #dbe2ec; }

/* ---------- 分析页定制区块 ---------- */
html[data-theme="dark"] .toc-header { color: #8b94a3; border-color: #2c323c; }
html[data-theme="dark"] .toc-item { color: #b6c0cf; }
html[data-theme="dark"] .toc-item:hover { background: #262c36; }
html[data-theme="dark"] .toc-item.active { background: #1f2633; color: #7d96ff; }
html[data-theme="dark"] .layout-resizer { background: #2c323c; }
html[data-theme="dark"] .section-toggle:hover { background-color: #262c36 !important; }
html[data-theme="dark"] #signalSummaryBar .signal-chip.sig-pos { background: #3d1a1a; color: #ff9d9d; border-color: #5c2626; }
html[data-theme="dark"] #signalSummaryBar .signal-chip.sig-neg { background: #14321d; color: #7fd89a; border-color: #1e4a2b; }
html[data-theme="dark"] #signalSummaryBar .signal-chip.sig-warn { background: #3d3014; color: #f3df9d; border-color: #54441e; }
html[data-theme="dark"] #signalSummaryBar .signal-chip.sig-info { background: #15293f; color: #8fc2ff; border-color: #1d3c56; }
html[data-theme="dark"] #signalSummaryBar .signal-chip.sig-neutral { background: #2c323c; color: #b6c0cf; border-color: #3a414d; }

/* ---------- 对比页 ---------- */
html[data-theme="dark"] .compare-hero,
html[data-theme="dark"] .compare-table-card {
    background: #1d2128; border-color: #2c323c;
}
html[data-theme="dark"] .compare-hero h1 { color: #e2e8f2; }
html[data-theme="dark"] #compareTable thead th { background: #22272f; border-color: #2c323c; color: #dbe2ec; }
html[data-theme="dark"] #compareTable tbody th { background: #21262e; color: #8b94a3; }

/* ---------- 帮助页 ---------- */
html[data-theme="dark"] .help-hero,
html[data-theme="dark"] .help-toc,
html[data-theme="dark"] .help-section {
    background: #1d2128; border-color: #2c323c;
}
html[data-theme="dark"] .help-hero h1,
html[data-theme="dark"] .help-section h2,
html[data-theme="dark"] .help-section h3,
html[data-theme="dark"] .faq-q { color: #e2e8f2; }
html[data-theme="dark"] .help-section p,
html[data-theme="dark"] .help-section li,
html[data-theme="dark"] .faq-a,
html[data-theme="dark"] .help-toc a { color: #b6c0cf; }
html[data-theme="dark"] .help-toc a:hover { background: #262c36; }
html[data-theme="dark"] .help-toc a.active { background: #1f2633; color: #7d96ff; }
html[data-theme="dark"] .help-section .mini-card { background: #22272f; border-color: #2c323c; }
html[data-theme="dark"] .help-section .mini-card strong { color: #dbe2ec; }
html[data-theme="dark"] .help-section .tip { background: #1f2633; color: #a9bbdd; border-left-color: #4e6cff; }
html[data-theme="dark"] .help-section .warn { background: #3d3014; color: #d9c187; }
html[data-theme="dark"] .help-section code, html[data-theme="dark"] .help-section kbd {
    background: #262c36; border-color: #3a414d; color: #7d96ff;
}
html[data-theme="dark"] .help-section th { background: #22272f; color: #dbe2ec; }
html[data-theme="dark"] .help-section td { border-color: #2c323c; }
html[data-theme="dark"] .faq-item { border-color: #2c323c; }

/* ---------- ECharts：dark 主题由 qaInitChart 注入，容器透明继承卡片深色 ---------- */
html[data-theme="dark"] div[_echarts_instance_] {
    background: transparent;
}

/* ---------- 滚动条 ---------- */
html[data-theme="dark"] ::-webkit-scrollbar-track { background: #1d2128; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3a414d; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #4a5260; }
