/*
 * dark-mode.css
 *
 * 通用深色模式样式。
 * 激活条件：<html data-theme="dark"> （auto 模式在 theme-head 脚本中解析为 dark 或 light）。
 * 由 tpl/common/theme-head.html 决定 data-theme 的值，依赖 user_settings.dark_mode。
 */

html[data-theme="dark"] {
    color-scheme: dark;
}

/* ===== 基础 body / 文字 / 链接 ===== */
html[data-theme="dark"] body {
    background-color: #121418;
    color: #d4d4d4;
}

html[data-theme="dark"] a {
    color: #7aa7ff;
}

html[data-theme="dark"] a:hover {
    color: #ff8a33;
}

html[data-theme="dark"] hr,
html[data-theme="dark"] .nav-divider,
html[data-theme="dark"] .dropdown-divider,
html[data-theme="dark"] .community-divider {
    background-color: #2e333b;
    border-color: #2e333b;
}

/* ===== 顶部固定栏 ===== */
html[data-theme="dark"] .top-header {
    background-color: #1a1d22;
    border-bottom-color: #2a2e35;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .search-input,
html[data-theme="dark"] .mobile-search-input {
    background-color: #242830;
    border-color: #333842;
    color: #e6e6e6;
}

html[data-theme="dark"] .search-input::placeholder,
html[data-theme="dark"] .mobile-search-input::placeholder {
    color: #888c93;
}

html[data-theme="dark"] .search-box i {
    color: #9aa0a8;
}

html[data-theme="dark"] .header-nav-btn {
    color: #c8cdd4;
}

html[data-theme="dark"] .header-nav-btn:hover {
    background-color: #262b33;
    color: #ffffff;
}

html[data-theme="dark"] .user-menu-trigger:hover,
html[data-theme="dark"] .sidebar-toggle:hover {
    background-color: #262b33;
}

html[data-theme="dark"] .user-menu-trigger .user-name {
    color: #e8e8e8;
}

html[data-theme="dark"] .user-menu-trigger .dropdown-icon {
    color: #9aa0a8;
}

html[data-theme="dark"] .sidebar-toggle,
html[data-theme="dark"] .dropdown-btn {
    color: #c8cdd4;
}

html[data-theme="dark"] .sidebar-toggle:hover {
    color: #ff8a33;
}

html[data-theme="dark"] .sidebar-toggle-edge {
    background-color: #1a1d22;
    border-color: #2e333b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .header-guest-login {
    color: #f1f1f1;
}

html[data-theme="dark"] .header-mobile-search-btn {
    color: #c8cdd4;
}

/* ===== 用户下拉菜单 ===== */
html[data-theme="dark"] .user-dropdown-menu {
    background-color: #1e2228;
    border-color: #2e333b;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

html[data-theme="dark"] .dropdown-username {
    color: #ffffff;
}

html[data-theme="dark"] .dropdown-user-email {
    color: #9aa0a8;
}

html[data-theme="dark"] .dropdown-item {
    color: #e0e0e0;
}

html[data-theme="dark"] .dropdown-item i {
    color: #9aa0a8;
}

html[data-theme="dark"] .dropdown-item:hover {
    background-color: #262b33;
}

html[data-theme="dark"] .dropdown-item.logout-item {
    color: #ff6b6b;
}

html[data-theme="dark"] .dropdown-item.logout-item i {
    color: #ff6b6b;
}

html[data-theme="dark"] .dropdown-item.logout-item:hover {
    background-color: #2a1f22;
}

/* ===== 左侧菜单 ===== */
html[data-theme="dark"] .sidebar {
    background-color: #1a1d22;
    border-right-color: #2a2e35;
}

html[data-theme="dark"] .sidebar::-webkit-scrollbar-track {
    background: #1a1d22;
}

html[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb {
    background: #3a3f47;
}

html[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb:hover {
    background: #4a4f57;
}

html[data-theme="dark"] .nav-section-title {
    color: #9aa0a8;
}

html[data-theme="dark"] .nav-section-title:hover {
    color: #ffffff;
}

html[data-theme="dark"] .nav-section-toggle {
    color: #7a7f87;
}

html[data-theme="dark"] .nav-link {
    color: #d4d4d4;
}

html[data-theme="dark"] .nav-link i {
    color: #9aa0a8;
}

html[data-theme="dark"] .nav-link:hover {
    background-color: #262b33;
}

html[data-theme="dark"] .channel-followed {
    background-color: #183520;
    color: #4ade80;
}

html[data-theme="dark"] .channel-nav-extra .nav-link-mini {
    color: #8a8f97;
}

html[data-theme="dark"] .channel-nav-extra .nav-link-mini i {
    color: #8a8f97;
}

html[data-theme="dark"] .sidebar-overlay {
    background-color: rgba(0, 0, 0, 0.65);
}

/* ===== 右侧边栏 / 小部件 ===== */
html[data-theme="dark"] .right-list-block,
html[data-theme="dark"] .right-list-section,
html[data-theme="dark"] .right-sidebar {
    background-color: transparent;
}

html[data-theme="dark"] .right-list-header h3 {
    color: #ededed;
}

html[data-theme="dark"] .right-list-block-divider {
    background-color: #2e333b;
}

html[data-theme="dark"] .bookmark-item {
    background-color: #1e2228;
    color: #e0e0e0;
}

html[data-theme="dark"] .bookmark-item:hover {
    background-color: #262b33;
}

html[data-theme="dark"] .bookmark-item i {
    color: #8a8f97;
}

html[data-theme="dark"] .rule-item,
html[data-theme="dark"] .rule-text {
    color: #e0e0e0;
}

html[data-theme="dark"] .right-link-list a {
    color: #d4d4d4;
}

html[data-theme="dark"] .right-link-list a::before {
    color: #d4d4d4;
}

html[data-theme="dark"] .subreddit-item,
html[data-theme="dark"] .subreddit-name,
html[data-theme="dark"] .community-user-name {
    color: #e0e0e0;
}

html[data-theme="dark"] .subreddit-members {
    color: #9aa0a8;
}

/* ===== 社区简介卡片 ===== */
html[data-theme="dark"] .community-top,
html[data-theme="dark"] .community-name,
html[data-theme="dark"] .community-title,
html[data-theme="dark"] .community-description,
html[data-theme="dark"] .community-section-title,
html[data-theme="dark"] .community-stats .stat-number {
    color: #ededed;
}

html[data-theme="dark"] .community-meta,
html[data-theme="dark"] .community-meta i,
html[data-theme="dark"] .community-stats .stat-label {
    color: #9aa0a8;
}

html[data-theme="dark"] .community-join-btn {
    background-color: #1e2228;
    border-color: #333842;
    color: #e0e0e0;
}

html[data-theme="dark"] .community-join-btn:hover {
    background-color: #262b33;
}

html[data-theme="dark"] .community-pill-btn {
    background-color: #262b33;
    color: #e0e0e0;
}

html[data-theme="dark"] .community-pill-btn:hover {
    background-color: #303640;
}

/* ===== 主内容卡片通用样式 ===== */
html[data-theme="dark"] .main-content,
html[data-theme="dark"] .content-inner {
    background-color: transparent;
}

html[data-theme="dark"] .post-detail,
html[data-theme="dark"] .profile-card,
html[data-theme="dark"] .account-card,
html[data-theme="dark"] .home-section,
html[data-theme="dark"] .posts-container .post-item,
html[data-theme="dark"] .feed-header,
html[data-theme="dark"] .page-article,
html[data-theme="dark"] .page-article-body,
html[data-theme="dark"] .content-toolbar {
    background-color: #1a1d22;
    border-color: #2a2e35;
    color: #d4d4d4;
}

html[data-theme="dark"] .content-toolbar {
    background-color: transparent;
    border-bottom-color: #2a2e35;
}

html[data-theme="dark"] .posts-container .post-item {
    border-bottom-color: #2a2e35;
}

html[data-theme="dark"] .posts-container.digest-list-view .post-item,
html[data-theme="dark"] .posts-container.original-list-view .post-item {
    background-color: #1a1d22;
    border-bottom-color: #2a2e35;
}

html[data-theme="dark"] .posts-container.digest-list-view .post-title,
html[data-theme="dark"] .posts-container.original-list-view .post-title,
html[data-theme="dark"] .posts-container.image-text-view .post-title,
html[data-theme="dark"] .posts-container.text-only-view .post-title {
    color: #ededed;
}

html[data-theme="dark"] .posts-container .post-title .post-link,
html[data-theme="dark"] .posts-container .post-title a:link,
html[data-theme="dark"] .posts-container .post-title a:visited {
    color: #e4e4e4;
}

html[data-theme="dark"] .posts-container .post-title .post-link:hover,
html[data-theme="dark"] .posts-container .post-title a:hover {
    color: #ff8a33;
}

html[data-theme="dark"] .post-item,
html[data-theme="dark"] .post-author,
html[data-theme="dark"] .post-time,
html[data-theme="dark"] .post-meta-row,
html[data-theme="dark"] .post-meta-row a {
    color: #a8acb2;
}

html[data-theme="dark"] .post-meta-row .sep {
    color: #4a4f57;
}

html[data-theme="dark"] .post-author-link {
    color: #d4d4d4;
}

html[data-theme="dark"] .post-author-link:hover {
    color: #ff8a33;
}

html[data-theme="dark"] .post-detail-title,
html[data-theme="dark"] .post-detail-author,
html[data-theme="dark"] .post-detail-sub {
    color: #ededed;
}

html[data-theme="dark"] .post-detail-meta,
html[data-theme="dark"] .post-detail-dot,
html[data-theme="dark"] .post-back-btn {
    color: #9aa0a8;
}

html[data-theme="dark"] .post-back-btn:hover {
    background-color: #262b33;
    color: #ededed;
}

html[data-theme="dark"] .post-toolbar,
html[data-theme="dark"] .post-footer {
    border-bottom-color: #2a2e35;
    border-top-color: #2a2e35;
}

html[data-theme="dark"] .toolbar-btn {
    background-color: #1e2228;
    border-color: #2e333b;
    color: #c8cdd4;
}

html[data-theme="dark"] .toolbar-btn:hover {
    background-color: #262b33;
    color: #ededed;
}

html[data-theme="dark"] .post-action {
    color: #a8acb2;
}

html[data-theme="dark"] .post-action:hover {
    background-color: #262b33;
    color: #ededed;
}

html[data-theme="dark"] .post-action.liked {
    color: #ff8a33;
}

/* ===== 信息流 / Feed 头部 ===== */
html[data-theme="dark"] .feed-title,
html[data-theme="dark"] .feed-moderators-label {
    color: #ededed;
}

html[data-theme="dark"] .feed-desc,
html[data-theme="dark"] .feed-moderator {
    color: #a8acb2;
}

html[data-theme="dark"] .feed-moderator:hover {
    color: #ff8a33;
}

html[data-theme="dark"] .feed-btn,
html[data-theme="dark"] .feed-btn-region {
    background-color: #1e2228;
    border-color: #2e333b;
    color: #d4d4d4;
}

html[data-theme="dark"] .feed-btn-ghost:hover,
html[data-theme="dark"] .feed-btn-region:hover {
    background-color: #262b33;
}

html[data-theme="dark"] .feed-btn-followed {
    background-color: #262b33;
    color: #d4d4d4;
    border-color: #2e333b;
}

/* ===== 视图模式 / 频道工具栏 / 下拉 ===== */
html[data-theme="dark"] .view-mode-trigger,
html[data-theme="dark"] .channel-sort-select {
    background-color: #1e2228;
    border-color: #2e333b;
    color: #d4d4d4;
}

html[data-theme="dark"] .view-mode-trigger:hover,
html[data-theme="dark"] .channel-sort-select:hover {
    background-color: #262b33;
}

html[data-theme="dark"] .view-mode-menu {
    background-color: #1e2228;
    border-color: #2e333b;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .view-mode-item {
    color: #d4d4d4;
}

html[data-theme="dark"] .view-mode-item:hover {
    background-color: #262b33;
}

html[data-theme="dark"] .view-mode-item.active {
    background-color: #262b33;
    color: #ff8a33;
}

html[data-theme="dark"] .traditional-chinese-btn {
    background-color: #1e2228;
    border-color: #2e333b;
    color: #d4d4d4;
}

html[data-theme="dark"] .traditional-chinese-btn:hover {
    background-color: #262b33;
}

html[data-theme="dark"] .traditional-chinese-btn.active {
    background-color: #3b2a10;
    color: #ff8a33;
    border-color: #553d18;
}

html[data-theme="dark"] .toolbar-mobile-link {
    background-color: #1e2228;
    border-color: #2e333b;
    color: #d4d4d4;
}

html[data-theme="dark"] .toolbar-mobile-link:hover {
    background-color: #262b33;
    border-color: #3a3f47;
    color: #ff8a33;
}

/* ===== 精华帖 / 摘要块 ===== */
html[data-theme="dark"] .digest-area {
    background-color: #1a1d22;
    border-color: #2a2e35;
}

html[data-theme="dark"] .digest-head h3 {
    color: #ededed;
}

html[data-theme="dark"] .digest-en,
html[data-theme="dark"] .digest-head-more {
    color: #9aa0a8;
}

html[data-theme="dark"] .digest-head-more:hover {
    color: #ff8a33;
}

html[data-theme="dark"] .digest-item {
    border-color: #2e333b;
    background-color: #1e2228;
    color: #d4d4d4;
}

html[data-theme="dark"] .digest-item:hover {
    background-color: #262b33;
}

html[data-theme="dark"] .digest-text {
    color: #e0e0e0;
}

html[data-theme="dark"] .digest-prefix {
    color: #9aa0a8;
}

/* ===== 文章正文 ===== */
html[data-theme="dark"] .post-content,
html[data-theme="dark"] .article-content,
html[data-theme="dark"] #article-content,
html[data-theme="dark"] .page-article-body {
    color: #d4d4d4;
}

html[data-theme="dark"] .post-content p,
html[data-theme="dark"] .article-content p,
html[data-theme="dark"] #article-content p {
    color: #d4d4d4;
}

html[data-theme="dark"] .post-content blockquote,
html[data-theme="dark"] #article-content blockquote {
    background-color: #1e2228;
    border-left-color: #3a3f47;
    color: #c0c0c0;
}

html[data-theme="dark"] .post-content pre,
html[data-theme="dark"] .post-content code,
html[data-theme="dark"] #article-content pre,
html[data-theme="dark"] #article-content code {
    background-color: #0f1216;
    color: #e6e6e6;
    border-color: #2a2e35;
}

html[data-theme="dark"] .post-content table,
html[data-theme="dark"] #article-content table {
    border-color: #2e333b;
}

