/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #5A5A5A;
    background: linear-gradient(135deg, #f0f8f2 50%, #e0f0e8 100%);
    min-height: 100vh;
    position: relative;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* 防止整个页面水平溢出 */
}

/* 主要内容区域，使用flex-grow: 1来填充可用空间 */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 背景装饰元素 */
body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 20%);
    z-index: -1;
}

/* 顶部导航栏 */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    box-sizing: border-box;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: #444;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: #666;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: #333;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: #a3c9b2;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-icons {
    display: flex;
    gap: 20px;
}

.nav-icon {
    font-size: 1.2rem;
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
    cursor: pointer;
}

.nav-icon:hover {
    color: #333;
}

/* 移动端菜单按钮样式 */
#menu-toggle {
    display: none;
    font-size: 1.5rem;
}

/* 右侧抽屉菜单样式 */
.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    box-shadow: 0 2px 8px rgba(168, 230, 207, 0.15);
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    border-top-left-radius: 20px;
    border-bottom-left-radius: 20px;
    border-left: 1px solid rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.6);
}

.mobile-drawer.active {
    transform: translateX(0);
}

.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 25, 20, 0.28);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1500;
}

.drawer-overlay.active {
    display: block;
}

.drawer-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.drawer-header {
    display: flex;
    justify-content: flex-end;
    padding-bottom: 15px;
}

.close-btn {
    font-size: 30px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.close-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.drawer-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}

.drawer-link {
    padding: 15px;
    text-decoration: none;
    color: #666;
    border-radius: 8px;
    transition: background-color 0.3s;
    font-weight: 500;
}

.drawer-link:hover {
    background: rgba(163, 201, 178, 0.3);
    color: #333;
}

/* 黑暗模式样式 */
.dark-theme {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #e0e0e0;
}

.dark-theme::before {
    content: none;
}

.dark-theme .top-nav,
.dark-theme .glass-banner,
.dark-theme .author-card,
.dark-theme .filter-section,
.dark-theme .post-item,
.dark-theme .content,
.dark-theme .toc,
.dark-theme .mobile-drawer,
.dark-theme .filters {
    background: rgba(30, 30, 30, 0.85);
    color: #e0e0e0;
    border: 1px solid rgba(80, 80, 80, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.dark-theme .glass-banner::before,
.dark-theme .glass-banner::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.dark-theme .nav-brand,
.dark-theme .glass-banner h1,
.dark-theme .author-name,
.dark-theme .content h1,
.dark-theme .content h2,
.dark-theme .content h3 {
    color: #e0e0e0;
}

.dark-theme .nav-link,
.dark-theme .glass-banner p,
.dark-theme .glass-banner-subtitle,
.dark-theme .author-bio,
.dark-theme .post-date,
.dark-theme .filter-title,
.dark-theme .toc-title {
    color: #b0b0b0;
}

.dark-theme .post-title a,
.dark-theme .filter-tag,
.dark-theme .post-category,
.dark-theme .post-tag,
.dark-theme .content p,
.dark-theme .content li {
    color: #a3c9b2;
}

.dark-theme .floating-back-link,
.dark-theme .floating-top-link,
.dark-theme .floating-toc-link {
    background: #555;
}

.dark-theme .drawer-link {
    color: #b0b0b0;
}

.dark-theme .drawer-link:hover {
    background: rgba(163, 201, 178, 0.3);
    color: #e0e0e0;
}

/* 返回顶部和首页按钮样式 */
.floating-back-link, .floating-top-link, .floating-toc-link {
    position: fixed;
    right: 30px;
    bottom: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #666;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 999;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.5rem;
    border: none;
}

.floating-toc-link {
    bottom: 150px; /* 位于返回顶部按钮之上 */
}

.floating-top-link {
    bottom: 90px;
}

.floating-back-link {
    bottom: 30px; /* 普通情况下返回首页按钮在最下方 */
}

.floating-back-link:hover, .floating-top-link:hover, .floating-toc-link:hover {
    background: #a3c9b2;
    color: white;
    transform: scale(1.1);
}

/* 移动端响应式设计 */
@media screen and (max-width: 768px) {
    .top-nav {
        padding: 12px 5%;
        min-height: 60px;
    }
    
    .nav-menu {
        display: none;
    }
    
    #menu-toggle {
        display: block;
    }
    
    .nav-brand {
        font-size: 1.2rem;
    }
    
    .nav-icon {
        font-size: 1.1rem;
    }
    
    .floating-back-link, .floating-top-link, .floating-toc-link {
        width: 40px;
        height: 40px;
        font-size: 18px;
        bottom: 15px;
        right: 15px;
    }
    
    .floating-toc-link {
        bottom: 115px; /* 按照规范：目录按钮在最上方，与返回顶部按钮间距50px */
    }
    
    .floating-top-link {
        bottom: 65px; /* 按照规范：返回顶部按钮在中间，与返回首页按钮间距50px */
    }
    
    .floating-back-link {
        bottom: 15px; /* 移动端返回首页按钮在最下方 */
    }
}



/* 底部访问量统计横幅样式 */
.footer-stats {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    margin-top: auto; /* 推动footer到页面底部 */
}

.footer-stats-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    font-size: 0.9rem;
    color: #666;
}

.footer-stats-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-stats-label {
    color: #777;
}

.footer-stats-value {
    font-weight: bold;
    color: #444;
}

@media screen and (max-width: 768px) {
    .footer-stats-content {
        flex-direction: row; /* 移动端也保持横向排列 */
        gap: 15px; /* 调整间距 */
        padding: 0 10px;
        justify-content: center; /* 居中对齐 */
    }
    
    .footer-stats {
        padding: 12px 0;
        margin-top: 30px;
    }
}
