/* ============================================================
   全局主题设置 + 语言切换（顶部导航按钮 / 弹窗 / 下拉）
   ============================================================ */

/* ===== 顶部按钮 ===== */
.kx-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    background: #fff;
    color: #4a5568;
    font-size: .85rem;
    cursor: pointer;
    transition: all .15s;
    padding: 0;
    text-decoration: none;
    flex-shrink: 0;
}
.kx-nav-btn:hover { border-color: #4a6cf7; color: #4a6cf7; background: #eef2ff; }
.kx-nav-btn.kx-active { border-color: #4a6cf7; color: #4a6cf7; background: #eef2ff; }
.navbar-top .nav-right .kx-nav-btn { margin-right: 2px; }
.mobile-header .header-actions .kx-nav-btn { width: 32px; height: 32px; font-size: .8rem; margin-left: 4px; }

/* ===== 弹窗 / 下拉（fixed 定位，居中/靠右） ===== */
.kx-pop {
    position: fixed;
    background: #fff;
    border: 1px solid #e8ecf1;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .14);
    z-index: 1200;
    display: none;
    padding: 16px;
    min-width: 240px;
}
.kx-pop.kx-open { display: block; }
.kx-pop.kx-anchor-right { right: 16px; top: 60px; }
.kx-pop.kx-anchor-left { left: 16px; top: 60px; }

/* ===== 主题弹窗 ===== */
.kx-theme-pop .kx-pop-title { font-size: .9rem; font-weight: 700; color: #1a1a2e; margin-bottom: 8px; }
.kx-theme-pop .kx-sec { margin-top: 12px; }
.kx-theme-pop .kx-sec-label { font-size: .8rem; color: #64748b; margin-bottom: 8px; font-weight: 600; }
.kx-theme-pop .kx-mode-row { display: flex; gap: 8px; }
.kx-theme-pop .kx-mode {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border: 2px solid #e8ecf1;
    border-radius: 10px;
    padding: 10px 6px;
    cursor: pointer;
    background: #fff;
    transition: all .15s;
    color: #4a5568;
}
.kx-theme-pop .kx-mode i { font-size: 1.1rem; }
.kx-theme-pop .kx-mode span { font-size: .72rem; }
.kx-theme-pop .kx-mode.kx-sel { border-color: #4a6cf7; background: #eef2ff; color: #4a6cf7; }
.kx-theme-pop .kx-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.kx-theme-pop .kx-color {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .15s;
    position: relative;
}
.kx-theme-pop .kx-color.kx-sel { border-color: #1a1a2e; box-shadow: 0 0 0 2px #fff inset; }
.kx-theme-pop .kx-color.kx-sel::after {
    content: "✓";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,.3);
}

/* ===== 语言下拉 ===== */
.kx-lang-pop { padding: 8px; min-width: 150px; }
.kx-lang-pop .kx-lang-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    border: none;
    background: none;
    border-radius: 8px;
    font-size: .88rem;
    color: #1f2937;
    cursor: pointer;
    transition: background .15s;
}
.kx-lang-pop .kx-lang-item:hover { background: #f1f5f9; }
.kx-lang-pop .kx-lang-item.kx-sel { background: #eef2ff; color: #4a6cf7; font-weight: 600; }

/* ============================================================
   主题变量（主题色）
   ============================================================ */
body { --kx-primary: #4a6cf7; --kx-primary-soft: #eef2ff; }
body[data-color="red"]    { --kx-primary: #e53e3e; --kx-primary-soft: #fff1f1; }
body[data-color="green"]  { --kx-primary: #10b981; --kx-primary-soft: #ecfdf5; }
body[data-color="purple"] { --kx-primary: #8b5cf6; --kx-primary-soft: #f5f3ff; }
body[data-color="orange"] { --kx-primary: #f59e0b; --kx-primary-soft: #fffbeb; }
body[data-color="pink"]   { --kx-primary: #ec4899; --kx-primary-soft: #fdf2f8; }
body[data-color="teal"]   { --kx-primary: #14b8a6; --kx-primary-soft: #f0fdfa; }
body[data-color="indigo"] { --kx-primary: #6366f1; --kx-primary-soft: #eef2ff; }

/* 主题色覆盖主要蓝色元素 */
body .forum-search-bar button,
body .mobile-search button,
body .forum-search-bar button:hover,
body .kx-theme-pop .kx-mode.kx-sel,
body .kx-theme-pop .kx-color.kx-sel { background-color: var(--kx-primary); }
body .forum-search-bar button { border-color: var(--kx-primary); }
body .search-page-card button { background: var(--kx-primary); }
body .tab-item.active { color: var(--kx-primary); }
body .nav-right a:hover,
body .post-title .title-link:hover,
body .breadcrumb-nav a,
body .pagination .page-link,
body .forum-search-bar .hk-chip,
body .kx-lang-pop .kx-lang-item.kx-sel { color: var(--kx-primary); }
body .badge-category,
body .hk-chip,
body .forum-tab-nav .tab-item.active { background-color: var(--kx-primary-soft); }
body .mobile-bottom-nav .nav-item.active,
body .mobile-bottom-nav .nav-item.active i { color: var(--kx-primary); }
body .btn-publish,
body .btn-recharge,
body .back-to-top,
body .cat-search-card button { background: var(--kx-primary); }

/* ============================================================
   夜间模式
   ============================================================ */
body[data-theme="dark"] { background: #111827; color: #e5e7eb; }
body[data-theme="dark"] .navbar-top,
body[data-theme="dark"] .mobile-header,
body[data-theme="dark"] .site-footer,
body[data-theme="dark"] .mobile-bottom-nav,
body[data-theme="dark"] .search-page-card,
body[data-theme="dark"] .forum-box,
body[data-theme="dark"] .home-sections,
body[data-theme="dark"] .forum-sections,
body[data-theme="dark"] .forum-search-bar,
body[data-theme="dark"] .breadcrumb-nav,
body[data-theme="dark"] .cat-search-card,
body[data-theme="dark"] .sidebar-card,
body[data-theme="dark"] .hot-card,
body[data-theme="dark"] .result-stats,
body[data-theme="dark"] .hot-keywords,
body[data-theme="dark"] .pagination .page-link,
body[data-theme="dark"] .mobile-category-nav,
body[data-theme="dark"] .kx-pop,
body[data-theme="dark"] .kx-nav-btn { background: #1f2937; border-color: #374151; color: #e5e7eb; }
body[data-theme="dark"] .forum-post-card,
body[data-theme="dark"] .fs-card,
body[data-theme="dark"] .hs-card { background: #1f2937; border-color: #374151; }
body[data-theme="dark"] .forum-box .forum-tab-nav,
body[data-theme="dark"] .home-sections .hs-head,
body[data-theme="dark"] .forum-sections .fs-head,
body[data-theme="dark"] .mobile-header { background: #111827; border-color: #374151; }
body[data-theme="dark"] .post-title .title-link,
body[data-theme="dark"] .hs-name,
body[data-theme="dark"] .fs-name,
body[data-theme="dark"] .cat-name,
body[data-theme="dark"] .forum-page-title,
body[data-theme="dark"] .announcement-item .ann-title,
body[data-theme="dark"] .logo { color: #f3f4f6; }
body[data-theme="dark"] .post-meta,
body[data-theme="dark"] .post-info,
body[data-theme="dark"] .time,
body[data-theme="dark"] .hs-cnt,
body[data-theme="dark"] .fs-cnt,
body[data-theme="dark"] .post-count,
body[data-theme="dark"] .forum-search-bar select,
body[data-theme="dark"] .forum-search-bar input,
body[data-theme="dark"] .mobile-search input,
body[data-theme="dark"] .cat-search-card select,
body[data-theme="dark"] .cat-search-card input { color: #9ca3af; background: #111827; border-color: #374151; }
body[data-theme="dark"] .forum-search-bar select option,
body[data-theme="dark"] .cat-search-card select option { background: #1f2937; color: #e5e7eb; }
body[data-theme="dark"] .forum-post-item,
body[data-theme="dark"] .announcement-item,
body[data-theme="dark"] .home-sections .hs-card,
body[data-theme="dark"] .home-sections .hs-head,
body[data-theme="dark"] .forum-box .sticky-item { border-color: #374151; }
body[data-theme="dark"] .forum-post-item:hover,
body[data-theme="dark"] .fs-card:hover,
body[data-theme="dark"] .hs-card:hover { background: #26313f; }
body[data-theme="dark"] .kx-pop .kx-pop-title,
body[data-theme="dark"] .kx-theme-pop .kx-sec-label { color: #e5e7eb; }
body[data-theme="dark"] .kx-lang-pop .kx-lang-item { color: #e5e7eb; }
body[data-theme="dark"] .kx-lang-pop .kx-lang-item:hover { background: #374151; }
body[data-theme="dark"] .kx-lang-pop .kx-lang-item.kx-sel { background: var(--kx-primary-soft); color: var(--kx-primary); }
body[data-theme="dark"] .kx-theme-pop .kx-mode { background: #1f2937; border-color: #374151; color: #9ca3af; }
body[data-theme="dark"] .kx-theme-pop .kx-mode.kx-sel { background: var(--kx-primary-soft); color: var(--kx-primary); border-color: var(--kx-primary); }
body[data-theme="dark"] .empty-state-custom { color: #9ca3af; }
body[data-theme="dark"] .footer-copy,
body[data-theme="dark"] .footer-tech { color: #6b7280; }

/* ===== 夜间模式补充覆盖（首页/论坛/帖子/播放器等全部浅色容器） ===== */
body[data-theme="dark"] .news-feed,
body[data-theme="dark"] #articleList .forum-post-item,
body[data-theme="dark"] .forum-post-item { background: #1f2937; border-color: #374151; }
body[data-theme="dark"] .category-bar,
body[data-theme="dark"] .hot-tags,
body[data-theme="dark"] .flash-item { background: #1f2937; border-color: #374151; }
body[data-theme="dark"] .date-header { color: #f3f4f6; border-color: #374151; }
body[data-theme="dark"] .date-header .day-week { color: #9ca3af; }
body[data-theme="dark"] .forum-banner { background: #1f2937; border-color: #374151; }
body[data-theme="dark"] .forum-tab-nav { background: #1f2937; border-color: #374151; }
body[data-theme="dark"] .empty-state-custom,
body[data-theme="dark"] .empty-state { background: #1f2937; border-color: #374151; color: #9ca3af; }
body[data-theme="dark"] .ad-placeholder,
body[data-theme="dark"] .footer-custom { background: #1f2937; border-color: #374151; }
body[data-theme="dark"] .follow-section { background: #1f2937; border-color: #374151; }
body[data-theme="dark"] .follow-section .follow-links a { background: #111827; border-color: #374151; color: #9ca3af; }
body[data-theme="dark"] .article-card { background: #1f2937; border-color: #374151; }
body[data-theme="dark"] .article-content blockquote { background: #111827; border-color: #374151; color: #cbd5e1; }
body[data-theme="dark"] .article-content .vip-content { background: #0f2e22; border-color: #2f7a4d; }
body[data-theme="dark"] .article-content .vip-locked { background: #332b12; border-color: #8a6d1a; }
body[data-theme="dark"] .article-content .svip-content { background: #241f3d; border-color: #6d4fa3; }
body[data-theme="dark"] .files-section { background: #111827; border-color: #374151; }
body[data-theme="dark"] .files-section .file-item { background: #1f2937; border-color: #374151; }
body[data-theme="dark"] .audio-list-player { background: #111827; border-color: #374151; }
body[data-theme="dark"] .audio-playlist-item:hover,
body[data-theme="dark"] .audio-controls button:hover { background: #26313f; }
body[data-theme="dark"] .audio-download-btn:hover { background: var(--kx-primary); }
body[data-theme="dark"] .badge-category,
body[data-theme="dark"] .post-title .badge-category { background: #1e3a5f; color: #93c5fd; }
body[data-theme="dark"] .category-badge { background: #1e3a5f; color: #93c5fd; }
body[data-theme="dark"] .mobile-category-nav .category-scroll a,
body[data-theme="dark"] .category-bar .category-item { color: #9ca3af; }
body[data-theme="dark"] .mobile-category-nav .category-scroll a:hover,
body[data-theme="dark"] .category-bar .category-item:hover { background: #374151; color: #e5e7eb; }
body[data-theme="dark"] .hot-item a { color: #cbd5e1; }
body[data-theme="dark"] .hot-item .hot-views { color: #6b7280; }
body[data-theme="dark"] .post-info .time { color: #9ca3af; }
body[data-theme="dark"] .load-more-btn { background: #1f2937; border-color: #374151; color: #e5e7eb; }
body[data-theme="dark"] .load-more-btn:hover { background: #26313f; }
body[data-theme="dark"] .pagination-custom .page-item .page-link { background: #1f2937; border-color: #374151; color: #9ca3af; }
body[data-theme="dark"] .pagination-custom .page-item .page-link:hover { background: #26313f; color: var(--kx-primary); }
body[data-theme="dark"] .stat-item,
body[data-theme="dark"] .post-meta,
body[data-theme="dark"] .post-header { color: #9ca3af; }
body[data-theme="dark"] .fs-desc,
body[data-theme="dark"] .cat-desc,
body[data-theme="dark"] .announcement-item .ann-content { color: #9ca3af; }
body[data-theme="dark"] .announcement-item .ann-time { color: #6b7280; }
body[data-theme="dark"] .comment-item,
body[data-theme="dark"] .comment-content { color: #cbd5e1; }
body[data-theme="dark"] .post-view,
body[data-theme="dark"] .post-replies,
body[data-theme="dark"] .quick-reply,
body[data-theme="dark"] .post-author { background: #1f2937; border-color: #374151; }
body[data-theme="dark"] .action-select,
body[data-theme="dark"] select.action-select { background: #1f2937; color: #e5e7eb; border-color: #374151; }
body[data-theme="dark"] .post-author .username,
body[data-theme="dark"] .post-title,
body[data-theme="dark"] .reply-title { color: #f3f4f6; }
/* 通用输入控件（评论框/搜索框/下拉等） */
body[data-theme="dark"] textarea,
body[data-theme="dark"] input[type="text"],
body[data-theme="dark"] input[type="password"],
body[data-theme="dark"] input[type="email"],
body[data-theme="dark"] input[type="number"],
body[data-theme="dark"] select { background: #111827; color: #e5e7eb; border-color: #374151; }
body[data-theme="dark"] ::placeholder { color: #6b7280; }
body[data-theme="dark"] .quick-reply textarea { background: #111827; }
/* 搜索页/版块页容器 */
body[data-theme="dark"] .forum-list { background: #1f2937; border-color: #374151; }
body[data-theme="dark"] .cat-grid-card,
body[data-theme="dark"] .batch-bar,
body[data-theme="dark"] .top-list,
body[data-theme="dark"] .subtype-bar { background: #1f2937; border-color: #374151; }
body[data-theme="dark"] .action-select,
body[data-theme="dark"] select.action-select { background: #111827 !important; color: #e5e7eb !important; }
body[data-theme="dark"] select { background: #111827 !important; color: #e5e7eb !important; }
body[data-theme="dark"] .btn-batch,
body[data-theme="dark"] .btn-batch-danger { background: #1f2937; color: #e5e7eb; border-color: #374151; }

/* ============================================================
   护眼模式（柔和绿）
   ============================================================ */
body[data-theme="eye"] { background: #f2f7ec; }
body[data-theme="eye"] .navbar-top,
body[data-theme="eye"] .mobile-header,
body[data-theme="eye"] .site-footer,
body[data-theme="eye"] .mobile-bottom-nav,
body[data-theme="eye"] .search-page-card,
body[data-theme="eye"] .forum-box,
body[data-theme="eye"] .home-sections,
body[data-theme="eye"] .forum-sections,
body[data-theme="eye"] .forum-search-bar,
body[data-theme="eye"] .breadcrumb-nav,
body[data-theme="eye"] .cat-search-card,
body[data-theme="eye"] .sidebar-card,
body[data-theme="eye"] .hot-card,
body[data-theme="eye"] .result-stats,
body[data-theme="eye"] .hot-keywords,
body[data-theme="eye"] .pagination .page-link,
body[data-theme="eye"] .forum-post-card,
body[data-theme="eye"] .fs-card,
body[data-theme="eye"] .hs-card { background: #fbfdf6; border-color: #dce8d2; }
body[data-theme="eye"] .forum-box .forum-tab-nav,
body[data-theme="eye"] .home-sections .hs-head,
body[data-theme="eye"] .forum-sections .fs-head,
body[data-theme="eye"] .mobile-header { background: #eef4e4; border-color: #dce8d2; }
body[data-theme="eye"] .forum-post-item,
body[data-theme="eye"] .announcement-item,
body[data-theme="eye"] .home-sections .hs-card { border-color: #dce8d2; }
body[data-theme="eye"] .post-title .title-link,
body[data-theme="eye"] .hs-name,
body[data-theme="eye"] .fs-name,
body[data-theme="eye"] .forum-page-title { color: #2f4a2f; }
body[data-theme="eye"] .post-meta,
body[data-theme="eye"] .post-info,
body[data-theme="eye"] .time,
body[data-theme="eye"] .hs-cnt,
body[data-theme="eye"] .fs-cnt,
body[data-theme="eye"] .forum-search-bar input,
body[data-theme="eye"] .forum-search-bar select { color: #5c6e5c; }

/* 移动端弹窗定位 */
@media (max-width: 768px) {
    .kx-pop.kx-anchor-right { right: 10px; top: 58px; }
    .kx-pop.kx-anchor-left { left: 10px; top: 58px; }
    .kx-theme-pop { min-width: 200px; }
}
