
/* 
    全局样式设置
    主要应用现代CSS3特性，确保页面的响应式和视觉效果。
    采用冷色系作为主色调，辅以亮色点缀，体现科技感与专业性。
    使用flexbox和grid布局实现灵活的响应式设计，适配各种设备和屏幕尺寸。
*/

/* 设置根字体大小和盒子模型 */
html {
    box-sizing: border-box;
    font-size: 16px;
}

*, *::before, *::after {
    box-sizing: inherit;
}

/* 应用全局字体和背景 */
body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #ecf0f1;
    line-height: 1.6;
    transition: background 0.3s ease;
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(52, 73, 94, 0.9);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar .logo {
    font-size: 1.5em;
    font-weight: bold;
    color: #ecf0f1;
}

.navbar .nav-links a {
    color: #ecf0f1;
    text-decoration: none;
    margin-left: 20px;
    position: relative;
    transition: color 0.3s ease;
}

.navbar .nav-links a::after {
    content: '';
    position: absolute;
    width: 0%;
    height: 2px;
    background-color: #e67e22;
    left: 0;
    bottom: -5px;
    transition: width 0.3s ease;
}

.navbar .nav-links a:hover::after {
    width: 100%;
}

.navbar .theme-switch {
    width: 40px;
    height: 20px;
    background-color: #bdc3c7;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.navbar .theme-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.navbar .theme-switch.active {
    background-color: #e67e22;
}

.navbar .theme-switch.active::after {
    transform: translateX(20px);
}

/* 主容器样式，使用grid布局 */
.container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    padding: 100px 30px 50px 30px;
    max-width: 1920px;
    margin: 0 auto;
}

/* 文章样式 */
article {
    grid-column: 2 / 12;
    background-color: rgba(44, 62, 80, 0.8);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease;
}

article h2, article h3, article h4 {
    color: #e67e22;
    margin-bottom: 15px;
}

article p {
    font-size: 1em;
    margin-bottom: 20px;
    line-height: 1.8;
}

article pre {
    background-color: #2c3e50;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 20px;
}

article code {
    color: #f39c12;
    font-family: 'Courier New', Courier, monospace;
}

article table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

article table, article th, article td {
    border: 1px solid #7f8c8d;
}

article th, article td {
    padding: 10px;
    text-align: left;
}

article th {
    background-color: #34495e;
}

article tr:nth-child(even) {
    background-color: rgba(236, 240, 241, 0.2);
}

/* 图片样式 */
img.decorative {
    width: 100%;
    max-width: 320px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

img.decorative:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

/* 按钮样式 */
.button-primary {
    background-color: #e67e22;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.button-primary:hover {
    background-color: #d35400;
    transform: translateY(-2px);
}

/* 折叠区域样式 */
.collapsible {
    background-color: rgba(44, 62, 80, 0.9);
    color: #ecf0f1;
    cursor: pointer;
    padding: 18px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.collapsible:hover {
    background-color: #34495e;
}

.content {
    padding: 0 18px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: rgba(52, 73, 94, 0.8);
    border-left: 2px solid #e67e22;
}

/* 侧边栏样式 */
.sidebar {
    grid-column: 1 / 2;
    background-color: rgba(52, 73, 94, 0.95);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    padding-top: 60px;
    transition: width 0.3s ease;
    overflow-x: hidden;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar a {
    padding: 15px 25px;
    text-decoration: none;
    font-size: 1em;
    color: #ecf0f1;
    display: block;
    transition: background-color 0.3s ease;
    rel="nofollow"
}

.sidebar a:hover {
    background-color: #34495e;
}

.sidebar .submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: #2c3e50;
}

.sidebar .submenu a {
    padding-left: 40px;
}

.sidebar .submenu.open {
    max-height: 500px; /* Arbitrary large value */
}

/* 底部样式 */
.footer {
    grid-column: 1 / -1;
    background-color: rgba(44, 62, 80, 0.9);
    color: #ecf0f1;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.footer .brand-logo {
    font-size: 1.5em;
    font-weight: bold;
}

.footer .social-media a {
    color: #e67e22;
    margin-left: 15px;
    transition: color 0.3s ease;
}

.footer .social-media a:hover {
    color: #d35400;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .container {
        grid-template-columns: repeat(8, 1fr);
    }

    article {
        grid-column: 1 / -1;
    }

    .sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    article {
        padding: 20px;
    }

    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .navbar .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
    }

    .navbar .nav-links a {
        margin: 10px 0;
    }

    .navbar.active .nav-links {
        display: flex;
    }

    .container {
        grid-template-columns: 1fr;
        padding: 100px 20px 50px 20px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 13px;
    }

    .navbar {
        padding: 10px 20px;
    }

    .footer {
        flex-direction: column;
        text-align: center;
    }

    .footer .social-media a {
        margin: 10px 5px 0 5px;
    }
}

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

.fade-in {
    animation: fadeInUp 0.6s forwards;
}

/* 提示文字样式 */
.prompt-text {
    position: fixed;
    top: 10px;
    right: 10px;
    background-color: rgba(231, 126, 34, 0.9);
    color: #ffffff;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 0.9em;
    z-index: 1100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

