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

body {
    font-family: "Microsoft YaHei", "Heiti SC", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: #165DFF;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #0e42d2;
    text-decoration: underline;
}

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

/* ====================================
   SVG图标样式
==================================== */
.icon {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    vertical-align: -0.2em;
    flex-shrink: 0;
}

/* ====================================
   布局工具类
==================================== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 15px;
}

.hidden {
    display: none !important;
}

.mb-4 {
    margin-bottom: 16px;
}

.py-6 {
    padding: 24px 0;
}

/* ====================================
   头部导航
==================================== */
.header {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: #333;
    transition: opacity 0.2s ease;
}

.logo:hover {
    opacity: 0.8;
    text-decoration: none;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #165DFF 0%, #0e42d2 100%);
    border-radius: 6px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    line-height: 1;
}

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

.nav a {
    color: #666;
    font-size: 0.9rem;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.nav a:hover {
    color: #165DFF;
    background: #f0f7ff;
    text-decoration: none;
}

.nav a.active {
    color: #165DFF;
    font-weight: 500;
    background: #e8f3ff;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #333;
    transition: all 0.3s ease;
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 6px;
}

.menu-toggle:hover {
    background: #f0f7ff;
}

/* 汉堡菜单图标 */
.menu-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    position: relative;
}

.menu-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background: #333;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-toggle:hover .menu-icon span {
    background: #165DFF;
}

/* 菜单打开时的动画 */
.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.mobile-nav {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ====================================
   面包屑导航
==================================== */
.breadcrumb {
    font-size: 0.85rem;
    color: #999;
    padding: 10px 0;
    line-height: 1.5;
}

.breadcrumb a {
    color: #999;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: #165DFF;
    text-decoration: none;
}

.breadcrumb span {
    color: #666;
}

/* ====================================
   文章头部
==================================== */
.article-header {
    margin-bottom: 24px;
}

.article-tag {
    display: inline-block;
    background: #E8F3FF;
    color: #165DFF;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-bottom: 12px;
    font-weight: 500;
}

.article-title {
    font-size: 1.9rem;
    line-height: 1.3;
    margin-bottom: 16px;
    color: #222;
    font-weight: 600;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.85rem;
    color: #888;
    align-items: center;
}

.author {
    display: flex;
    align-items: center;
    gap: 6px;
}

.author img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* ====================================
   主内容区域布局
==================================== */
.content-wrap {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.article-card {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

/* ====================================
   文章摘要
==================================== */
.article-excerpt {
    background: linear-gradient(135deg, #FFF8E6 0%, #FFF4DC 100%);
    border-left: 4px solid #FF9800;
    padding: 18px 20px;
    margin-bottom: 24px;
    border-radius: 0 6px 6px 0;
}

.article-excerpt h2 {
    color: #E67E22;
    margin-bottom: 10px;
    font-size: 1.1rem;
    font-weight: 600;
}

.article-excerpt p {
    color: #666;
    line-height: 1.7;
    margin: 0;
}

/* ====================================
   文章正文样式
==================================== */
.article-content h2 {
    font-size: 1.5rem;
    margin: 28px 0 16px;
    color: #222;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
    font-weight: 600;
}

.article-content h3 {
    font-size: 1.2rem;
    margin: 20px 0 12px;
    color: #333;
    font-weight: 600;
}

.article-content p {
    margin-bottom: 16px;
    line-height: 1.8;
    color: #444;
}

.article-content ul,
.article-content ol {
    margin: 16px 0;
    padding-left: 28px;
    line-height: 1.8;
}

.article-content li {
    margin-bottom: 8px;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 20px auto;
    margin-left: auto;
    margin-right: auto;
    display: block;
}

.article-content figure {
    margin: 24px 0;
}

.article-content figcaption {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-top: 8px;
}

/* 文章标签 */
.article-tags h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: #333;
}

.article-tags a {
    display: inline-block;
    margin: 4px;
    transition: all 0.2s ease;
}

.article-tags a:hover {
    transform: translateY(-2px);
    text-decoration: none;
}

/* ====================================
   侧边栏
==================================== */
.sidebar {
    width: 320px;
    flex-shrink: 0;
}

.sidebar-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    transition: box-shadow 0.3s ease;
}

.sidebar-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.sidebar-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    align-items: center;
    color: #222;
}

.sidebar-title .icon {
    margin-right: 8px;
    color: #165DFF;
}

/* 搜索框 */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    outline: none;
}

.search-box input:focus {
    border-color: #165DFF;
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.1);
}

.search-box .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    transition: color 0.2s ease;
    pointer-events: none;
}

.search-box input:focus + .icon,
.search-box:hover .icon {
    color: #165DFF;
}

/* 目录列表 */
.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 12px;
    padding-left: 0;
}

