/* ==========================================================================
   BuffNav 核心布局 (assets/css/main.css)
   ========================================================================== */

/* 1. 基础重置与变量 */
:root {
    --primary-color: #007bff;
    --bg-color: #f4f7f9;
    --card-bg: #ffffff;
    --text-main: #333;
    --text-muted: #999;
    --border-color: #eee;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "PingFang SC", "Helvetica Neue", sans-serif; background: var(--bg-color); color: var(--text-main); line-height: 1.6; }

/* 2. 容器布局 */
.buffnav-container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.main-content-wrapper { display: flex; gap: 20px; margin-top: 30px; }
.left-sidebar { flex: 1; min-width: 0; }
.right-sidebar { width: 320px; flex-shrink: 0; }

/* 3. 搜索区域 (Section 1-3) */
.top-search-section { text-align: center; padding: 40px 0; }
.search-main { display: flex; justify-content: center; margin-bottom: 10px; position: relative; }

#search-form { 
    display: flex; 
    width: 600px; 
    height: 50px; 
    background: #fff; 
    border-radius: 25px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
    overflow: visible; 
    border: 1px solid #ddd; 
}

/* 搜索引擎选择器 */
.engine-selector {
    position: relative;
    width: 60px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-right: 1px solid #eee;
    flex-shrink: 0;
}

#current-engine-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* --- 搜索引擎组件 2.0 (居中与箭头) --- */

/* 1. 确保选择器在父容器中垂直水平居中 */
.engine-selector {
    position: relative;
    width: 60px; /* 固定宽度 */
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center; /* 核心：水平居中 */
    cursor: pointer;
    border-right: 1px solid #eee;
    flex-shrink: 0;
}

.current-engine-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px; /* 图标与箭头间距 */
}

/* 2. 仿参考站点的上下箭头 (CSS 绘制) */
.engine-arrow-icon {
    width: 8px;
    height: 8px;
    position: relative;
    margin-top: -2px;
}

.engine-arrow-icon::after {
    content: "";
    display: block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #999; /* 向下箭头颜色 */
    transition: transform 0.3s;
}

/* 当下拉菜单打开时，箭头反转 (需配合 JS 切换类名) */
.engine-selector.active .engine-arrow-icon::after {
    transform: rotate(180deg);
}

/* 3. 下拉列表排版优化 */
.engine-drop-list {
    display: none; 
    position: absolute;
    top: 51px;
    left: 50%; /* 配合 transform 实现相对于选择器中心弹出 */
    transform: translateX(-50%); 
    width: 116px;
    height: 146px;
    background: #fff;
    border: 1px solid #dcdcdc;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: 8px;
    z-index: 9999;
    margin: 0;
    padding: 5px 0;
    list-style: none;
    overflow: hidden;
}

/* 4. 去掉下划线并修正文字排版 */
.engine-drop-list li a {
    display: flex;
    align-items: center;
    width: 100%;
    height: 32px;
    padding: 0 12px;
    text-decoration: none !important; /* 核心：去掉下划线 */
    color: #333;
    font-size: 13px;
    transition: background 0.2s;
}

.engine-drop-list li a:hover {
    background-color: #f2f2f2;
    color: var(--primary-color);
}
.engine-drop-list {
    display: none; /* 默认隐藏 */
    position: absolute;
    top: 51px;
    left: 50%;
    transform: translateX(-50%);
    width: 116px;
    height: 146px;
    background: #fff;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    z-index: 9999;
    
    /* --- 修复横向排版的关键 --- */
    flex-direction: column !important; /* 强制垂直排列 */
    padding: 5px 0;
    margin: 0;
    list-style: none;
}

/* 确保内部的 li 撑满宽度 */
.engine-drop-list li {
    width: 100%; 
    height: 32px;
    display: block; /* 确保 li 本身是块级 */
}

.engine-icon {
    width: 16px;
    height: 16px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: 8px;
    flex-shrink: 0;
}

/* 输入框与按钮 */
#search-input { flex: 1; border: none; padding: 0 15px; outline: none; font-size: 16px; background: transparent; }
#search-btn { width: 80px; border: none; background: var(--primary-color); color: #fff; border-radius: 0 25px 25px 0; cursor: pointer; font-weight: bold; }

