/* ============================================================
   style.css - 全局基础样式（侧边栏、导航、搜索、底部）
   ============================================================ */

/* ---------- 重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f0f4f8;
    color: #1a202c;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
a {
    text-decoration: none;
    color: inherit;
}
ul {
    list-style: none;
}

/* ---------- 侧边栏遮罩 ---------- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* ---------- 侧边栏 ---------- */
.main-sidebar {
    width: 230px;
    background: #fff;
    border-right: 1px solid #e8ecf1;
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1002;
    transform: translateX(-100%);
    transition: width 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.06);
}
.main-sidebar.active {
    transform: translateX(0);
}
.sidebar-logo {
    text-align: center;
    border-bottom: 1px solid #f0f2f5;
    margin-bottom: 8px;
}
.sidebar-logo img {
    max-height: 66px;
    width: auto;
}
.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 8px 24px;
    color: #555;
    font-size: 14px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    margin: 2px 0;
}
.sidebar-menu li a:hover,
.sidebar-menu li a.on {
    background: #f0f5ff;
    color: #4a6cf7;
    border-left-color: #4a6cf7;
}
.sidebar-menu li a .dh-item-icon {
    margin-right: 14px;
    font-size: 18px;
    width: 24px;
    text-align: center;
    color: #888;
}
.sidebar-menu.sidebar-bottom {
    margin-top: 24px;
    border-top: 1px solid #f0f2f5;
    padding-top: 12px;
}
.sidebar-toggle {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background: #f0f2f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    color: #888;
    font-size: 18px;
}
.sidebar-toggle:hover {
    background: #e4e7ed;
    color: #4a6cf7;
}
.main-sidebar.collapsed {
    width: 60px !important;
}
.main-sidebar.collapsed .sidebar-logo img {
    max-height: 30px;
    margin: 0 auto;
}
.main-sidebar.collapsed .sidebar-logo {
    padding: 0 10px 16px;
}
.main-sidebar.collapsed .sidebar-menu li a {
    justify-content: flex-start !important;
    padding: 8px 10px !important;
}
.main-sidebar.collapsed .sidebar-menu li a .dh-item-icon {
    display: inline-block !important;
    margin-right: 0 !important;
    font-size: 20px !important;
    min-width: 24px !important;
    text-align: center !important;
    color: #555 !important;
}
.main-sidebar.collapsed .sidebar-menu li a.on .dh-item-icon {
    color: #4a6cf7 !important;
}
.main-sidebar.collapsed .sidebar-menu li a span {
    display: none !important;
}
.main-sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}
.main-sidebar.collapsed ~ .main-content {
    margin-left: 60px !important;
}

/* ---------- 主容器 ---------- */
.dh-container {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}
.main-content {
    flex: 1;
    margin-left: 0;
    padding: 0 16px 40px;
    background: transparent;
    transition: margin-left 0.3s ease;
}

/* ---------- 顶部导航 ---------- */
.dh-header {
    padding: 12px 0 0;
}
.dh-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dh-navbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.navbar-left-btn {
    font-size: 26px;
    cursor: pointer;
    padding: 4px 8px;
    display: none;
    color: #333;
}
#dh-nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
#dh-nav .navbar-item a {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 500;
    color: #555;
    background: transparent;
    transition: all 0.25s ease;
    border: none;
}
#dh-nav .navbar-item a:hover {
    background: rgba(74, 108, 247, 0.10);
    color: #4a6cf7;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.12);
}
#dh-nav .navbar-item a.on,
#dh-nav .navbar-item a.active {
    background: linear-gradient(135deg, #4a6cf7 0%, #6a8cff 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(74, 108, 247, 0.30);
}
#dh-nav .navbar-item a.on:hover,
#dh-nav .navbar-item a.active:hover {
    background: linear-gradient(135deg, #3a5cd9 0%, #5a7cf7 100%);
    box-shadow: 0 6px 20px rgba(74, 108, 247, 0.40);
}

/* ---------- 搜索框 ---------- */
.dh-search {
    max-width: 600px;
    margin: 20px auto 28px;
    padding: 0 4px;
}
.dh-search-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    justify-content: center;
    background: #f0f2f5;
    border-radius: 30px;
    padding: 4px;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}
