/* ===== CSS Variables ===== */
:root {
    --bg-primary: #1a1b1e;
    --bg-secondary: #25262b;
    --bg-tertiary: #2c2e33;
    --bg-card: #25262b;
    --bg-card-hover: #2f3136;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --text-muted: #6b7280;
    --accent-primary: #4f8cff;
    --accent-primary-hover: #6ba1ff;
    --accent-secondary: #4fc3f7;
    --border-color: #3c4043;
    --border-light: #4a4d51;
    --success: #34a853;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.25);
    --shadow-lg: 0 8px 20px rgba(0,0,0,0.3);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}
[data-theme="light"] {
    --bg-primary: #ffffff; --bg-secondary: #f5f5f7; --bg-tertiary: #e8eaed;
    --bg-card: #ffffff; --bg-card-hover: #f5f5f7;
    --text-primary: #202124; --text-secondary: #5f6368; --text-muted: #9aa0a6;
    --border-color: #dadce0; --border-light: #e8eaed;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06); --shadow-md: 0 4px 6px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 20px rgba(0,0,0,0.08);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    background: var(--bg-primary); color: var(--text-primary);
    line-height: 1.7; min-height: 100vh; padding-top: 60px;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; font-size: 14px;
    border-radius: var(--radius-sm); border: none; cursor: pointer;
    text-decoration: none; transition: all 150ms ease;
}
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.btn-primary {
    padding: 10px 20px; background: var(--accent-primary); color: white;
    font-size: 14px; border-radius: var(--radius-sm);
    text-decoration: none; transition: all 150ms ease;
}
.btn-primary:hover { background: var(--accent-primary-hover); }

/* ===== Page Layout ===== */
.page-container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }
.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.page-desc { color: var(--text-secondary); font-size: 16px; }
.page-meta { margin-top: 8px; color: var(--text-muted); font-size: 13px; }
@media (max-width: 768px) { .page-container { padding: 24px 16px; } }

/* ===== Tool Card Grid ===== */
.tools-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
@media (max-width: 768px) { .tools-grid { grid-template-columns: 1fr; } }

/* ===== Tool Card ===== */
.tool-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 20px;
    transition: all 200ms ease;
}
.tool-card:hover { background: var(--bg-card-hover); border-color: var(--border-light); }
.tool-card-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.tool-icon {
    width: 40px; height: 40px; background: var(--bg-tertiary);
    border-radius: var(--radius-md); display: flex; align-items: center;
    justify-content: center; font-size: 18px; flex-shrink: 0;
}
.tool-info { flex: 1; min-width: 0; }
.tool-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.tool-name a { color: var(--text-primary); }
.tool-name a:hover { color: var(--accent-primary); }
.tool-category { font-size: 12px; color: var(--accent-secondary); }
.tool-description {
    font-size: 13px; color: var(--text-secondary);
    line-height: 1.6; margin-bottom: 14px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tool-footer { display: flex; align-items: center; justify-content: space-between; }
.tool-tags { display: flex; gap: 6px; }
.tool-tag {
    padding: 2px 10px; background: var(--bg-tertiary);
    border-radius: var(--radius-sm); font-size: 11px; color: var(--text-muted);
}
.tool-actions { display: flex; gap: 12px; align-items: center; }
.tool-link {
    font-size: 13px; font-weight: 500; color: var(--accent-primary);
}
.tool-link:hover { text-decoration: underline; }

/* ===== Guide Card ===== */
.guides-list { display: flex; flex-direction: column; gap: 16px; }
.guide-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 20px; transition: all 200ms ease;
}
.guide-card:hover { background: var(--bg-card-hover); border-color: var(--border-light); }
.guide-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.guide-card h2 a { color: var(--text-primary); }
.guide-card h2 a:hover { color: var(--accent-primary); }
.guide-card p { color: var(--text-secondary); font-size: 14px; margin-bottom: 10px; line-height: 1.6; }
.guide-card time { color: var(--text-muted); font-size: 12px; }

/* ===== Category Blocks ===== */
.categories-overview {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
.category-block {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 24px 16px;
    text-align: center; text-decoration: none; transition: all 200ms ease;
}
.category-block:hover { background: var(--bg-card-hover); border-color: var(--accent-primary); }
.cat-icon-bg { font-size: 32px; margin-bottom: 12px; }
.category-block h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.cat-count { color: var(--text-muted); font-size: 13px; }

/* ===== Pagination ===== */
.pagination {
    display: flex; justify-content: center; gap: 4px;
    margin-top: 32px; list-style: none; padding: 0;
}
.pagination .page-link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px; padding: 0 8px;
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-secondary);
    font-size: 13px; text-decoration: none; transition: all 150ms ease;
}
.pagination .page-link:hover { background: var(--bg-card-hover); border-color: var(--accent-primary); color: var(--text-primary); }
.pagination .active .page-link { background: var(--accent-primary); border-color: var(--accent-primary); color: white; }
.pagination .disabled .page-link { opacity: 0.4; cursor: not-allowed; }