.toc-list a {
    color: #666;
    font-size: 0.9rem;
    display: block;
    padding: 6px 0;
    transition: all 0.2s ease;
    line-height: 1.5;
}

.toc-list a:hover {
    color: #165DFF;
    padding-left: 8px;
    text-decoration: none;
}

/* ====================================
   相关文章推荐
==================================== */
.related-articles {
    margin: 40px 0 30px;
}

.related-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    color: #222;
}

.related-title .icon {
    margin-right: 10px;
    color: #165DFF;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.article-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.article-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.article-item a {
    display: block;
    text-decoration: none;
}

.article-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-item:hover img {
    transform: scale(1.05);
}

.article-item-content {
    padding: 18px;
}

.article-item-category {
    font-size: 0.75rem;
    color: #165DFF;
    background: #E8F3FF;
    padding: 3px 10px;
    border-radius: 10px;
    margin-bottom: 8px;
    display: inline-block;
    font-weight: 500;
}

.article-item-title {
    font-size: 1rem;
    margin-bottom: 10px;
    line-height: 1.5;
    color: #333;
    font-weight: 500;
}

.article-item-title a {
    color: inherit;
}

.article-item-title a:hover {
    color: #165DFF;
    text-decoration: none;
}

.article-item-meta {
    font-size: 0.8rem;
    color: #999;
}

/* ====================================
   页脚
==================================== */
.footer {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #999;
    padding: 40px 0 20px;
    font-size: 0.85rem;
    margin-top: 60px;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 20px;
}

.footer-col {
    flex: 1;
    min-width: 200px;
}

.footer-col h3 {
    color: white;
    font-size: 1.05rem;
    margin-bottom: 18px;
    font-weight: 600;
}

.footer-col ul {
    list-style: none;
    padding: 0;
}

.footer-col li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.footer-col a {
    color: #999;
    transition: all 0.2s ease;
}

.footer-col a:hover {
    color: white;
    padding-left: 5px;
    text-decoration: none;
}

.footer-col p {
    line-height: 1.7;
    color: #aaa;
}

.copyright {
    text-align: center;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid #3a3a3a;
    color: #888;
}

.copyright p {
    margin: 0;
}

.copyright a {
    color: #999;
    text-decoration: none;
}

.copyright a:hover {
    color: #165DFF;
}

/* ====================================
   实用组件
==================================== */
/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #165DFF 0%, #0e42d2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(22, 93, 255, 0.3);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(22, 93, 255, 0.4);
}

.back-to-top:active {
    transform: translateY(-1px);
}

/* 滚动进度条 */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #165DFF 0%, #0e42d2 100%);
    z-index: 1000;
    width: 0%;
    transition: width 0.1s ease;
}

/* ====================================
   响应式设计
==================================== */

/* 平板设备 (≤992px) */
@media (max-width: 992px) {
    .container {
        max-width: 100%;
        padding: 0 20px;
    }
    
    .content-wrap {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-width: 100%;
    }
    
    .main-content {
        max-width: 100%;
    }
    
    .article-card {
        padding: 24px;
    }
    
    .articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

/* 手机设备 (≤768px) */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    /* 导航菜单 */
    .nav {
        display: none;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .header-inner {
        height: 55px;
    }
    
    .logo {
        font-size: 1.1rem;
    }
    
    .logo-icon {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
    
    /* 文章样式 */
    .article-title {
        font-size: 1.5rem;
    }
    
    .article-meta {
        gap: 10px;
        font-size: 0.8rem;
    }
    
    .article-card {
        padding: 20px;
        border-radius: 6px;
    }
    
    .article-content h2 {
        font-size: 1.3rem;
        margin: 20px 0 14px;
    }
    
    .article-content h3 {
        font-size: 1.1rem;
    }
    
    /* 文章列表 */
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* 侧边栏 */
    .sidebar-card {
        padding: 16px;
    }
    
    /* 页脚 */
    .footer {
        padding: 30px 0 15px;
        margin-top: 40px;
    }
    
    .footer-inner {
        gap: 25px;
    }
    
    .footer-col {
        min-width: 100%;
    }
    
    /* 回到顶部按钮 */
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
}

/* 小屏手机 (≤480px) */
@media (max-width: 480px) {
    .article-title {
        font-size: 1.3rem;
    }
    
    .article-card {
        padding: 16px;
    }
    
    .related-title {
        font-size: 1.15rem;
    }
}

/* ====================================
   打印样式
==================================== */
@media print {
    .header,
    .breadcrumb,
    .sidebar,
    .related-articles,
    .footer,
    .back-to-top,
    .progress-bar,
    .menu-toggle,
    .article-tags {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .article-card {
        box-shadow: none;
        padding: 0;
    }
    
    .article-content img {
        page-break-inside: avoid;
    }
}