/*
Theme Name: LuoLei
Theme URI: https://blog.tianai.fun
Author: TianAI
Description: 现代化博客主题 - 支持深色模式、侧边栏、标签云、Hero区域
Version: 3.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: luolei
Tags: blog, news, minimalist, responsive, card-layout, dark-mode
*/

/* ===== CSS变量 ===== */
:root {
    --bg: #ffffff;
    --bg-secondary: #f7f8fa;
    --text: #1a1a2e;
    --text-secondary: #4a4a68;
    --text-light: #71717a;
    --text-lighter: #a1a1aa;
    --border: #e5e7eb;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --card-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --card-shadow-hover: 0 8px 30px rgba(0,0,0,0.12);
    --header-bg: rgba(255,255,255,0.95);
    --sidebar-width: 320px;
    --content-max-width: 1400px;
}

[data-theme="dark"] {
    --bg: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --text: #e5e7eb;
    --text-secondary: #a1a1aa;
    --text-light: #71717a;
    --text-lighter: #52525b;
    --border: #2d2d3f;
    --card-bg: #1a1a2e;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
    --card-shadow-hover: 0 8px 30px rgba(0,0,0,0.4);
    --header-bg: rgba(15,15,26,0.95);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.3s, color 0.3s;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent);
}

img {
    max-width: 100%;
    height: auto;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

/* ===== 布局容器 ===== */
.home-container {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== 头部导航 ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: all 0.3s;
}

.header-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
}

.logo-img {
    border-radius: 8px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-item {
    padding: 8px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-item:hover {
    color: var(--accent);
    background: var(--bg-secondary);
}

.nav-item.active {
    color: var(--accent);
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-btn, .theme-toggle, .menu-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.search-btn:hover, .theme-toggle:hover, .menu-toggle:hover {
    background: var(--bg-secondary);
    color: var(--accent);
}

.menu-toggle {
    display: none;
}

/* ===== Hero区域 ===== */
.hero-section {
    margin-top: 84px;
    padding: 40px 0;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    transition: all 0.3s;
}

.hero-content:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.hero-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-light);
}

.hero-category {
    color: var(--accent);
    font-weight: 600;
}

.hero-title {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 16px;
    color: var(--text);
}

.hero-title a:hover {
    color: var(--accent);
}

.hero-excerpt {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-readmore {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    width: fit-content;
    transition: all 0.2s;
}

.hero-readmore:hover {
    background: var(--accent-hover);
    color: white;
    transform: translateX(4px);
}

.hero-image {
    border-radius: 12px;
    overflow: hidden;
}

.hero-img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

/* ===== 内容布局 ===== */
.content-layout {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: 32px;
    padding: 32px 0;
}

@media (max-width: 1024px) {
    .content-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
}

/* ===== 分类导航 ===== */
.category-nav {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-list a {
    padding: 8px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    border-radius: 20px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.category-list a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.category-list a.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ===== 文章网格 ===== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.post-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

.post-card-link {
    display: block;
}

.post-thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--bg-secondary);
}

.post-card-body {
    padding: 20px;
}

.post-card-category {
    margin-bottom: 12px;
}

.category-tag {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-secondary);
    color: var(--accent);
    font-size: 12px;
    border-radius: 6px;
    font-weight: 500;
}

.post-card-title-link {
    display: block;
}

.post-card-title {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 12px;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card:hover .post-card-title {
    color: var(--accent);
}

.post-card-excerpt {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-lighter);
}

.post-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 40px 0;
}

.pagination a,
.pagination span {
    padding: 10px 16px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
}

.pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.pagination .current {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ===== 侧边栏 ===== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-widget {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
}

.item-headline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

.item-headline i {
    color: var(--accent);
}

/* 作者卡片 */
.card-author {
    text-align: center;
}

.author-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.author-avatar-wrap {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent);
}

.author-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.author-bio {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
}

