/* ==================== 全局变量 ==================== */
:root {
    --bg: #f0f2f5;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-bg-solid: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: rgba(148, 163, 184, 0.2);
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: #eef2ff;
    --code-bg: #1e1e2e;
    --code-text: #cdd6f4;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.03), 0 1px 4px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.04), 0 2px 6px rgba(0,0,0,0.02);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.03);
    --glass-blur: blur(14px);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.75;
    color: var(--text);
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

::selection { background: #c7d2fe; color: #1e1b4b; }

/* ==================== 头部（默认可见，带隐藏动画） ==================== */
#header {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    transform: translateY(0);
    transition: transform 0.35s ease, background 0.3s, box-shadow 0.3s;
}

/* 向下滚动时隐藏头部 */
#header.header-hidden {
    transform: translateY(-100%);
}

#header h1 {
    margin: 0;
    padding: 12px 0 4px;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
#header h1 a {
    text-decoration: none !important;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#header h2 {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 0 0 6px;
    font-weight: 400;
}

#navList {
    list-style: none;
    margin: 0;
    padding: 0 0 6px;
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
}
#navList li a {
    display: inline-block;
    padding: 6px 14px;
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    border-radius: 50px;
    font-size: 0.84rem;
    font-weight: 500;
    transition: all var(--transition);
}
#navList li a:hover {
    color: var(--accent) !important;
    background: rgba(99, 102, 241, 0.08);
    transform: translateY(-1px);
}

/* ==================== 主体布局 ==================== */
#main {
    max-width: 1150px;
    margin: 0 auto;
    padding: 24px 20px;
    display: flex;
    gap: 24px;
}

#mainContent {
    flex: 1;
    min-width: 0;
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

/* ==================== 文章列表 ==================== */
.day {
    padding: 18px 12px;
    margin: 0 -12px;
    border-bottom: 1px solid #f1f5f9;
    transition: all var(--transition);
    border-radius: var(--radius-sm);
}
.day:last-child { border-bottom: none; }
.day:hover {
    background: rgba(255,255,255,0.5);
    transform: translateX(4px);
}

.day .postTitle a {
    font-size: 1.2rem;
    font-weight: 650;
    color: var(--text) !important;
    text-decoration: none !important;
}
.day .postTitle a:hover { color: var(--accent) !important; }

/* ==================== 文章详情 ==================== */
.postTitle, #cb_post_title_url {
    font-size: 1.7rem !important;
    font-weight: 700 !important;
    line-height: 1.3;
    letter-spacing: -0.4px;
    margin-bottom: 6px;
}

.postDesc, #post-date {
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
    margin-bottom: 22px;
}

#cnblogs_post_body, .postBody {
    font-size: 15px;
    line-height: 1.85;
    color: var(--text);
}

#cnblogs_post_body a, .postBody a {
    color: var(--accent);
    text-decoration: none;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    background-size: 0% 2px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: background-size 0.3s, color 0.2s;
    padding-bottom: 2px;
}
#cnblogs_post_body a:hover, .postBody a:hover {
    background-size: 100% 2px;
    color: #4f46e5;
}

#cnblogs_post_body h1, .postBody h1 {
    font-size: 1.55rem;
    border-left: 4px solid var(--accent);
    padding-left: 14px;
    margin-top: 1.5em;
}
#cnblogs_post_body h2, .postBody h2 {
    font-size: 1.35rem;
    margin-top: 1.4em;
}
#cnblogs_post_body h2::before, .postBody h2::before {
    content: "#";
    color: var(--accent);
    margin-right: 8px;
    font-weight: 400;
    opacity: 0.6;
}

#cnblogs_post_body img, .postBody img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin: 14px 0;
    transition: all 0.3s ease;
}
#cnblogs_post_body img:hover, .postBody img:hover {
    box-shadow: 0 12px 28px rgba(0,0,0,0.08);
    transform: scale(1.005);
}

#cnblogs_post_body blockquote, .postBody blockquote {
    margin: 18px 0;
    padding: 14px 20px;
    background: rgba(238, 242, 255, 0.5);
    backdrop-filter: blur(8px);
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: #334155;
}

#cnblogs_post_body table, .postBody table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
#cnblogs_post_body th, .postBody th {
    background: #f8fafc;
    padding: 10px 14px;
    font-weight: 600;
}
#cnblogs_post_body td, .postBody td {
    padding: 9px 14px;
    border-bottom: 1px solid #f1f5f9;
}

