body.dark-mode {
    --bg-color: #222222;
    --text-color: #e0e0e0;
    --border-color: #333333;
    --chosen-color: #0085a1;
    --secondary-text: rgba(255, 255, 255, 0.8);
}

body {
    background-color: var(--bg-color, #ffffff);
    color: var(--text-color, #404040);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease,
                border-top-color 0.3s ease, border-bottom-color 0.3s ease;
}

body *,
body *::before,
body *::after {
    transition: border-color 0.3s ease, border-top-color 0.3s ease,
                border-bottom-color 0.3s ease, background-color 0.3s ease;
}

/* ========== 基础文字 ========== */
body.dark-mode .post-preview > a > .post-title,
body.dark-mode .post-content {
    color: var(--text-color) !important;
}

body.dark-mode .post-preview > a > .post-subtitle {
    color: var(--text-color) !important;
}

body.dark-mode .post-content-preview {
    color: #888888 !important;
}

.post-preview > a > .post-title {
    transition: color 0.3s ease !important;
}

/* ========== 引用块 / 标注左侧条纹 ========== */
body.dark-mode blockquote {
    border-left-color: var(--border-color) !important;
}

/* ========== 底部分页按钮 ========== */
body.dark-mode .pager li > a {
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
}

body.dark-mode .pager li > a:hover {
    background-color: var(--chosen-color) !important;
    color: white !important;
    border: 1px solid var(--chosen-color) !important;
}

/* ========== 移动端边栏 ========== */
@media only screen and (max-width: 767px) {
    body.dark-mode .navbar-default .navbar-collapse {
        background-color: var(--bg-color) !important;
        border: 1px solid var(--border-color) !important;
        box-shadow: 0px 5px 10px 2px rgba(0, 0, 0, 0.6) !important;
    }

    body.dark-mode .navbar-default .navbar-nav > li > a {
        color: var(--text-color) !important;
    }

    body.dark-mode .search-icon a,
    body.dark-mode .search-icon-close {
        color: var(--text-color) !important;
    }

    body.dark-mode .navbar-default .navbar-nav > li > a:hover,
    body.dark-mode .navbar-default .navbar-nav > li > a:focus {
        background-color: rgba(255, 255, 255, 0.08) !important;
        color: var(--text-color) !important;
    }
}

/* ========== 全屏搜索界面 ========== */
body.dark-mode .search-page {
    background-color: var(--bg-color) !important;
}

body.dark-mode .search-page #search-input {
    color: var(--text-color) !important;
    background-color: transparent !important;
}

body.dark-mode .search-page .search-icon-close {
    color: var(--text-color) !important;
}

body.dark-mode .search-page #search-results {
    color: var(--text-color) !important;
}

body.dark-mode .search-page #search-results a {
    color: var(--text-color) !important;
}

body.dark-mode .search-page #search-results a:hover {
    color: var(--chosen-color) !important;
}

/* ========== Header Style: Text ========== */
body.dark-mode .intro-header.style-text .site-heading,
body.dark-mode .intro-header.style-text .post-heading,
body.dark-mode .intro-header.style-text .page-heading {
    color: var(--text-color) !important;
}

body.dark-mode .intro-header.style-text .site-heading .subheading,
body.dark-mode .intro-header.style-text .post-heading .subheading,
body.dark-mode .intro-header.style-text .page-heading .subheading {
    color: var(--text-color) !important;
}

body.dark-mode .intro-header.style-text .post-heading .meta,
body.dark-mode .intro-header.style-text .post-heading .meta a {
    color: var(--text-color) !important;
}

body.dark-mode .intro-header.style-text .tags a,
body.dark-mode .intro-header.style-text .tags .tag {
    border-color: var(--text-color) !important;
    color: var(--text-color) !important;
}

body.dark-mode .intro-header.style-text .navbar-default .navbar-brand,
body.dark-mode .intro-header.style-text .navbar-default .navbar-nav > li > a {
    color: var(--text-color) !important;
}

body.dark-mode .intro-header.style-text .navbar-default .navbar-toggle .icon-bar {
    background-color: var(--text-color) !important;
}

body.dark-mode .intro-header.style-text .navbar-default .search-icon a {
    color: var(--text-color) !important;
}

/* ========== 导航栏核心修复 ========== */

