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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --background: #ffffff;
    --surface: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    display: flex;
    min-height: 100vh;
}

.container {
    display: flex;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

/* 侧边栏样式 */
.sidebar {
    width: 300px;
    background: var(--background);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    padding: 1.5rem;
    transition: var(--transition);
}

.logo h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.main-nav h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.main-nav ul {
    list-style: none;
}

.main-nav li {
    margin-bottom: 0.25rem;
}

.main-nav a {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.9rem;
}

.main-nav a:hover {
    background: var(--surface);
    color: var(--primary-color);
}

.main-nav a.active {
    background: var(--primary-color);
    color: white;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    padding: 2rem;
    background: var(--surface);
    min-height: 100vh;
}

.top-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--background);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    width: 300px;
}

.search-box input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    outline: none;
    font-size: 0.9rem;
}

.search-box button {
    padding: 0.75rem 1rem;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.search-box button:hover {
    background: var(--primary-dark);
}

/* 欢迎区域 */
.welcome-section {
    margin-bottom: 3rem;
}

.welcome-section h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.welcome-section p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 800px;
}

.quick-links h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.category h4 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.category ul {
    list-style: none;
}

.category li {
    margin-bottom: 0.5rem;
}

.category a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.25rem 0;
    display: block;
    transition: var(--transition);
}

.category a:hover {
    color: var(--primary-color);
    padding-left: 0.5rem;
}

/* 产品网格 */
.featured-products h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

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

.product-card {
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.product-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.product-tag {
    background: var(--surface);
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.product-links {
    display: flex;
    gap: 1rem;
}

.doc-link, .github-link {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.doc-link {
    background: var(--primary-color);
    color: white;
}

.doc-link:hover {
    background: var(--primary-dark);
}

.github-link {
    background: #333;
    color: white;
}

.github-link:hover {
    background: #555;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-content {
        padding: 1.5rem;
    }
    
    .top-bar {
        justify-content: center;
    }
    
    .search-box {
        width: 100%;
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        padding: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .welcome-section h1 {
        font-size: 1.5rem;
    }
    
    .categories {
        grid-template-columns: 1fr;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* 文档页面样式 */
.doc-content {
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.doc-content h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.doc-content h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem 0;
    color: var(--text-primary);
}

.doc-content h3 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem 0;
    color: var(--text-primary);
}

.doc-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.doc-content ul, .doc-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.doc-content li {
    margin-bottom: 0.5rem;
}

.doc-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.doc-content a:hover {
    text-decoration: underline;
}

.doc-content code {
    background: var(--surface);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 0.9em;
}

.doc-content pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1rem 0;
}

.doc-content pre code {
    background: none;
    padding: 0;
}

.doc-content img {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 1rem 0;
}

/* 返回按钮 */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.back-button:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--surface);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section {
    flex: 1;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
    color: white;
}

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

.footer-section ul li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
    display: inline-block;
    padding: 0.125rem 0;
}

.footer-section a:hover {
    color: white;
    transform: translateX(3px);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
}

/* 修正移动端footer布局 */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.5rem;
    }

    .footer-section {
        margin-bottom: 1rem;
    }

    .footer-section:last-child {
        margin-bottom: 0;
    }
}