html[data-theme="dark"] .post-content th,
html[data-theme="dark"] #article-content th {
    background-color: #1e2228;
    color: #ededed;
    border-color: #2e333b;
}

html[data-theme="dark"] .post-content td,
html[data-theme="dark"] #article-content td {
    border-color: #2e333b;
}

html[data-theme="dark"] .post-content a,
html[data-theme="dark"] #article-content a {
    color: #7aa7ff;
}

html[data-theme="dark"] .post-content hr,
html[data-theme="dark"] #article-content hr {
    border-color: #2e333b;
}

/* ===== 相关推荐（好评推荐） ===== */
html[data-theme="dark"] .related-content {
    border-top-color: #2a2e35;
}

html[data-theme="dark"] .related-header h3 {
    color: #ededed;
}

html[data-theme="dark"] .related-en {
    color: #a8acb2;
}

html[data-theme="dark"] .related-thumb {
    background-color: #1e2228;
}

html[data-theme="dark"] .related-card,
html[data-theme="dark"] .related-title {
    color: #e4e4e4;
}

html[data-theme="dark"] .related-card:hover .related-title {
    color: #ff8a33;
}

html[data-theme="dark"] .all-comments-list a {
    color: #a8acb2 !important;
}

html[data-theme="dark"] .all-comments-list a:hover {
    color: #ff8a33 !important;
}

