/* 
 * 博客系统样式表
 * 主题：紫色
 * 设计：圆角
 * 响应式：适配PC、安卓、iOS
 */

/* 字体设置 */
@font-face {
    font-family: 'BlogFont';
    src: url('../font.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

/* 全局样式 */
:root {
    --primary: #2d3748;      /* 主色：深灰色 */
    --secondary: #4a5568;    /* 次要色：中灰色 */
    --accent: #3182ce;       /* 强调色：蓝色 */
    --accent-light: #63b3ed; /* 浅强调色 */
    --background: #f8fafc;   /* 背景色：浅灰色 */
    --card-bg: #ffffff;      /* 卡片背景色 */
    --text: #1a202c;         /* 文字颜色：深色 */
    --text-light: #718096;   /* 浅色文字 */
    --border: #e2e8f0;       /* 边框颜色 */
    --shadow: rgba(0, 0, 0, 0.1); /* 阴影颜色 */
    --button-hover: #4299e1; /* 按钮悬停色 */
    --link: #2b6cb0;         /* 链接色 */
}

body.dark-mode {
    --primary: #f7fafc;
    --secondary: #e2e8f0;
    --accent: #4299e1;
    --accent-light: #90cdf4;
    --background: #1a202c;
    --card-bg: #2d3748;
    --text: #f7fafc;
    --text-light: #cbd5e0;
    --border: #4a5568;
    --shadow: rgba(0, 0, 0, 0.3);
    --button-hover: #63b3ed;
    --link: #90cdf4;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'BlogFont', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
}

header h1 {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    color: var(--light-text);
    font-size: 1.2rem;
}

/* 搜索栏样式 */
.search-container {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

.search-box {
    display: flex;
    width: 100%;
    max-width: 600px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--border);
    border-radius: 50px;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(159, 122, 234, 0.3);
}

.search-button {
    position: absolute;
    right: 5px;
    top: 5px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-button:hover {
    background-color: var(--secondary);
}

/* 文章网格样式 */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.article-card {
    background-color: var(--white);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px var(--shadow);
}

.article-content {
    padding: 20px;
}

.article-date {
    color: var(--light-text);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.article-title {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 10px;
    line-height: 1.3;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

.pagination button {
    background-color: var(--white);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 15px;
    margin: 0 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.pagination button.active {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 页脚样式 */
footer {
    text-align: center;
    margin-top: 50px;
    padding: 20px;
    color: var(--light-text);
    border-top: 1px solid var(--border);
}

/* 文章页面样式 */
.article-container {
    background-color: var(--white);
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 5px 15px var(--shadow);
    margin-bottom: 40px;
}

.article-header {
    margin-bottom: 30px;
}

.article-header h1 {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.article-meta {
    color: var(--light-text);
    font-size: 1rem;
}

.article-body {
    line-height: 1.8;
    font-size: 1.1rem;
}

.article-body p {
    margin-bottom: 20px;
}

.article-body h2 {
    color: var(--secondary);
    margin: 30px 0 15px;
    font-size: 1.8rem;
}

.article-body h3 {
    color: var(--secondary);
    margin: 25px 0 15px;
    font-size: 1.5rem;
}

.back-button {
    display: inline-block;
    background-color: var(--primary);
    color: var(--white);
    padding: 12px 25px;
    border-radius: 50px;
    text-decoration: none;
    margin-top: 30px;
    transition: background-color 0.3s ease;
}

.back-button:hover {
    background-color: var(--secondary);
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .article-container {
        padding: 25px;
    }
    
    .article-header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .search-input {
        padding: 12px 15px;
    }
    
    .search-button {
        padding: 7px 15px;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .article-container {
        padding: 20px;
    }
    
    .article-header h1 {
        font-size: 1.8rem;
    }
    
    .pagination button {
        padding: 8px 12px;
        margin: 3px;
    }
}

/* 无内容状态 */
.no-articles {
    text-align: center;
    padding: 50px 0;
    color: var(--light-text);
}

/* 搜索动画 */
@keyframes searching {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-loading {
    position: relative;
}

.search-loading::after {
    content: '';
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: searching 0.8s linear infinite;
    display: none;
}

.searching .search-loading::after {
    display: block;
}

.search-button.searching {
    background-color: var(--secondary);
    pointer-events: none;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 50px 0;
    color: var(--primary);
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 120px;
    background-color: var(--text);
    color: var(--white);
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}