/* ==================== 代码块 ==================== */
.cnblogs_code, #cnblogs_post_body pre, .postBody pre, pre[class*="brush"] {
    background: var(--code-bg) !important;
    color: var(--code-text) !important;
    border-radius: var(--radius-md) !important;
    padding: 42px 20px 20px 20px !important;
    font-family: var(--font-mono) !important;
    font-size: 0.84rem !important;
    line-height: 1.65 !important;
    margin: 20px 0 !important;
    border: none !important;
    box-shadow: var(--shadow-md);
    position: relative;
}
.cnblogs_code::before, #cnblogs_post_body pre::before, .postBody pre::before {
    content: "";
    position: absolute;
    top: 14px;
    left: 18px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #ff5f56;
    box-shadow: 18px 0 0 #ffbd2e, 36px 0 0 #27c93f;
    z-index: 2;
}
.cnblogs_code .left, .cnblogs_code .cnblogs_code_left,
.syntaxhighlighter .gutter {
    color: #6c7086 !important;
    background: transparent !important;
    border-right: 1px solid #313244 !important;
}
#cnblogs_post_body code:not(pre code), .postBody code:not(pre code), code:not([class*="language"]) {
    background: #f1f5f9 !important;
    color: #d6336c !important;
    padding: 2px 7px !important;
    border-radius: 5px !important;
    font-family: var(--font-mono) !important;
    font-size: 0.88em !important;
    border: 1px solid #e2e8f0;
}

/* ==================== 侧边栏 ==================== */
#sideBar {
    width: 270px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#sideBar .sidebar-block,
#sideBar .mySearch,
#sideBar #blog-calendar,
#sideBar .catList,
#sideBar .itembox {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all var(--transition);
}
#sideBar .sidebar-block:hover,
#sideBar .catList:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

#sideBar h3, #sideBar .catListTitle {
    font-size: 0.88rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent-light);
    color: var(--text);
}

#sideBar ul li a {
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    transition: all 0.2s;
    font-size: 0.84rem;
}
#sideBar ul li a:hover {
    color: var(--accent) !important;
    padding-left: 6px;
}

#sideBar input[type="text"], #sideBar #q {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    font-size: 0.86rem;
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(8px);
    outline: none;
}
#sideBar input[type="text"]:focus, #sideBar #q:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
    background: white;
}

/* ==================== 评论 ==================== */
#tbCommentBody, #tbCommentBody_Editor {
    border: 1.5px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    padding: 12px !important;
    background: rgba(255,255,255,0.6) !important;
    backdrop-filter: blur(8px);
}
#tbCommentBody:focus, #tbCommentBody_Editor:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

#btn_comment_submit, .comment_btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    color: white !important;
    border: none !important;
    padding: 8px 22px !important;
    border-radius: 50px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 10px rgba(99,102,241,0.25);
    transition: all 0.25s;
}
#btn_comment_submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99,102,241,0.35);
}

/* ==================== 进度条（细线） ==================== */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #a78bfa, #6366f1);
    z-index: 10001;
    width: 0;
    transition: width 0.1s linear;
    border-radius: 0 1px 1px 0;
}

/* ==================== 返回顶部按钮 ==================== */
#back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    z-index: 999;
    opacity: 0;
    transform: translateY(15px);
    pointer-events: none;
    transition: all 0.3s;
}
#back-to-top.visible {
    opacity: 0.85;
    transform: translateY(0);
    pointer-events: auto;
}
#back-to-top:hover {
    background: var(--accent);
    color: white;
    opacity: 1;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(99,102,241,0.3);
}

/* ==================== 页脚 ==================== */
#footer {
    text-align: center;
    padding: 24px 20px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    background: rgba(255,255,255,0.4);
    backdrop-filter: blur(10px);
    margin-top: 32px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 900px) {
    #main { flex-direction: column; padding: 14px 12px; }
    #mainContent { padding: 20px 16px; }
    #sideBar { width: 100%; gap: 12px; }
    .postTitle, #cb_post_title_url { font-size: 1.35rem !important; }
    /* 移动端保留头部显示（避免交互困难） */
    #header.header-hidden {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    #mainContent { padding: 12px 10px; }
    #navList li a { padding: 4px 10px; font-size: 0.78rem; }
}

@media print {
    #sideBar, #header, #footer, #back-to-top, #progress-bar { display: none !important; }
}