/* ===== 评论 ===== */
html[data-theme="dark"] .comments-section,
html[data-theme="dark"] .comment-list,
html[data-theme="dark"] .comments-container,
html[data-theme="dark"] .comment-form,
html[data-theme="dark"] .comment-item,
html[data-theme="dark"] .comment-reply,
html[data-theme="dark"] .comment-upcomment,
html[data-theme="dark"] .subcomment-list,
html[data-theme="dark"] .subcomment-item {
    background-color: transparent;
    color: #d4d4d4;
    border-color: #2a2e35;
}

html[data-theme="dark"] .comment-item,
html[data-theme="dark"] .subcomment-item {
    background-color: #1a1d22;
}

html[data-theme="dark"] .comment-author,
html[data-theme="dark"] .comment-user,
html[data-theme="dark"] .comment-header,
html[data-theme="dark"] .comments-section h2,
html[data-theme="dark"] .comments-section h3 {
    color: #ededed;
}

html[data-theme="dark"] .comment-time,
html[data-theme="dark"] .comment-meta,
html[data-theme="dark"] .comment-meta a {
    color: #9aa0a8;
}

html[data-theme="dark"] .comment-body,
html[data-theme="dark"] .comment-content {
    color: #d4d4d4;
}

html[data-theme="dark"] .comment-upcomment {
    background-color: #15181d;
    border-color: #2a2e35;
}

