/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 容器样式 */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏样式 */
.nav-bar {
    background-color: #007bff;
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand a {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 2px 0;
    transition: all 0.3s ease;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin-right: 30px;
}

.nav-item {
    margin-left: 20px;
    position: relative;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 下拉菜单 */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    color: #333;
    list-style: none;
    min-width: 150px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    z-index: 1000;
    display: none;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-item {
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    display: block;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

/* 搜索表单 */
.search-form {
    display: flex;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    width: 200px;
}

.search-btn {
    padding: 8px 12px;
    border: none;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0069d9;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

.btn-outline-white {
    background-color: transparent;
    color: white;
    border: 1px solid white;
}

.btn-outline-white:hover {
    background-color: white;
    color: #007bff;
}

/* 英雄区域 */
.hero-section {
    background: linear-gradient(135deg, #343a40 0%, #212529 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.hero-section h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.lead-text {
    font-size: 1.25rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

/* 特色功能 */
.features {
    padding: 60px 0;
    background-color: white;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col {
    flex: 1;
    padding: 0 15px;
    min-width: 300px;
    margin-bottom: 30px;
}

.feature-card {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    text-align: center;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.feature-card h3 {
    margin-bottom: 15px;
    color: #007bff;
}

/* 文章列表 */
.articles {
    padding: 60px 0;
    background-color: #f8f9fa;
}

.section-title {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2rem;
    color: #333;
}

.article-card {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    height: 100%;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.article-title {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.25rem;
}

.article-text {
    margin-bottom: 20px;
    color: #6c757d;
    line-height: 1.6;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.article-tag {
    background-color: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
}

/* 订阅区域 */
.subscribe {
    background: linear-gradient(135deg, #007bff 0%, #0069d9 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.subscribe h2 {
    margin-bottom: 20px;
}

.subscribe-form {
    display: flex;
    justify-content: center;
    max-width: 600px;
    margin: 30px auto 0;
    flex-wrap: wrap;
}

.subscribe-input {
    padding: 12px 20px;
    border: none;
    border-radius: 4px 0 0 4px;
    font-size: 16px;
    width: 300px;
    margin-right: 0;
    margin-bottom: 10px;
}

.subscribe-form .btn {
    border-radius: 0 4px 4px 0;
    margin-bottom: 10px;
}

/* 页脚 */
.footer {
    background-color: #212529;
    color: white;
    padding: 60px 0 30px;
}

.footer h3 {
    margin-bottom: 20px;
    color: #007bff;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #adb5bd;
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #343a40;
    text-align: center;
    color: #adb5bd;
}

/* 代码高亮 */
pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    margin: 20px 0;
}

code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

.keyword {
    color: #0000ff;
    font-weight: bold;
}

.string {
    color: #008000;
}

.comment {
    color: #808080;
    font-style: italic;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .col {
        flex: 0 0 50%;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #007bff;
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        display: none;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-menu {
        flex-direction: column;
        margin: 0 0 20px 0;
        width: 100%;
    }
    
    .nav-item {
        margin: 0 0 10px 0;
        width: 100%;
    }
    
    .search-form {
        width: 100%;
    }
    
    .search-input {
        width: 100%;
    }
    
    .col {
        flex: 0 0 100%;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .subscribe-form {
        flex-direction: column;
        align-items: center;
    }
    
    .subscribe-input {
        border-radius: 4px;
        margin-right: 0;
        width: 100%;
        max-width: 400px;
    }
    
    .subscribe-form .btn {
        border-radius: 4px;
        margin-top: 10px;
    }
}

@media (max-width: 576px) {
    .hero-section h1 {
        font-size: 1.5rem;
    }
    
    .lead-text {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .feature-card,
    .article-card {
        padding: 20px;
    }
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 文章内容区域 */
.article-content {
    padding: 60px 0;
    background-color: white;
}

.article-main {
    flex: 1;
    min-width: 300px;
    margin-right: 30px;
}

.article-sidebar {
    flex: 0 0 300px;
    min-width: 250px;
}

.article-content h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #333;
}

.article-meta {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
    color: #6c757d;
    font-size: 0.9rem;
}

.article-meta span {
    margin-right: 15px;
}

.article-body {
    line-height: 1.8;
    color: #333;
}

.article-body h2 {
    margin-top: 40px;
    margin-bottom: 20px;
    color: #007bff;
    font-size: 1.5rem;
}

.article-body p {
    margin-bottom: 20px;
}

.article-body ul,
.article-body ol {
    margin-bottom: 20px;
    padding-left: 20px;
}

.article-body li {
    margin-bottom: 10px;
}

/* 评论区域 */
.comments-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #e9ecef;
}

.comments-section h3 {
    margin-bottom: 30px;
    color: #333;
}

.comment-form {
    margin-bottom: 40px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.comment {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background-color: #f8f9fa;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: #6c757d;
    font-size: 0.9rem;
}

.comment-content {
    color: #333;
    line-height: 1.6;
}

/* 侧边栏 */
.sidebar {
    background-color: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.sidebar-card {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.sidebar-card:last-child {
    border-bottom: none;
}

.sidebar-card h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.sidebar-links {
    list-style: none;
}

.sidebar-links li {
    margin-bottom: 10px;
}

.sidebar-links a {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.3s ease;
}

.sidebar-links a:hover {
    color: #007bff;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    background-color: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    transition: all 0.3s ease;
}

.tag:hover {
    background-color: #0069d9;
    transform: translateY(-2px);
}

/* 加载动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-section,
.feature-card,
.article-card,
.article-main,
.sidebar-card {
    animation: fadeIn 0.6s ease-out;
}

/* 响应式调整 */
@media (max-width: 992px) {
    .article-main {
        margin-right: 0;
        margin-bottom: 30px;
    }
    
    .article-sidebar {
        flex: 0 0 100%;
    }
}
