/* 全局样式重置 - 程序员专业配色 (IDE风格) */
:root {
    /* 主色调 - VS Code风格蓝色 */
    --primary: #0ea5e9;
    --primary-light: #38bdf8;
    --primary-dark: #0284c7;
    /* 次要色 - 语法高亮绿色 */
    --secondary: #10b981;
    --secondary-light: #34d399;
    /* 语义色 */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    /* 深色背景层级 (GitHub Dark风格) */
    --bg-base: #0d1117;
    --bg-elevated: #161b22;
    --bg-overlay: #1c2128;
    --dark: #e6edf3;
    --light: #0d1117;
    /* 文字色 */
    --text-primary: #e6edf3;
    --text-secondary: #c9d1d9;
    --text-muted: #8b949e;
    /* 灰阶 */
    --gray: #8b949e;
    --gray-light: #30363d;
    --gray-dark: #6e7681;
    /* 边框 */
    --border: #30363d;
    --border-muted: #21262d;
    /* 语法高亮色 (用于强调) */
    --syntax-keyword: #ff7b72;
    --syntax-string: #a5d6ff;
    --syntax-function: #d2a8ff;
    --syntax-comment: #8b949e;
    --syntax-number: #79c0ff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Source Code Pro', Consolas, 'Courier New', monospace;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-base);
    background-image: 
        linear-gradient(rgba(14, 165, 233, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 165, 233, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: 0 0, 0 0;
    background-attachment: fixed;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 - 终端窗口风格 */
header {
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 50px 0 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--border);
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(14, 165, 233, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 165, 233, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
}

header h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    font-weight: 700;
    position: relative;
    text-shadow: 0 0 20px rgba(14, 165, 233, 0.4);
    background: linear-gradient(90deg, var(--primary-light), var(--syntax-function));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
    letter-spacing: -0.02em;
}

header h1::before {
    content: '> ';
    color: var(--syntax-keyword);
    -webkit-text-fill-color: var(--syntax-keyword);
    font-weight: 400;
}

header p {
    font-size: 1.1rem;
    opacity: 0.85;
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    font-weight: 400;
    color: var(--text-muted);
}

header p::before {
    content: '// ';
    color: var(--syntax-comment);
}

/* 主内容区域 */
.main-content {
    display: flex;
    gap: 30px;
    padding: 40px 0;
    position: relative;
}

/* 左侧分类导航 - 文件树风格 */
.category-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 40px;
    align-self: flex-start;
}

.category-list {
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}

.category-list h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: 600;
    position: relative;
    padding-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.category-list h2::before {
    content: '📁 ';
    margin-right: 6px;
}

.category-list h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--border);
}

.category-item {
    margin-bottom: 4px;
}

.category-link {
    display: block;
    padding: 8px 12px;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    font-weight: 400;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
    background: transparent;
    border-left: 2px solid transparent;
}

.category-link::before {
    content: '▸ ';
    color: var(--text-muted);
    margin-right: 4px;
}

.category-link:hover {
    color: var(--primary-light);
    background: var(--bg-overlay);
    border-left-color: var(--primary);
    transform: translateX(2px);
}

.category-link:hover::before {
    content: '▾ ';
    color: var(--primary);
}

.category-link.active {
    color: var(--primary-light);
    background: rgba(14, 165, 233, 0.1);
    border-left-color: var(--primary);
}

.category-link.active::before {
    content: '▾ ';
    color: var(--primary);
}

.category-badge {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(14, 165, 233, 0.2);
    color: var(--primary-light);
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

/* 右侧工具内容区 */
.tools-content {
    flex: 1;
    min-width: 0;
}

/* 最近使用工具区域 */
.recent-tools {
    margin-bottom: 40px;
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}

.recent-tools h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
}

.recent-tools h2::before {
    content: '🔥';
    font-size: 1.2rem;
}

/* 工具分类区域 */
.tool-category {
    margin-bottom: 40px;
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    scroll-margin-top: 50px;
}

.tool-category h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 600;
    position: relative;
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
}

.tool-category h2::before {
    content: '## ';
    color: var(--syntax-keyword);
}

.tool-category h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

/* 工具网格布局 */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* 工具卡片样式 - 代码块风格 */
.tool-card {
    background: var(--bg-overlay);
    border-radius: 6px;
    padding: 24px;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--primary);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.2s ease;
}

.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
    background: var(--bg-elevated);
}

.tool-card:hover::before {
    transform: scaleY(1);
}

