/* 全局变量 */
:root {
    /* 调色板 */
    --primary: #9370DB;
    --primary-light: #ece6fc;
    --primary-dark: #7B5DC8;
    --primary-darker: #7B5DC8;
    /* 中性色 */
    --background: #FFFFFF;
    --navbar-bg: rgba(248, 248, 248, 0.95);
    --footer-bg: #F5F5F5;
    --card-bg: #FFFFFF;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #E5E5E5;
    /* 圆角系统 */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-full: 999px;
    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    /* 间距 */
    --space-sm: 12px;
    --space-md: 20px;
    --space-lg: 32px;
    --space-xl: 48px;
}

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    padding-top: 70px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* 导航栏 */
header {
    background-color: var(--navbar-bg);
    padding: 12px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap; /* 防止换行 */
}

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* 防止被压缩 */
    margin-right: var(--space-md); /* 与导航链接间隔 */
}

.logo h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap; /* 防止标题换行 */
}

.logo span {
    font-size: 14px;
    color: var(--text-secondary);
    display: block;
}

/* 桌面导航 */
.desktop-nav {
    display: flex;
    flex-grow: 1; /* 占据剩余空间 */
    justify-content: flex-end; /* 链接靠右 */
}

.desktop-nav ul {
    display: flex;
    gap: 8px; /* 缩小间距 */
    list-style: none;
    align-items: center;
    flex-wrap: nowrap; /* 防止换行 */
    margin: 0;
    padding: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-weight: 500;
    font-size: 15px;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--primary-light);
    color: var(--primary);
}

.nav-link.active .nav-indicator {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background-color: var(--primary);
    border-radius: 2px;
    animation: navIndicator 0.3s ease-out;
}

@keyframes navIndicator {
    from { width: 0; opacity: 0; }
    to { width: 20px; opacity: 1; }
}

/* 下拉菜单 */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-sm) 0;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
    border: 1px solid var(--border-color);
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
}

.dropdown-menu li {
    padding: 0;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px var(--space-md);
    color: var(--text-secondary);
}

.dropdown-menu a:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

/* 移动菜单 */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 24px;
    cursor: pointer;
    margin-left: var(--space-sm);
}

.mobile-menu {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    padding: var(--space-md);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    display: none;
    border-bottom: 1px solid var(--border-color);
}

.mobile-menu.active {
    display: block;
}

.mobile-menu ul {
    list-style: none;
}

.mobile-menu li {
    margin-bottom: var(--space-sm);
}

.mobile-menu a {
    display: block;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
}

.mobile-menu a:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

/* 搜索区域 */
.search-section {
    padding: var(--space-lg) 0;
    background-color: var(--primary-light);
    margin-bottom: var(--space-xl);
}

.search-box {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    animation: fadeIn 0.6s ease-out;
}

.search-box input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full) 0 0 var(--radius-full);
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(25, 141, 219, 0.2);
}

.search-box button {
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
    padding: 0 24px;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 主要内容区 */
main {
    display: flex;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

#main-content {
    flex: 3;
}

aside {
    flex: 1;
    position: sticky;
    top: 100px;
    align-self: flex-start;
}

/* 文章卡片 */
.article-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-lg);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.5s ease-out;
}

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

.article-image {
    height: 220px;
    background-color: var(--primary);
    background-size: cover;
    background-position: center;
    position: relative;
}

.article-image::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.7));
}

.article-title {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    color: white;
    font-size: 1.8rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    margin: 0;
}

.article-content {
    padding: var(--space-md);
}

.article-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-sm);
}

.article-excerpt {
    color: var(--text-secondary);
    margin: var(--space-md) 0;
    line-height: 1.6;
}

/* 标签样式 */
.tags {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin: var(--space-md) 0;
}

.tag {
    background-color: var(--primary-light);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tag:hover {
    background-color: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* 侧边栏 */
.sidebar-widget {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    animation: fadeIn 0.7s ease-out;
}

.widget-title {
    color: var(--primary-darker);
    font-size: 1.2rem;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--primary-light);
}

#category-list {
    list-style: none;
}

#category-list li {
    margin-bottom: var(--space-sm);
    transition: all 0.3s ease;
}

#category-list li:hover {
    transform: translateX(5px);
}

#category-list a {
    display: block;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
}

#category-list a:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

/* 页脚 */
footer {
    background-color: var(--footer-bg);
    padding: var(--space-xl) 0;
    border-top: 1px solid var(--border-color);
}

.footer-logo h1 {
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 8px;
}

.footer-logo p {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-xl);
    margin-top: var(--space-lg);
}

.link-group h3 {
    color: var(--primary);
    margin-bottom: var(--space-md);
    font-size: 18px;
}

.link-group ul {
    list-style: none;
}

.link-group li {
    margin-bottom: var(--space-sm);
}

.link-group a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.link-group a:hover {
    color: var(--primary);
    transform: translateX(5px);
}

.copyright {
    margin-top: var(--space-xl);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 14px;
}

.stat-counter {
    color: var(--primary);
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes navIndicator {
    from { width: 0; opacity: 0; }
    to { width: 20px; opacity: 1; }
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(25, 141, 219, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 992px) {
    .desktop-nav {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .header-content {
        justify-content: space-between;
    }
    
    .logo h1 {
        font-size: 20px; /* 缩小标题字号 */
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }
    
    .desktop-nav {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .mobile-menu {
        top: 70px;
    }
    
    main {
        flex-direction: column;
    }
    
    aside {
        position: static;
    }
    
    .footer-links {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
}

@media (max-width: 576px) {
    .logo h1 {
        font-size: 18px;
    }
}