/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90d9;
    --primary-dark: #357abd;
    --secondary-color: #f5f7fa;
    --text-color: #333;
    --text-light: #666;
    --text-lighter: #999;
    --border-color: #e8e8e8;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
    --radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

/* 顶部导航 */
.header {
    background: #fff;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo img {
    height: 36px;
    width: auto;
}

.nav-menu {
    display: flex;
    gap: 30px;
}

.nav-menu a {
    color: var(--text-color);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}

.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--secondary-color);
    border-radius: 20px;
    padding: 5px 15px;
    transition: var(--transition);
}

.search-box:focus-within {
    background: #fff;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.search-box input {
    border: none;
    background: none;
    outline: none;
    width: 150px;
    font-size: 0.9rem;
}

.search-box button {
    color: var(--text-light);
    padding: 5px;
}

.mobile-menu-btn {
    display: none;
    font-size: 1.25rem;
    color: var(--text-color);
}

/* 轮播图 */
.carousel-section {
    margin: 20px 0;
}

.carousel {
    position: relative;
    width: 100%;
    height: 400px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.carousel-inner {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease;
}

.carousel-item {
    min-width: 100%;
    height: 100%;
    position: relative;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #fff;
}

.carousel-content h3 {
    font-size: 1.75rem;
    margin-bottom: 10px;
}

.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.carousel-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: var(--transition);
}

.carousel-indicator.active {
    background: #fff;
    width: 30px;
    border-radius: 5px;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(5px);
    border-radius: 50%;
    color: #fff;
    font-size: 1.25rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-btn:hover {
    background: rgba(255,255,255,0.4);
}

.carousel-prev { left: 20px; }
.carousel-next { right: 20px; }

/* 分类导航 */
.categories-section {
    margin: 30px 0;
}

.categories-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.categories-scroll {
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
}

.categories-scroll::-webkit-scrollbar {
    display: none;
}

.categories-list {
    display: flex;
    gap: 15px;
    padding: 5px;
}

.category-item {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #fff;
    border-radius: 25px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.category-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.category-item.active {
    background: var(--primary-color);
    color: #fff;
}

.category-item .icon {
    font-size: 1.25rem;
}

.category-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow);
    color: var(--text-color);
    flex-shrink: 0;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-nav-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

.category-prev { margin-right: 10px; }
.category-next { margin-left: 10px; }

/* 文章列表 */
.articles-section {
    margin: 40px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    color: var(--text-color);
}

.section-title i {
    color: var(--primary-color);
}

.view-toggle {
    display: flex;
    gap: 5px;
    background: #fff;
    padding: 5px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.view-toggle button {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    color: var(--text-light);
    transition: var(--transition);
}

.view-toggle button.active,
.view-toggle button:hover {
    background: var(--primary-color);
    color: #fff;
}

/* 文章网格视图 */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.article-card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.article-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.article-card:hover .article-image img {
    transform: scale(1.05);
}

.article-category {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 5px 12px;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.8rem;
    border-radius: 15px;
}

.article-top {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: #ff6b6b;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.article-content {
    padding: 20px;
}

.article-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-summary {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-lighter);
    font-size: 0.85rem;
}

.article-meta-left {
    display: flex;
    gap: 15px;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 文章列表视图 */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.articles-list .article-card {
    display: flex;
    flex-direction: row;
}

.articles-list .article-image {
    width: 280px;
    height: auto;
    flex-shrink: 0;
}

.articles-list .article-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 加载更多 */
.loading-more,
.no-more {
    text-align: center;
    padding: 30px;
    color: var(--text-light);
}

.loading-more i {
    margin-right: 8px;
}

/* 页脚 */
.footer {
    background: #fff;
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    margin-top: 50px;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-info {
    color: var(--text-light);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: var(--text-light);
    font-size: 1.1rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* 回到顶部 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: #fff;
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .search-box {
        display: none;
    }
    
    .carousel {
        height: 250px;
    }
    
    .carousel-content {
        padding: 20px;
    }
    
    .carousel-content h3 {
        font-size: 1.25rem;
    }
    
    .carousel-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .articles-list .article-card {
        flex-direction: column;
    }
    
    .articles-list .article-image {
        width: 100%;
        height: 200px;
    }
    
    .footer-inner {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

/* 文章详情页样式 */
.article-detail {
    background: #fff;
    border-radius: var(--radius);
    padding: 40px;
    margin: 30px 0;
    box-shadow: var(--shadow);
}

.article-detail-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.article-detail-title {
    font-size: 2rem;
    margin-bottom: 15px;
    line-height: 1.3;
}

.article-detail-meta {
    display: flex;
    gap: 20px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.article-detail-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-color);
}

.article-detail-content p {
    margin-bottom: 1.2em;
}

.article-detail-content h2,
.article-detail-content h3 {
    margin: 1.5em 0 0.8em;
}

.article-detail-content img {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 1.5em 0;
}

.article-detail-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 1.5em 0;
    color: var(--text-light);
    font-style: italic;
}

.article-detail-content code {
    background: var(--secondary-color);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.article-detail-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1.5em 0;
}

.article-detail-content pre code {
    background: none;
    padding: 0;
}

/* 搜索结果高亮 */
.highlight {
    background: #ffeb3b;
    padding: 0 2px;
}