.search-tab {
    flex: 1;
    text-align: center;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    background: transparent;
    border: none;
    white-space: nowrap;
}
.search-tab:hover {
    color: #4a6cf7;
    background: rgba(74, 108, 247, 0.06);
}
.search-tab.active {
    background: #ffffff;
    color: #4a6cf7;
    box-shadow: 0 2px 12px rgba(74, 108, 247, 0.15);
    font-weight: 600;
}
.dh-search-engines {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 6px 10px !important;
    margin-bottom: 10px !important;
    font-size: 13px !important;
    color: #666 !important;
    justify-content: center !important;
}
.dh-search-engines .engine-item {
    display: inline-block !important;
    cursor: pointer !important;
    padding: 2px 12px !important;
    border-radius: 20px !important;
    transition: 0.2s !important;
    border: 1px solid transparent !important;
    white-space: nowrap !important;
    user-select: none !important;
}
.dh-search-engines .engine-item:hover {
    background: #eef0f3 !important;
}
.dh-search-engines .engine-item.active {
    background: #4a6cf7 !important;
    color: #fff !important;
    border-color: #4a6cf7 !important;
}
.search-form {
    display: flex;
    background: #fff;
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    border: 1px solid #e4e7ed;
    transition: border-color 0.2s;
}
.search-form:focus-within {
    border-color: #4a6cf7;
    box-shadow: 0 4px 16px rgba(74, 108, 247, 0.12);
}
.search-input {
    flex: 1;
    border: none;
    padding: 13px 22px;
    font-size: 15px;
    outline: none;
    background: transparent;
    color: #333;
}
.search-input::placeholder {
    color: #b0b8c4;
}
.search-btn {
    border: none;
    background: #4a6cf7;
    color: #fff;
    padding: 0 22px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- 底部 ---------- */
.site-footer {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255, 255, 255, 0.6);
    padding: 14px 0;
    font-size: 13px;
    color: #718096;
    flex-shrink: 0;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}
.footer-copyright {
    margin-bottom: 2px;
}
.footer-copyright a {
    color: #4a6cf7;
}
.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}
.footer-links a {
    color: #4a6cf7;
    padding: 0 10px;
}
.footer-divider {
    color: #cbd5e0;
}

/* ---------- 桌面端 ---------- */
@media (min-width: 769px) {
    .main-sidebar {
        transform: translateX(0);
        box-shadow: none;
        border-right: 1px solid #e8ecf1;
    }
    .main-content {
        margin-left: 230px;
        padding: 0 28px 40px;
    }
    .sidebar-overlay {
        display: none !important;
    }
    .navbar-left-btn {
        display: none;
    }
    .mobile-logo {
        display: none !important;
    }
}

/* ---------- 移动端（通用） ---------- */
@media (max-width: 768px) {
    .navbar-left-btn {
        display: block;
    }
    #dh-nav {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 8px 20px !important;
    }
    .dh-search {
        margin: 12px auto 18px;
        padding: 0;
    }
    .dh-search-engines {
        gap: 4px 6px !important;
        font-size: 12px !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        padding-bottom: 4px !important;
    }
    .dh-search-engines::-webkit-scrollbar {
        display: none !important;
    }
    .dh-search-engines .engine-item {
        padding: 2px 8px !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }
    .search-input {
        padding: 10px 16px;
        font-size: 14px;
    }
    .search-btn {
        padding: 0 16px;
        font-size: 18px;
    }
    .dh-search-tabs {
        max-width: 280px;
        padding: 3px;
        gap: 3px;
    }
    .search-tab {
        font-size: 14px;
        padding: 6px 14px;
    }
    .dh-navbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    .dh-navbar-left {
        display: flex;
        align-items: center;
        flex: 1;
        justify-content: flex-start;
        position: relative;
    }
    .navbar-left-btn {
        flex-shrink: 0;
        display: block !important;
        order: 1;
    }
    .mobile-logo {
        display: block !important;
        flex: 1;
        text-align: center;
        order: 2;
    }
    .mobile-logo img {
        max-height: 60px;
        width: auto;
        vertical-align: middle;
    }
    .dh-navbar-right {
        flex-shrink: 0;
        display: block;
        order: 3;
    }
    .sidebar-logo {
        display: block !important;
        padding: 0 10px 16px !important;
    }
    .sidebar-logo img {
        display: block !important;
        max-width: 80%;
        height: auto;
        margin: 0 auto;
        max-height: 40px;
    }
    .sidebar-toggle {
        display: none !important;
    }
    .site-footer {
        padding: 10px 0;
    }
    .footer-inner {
        padding: 0 12px;
        font-size: 12px;
    }
}

/* ---------- 超小屏（≤480px）进一步微调 ---------- */
@media (max-width: 480px) {
    .dh-search-tabs {
        max-width: 220px;
        padding: 2px;
    }
    .search-tab {
        font-size: 13px;
        padding: 5px 10px;
    }
}

/* ============================================================
   新导航条（header-nav-top）样式 - 隐藏滚动条
   ============================================================ */
