
/* 全局样式设置 */
:root {
    /* 颜色变量定义 */
    --primary-gradient: linear-gradient(135deg, #0A2C4D, #1E90FF);
    --accent-orange: #FFA500;
    --accent-yellow: #FFFF00;
    --neutral-gray: #F5F5F5;
    --text-color: #333333;
    --background-color: #1A1A1A;
    --header-height: 60px;
}

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Open Sans', sans-serif;
    color: var(--text-color);
    background: var(--background-color);
    line-height: 1.6;
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--header-height);
    background: var(--primary-gradient);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.navbar a {
    color: #ffffff;
    text-decoration: none;
    margin-left: 15px;
    transition: color 0.3s;
}
.navbar a:hover {
    color: var(--accent-yellow);
}
.navbar .logo {
    font-size: 1.5rem;
    font-weight: bold;
}

/* 侧边栏样式 */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 250px;
    height: calc(100% - var(--header-height));
    background-color: #ffffff;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    transform: translateX(0);
}
.sidebar.collapsed {
    transform: translateX(-100%);
}
.sidebar ul {
    list-style: none;
    padding: 20px;
}
.sidebar ul li {
    margin-bottom: 20px;
}
.sidebar ul li a {
    color: #333333;
    text-decoration: none;
    font-size: 1.1rem;
    transition: color 0.3s;
}
.sidebar ul li a:hover {
    color: var(--accent-orange);
}

/* 主内容区样式 */
.main-content {
    margin-left: 250px;
    padding: 80px 20px 20px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
}
.section {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}
.section:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.2);
}
.section img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}
.section img:hover {
    transform: scale(1.05);
}
.section h2 {
    font-size: 1.8rem;
    margin: 15px 0;
    color: var(--primary-gradient);
}
.section p {
    font-size: 1rem;
    color: #555555;
}
.section pre {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 5px;
    overflow: visible;
    margin-top: 20px;
}
.section pre code {
    font-family: 'Roboto', monospace;
    color: #0A2C4D;
}
.section .code-block {
    background: #f9f9f9;
    padding: 10px;
    border-left: 4px solid var(--accent-orange);
    margin: 10px 0;
    overflow: visible;
}

/* 按钮样式 */
.btn {
    background: var(--primary-gradient);
    color: #ffffff;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
    text-decoration: none;
    display: inline-block;
    margin-top: 10px;
}
.btn:hover {
    background: linear-gradient(135deg, #1E90FF, #0A2C4D);
    transform: scale(1.05);
}

/* 加载动画样式 */
.loader {
    border: 8px solid var(--neutral-gray);
    border-top: 8px solid var(--accent-orange);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 100px auto;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 代码示例样式 */
.code-example {
    background: #2d2d2d;
    padding: 20px;
    border-radius: 8px;
    overflow: auto;
    color: #f8f8f2;
    font-family: 'Courier New', Courier, monospace;
    position: relative;
}
.code-example::before {
    content: 'CSS3 示例代码';
    position: absolute;
    top: -20px;
    left: 0;
    background: var(--accent-orange);
    color: #ffffff;
    padding: 5px 10px;
    border-radius: 5px 5px 0 0;
    font-size: 0.9rem;
}
pre code {
    overflow: visible;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

