/* ========================================
   Walle 技术文档中心 - 主样式文件
   ======================================== */

/* CSS Variables */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --accent-color: #0ea5e9;
    --success-color: #22c55e;
    --warning-color: #f97316;
    --danger-color: #ef4444;
    
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-light: #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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base Styles */
html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   Header Styles (首页专用)
   ======================================== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    padding: 60px 0;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
}

.header-info {
    text-align: right;
}

.header-info p {
    margin: 5px 0;
    font-size: 0.95rem;
    opacity: 0.9;
}

.header-info .icon {
    margin-right: 8px;
}

/* ========================================
   Search Section (首页专用)
   ======================================== */
.search-section {
    max-width: 700px;
    margin: 50px auto 40px;
    display: flex;
    gap: 10px;
}

.search-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-button {
    padding: 15px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.search-button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========================================
   Page Grid (首页专用)
   ======================================== */
.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.page-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.page-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.page-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
    margin: 0;
}

.update-time {
    background: #f1f5f9;
    color: var(--text-light);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.page-summary {
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 20px;
    flex: 1;
}

.page-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.read-link {
    color: var(--primary-color);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.read-link:hover {
    color: var(--primary-hover);
    transform: translateX(5px);
}

.page-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    background: #eff6ff;
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.no-results p {
    font-size: 1.2rem;
}

/* ========================================
   Document Page Styles (文档页专用)
   ======================================== */

/* Document Header */
.doc-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    padding: 80px 0 60px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.doc-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.doc-header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.meta-info {
    display: inline-flex;
    gap: 20px;
    margin-top: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.meta-tag {
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
}

/* Document Main Content */
.doc-main-content {
    display: flex;
    margin-top: -40px;
    margin-bottom: 60px;
    gap: 30px;
}

/* Sidebar */
.sidebar {
    flex: 0 0 280px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 30px 20px;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.sidebar.collapsed {
    flex: 0 0 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.toggle-sidebar {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 1.2rem;
    color: var(--text-light);
}

.toggle-sidebar:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.toggle-sidebar span {
    transition: transform var(--transition-normal);
}

.toggle-sidebar:hover span {
    transform: scale(1.1);
}

.expand-sidebar {
    position: fixed;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 50;
    transition: all var(--transition-normal);
    opacity: 0;
    visibility: hidden;
}

.expand-sidebar:hover {
    background: var(--accent-color);
    transform: translateY(-50%) scale(1.1);
    box-shadow: var(--shadow-lg);
}

.expand-sidebar.show {
    opacity: 1;
    visibility: visible;
}

.nav-menu {
    list-style: none;
}

.nav-menu li {
    margin-bottom: 8px;
}

.nav-menu a {
    display: block;
    color: var(--text-light);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
    font-size: 0.95rem;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: var(--primary-color);
    color: white;
    transform: translateX(5px);
}

.nav-menu .sub-menu {
    margin-left: 15px;
    margin-top: 5px;
}

.nav-menu .sub-menu a {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Document Content */
.doc-content {
    flex: 1;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 40px;
    box-shadow: var(--shadow-md);
}

.doc-content h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin: 50px 0 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--accent-color);
}

.doc-content h3 {
    font-size: 1.4rem;
    color: var(--text-color);
    margin: 35px 0 20px;
}

.doc-content h4 {
    font-size: 1.2rem;
    color: var(--text-color);
    margin: 25px 0 15px;
}

.doc-content p {
    margin-bottom: 20px;
    line-height: 1.8;
}

.doc-content ul,
.doc-content ol {
    margin: 20px 0;
    padding-left: 25px;
}

.doc-content li {
    margin-bottom: 12px;
}

.doc-content code {
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

.doc-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 25px 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

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

/* Tables */
.doc-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    font-size: 0.95rem;
}

.doc-content table thead {
    background: var(--primary-color);
    color: white;
}

.doc-content table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.doc-content table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.doc-content table tbody tr:hover {
    background: #f1f5f9;
}

/* Mermaid Diagrams */
.mermaid {
    background: white;
    padding: 30px;
    border-radius: var(--radius-md);
    margin: 30px 0;
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

/* Info Boxes */
.info-box {
    background: #eff6ff;
    border-left: 4px solid var(--primary-color);
    padding: 20px;
    margin: 25px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.info-box.warning {
    background: #fff7ed;
    border-left-color: var(--warning-color);
}

.info-box.success {
    background: #f0fdf4;
    border-left-color: var(--success-color);
}

.info-box.info {
    background: #f0f9ff;
    border-left-color: #3b82f6;
}

/* ========================================
   Footer (通用)
   ======================================== */
.footer {
    background: var(--text-color);
    color: white;
    text-align: center;
    padding: 40px 20px;
    margin-top: 60px;
}

.footer p {
    opacity: 0.8;
    margin-bottom: 10px;
}

/* ========================================
   Buttons (通用)
   ======================================== */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    border: none;
    font-size: 1.5rem;
    opacity: 0;
    visibility: hidden;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.mobile-nav-toggle {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 100;
    transition: all var(--transition-normal);
}

.mobile-nav-toggle:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
    .doc-main-content {
        flex-direction: column;
    }

    .sidebar {
        position: relative;
        top: 0;
        max-height: none;
        max-height: 400px;
        overflow-y: auto;
    }

    .expand-sidebar {
        display: none;
    }

    .mobile-nav-toggle {
        display: flex;
    }

    .doc-content {
        padding: 30px 20px;
    }
    
    .page-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
    
    .header-content {
        text-align: center;
        justify-content: center;
    }
    
    .header-info {
        text-align: center;
    }
}

@media (max-width: 768px) {
    .doc-header h1,
    .logo h1 {
        font-size: 1.8rem;
    }

    .doc-header p,
    .tagline {
        font-size: 1rem;
    }

    .meta-info {
        gap: 10px;
    }

    .meta-tag {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .doc-content h2 {
        font-size: 1.5rem;
    }

    .doc-content h3 {
        font-size: 1.3rem;
    }

    .doc-content table {
        font-size: 0.85rem;
    }

    .doc-content table th,
    .doc-content table td {
        padding: 10px;
    }

    .sidebar {
        max-height: 60vh;
    }

    .toggle-sidebar span {
        font-size: 1rem;
    }
    
    .page-grid {
        grid-template-columns: 1fr;
    }
    
    .page-card-header {
        flex-direction: column;
    }
    
    .search-section {
        flex-direction: column;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .sidebar,
    .scroll-top,
    .mobile-nav-toggle,
    .footer,
    .search-section {
        display: none;
    }

    .doc-content {
        box-shadow: none;
        padding: 0;
    }

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

/* ========================================
   Selection
   ======================================== */
::selection {
    background: var(--primary-color);
    color: white;
}