/* ===== Breadcrumb ===== */
.breadcrumb { padding: 12px 0; max-width: 1200px; margin: 0 auto; }
.breadcrumb ol { display: flex; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.breadcrumb li { display: flex; align-items: center; }
.breadcrumb li:not(:last-child)::after { content: ">"; margin: 0 8px; color: var(--text-muted); font-size: 12px; }
.breadcrumb a { color: var(--accent-primary); font-size: 13px; }
.breadcrumb a:hover { text-decoration: underline; }

/* ===== Tool Detail ===== */
.tool-detail-container {
    max-width: 1200px; margin: 0 auto; padding: 32px 24px;
    display: grid; grid-template-columns: 1fr 280px; gap: 32px;
}
.tool-detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.tool-icon-lg {
    width: 56px; height: 56px; background: var(--bg-tertiary);
    border-radius: var(--radius-lg); display: flex; align-items: center;
    justify-content: center; font-size: 28px; flex-shrink: 0;
}
.tool-detail-header h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.tool-badge {
    display: inline-block; padding: 3px 10px;
    background: rgba(79,140,255,0.1); color: var(--accent-primary);
    border-radius: 4px; font-size: 12px;
}
.tool-detail-desc { font-size: 16px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 20px; }
.tool-meta { margin-bottom: 20px; display: flex; flex-wrap: wrap; gap: 16px; }
.meta-item {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-muted); font-size: 13px;
}
.tool-actions-bar {
    display: flex; gap: 12px;
    margin-bottom: 24px; padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}
.tool-content { color: var(--text-secondary); line-height: 1.8; font-size: 15px; }
.tool-content h2 { font-size: 20px; font-weight: 700; margin: 28px 0 12px; color: var(--text-primary); }
.tool-content h3 { font-size: 17px; font-weight: 600; margin: 20px 0 8px; color: var(--text-primary); }
.tool-content p { margin-bottom: 14px; }
.tool-content a { color: var(--accent-primary); }
.tool-content a:hover { text-decoration: underline; }
.tool-content ul, .tool-content ol { padding-left: 20px; margin-bottom: 14px; }
.tool-content li { margin-bottom: 6px; }

/* ===== Tool Sidebar ===== */
.tool-sidebar { display: flex; flex-direction: column; gap: 16px; }
.sidebar-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 16px;
}
.sidebar-card h3 { font-size: 12px; font-weight: 600; margin-bottom: 12px; color: var(--text-muted); }
.sidebar-list { display: flex; flex-direction: column; gap: 8px; }
.sidebar-item { display: flex; justify-content: space-between; }
.sidebar-label { font-size: 13px; color: var(--text-muted); }
.sidebar-value { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sidebar-tag {
    padding: 3px 10px; background: var(--bg-tertiary);
    border-radius: var(--radius-sm); font-size: 12px; color: var(--text-muted);
}
.related-list { list-style: none; }
.related-list li { margin-bottom: 8px; }
.related-list a { color: var(--text-secondary); font-size: 13px; }
.related-list a:hover { color: var(--accent-primary); }
@media (max-width: 768px) { .tool-detail-container { grid-template-columns: 1fr; padding: 24px 16px; } }

/* ===== Search Results ===== */
.search-result-item {
    display: block; background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 16px 20px;
    margin-bottom: 10px; text-decoration: none;
    transition: all 200ms ease;
}
.search-result-item:hover { background: var(--bg-card-hover); border-color: var(--accent-primary); }
.search-result-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.search-result-header h3 { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.search-result-item p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-type-badge {
    font-size: 11px; padding: 2px 8px; border-radius: 3px; white-space: nowrap; flex-shrink: 0;
}
.search-type-tool { background: rgba(79,140,255,0.12); color: var(--accent-primary); }
.search-type-guide { background: rgba(79,195,247,0.12); color: var(--accent-secondary); }

/* ===== Guide Page ===== */
.guide-page { max-width: 900px; margin: 0 auto; padding: 32px 24px; }
.guide-header { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border-color); }
.guide-header h1 { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.guide-description { font-size: 16px; color: var(--text-secondary); line-height: 1.7; }
.guide-meta { display: flex; gap: 16px; margin-top: 12px; color: var(--text-muted); font-size: 13px; }
.guide-content { color: var(--text-secondary); line-height: 1.9; font-size: 16px; margin-top: 24px; }
.guide-content h2 { font-size: 22px; font-weight: 700; margin: 28px 0 12px; color: var(--text-primary); }
.guide-content h3 { font-size: 18px; font-weight: 600; margin: 24px 0 10px; color: var(--text-primary); }
.guide-content p { margin-bottom: 16px; }
.guide-content a { color: var(--accent-primary); }
.guide-content a:hover { text-decoration: underline; }
.guide-content ul, .guide-content ol { padding-left: 20px; margin-bottom: 16px; }
.guide-content li { margin-bottom: 6px; }
.guide-content code {
    padding: 2px 6px; background: var(--bg-tertiary); border-radius: 3px;
    font-size: 14px; font-family: 'JetBrains Mono', monospace;
}
.guide-content pre {
    background: var(--bg-tertiary); padding: 16px; border-radius: var(--radius-md);
    overflow-x: auto; margin-bottom: 16px; border: 1px solid var(--border-color);
}
.guide-content pre code { background: none; padding: 0; }
.guide-content img { max-width: 100%; border-radius: var(--radius-md); margin: 16px 0; }
.toc { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 16px 20px; margin-bottom: 24px; }
.toc h2 { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.toc nav ul { list-style: none; padding: 0; }
.toc nav li { margin-bottom: 4px; }
.toc nav a { font-size: 14px; color: var(--accent-primary); }
.toc nav a:hover { text-decoration: underline; }
.guide-content blockquote {
    border-left: 4px solid var(--accent-primary); padding: 12px 16px;
    margin: 16px 0; background: var(--bg-secondary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary); font-size: 15px;
}
.guide-content blockquote p:last-child { margin-bottom: 0; }