body.dark-mode .navbar-custom {
    background-color: transparent !important;
    border: none !important;
}

body.dark-mode .navbar-custom.is-fixed {
    background-color: rgba(34, 34, 34, 0.9) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .navbar-custom .navbar-brand,
body.dark-mode .navbar-custom .navbar-nav > li > a {
    color: #ffffff !important;
}

body.dark-mode .navbar-default .navbar-toggle .icon-bar {
    background-color: #ffffff !important;
}

/* ========== 导航栏交互高亮（分透明/不透明状态） ========== */

body.dark-mode .navbar-custom:not(.is-fixed) .navbar-brand:hover,
body.dark-mode .navbar-custom:not(.is-fixed) .navbar-nav > li > a:hover {
    color: var(--secondary-text, rgba(255,255,255,0.8)) !important;
}

body.dark-mode .navbar-custom.is-fixed .navbar-brand:hover,
body.dark-mode .navbar-custom.is-fixed .navbar-nav > li > a:hover {
    color: var(--chosen-color, #0085a1) !important;
}

body.dark-mode .navbar-custom .navbar-brand:active,
body.dark-mode .navbar-custom .navbar-nav > li > a:active {
    color: var(--secondary-text, rgba(255, 255, 255, 0.8)) !important;
}

/* ========== 分割线与边框修复 ========== */

body.dark-mode hr {
    border-top-color: var(--border-color) !important;
}

body.dark-mode .post-container h2::before {
    border-bottom-color: var(--border-color) !important;
}

body.dark-mode table,
body.dark-mode .table,
body.dark-mode .table > tbody > tr > td,
body.dark-mode .table > tbody > tr > th,
body.dark-mode .table > thead > tr > th {
    border-color: var(--border-color) !important;
}

body.dark-mode .comment {
    border-top-color: var(--border-color) !important;
}

/* ========== 首页文章悬停高亮（深色模式） ========== */

body.dark-mode .post-preview > a:hover,
body.dark-mode .post-preview > a:focus {
    color: var(--chosen-color) !important; 
    text-decoration: none !important;
}

body.dark-mode .post-preview > a > .post-title {
    transition: color 0.3s ease !important;
}

body.dark-mode .post-preview > a:hover > .post-title,
body.dark-mode .post-preview > a:focus > .post-title {
    color: var(--chosen-color) !important;
}

body.dark-mode .post-preview > a:hover > .post-subtitle,
body.dark-mode .post-preview > a:focus > .post-subtitle,
body.dark-mode .post-preview > a:hover .post-content-preview,
body.dark-mode .post-preview > a:focus .post-content-preview {
    color: var(--chosen-color) !important;
}

/* ========== APlayer 深色模式适配 ========== */

body.dark-mode .aplayer {
    background-color: #2d2d2d !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .aplayer .aplayer-info .aplayer-music .aplayer-title,
body.dark-mode .aplayer .aplayer-info .aplayer-music .aplayer-author {
    color: var(--text-color) !important;
}

body.dark-mode .aplayer .aplayer-info .aplayer-controller .aplayer-time {
    color: var(--text-color) !important;
}

body.dark-mode .aplayer .aplayer-info .aplayer-controller .aplayer-time .aplayer-icon path {
    fill: var(--text-color) !important;
}

body.dark-mode .aplayer .aplayer-list ol li {
    color: var(--text-color) !important;
    border-bottom-color: var(--border-color) !important;
}

body.dark-mode .aplayer .aplayer-list ol li:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

body.dark-mode .aplayer .aplayer-list ol li.aplayer-list-light {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .aplayer .aplayer-list ol li .aplayer-list-index {
    color: var(--text-color) !important;
}

body.dark-mode .aplayer .aplayer-list ol li .aplayer-list-name {
    color: var(--text-color) !important;
}

body.dark-mode .aplayer .aplayer-list ol li .aplayer-list-author {
    color: rgba(255, 255, 255, 0.6) !important;
}

body.dark-mode .aplayer .aplayer-lrc {
    color: var(--text-color) !important;
}

body.dark-mode .aplayer .aplayer-lrc:after,
body.dark-mode .aplayer .aplayer-lrc:before {
    background: linear-gradient(to bottom, var(--bg-color) 0%, transparent 100%) !important;
}