/* 最近使用的工具卡片特殊样式 */
.tool-card.recent {
    border-left: 3px solid var(--secondary);
}

.tool-card.recent::before {
    display: none;
}

/* 工具图标 */
.tool-icon {
    font-size: 2.4rem;
    margin-bottom: 16px;
    text-align: center;
    transition: transform 0.2s ease;
    filter: grayscale(0.3);
}

.tool-card:hover .tool-icon {
    transform: scale(1.1);
    filter: grayscale(0);
}

/* 工具名称 */
.tool-card h3 {
    font-size: 1.15rem;
    margin-bottom: 8px;
    color: var(--text-primary);
    text-align: center;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.tool-card h3::before {
    content: '<';
    color: var(--syntax-comment);
}

.tool-card h3::after {
    content: '/>';
    color: var(--syntax-comment);
}

/* 工具描述 */
.tool-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
    font-family: 'JetBrains Mono', monospace;
}

/* 页脚样式 - 终端底栏风格 */
footer {
    background: var(--bg-elevated);
    color: var(--text-muted);
    padding: 30px 0;
    text-align: center;
    margin-top: 60px;
    position: relative;
    overflow: hidden;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

footer p {
    font-size: 0.9rem;
    opacity: 0.8;
    position: relative;
    font-weight: 400;
    font-family: 'JetBrains Mono', monospace;
}

footer p::before {
    content: '/* ';
    color: var(--syntax-comment);
}

footer p::after {
    content: ' */';
    color: var(--syntax-comment);
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tool-card {
    animation: fadeIn 0.5s ease forwards;
}

.tool-card:nth-child(1) { animation-delay: 0.1s; }
.tool-card:nth-child(2) { animation-delay: 0.2s; }
.tool-card:nth-child(3) { animation-delay: 0.3s; }
.tool-card:nth-child(4) { animation-delay: 0.4s; }
.tool-card:nth-child(5) { animation-delay: 0.5s; }
.tool-card:nth-child(6) { animation-delay: 0.6s; }
.tool-card:nth-child(7) { animation-delay: 0.7s; }
.tool-card:nth-child(8) { animation-delay: 0.8s; }

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        gap: 20px;
    }
    
    .category-sidebar {
        width: 240px;
    }
}

@media (max-width: 768px) {
    /* 移动端导航菜单 */
    .category-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-elevated);
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
        padding: 20px;
        overflow-y: auto;
        border-right: 1px solid var(--border);
    }
    
    .category-sidebar.open {
        left: 0;
    }
    
    .mobile-menu-toggle {
        display: block;
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 1001;
        background: var(--primary);
        color: var(--text-primary);
        border: 1px solid var(--border);
        width: 50px;
        height: 50px;
        border-radius: 6px;
        font-size: 1.5rem;
        cursor: pointer;
        box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
        transition: all 0.3s ease;
    }
    
    .mobile-menu-toggle:hover {
        background: var(--primary-dark);
        transform: scale(1.05);
    }
    
    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.7);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    
    .overlay.show {
        opacity: 1;
        pointer-events: auto;
    }
    
    header {
        padding: 40px 0 30px;
    }
    
    header h1 {
        font-size: 2.2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .main-content {
        flex-direction: column;
        padding: 30px 0;
    }
    
    .tools-content {
        width: 100%;
    }
    
    .tool-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .tool-card {
        padding: 20px;
    }
    
    .tool-icon {
        font-size: 2.2rem;
    }
    
    .tool-card h3 {
        font-size: 1.1rem;
    }
    
    .recent-tools, .tool-category {
        padding: 24px;
    }
    
    .recent-tools h2, .tool-category h2 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2rem;
    }
    
    .tool-grid {
        grid-template-columns: 1fr;
    }
    
    .mobile-menu-toggle {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .category-sidebar {
        width: 250px;
    }
}

/* 工具定位高亮样式 */
.tool-card.highlighted {
    animation: highlight 1.5s ease-in-out;
}

@keyframes highlight {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        border-color: var(--border);
    }
    50% {
        box-shadow: 0 0 20px rgba(14, 165, 233, 0.6);
        border-color: var(--primary);
        background: rgba(14, 165, 233, 0.1);
    }
}

/* 滚动条样式 - IDE风格 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-dark);
    border-radius: 5px;
    border: 2px solid var(--bg-base);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* 选中文本颜色 */
::selection {
    background: rgba(14, 165, 233, 0.3);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(14, 165, 233, 0.3);
    color: var(--text-primary);
}