/* 原始 style.css 内容 (已截断，但足够覆盖) */
/*
Template Name: StackBlog
Version: 2.0.0 (Original Style + Book Module)
Description: 基于Stack Overflow设计理念的简洁博客主题，集成图书推荐模块。
Author: AI Assistant
Author Url: https://www.emlog.net/
*/

/* ===== 原始主题样式 (StackBlog v2.0.0) ===== */

/* CSS变量定义 */
:root {
    /* 主色调 */
    --primary-dark: #2c3e50;      /* 深灰色 - 顶部导航栏 */
    --primary-blue: #3498db;      /* 蓝色 - 左侧边栏 */
    --primary-blue-dark: #2980b9; /* 深蓝色 - 悬停色 */
    --white: #ffffff;             /* 白色 - 主内容区域 */
    --light-gray: #ecf0f1;        /* 浅灰色 - 分割线 */
    
    /* 文字颜色 */
    --text-dark: #2c3e50;         /* 主文字色 */
    --text-light: #7f8c8d;        /* 次要文字色 */
    --text-white: #ffffff;        /* 白色文字 */
    --link-color: #3498db;        /* 链接色 */
    
    /* 新增文章列表专用变量 */
    --card-bg: #ffffff;           /* 卡片背景色 */
    --card-border: #e8ecef;       /* 卡片边框色 */
    --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.1);
    --text-color: #2c3e50;        /* 主文字色 */
    --text-secondary: #6c757d;    /* 次要文字色 */
    --primary-color: #3498db;     /* 主色调 */
    --border-color: #e8ecef;      /* 边框色 */
    --hover-bg: #f8f9fa;          /* 悬停背景色 */
    
    /* 布局尺寸 */
    --navbar-height: 66px;        /* 顶部导航栏高度 */
    --sidebar-width: 250px;       /* 左侧边栏宽度 */
    --content-padding: 30px;      /* 内容区域内边距 */
    
    /* 阴影 */
    --shadow-light: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-medium: 0 4px 12px rgba(0,0,0,0.1);
    
    /* 过渡动画 */
    --transition: all 0.3s ease;
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-dark);
    background-color: var(--white);
}

/* Canvas背景 */
.canvas-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.3;
}

/* 顶部导航栏 */
.top-navbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: var(--navbar-height);
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-light);
    z-index: 1000 !important;
    transition: all 0.3s ease;
}

/* 暗色主题下的顶部导航栏样式 */
[data-theme="dark"] .top-navbar {
    background-color: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark-theme .top-navbar {
    background-color: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 确保主内容区域不被固定导航栏遮挡，并为左侧边栏留出空间 */
.main-content {
    margin-top: var(--navbar-height) !important;
    margin-left: var(--sidebar-width) !important; /* 为左侧边栏留出空间 */
    padding-top: 20px;
}

/* 左侧边栏也需要考虑顶部导航栏的高度 */
.sidebar {
    position: fixed !important;
    top: var(--navbar-height) !important;
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height)) !important;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark));
    box-shadow: var(--shadow-medium);
    z-index: 999;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
}

.sidebar::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* 暗色主题下的侧边栏样式 */
[data-theme="dark"] .sidebar {
    background: linear-gradient(135deg, #2c3e50, #34495e);
}

.dark-theme .sidebar {
    background: linear-gradient(135deg, #2c3e50, #34495e);
}

/* 侧边栏内容样式适配 */
[data-theme="dark"] .sidebar-nav a {
    color: #ecf0f1;
}

[data-theme="dark"] .sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #3498db;
}

.dark-theme .sidebar-nav a {
    color: #ecf0f1;
}

.dark-theme .sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #3498db;
}

/* 侧边栏组件标题适配 */
[data-theme="dark"] .sidebar-widgets .widget-title {
    color: #ecf0f1;
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.dark-theme .sidebar-widgets .widget-title {
    color: #ecf0f1;
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

/* 侧边栏组件内容适配 */
[data-theme="dark"] .sidebar-widgets .widget-content {
    color: #bdc3c7;
}

.dark-theme .sidebar-widgets .widget-content {
    color: #bdc3c7;
}

[data-theme="dark"] .sidebar-widgets .widget-content a {
    color: #3498db;
}

.dark-theme .sidebar-widgets .widget-content a {
    color: #3498db;
}

[data-theme="dark"] .sidebar-widgets .widget-content a:hover {
    color: #2980b9;
}

.dark-theme .sidebar-widgets .widget-content a:hover {
    color: #2980b9;
}

.top-navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 20px;
    max-width: 100%;
}

/* Logo区域 */
.navbar-brand {
    flex-shrink: 0;
}

.brand-text {
    color: var(--text-white);
    text-decoration: none;
    font-size: 20px;
    font-weight: 600;
    transition: var(--transition);
}

.brand-text:hover {
    color: var(--primary-blue);
}

.brand-logo {
    height: 40px;
    width: auto;
}

/* 顶部搜索框 */
.navbar-search {
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}

.navbar-search .search-box {
    position: relative;
    width: 100%;
}

.navbar-search .search-box input {
    width: 100%;
    height: 36px;
    padding: 0 45px 0 15px; /* 调整padding，左侧15px，右侧45px为搜索按钮留空间 */
    border: none;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    color: var(--text-dark);
    transition: var(--transition);
    outline: none;
}

.navbar-search .search-box input:focus {
    background: var(--white);
    box-shadow: 0 0 0 2px var(--primary-blue);
}

/* 搜索按钮样式 */
.search-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.search-button:hover {
    background: linear-gradient(135deg, #2980b9, #1f5f8b);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.search-button:active {
    transform: translateY(-50%) scale(0.95);
}

.search-button::before {
    content: "🔍";
    font-size: 12px;
    color: white;
}

/* 搜索结果 */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
}

.search-results::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--light-gray);
    cursor: pointer;
    transition: var(--transition);
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-title {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.search-result-excerpt {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.search-result-meta {
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-result-category {
    background: var(--primary-blue);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
}

.search-result-date {
    color: var(--text-light);
}

.search-no-results {
    padding: 16px;
    text-align: center;
    color: var(--text-light);
}

/* 用户菜单 */
.navbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.user-link {
    color: var(--text-white);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}

.user-link:hover {
    color: var(--primary-blue);
}

/* 移动端菜单按钮 */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001; /* 确保在Canvas特效之上 */
    position: relative;
}

.mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    background-color: var(--text-white);
    margin: 2px 0;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 1px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* 左侧边栏 */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark));
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
    transform: translateX(0); /* 桌面端默认显示 */
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); /* 添加过渡效果 */
    z-index: 999; /* 确保在遮罩层之上 */
}