html[data-theme="dark"] .comment-actions a,
html[data-theme="dark"] .comment-actions button {
    color: #a8acb2;
}

html[data-theme="dark"] .comment-actions a:hover,
html[data-theme="dark"] .comment-actions button:hover {
    color: #ff8a33;
}

/* ===== 个人中心 / 用户资料卡片 ===== */
html[data-theme="dark"] .home-header h1,
html[data-theme="dark"] .section-header h2,
html[data-theme="dark"] .account-header h3,
html[data-theme="dark"] .profile-label,
html[data-theme="dark"] .profile-value,
html[data-theme="dark"] .account-value,
html[data-theme="dark"] .reputation-label,
html[data-theme="dark"] .reputation-value,
html[data-theme="dark"] .stat-value {
    color: #ededed;
}

html[data-theme="dark"] .section-header h2 i,
html[data-theme="dark"] .account-header h3 i {
    color: #ff8a33;
}

html[data-theme="dark"] .account-label,
html[data-theme="dark"] .stat-label,
html[data-theme="dark"] .login-location,
html[data-theme="dark"] .login-ip,
html[data-theme="dark"] .text-muted {
    color: #9aa0a8;
}

html[data-theme="dark"] .home-menu-item {
    background-color: #1e2228;
    color: #e0e0e0;
    border-color: #2a2e35;
}

