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

:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --text-color: #333;
    --light-bg: #f8f9fa;
    --border-color: #e1e8ed;
    --code-bg: #f6f8fa;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    line-height: 1.8;
    color: var(--text-color);
    background: #fff;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 0 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

header nav {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

header nav a {
    color: white;
    text-decoration: none;
    margin: 0 15px;
    padding: 8px 16px;
    border-radius: 20px;
    transition: background 0.3s;
}

header nav a:hover {
    background: rgba(255,255,255,0.2);
}

/* 语言切换按钮 - 与导航菜单同款样式 */
.lang-toggle-btn {
    cursor: pointer;
    font-weight: inherit;
    letter-spacing: inherit;
}
.lang-toggle-btn:hover {
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
}

/* 主内容区 */
main {
    padding: 40px 0;
    min-height: 60vh;
}

/* Hero 区域 */
.hero {
    background: var(--light-bg);
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 40px;
}

.hero h2 {
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.hero p {
    color: #666;
    font-size: 1.1rem;
}

/* 文章列表 */
.posts h3, .tags h3 {
    color: var(--secondary-color);
    margin-bottom: 25px;
    font-size: 1.5rem;
    border-left: 4px solid var(--primary-color);
    padding-left: 15px;
}

.post-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.post-card h4 {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.post-card h4 a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s;
}

.post-card h4 a:hover {
    color: var(--primary-color);
}

.post-card .meta {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.post-card .excerpt {
    color: #555;
    margin-bottom: 15px;
    line-height: 1.7;
}

.read-more {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.read-more:hover {
    color: #2980b9;
}

/* 标签云 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    background: var(--light-bg);
    color: var(--secondary-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.3s;
    cursor: pointer;
}

.tag:hover {
    background: var(--primary-color);
    color: white;
}

/* 页脚 */
footer {
    background: var(--secondary-color);
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 60px;
}

footer p {
    margin: 5px 0;
}

footer .visitor-count {
    opacity: 0.7;
    font-size: 0.9rem;
}

/* 响应式 */
@media (max-width: 768px) {
    header {
        padding: 40px 0 30px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    header .subtitle {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    header nav {
        margin-top: 14px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
        padding: 4px 0;
    }
    header nav a {
        display: inline-block;
        margin: 0;
        padding: 6px 12px;
        font-size: 0.85rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .lang-toggle-btn {
        padding: 5px 10px;
        font-size: 0.8rem;
        border-width: 1.5px;
    }

    .hero {
        padding: 25px;
    }

    .post-card {
        padding: 20px;
    }
}

/* ===== 全局搜索框 ===== */
.search-wrapper {
    max-width: 600px;
    margin: 0 auto 20px;
    position: relative;
    z-index: 1000;
}
.search-input-wrap {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.95);
    border-radius: 30px;
    padding: 0 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s;
    border: 2px solid transparent;
}
.search-input-wrap:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px rgba(52,152,219,0.3);
}
.search-input-wrap .search-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    opacity: 0.6;
    margin-right: 10px;
}
.search-input-wrap .search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.95rem;
    padding: 12px 0;
    background: transparent;
    color: #333;
    font-family: inherit;
}
.search-input-wrap .search-input::placeholder {
    color: #aaa;
}
.search-input-wrap .search-clear {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #ddd;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
    line-height: 1;
}
.search-input-wrap .search-clear:hover {
    background: #bbb;
}

/* 搜索下拉框 */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    max-height: 480px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.search-results {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    padding: 8px 0;
}
.search-result-item {
    display: block;
    padding: 12px 18px;
    text-decoration: none;
    color: #333;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}
.search-result-item:hover,
.search-result-item.active {
    background: #f0f7ff;
    border-left-color: var(--primary-color);
}
.search-result-item .search-result-category {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 4px;
    font-weight: 500;
    letter-spacing: 0.5px;
}
.search-result-item .search-result-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 2px;
    line-height: 1.4;
    color: #222;
}
.search-result-item .search-result-title mark {
    background: #fff3cd;
    color: #856404;
    padding: 0 2px;
    border-radius: 2px;
}
.search-result-item .search-result-excerpt {
    font-size: 0.8rem;
    color: #888;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.search-result-item .search-result-excerpt mark {
    background: #fff3cd;
    color: #856404;
    padding: 0 2px;
    border-radius: 2px;
}

/* 搜索空状态 */
.search-empty {
    text-align: center;
    padding: 40px 20px;
}
.search-empty-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.5;
}
.search-empty-text {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 4px;
}
.search-empty-hint {
    color: #aaa;
    font-size: 0.8rem;
}

/* 搜索底部提示 */
.search-footer {
    border-top: 1px solid #eee;
    padding: 8px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #999;
    background: #fafafa;
}
.search-hint {
    color: #bbb;
}

/* 遮罩层 */
.search-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 999;
    backdrop-filter: blur(2px);
}

/* 搜索框在 header 中的样式 */
header .search-wrapper {
    margin-top: 30px;
}
header .search-input-wrap {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
}

/* 滚动条 */
.search-results::-webkit-scrollbar {
    width: 6px;
}
.search-results::-webkit-scrollbar-track {
    background: transparent;
}
.search-results::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

@media (max-width: 768px) {
    .search-wrapper {
        max-width: 100%;
        margin-left: 10px;
        margin-right: 10px;
    }
    .search-input-wrap .search-input {
        font-size: 0.9rem;
        padding: 10px 0;
    }
    .search-dropdown {
        max-height: 70vh;
        border-radius: 12px;
    }
    .search-results {
        max-height: 60vh;
    }
    .search-footer {
        display: none;
    }
}