.header-nav-top {
    position: sticky;
    top: 0;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.04);
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
}

.header-nav-top-inner {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.header-nav-top ul {
    display: flex;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: nowrap;
    justify-content: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;      /* 隐藏滚动条（Firefox） */
}

/* 隐藏滚动条（Chrome/Safari/Edge） */
.header-nav-top ul::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.header-nav-top ul li {
    display: inline-block;
    flex-shrink: 0;
}

.header-nav-top ul li a {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    text-decoration: none;
    white-space: nowrap;
    background: transparent;
    border: 1px solid transparent;
    line-height: 1.4;
    transition: all 0.25s ease;
}
.header-nav-top ul li a:hover,
.header-nav-top ul li a.active {
    background: rgba(74, 108, 247, 0.08);
    color: #4a6cf7;
    border-color: rgba(74, 108, 247, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.06);
}
.header-nav-top ul li a i {
    margin-right: 4px;
    font-size: 16px;
    vertical-align: middle;
    display: inline-block;
}

.header-nav-right {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    flex-wrap: nowrap !important;
}
.header-nav-right .weather-widget {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
}
.header-nav-right .theme-toggle {
    flex-shrink: 0 !important;
}

/* 移动端导航适配 - 隐藏滚动条 */
@media (max-width: 768px) {
    .header-nav-top {
        padding: 0 12px;
        height: 46px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .header-nav-top::-webkit-scrollbar {
        display: none;
    }
    .header-nav-top .header-nav-top-inner {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 6px;
        min-width: 100%;
        width: auto;
        height: 100%;
    }
    .header-nav-top ul {
        flex-wrap: nowrap;
        gap: 4px;
        justify-content: flex-start;
    }
    .header-nav-top ul li a {
        padding: 4px 12px;
        font-size: 13px;
    }
    .header-nav-top ul li a i {
        font-size: 14px;
        margin-right: 2px;
    }
    .header-nav-right .weather-widget .weather-city {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .header-nav-top {
        height: 40px;
        padding: 0 8px;
    }
    .header-nav-top ul li a {
        padding: 2px 10px;
        font-size: 12px;
    }
    .header-nav-top ul li a i {
        font-size: 12px;
        margin-right: 2px;
    }
}

/* ===== 深色模式适配 ===== */
body.dark-mode .header-nav-top {
    background: rgba(26, 32, 44, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}
body.dark-mode .header-nav-top ul li a {
    color: #a0aec0;
}
body.dark-mode .header-nav-top ul li a:hover,
body.dark-mode .header-nav-top ul li a.active {
    background: rgba(74, 108, 247, 0.15);
    color: #6a8cff;
    border-color: rgba(74, 108, 247, 0.2);
}
body.dark-mode .header-nav-right .weather-widget {
    color: #cbd5e0;
}
body.dark-mode .header-nav-right .theme-toggle {
    color: #a0aec0;
}

/* ============================================================
   搜索模式切换（无跳动）
   ============================================================ */
.dh-search-modes-wrapper {
    position: relative;
    min-height: 110px;
}
.dh-search-mode {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
    min-height: 110px;
    display: block;
}
.dh-search-mode.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.dh-search-mode[style*="display:none"],
.dh-search-mode[style*="display: none"] {
    display: block !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.dh-search-mode.active[style*="display:none"],
.dh-search-mode.active[style*="display: none"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .dh-search-modes-wrapper { min-height: 100px; }
    .dh-search-mode { min-height: 100px; }
}
@media (max-width: 480px) {
    .dh-search-modes-wrapper { min-height: 90px; }
    .dh-search-mode { min-height: 90px; }
}

/* ============================================================
   搜索建议框
   ============================================================ */
.search-wrapper { position: relative !important; }
.suggestions-box {
    display: none;
    position: absolute !important;
    top: calc(100% + 4px) !important;
    left: 0 !important;
    right: 0 !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 0 0 12px 12px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06) !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    z-index: 100 !important;
}
.suggestions-box .suggestion-item {
    padding: 10px 18px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    color: #2d3748 !important;
    border-bottom: 1px solid #f7fafc !important;
}
.suggestions-box .suggestion-item:hover { background: #f0f5ff !important; }
.suggestions-box .suggestion-item .suggestion-highlight { color: #4a6cf7 !important; font-weight: 500 !important; }
.suggestions-loading {
    padding: 10px 18px !important;
    font-size: 14px !important;
    color: #a0aec0 !important;
    text-align: center !important;
}

/* 强制搜索建议显示 */
#suggestions.suggestions-box[style*="display:block"],
#suggestions.suggestions-box[style*="display: block"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 99999 !important;
}