html[data-theme="dark"] .home-menu-item:hover {
    background-color: #262b33;
    color: #ff8a33;
}

html[data-theme="dark"] .home-menu-item i {
    color: #9aa0a8;
}

html[data-theme="dark"] .home-menu-item:hover i {
    color: #ff8a33;
}

html[data-theme="dark"] .reputation-points {
    background-color: #3a2b10;
    color: #f8d178;
}

html[data-theme="dark"] .security-tip {
    background-color: #15181d;
    color: #c0c0c0;
    border-color: #2a2e35;
}

html[data-theme="dark"] .warning-text {
    color: #f8b84d;
}

/* ===== 表单 / 输入框 / 按钮 ===== */
html[data-theme="dark"] .form-input,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .custom-title-input,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="url"],
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
    background-color: #242830;
    border-color: #333842;
    color: #ededed;
}

html[data-theme="dark"] .form-input::placeholder,
html[data-theme="dark"] .custom-title-input::placeholder,
html[data-theme="dark"] textarea::placeholder,
html[data-theme="dark"] input::placeholder {
    color: #7a7f87;
}

html[data-theme="dark"] .form-input:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] .custom-title-input:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus {
    border-color: #4a9eff;
}

html[data-theme="dark"] .form-input:disabled {
    background-color: #1a1d22;
    color: #7a7f87;
}

