/* 深色模式修复 - 覆盖 style.css 中的硬编码白色背景 */

/* 覆盖所有白色背景为使用CSS变量 */
[data-theme="dark"] .site-header,
[data-theme="dark"] #masthead {
    background-color: var(--nav-bg) !important;
    color: var(--nav-text) !important;
}

[data-theme="dark"] .site-content,
[data-theme="dark"] #content {
    background-color: var(--bg-primary) !important;
}

[data-theme="dark"] .widget-area,
[data-theme="dark"] #secondary {
    background-color: var(--sidebar-bg) !important;
}

[data-theme="dark"] .entry-content,
[data-theme="dark"] .entry-summary,
[data-theme="dark"] .page-content,
[data-theme="dark"] article {
    background-color: var(--article-bg) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .site {
    background-color: var(--bg-primary) !important;
}

[data-theme="dark"] body {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

/* 修复所有白色背景的元素 */
[data-theme="dark"] *[style*="background: #fff"],
[data-theme="dark"] *[style*="background-color: #fff"],
[data-theme="dark"] *[style*="background: white"],
[data-theme="dark"] *[style*="background-color: white"] {
    background-color: var(--bg-primary) !important;
}

/* 修复所有白色文字的元素（排除按钮和链接） */
[data-theme="dark"] *[style*="color: #fff"]:not(.btn):not(a),
[data-theme="dark"] *[style*="color: white"]:not(.btn):not(a) {
    color: var(--text-primary) !important;
}

/* 评论区修复 */
[data-theme="dark"] #comments,
[data-theme="dark"] .comment-list,
[data-theme="dark"] .comment,
[data-theme="dark"] .comment-body,
[data-theme="dark"] .comment-content {
    background-color: var(--comment-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--comment-border) !important;
}

/* 导航菜单修复 */
[data-theme="dark"] .nav-menu,
[data-theme="dark"] .main-navigation,
[data-theme="dark"] #site-navigation {
    background-color: var(--nav-bg) !important;
}

[data-theme="dark"] .nav-menu li,
[data-theme="dark"] .main-navigation li {
    background-color: transparent !important;
}

[data-theme="dark"] .nav-menu a,
[data-theme="dark"] .main-navigation a {
    color: var(--nav-text) !important;
}

[data-theme="dark"] .nav-menu a:hover,
[data-theme="dark"] .main-navigation a:hover {
    background-color: var(--nav-hover-bg) !important;
    color: var(--link-hover) !important;
}

/* Widget 修复 */
[data-theme="dark"] .widget {
    background-color: var(--sidebar-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--sidebar-border) !important;
}

[data-theme="dark"] .widget-title {
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .widget ul,
[data-theme="dark"] .widget ol {
    background-color: transparent !important;
}

[data-theme="dark"] .widget a {
    color: var(--link-color) !important;
}

/* 文章列表修复 */
[data-theme="dark"] .hentry,
[data-theme="dark"] .post,
[data-theme="dark"] .page {
    background-color: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--card-border) !important;
}

[data-theme="dark"] .entry-header {
    background-color: transparent !important;
}

[data-theme="dark"] .entry-title a {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .entry-title a:hover {
    color: var(--link-hover) !important;
}

[data-theme="dark"] .entry-meta,
[data-theme="dark"] .entry-footer {
    color: var(--text-secondary) !important;
    background-color: transparent !important;
}

/* 搜索框修复 */
[data-theme="dark"] #searchform,
[data-theme="dark"] .search-form {
    background-color: var(--input-bg) !important;
}

[data-theme="dark"] #s,
[data-theme="dark"] .search-field {
    background-color: var(--input-bg) !important;
    color: var(--input-text) !important;
    border-color: var(--input-border) !important;
}

/* 分页修复 */
[data-theme="dark"] .pagination,
[data-theme="dark"] .page-links,
[data-theme="dark"] .nav-links {
    background-color: transparent !important;
}

[data-theme="dark"] .pagination a,
[data-theme="dark"] .page-links a,
[data-theme="dark"] .nav-links a {
    background-color: var(--card-bg) !important;
    color: var(--link-color) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .pagination a:hover,
[data-theme="dark"] .page-links a:hover,
[data-theme="dark"] .nav-links a:hover {
    background-color: var(--bg-hover) !important;
}

[data-theme="dark"] .pagination .current,
[data-theme="dark"] .page-links > .current {
    background-color: var(--accent-primary) !important;
    color: var(--text-inverse) !important;
}

/* 面包屑导航修复 */
[data-theme="dark"] .breadcrumbs,
[data-theme="dark"] .breadcrumb {
    background-color: var(--bg-secondary) !important;
    color: var(--text-secondary) !important;
}

/* 侧边栏小工具特定修复 */
[data-theme="dark"] #calendar_wrap {
    background-color: var(--card-bg) !important;
}

[data-theme="dark"] #calendar_wrap table,
[data-theme="dark"] #calendar_wrap th,
[data-theme="dark"] #calendar_wrap td {
    background-color: transparent !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

/* 标签云修复 */
[data-theme="dark"] .tagcloud a,
[data-theme="dark"] .wp_widget_tag_cloud a {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .tagcloud a:hover,
[data-theme="dark"] .wp_widget_tag_cloud a:hover {
    background-color: var(--bg-hover) !important;
    color: var(--link-hover) !important;
}

/* 最近评论修复 */
[data-theme="dark"] .recentcomments {
    background-color: transparent !important;
    color: var(--text-primary) !important;
}

/* RSS 链接修复 */
[data-theme="dark"] .rss-date,
[data-theme="dark"] .rssSummary {
    color: var(--text-secondary) !important;
}

/* 存档页面修复 */
[data-theme="dark"] .archive-meta,
[data-theme="dark"] .page-header {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

/* 404 页面修复 */
[data-theme="dark"] .error404 .widget {
    background-color: var(--card-bg) !important;
}

/* 图片说明修复 */
[data-theme="dark"] .wp-caption,
[data-theme="dark"] .gallery-caption {
    background-color: var(--bg-secondary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .wp-caption-text {
    color: var(--text-secondary) !important;
}

/* 嵌入内容修复 */
[data-theme="dark"] embed,
[data-theme="dark"] iframe,
[data-theme="dark"] object {
    border-color: var(--border-primary) !important;
}

/* 按钮修复 - 确保按钮上的白色文字不被改变 */
[data-theme="dark"] .btn,
[data-theme="dark"] button,
[data-theme="dark"] input[type="submit"],
[data-theme="dark"] input[type="button"],
[data-theme="dark"] .comment-reply-link {
    color: inherit;
}

[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-success,
[data-theme="dark"] .btn-info,
[data-theme="dark"] .btn-warning,
[data-theme="dark"] .btn-danger {
    color: var(--text-inverse) !important;
}

/* Sticky post 修复 */
[data-theme="dark"] .sticky {
    background-color: var(--bg-secondary) !important;
    border-color: var(--accent-primary) !important;
}

/* 引用文字修复 */
[data-theme="dark"] cite {
    color: var(--text-secondary) !important;
}

/* 列表修复 */
[data-theme="dark"] ul,
[data-theme="dark"] ol,
[data-theme="dark"] dl {
    color: var(--text-primary) !important;
}

/* 定义列表修复 */
[data-theme="dark"] dt {
    color: var(--text-primary) !important;
}

[data-theme="dark"] dd {
    color: var(--text-secondary) !important;
}

/* 强调文本修复 */
[data-theme="dark"] strong,
[data-theme="dark"] b {
    color: var(--text-primary) !important;
}

[data-theme="dark"] em,
[data-theme="dark"] i {
    color: var(--text-primary) !important;
}

/* 删除线修复 */
[data-theme="dark"] del,
[data-theme="dark"] s {
    color: var(--text-tertiary) !important;
}

/* 下划线修复 */
[data-theme="dark"] ins,
[data-theme="dark"] u {
    color: var(--text-primary) !important;
    background-color: var(--bg-tertiary) !important;
}

/* 小号文字修复 */
[data-theme="dark"] small {
    color: var(--text-secondary) !important;
}

/* 标记文字修复 */
[data-theme="dark"] mark {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

/* Pygments 代码高亮修复 */
[data-theme="dark"] .highlight,
[data-theme="dark"] .codehilite {
    background-color: var(--code-block-bg) !important;
}

[data-theme="dark"] .highlight pre,
[data-theme="dark"] .codehilite pre {
    background-color: transparent !important;
}

/* 站点标题和描述修复 */
[data-theme="dark"] .site-title,
[data-theme="dark"] .site-description {
    color: var(--nav-text) !important;
}

[data-theme="dark"] .site-title a {
    color: var(--nav-text) !important;
}

[data-theme="dark"] .site-title a:hover {
    color: var(--link-hover) !important;
}

/* 页面容器修复 */
[data-theme="dark"] #page,
[data-theme="dark"] .site,
[data-theme="dark"] #main,
[data-theme="dark"] .wrapper {
    background-color: var(--bg-primary) !important;
}

/* 修复特定的警告框背景 */
[data-theme="dark"] *[style*="background: #fff9c0"],
[data-theme="dark"] *[style*="background-color: #fff9c0"] {
    background-color: rgba(255, 249, 192, 0.2) !important;
    color: var(--text-primary) !important;
}

/* 修复特定的警告框背景 */
[data-theme="dark"] *[style*="background: #fff3cd"],
[data-theme="dark"] *[style*="background-color: #fff3cd"] {
    background-color: rgba(255, 243, 205, 0.2) !important;
    color: var(--text-primary) !important;
}

/* 补充：文章卡片内部元素修复 */
[data-theme="dark"] .post-thumbnail,
[data-theme="dark"] .entry-thumbnail {
    background-color: transparent !important;
}

/* 补充：作者信息框修复 */
[data-theme="dark"] .author-info,
[data-theme="dark"] .author-bio {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

/* 补充：相关文章修复 */
[data-theme="dark"] .related-posts,
[data-theme="dark"] .related-articles {
    background-color: var(--bg-secondary) !important;
}

/* 补充：分类和标签显示修复 */
[data-theme="dark"] .cat-links,
[data-theme="dark"] .tags-links {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .cat-links a,
[data-theme="dark"] .tags-links a {
    color: var(--link-color) !important;
    background-color: var(--bg-tertiary) !important;
}

/* 补充：阅读更多链接修复 */
[data-theme="dark"] .more-link {
    color: var(--link-color) !important;
}

[data-theme="dark"] .more-link:hover {
    color: var(--link-hover) !important;
}

/* 补充：表单元素标签修复 */
[data-theme="dark"] label {
    color: var(--text-primary) !important;
}

/* 补充：占位符修复 */
[data-theme="dark"] ::placeholder {
    color: var(--input-placeholder) !important;
    opacity: 1;
}

[data-theme="dark"] :-ms-input-placeholder {
    color: var(--input-placeholder) !important;
}

[data-theme="dark"] ::-ms-input-placeholder {
    color: var(--input-placeholder) !important;
}

/* 补充：选中文本修复 */
[data-theme="dark"] ::selection {
    background-color: var(--accent-primary) !important;
    color: var(--text-inverse) !important;
}

[data-theme="dark"] ::-moz-selection {
    background-color: var(--accent-primary) !important;
    color: var(--text-inverse) !important;
}

/* 修复 hfeed 类容器 */
[data-theme="dark"] .hfeed {
    background-color: var(--bg-primary) !important;
}

/* 修复所有可能的白色背景覆盖 */
[data-theme="dark"] .site-header,
[data-theme="dark"] .site-content,
[data-theme="dark"] .site-footer {
    background-color: transparent !important;
}