.search-footer { width: 600px; margin: 0 auto; display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); padding: 0 10px; }
.footer-right a { color: #666; text-decoration: none; margin-left: 10px; }

/* 4. 左侧 Tab 导航 (Section 6) */
.nav-tabs-container { background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.nav-tab-headers { display: flex; flex-wrap: wrap; list-style: none; border-bottom: 1px solid #eee; margin-bottom: 20px; }
.nav-tab-headers li { padding: 8px 16px; cursor: pointer; font-weight: 500; color: #666; }
.nav-tab-headers li.active { color: var(--primary-color); border-bottom: 2px solid var(--primary-color); }

.url-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.url-card { display: flex; align-items: center; padding: 10px; background: #f9f9f9; border-radius: 6px; text-decoration: none; color: #444; border: 1px solid transparent; transition: all 0.2s; }
.url-card:hover { border-color: var(--primary-color); background: #fff; box-shadow: 0 4px 8px rgba(0,0,0,0.05); }
.url-icon { width: 18px; height: 18px; margin-right: 8px; }

/* 5. 右侧边栏与状态栏 */
.sidebar-card { background: #fff; border-radius: 12px; padding: 18px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.card-title { font-weight: bold; font-size: 15px; margin-bottom: 15px; padding-left: 10px; border-left: 4px solid var(--primary-color); }

/* 状态栏 (日期|天气|邮箱) */
.datetime-geo-bar { display: flex; align-items: center; font-size: 13px; height: 30px; white-space: nowrap; }
.datetime-geo-bar .sep { margin: 0 10px; color: #ddd; flex-shrink: 0; }

/* 邮箱悬浮菜单 */
.email { position: relative; display: inline-block; }
.email .list { display: flex; align-items: center; cursor: pointer; }
.email-name.word { color: var(--primary-color); font-weight: 500; }
.arrow { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid #999; margin-left: 5px; transition: transform 0.3s; }

.menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border-radius: 4px;
    z-index: 9999;
    min-width: 100px;
    padding: 8px 0;
    margin-top: 0;
    opacity: 0;
    transition: all 0.2s ease-in-out;
}
.menu::before { content: ""; position: absolute; top: -10px; left: 0; width: 100%; height: 10px; background: transparent; }

.list:hover .menu { display: block; opacity: 1; transform: translateX(-50%) scale(1); }
.list:hover .arrow { transform: rotate(180deg); }
.menu a.word { display: block; padding: 8px 15px; text-decoration: none; color: #444; font-size: 13px; text-align: center; }
.menu a.word:hover { background-color: #f5f5f5; color: var(--primary-color); }

/* 6. 热搜榜样式 */
.hot-search-tabs { display: flex; justify-content: space-between; margin-bottom: 12px; border-bottom: 1px solid #f0f0f0; padding-bottom: 8px; }
.hot-tab { cursor: pointer; font-size: 13px; color: #666; padding: 2px 6px; }
.hot-tab.active { color: var(--primary-color); font-weight: bold; }
#hot-list { list-style: none; }
#hot-list li { display: flex; align-items: center; padding: 6px 0; font-size: 13px; border-bottom: 1px solid #fcfcfc; }
#hot-list li .rank { width: 20px; font-style: italic; color: #ff8c00; font-weight: bold; }
#hot-list li a { text-decoration: none; color: #444; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-more { text-align: center; font-size: 12px; color: var(--text-muted); cursor: pointer; margin-top: 10px; }

/* 7. 侧边栏页脚 */
.footer-card { background: transparent !important; box-shadow: none !important; text-align: center; padding: 10px 0 !important; margin-top: 20px; border-top: 1px solid #eee; }
.footer-links { margin-bottom: 8px; font-size: 13px; }
.footer-links a { color: #666; text-decoration: none; }
.footer-copyright { font-size: 12px; color: #999; line-height: 1.8; }

/* 8. 响应式 */
@media (max-width: 992px) {
    .main-content-wrapper { flex-direction: column; }
    .right-sidebar { width: 100%; }
    #search-form, .search-footer { width: 95%; }
}