html[data-theme="dark"] .form-label,
html[data-theme="dark"] .form-hint {
    color: #b8bcc2;
}

html[data-theme="dark"] .form-hint {
    color: #9aa0a8;
}

html[data-theme="dark"] .btn-primary {
    background-color: #3b82f6;
    color: #ffffff;
}

html[data-theme="dark"] .btn-primary:hover {
    background-color: #2563eb;
}

html[data-theme="dark"] .btn-primary:disabled {
    background-color: #3a3f47;
    color: #7a7f87;
}

html[data-theme="dark"] .btn-success {
    background-color: #22c55e;
}

html[data-theme="dark"] .btn-success:hover {
    background-color: #16a34a;
}

html[data-theme="dark"] .btn-success:disabled {
    background-color: #3a3f47;
    color: #7a7f87;
}

/* ===== 分页 ===== */
html[data-theme="dark"] .pagination a,
html[data-theme="dark"] .pagination span {
    background-color: #1e2228;
    border-color: #2e333b;
    color: #d4d4d4;
}

html[data-theme="dark"] .pagination a:hover {
    background-color: #262b33;
    color: #ff8a33;
}

html[data-theme="dark"] .pagination .active,
html[data-theme="dark"] .pagination .current {
    background-color: #ff8a33;
    border-color: #ff8a33;
    color: #ffffff;
}

html[data-theme="dark"] .pagination .disabled {
    color: #6a6f77;
    background-color: #1a1d22;
}

/* ===== 广告容器 ===== */
html[data-theme="dark"] .ad-container {
    border-top-color: #2e333b;
    border-bottom-color: #2e333b;
}

html[data-theme="dark"] .ad-container span {
    color: #a8acb2;
}

/* ===== 滚动条（WebKit） ===== */
html[data-theme="dark"] ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

html[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #15181d;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #3a3f47;
    border-radius: 5px;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #4a4f57;
}

/* ===== 自定义提示框 ===== */
html[data-theme="dark"] .success-toast {
    background-color: #16a34a;
    color: #ffffff;
}

/* ===== 频道页 / 全部频道 ===== */
html[data-theme="dark"] .channels-page-title {
    color: #ededed;
    border-bottom-color: #2a2e35;
}

html[data-theme="dark"] .channels-grid .channel-card,
html[data-theme="dark"] .channel-card {
    background-color: #1a1d22;
    border-color: #2a2e35;
    color: #d4d4d4;
}

html[data-theme="dark"] .channel-card:hover {
    background-color: #21252c;
}

html[data-theme="dark"] .channel-card h3,
html[data-theme="dark"] .channel-card .channel-name {
    color: #ededed;
}

html[data-theme="dark"] .channel-card .channel-desc {
    color: #a8acb2;
}

/* ===== 标签 / 筛选条 ===== */
html[data-theme="dark"] .user-tag-filter-link {
    background-color: #1e2228;
    border-color: #333842;
    color: #d4d4d4;
}

html[data-theme="dark"] .user-tag-filter-link.active {
    background-color: #ededed;
    color: #111418;
    border-color: #ededed;
}

/* ===== 遗留的 .theme-dark（index_home.html 老脚本兼容） ===== */
html.theme-dark body {
    background-color: inherit;
}