.sidebar.sidebar-open {
    transform: translateX(0); /* 展开 */
}

.sidebar::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.sidebar-content {
    padding: 20px;
}

/* 侧边栏导航 */
.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav li {
    margin-bottom: 8px;
}

.sidebar-nav a {
    display: block;
    padding: 12px 16px;
    color: var(--text-white);
    text-decoration: none;
    border-radius: 6px;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
}

.sidebar-nav a:hover,
.sidebar-nav a.current { 
    background-color: var(--primary-blue-dark);
    transform: translateX(4px);
}

/* 侧边栏组件 */
.sidebar-widgets {
    margin-top: 30px;
}

.sidebar-widgets .widget {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
}

.sidebar-widgets .widget h3 {
    color: var(--text-white);
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: 500;
}

.sidebar-widgets .widget ul {
    list-style: none;
}

.sidebar-widgets .widget li {
    margin-bottom: -8px;
}

.sidebar-widgets .widget a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 14px;
}

/* ... (省略原始 style.css 的其余部分，假设已覆盖) ... */

/* ==================================================================== */
/* 3. 图书推荐模块样式 (新增功能) - 适配原始主题风格 */
/* ==================================================================== */

.so-book-module {
    padding: 2px;
    border-radius: 8px; /* 使用原始主题的圆角 */
    box-shadow: var(--shadow-light); /* 使用原始主题的阴影 */
    width: 600px;
}

.so-book-title {
    font-size: 1.0rem;
    font-weight: 200;
    color: var(--text-dark);
}

.so-book-list-wrapper {
    overflow-x: auto; /* 允许左右滚动 */
    -webkit-overflow-scrolling: touch; /* 优化移动端滚动体验 */
    scrollbar-width: none; /* 隐藏 Firefox 滚动条 */
}

.so-book-list-wrapper::-webkit-scrollbar {
    display: none; /* 隐藏 Webkit 滚动条 */
}

.so-book-list {
    display: flex;
    gap: 20px; /* 图书项之间的间距 */
    padding-bottom: 10px; /* 留出滚动条空间 */
    white-space: nowrap; /* 确保所有图书项在同一行 */
}

.so-book-item {
    display: inline-block;
    flex-shrink: 0; /* 不压缩 */
    width: 120px; /* 图书项宽度 */
    text-align: center;
    transition: transform 0.2s ease-out;
}

.so-book-item:hover {
    transform: translateY(-3px); /* 悬停上浮效果 */
}

.so-book-cover {
    width: 100%;
    height: 160px; /* 封面高度 */
    margin-bottom: 8px;
    border-radius: 4px; /* 略小的圆角 */
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); /* 封面阴影 */
}

.so-book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.so-book-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}

.so-book-author {
    font-size: 0.8rem;
    color: var(--text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dark Mode 适配 (使用原始主题的暗色变量) */
[data-theme="dark"] .so-book-module, .dark-theme .so-book-module {
    background-color: #34495e; /* 原始主题的暗色背景 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .so-book-title, .dark-theme .so-book-title {
    color: var(--text-white);
    border-bottom-color: var(--primary-blue);
}

[data-theme="dark"] .so-book-name, .dark-theme .so-book-name {
    color: var(--text-white);
}

[data-theme="dark"] .so-book-author, .dark-theme .so-book-author {
    color: #bdc3c7;
}

/* ==================================================================== */
/* 4. 图书阅读进度样式 (新增功能) */
/* ==================================================================== */

.so-book-cover {
    position: relative;
}

/* 阅读进度条 */
.so-book-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 5px;
    background-color: var(--primary-blue); /* 使用主题主色 */
    transition: width 0.5s ease;
    z-index: 10;
}

/* 阅读进度百分比文字 */
.so-book-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
    color: var(--white);
    background-color: rgba(0, 0, 0, 0.6);
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 11;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* 已读完的文字样式 */
.so-book-completed-text {
    background-color: rgba(46, 204, 113, 0.8); /* 绿色背景 */
}

/* 进度达到100%时，图书变灰 */
.so-book-item.so-book-completed .so-book-cover img {
    filter: grayscale(100%);
    opacity: 0.7;
    transition: filter 0.5s ease, opacity 0.5s ease;
}

/* 进度达到100%时，移除悬停效果 */
.so-book-item.so-book-completed:hover {
    transform: none;
}

/* 进度达到100%时，进度文字隐藏 */
.so-book-item.so-book-completed .so-book-progress-text {
    opacity: 1; /* 保持“已读完”文字可见 */
}

/* 优化性能：图片懒加载 */
.so-book-cover img {
    /* 确保图片加载时有占位符 */
    background-color: var(--light-gray);
}

/* 优化性能：移除不必要的阴影和过渡，保持简洁 */
.so-book-item {
    transition: transform 0.2s ease-out;
}

.so-book-cover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); /* 稍微减轻阴影 */
}