.author-social {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.social-link {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.social-link:hover {
    background: var(--accent);
    color: white;
}

/* 标签云 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    padding: 6px 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tag-item:hover {
    background: var(--accent);
    color: white;
}

.tag-item sup {
    font-size: 10px;
    opacity: 0.7;
}

/* 分类列表 */
.category-list-sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.category-item:hover {
    background: var(--accent);
    color: white;
}

.category-item:hover .category-count {
    background: rgba(255,255,255,0.2);
    color: white;
}

.category-count {
    font-size: 12px;
    padding: 2px 8px;
    background: var(--card-bg);
    border-radius: 10px;
    color: var(--text-light);
}

/* 归档列表 */
.archive-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.archive-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.2s;
}

.archive-item:hover {
    background: var(--accent);
    color: white;
}

.archive-date {
    color: var(--text-secondary);
}

.archive-item:hover .archive-date {
    color: white;
}

.archive-count {
    font-size: 12px;
    color: var(--text-light);
}

.archive-item:hover .archive-count {
    color: rgba(255,255,255,0.8);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stats-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 10px;
}

.stats-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    border-radius: 10px;
    font-size: 14px;
}

.stats-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.stats-label {
    font-size: 11px;
    color: var(--text-light);
}

/* ===== 页脚 ===== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    margin-top: 60px;
    padding: 40px 0 20px;
}

.footer-main {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 32px;
    margin-bottom: 32px;
}

.footer-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-links a {
    font-size: 13px;
    color: var(--text-light);
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-bottom {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 20px 20px 0;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-copyright {
    font-size: 13px;
    color: var(--text-light);
}

.footer-social {
    display: flex;
    gap: 12px;
}

.footer-social a {
    color: var(--text-light);
    font-size: 18px;
    transition: color 0.2s;
}

.footer-social a:hover {
    color: var(--accent);
}

/* ===== 右下角悬浮按钮 ===== */
.rightside {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99;
}

.rightside-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rightside-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    color: var(--text);
    border-radius: 50%;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
    font-size: 16px;
    transition: all 0.2s;
}

.rightside-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: scale(1.1);
}

/* ===== 搜索覆盖层 ===== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 200;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
}

.search-overlay.active {
    display: flex;
}

.search-container {
    width: 90%;
    max-width: 600px;
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
}

.search-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.search-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 18px;
    color: var(--text);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 20px;
    border-radius: 8px;
    transition: all 0.2s;
}

.search-close:hover {
    background: var(--bg-secondary);
    color: var(--text);
}

/* ===== 文章详情页 ===== */
.single-article {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

.single-header {
    margin-bottom: 32px;
}

.single-category {
    display: inline-block;
    padding: 6px 14px;
    background: var(--accent);
    color: white;
    font-size: 12px;
    border-radius: 6px;
    font-weight: 500;
    margin-bottom: 16px;
}

.single-title {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 16px;
    color: var(--text);
}

.single-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
    color: var(--text-light);
}

.single-content {
    font-size: 17px;
    line-height: 2;
}

.single-content p {
    margin-bottom: 24px;
}

.single-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 40px 0 20px;
    color: var(--text);
}

.single-content h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 32px 0 16px;
    color: var(--text);
}

.single-content a {
    color: var(--accent);
}

.single-content img {
    border-radius: 12px;
    margin: 24px 0;
}

.single-content pre {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 24px 0;
}

.single-content blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 20px;
    margin: 24px 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .header-inner {
        padding: 0 16px;
    }
    
    .nav {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--header-bg);
        flex-direction: column;
        padding: 16px;
        border-bottom: 1px solid var(--border);
        display: none;
    }
    
    .nav.active {
        display: flex;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        padding: 24px;
    }
    
    .hero-image {
        order: -1;
    }
    
    .hero-title {
        font-size: 24px;
    }
    
    .hero-img {
        height: 200px;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    .single-title {
        font-size: 28px;
    }
    
    .pagination a,
    .pagination span {
        padding: 8px 12px;
        min-width: 36px;
    }
}

/* ===== AI聊天按钮 ===== */
.ai-chat-btn {
    position: fixed;
    right: 24px;
    bottom: 80px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s;
    z-index: 98;
    border: none;
}

.ai-chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.5);
}

#chatbot-widget {
    z-index: 99 !important;
}
