/* global.css
包含一些基础变量，导航栏样式，进度条美化，搜索框样式等
每个页面都需要引用
*/

/* 复用部分基础变量，保持风格统一 */
:root {
    --primary-color: #3b82f6;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-color: #374151;
    --border-color: #c0c0c0;
    --sidebar-width: 280px;

    /* Mac 风格代码块变量 */
    --mac-bg-header: #3a404d;
    --mac-bg-body: #282c34;
    --mac-border: #1b1f27;
    --mac-text-muted: #abb2bf;
    --mac-btn-hover: rgba(255, 255, 255, 0.15);

    /* 行内代码背景色 */
    --inline-code-bg: #eaeaea;
    --inline-code-color: #ff0000;
}

html {
    /* 平滑滚动 - 增强用户体验 */
    scroll-behavior: smooth;
    /* 强制始终显示垂直滚动条，即使内容很短。这样可以预留出滚动条占用的宽度空间，防止页面内容跳动 */
    overflow-y: scroll;
}

body {
    font-family: 'Noto Sans SC VF', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* --- 头部导航栏与搜索栏样式 --- */
.header {
    background: var(--card-bg);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow 0.3s;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.025em;
}

.site-title a {
    color: inherit;
    text-decoration: none;
}

.nav-links a {
    margin-left: 25px;
    font-weight: 500;
    color: #6b7280;
    transition: color 0.2s;
}

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

/* 美化：自定义滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}



/* 搜索框样式 */
.search-wrapper {
    position: relative;
    width: 280px;
}

.search-input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    /* 左侧留出图标位置 */
    border: 1px solid #d1d5db;
    border-radius: 20px;
    background-color: #f9fafb;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    /* 添加一个搜索小图标背景 */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 18px;
}

.search-input:focus {
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 搜索结果下拉框 */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 50;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    /* 默认隐藏 */
    border: 1px solid #e5e7eb;
}

.search-result-item {
    display: block;
    padding: 12px 15px;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.1s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: #f9fafb;
}

.search-result-item h4 {
    margin: 0 0 5px 0;
    color: var(--primary-color);
    font-size: 1rem;
}

.search-result-item small {
    color: #9ca3af;
}
