/* ============================================================
   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 {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 9998;
    display: block;
}
.sidebar-overlay.is-open,
.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- 侧边栏 ---------- */
.main-sidebar {
    width: 180px;
    background: #fff;
    border-right: 1px solid #e8ecf1;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    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);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.main-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0 70px 0;
}
.main-sidebar-nav::-webkit-scrollbar { width: 4px; }
.main-sidebar-nav::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}
.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;
    z-index: 10;
    flex-shrink: 0;
}
.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-nav） ---------- */
.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: 620px !important;
    width: 100% !important;
    margin: 20px auto 28px !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}
.dh-search-tabs {
    display: flex !important;
    gap: 4px !important;
    margin: 0 auto 16px !important;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #eef2f6;
    border-radius: 40px;
    padding: 4px !important;
    max-width: 400px !important;
    width: 100% !important;
    box-shadow: 0 4px 16px rgba(74, 108, 247, 0.06);
    position: relative;
    box-sizing: border-box !important;
}
.search-tab {
    flex: 1;
    text-align: center;
    padding: 9px 14px !important;
    border-radius: 30px;
    font-size: 14px !important;
    font-weight: 500;
    color: #718096;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    user-select: none;
    background: transparent;
    border: none;
    white-space: nowrap;
    position: relative;
    letter-spacing: 0.2px;
}
.search-tab:hover:not(.active) {
    color: #4a6cf7;
    background: rgba(74, 108, 247, 0.06);
}
.search-tab.active {
    background: linear-gradient(135deg, #4a6cf7 0%, #6a8cff 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(74, 108, 247, 0.30);
    font-weight: 600;
}
.search-tab.active:hover {
    background: linear-gradient(135deg, #3a5cd9 0%, #5a7cf7 100%);
}
.search-tab:not(:last-child):not(.active)::after {
    content: '';
    position: absolute;
    right: -3px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 16px;
    background: #eef2f6;
    border-radius: 1px;
    pointer-events: none;
}
.search-tab.active::after,
.search-tab.active + .search-tab::after { opacity: 0; }

.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;
    width: 100% !important;
    box-sizing: border-box !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;
}
.dh-search-form,
.dh-search-form .search-wrapper,
.dh-search-form .search-form {
    width: 100% !important;
    max-width: 620px !important;
    margin: 0 auto !important;
    box-sizing: border-box !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: 180px;
        padding: 0 68px 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 {
        max-width: 100% !important;
        margin: 12px auto 18px !important;
        padding: 0 12px !important;
    }
    .dh-search-form,
    .dh-search-form .search-wrapper,
    .dh-search-form .search-form { max-width: 100% !important; }
    .search-input { padding: 10px 16px; font-size: 14px; }
    .search-btn { padding: 0 16px; font-size: 18px; }

    .dh-navbar {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-height: 56px;
        padding: 0 4px;
    }
    .dh-navbar-left {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 1;
        position: relative;
        min-height: 56px;
    }
    .navbar-left-btn {
        flex-shrink: 0;
        display: block !important;
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        font-size: 26px;
        padding: 4px 8px;
        cursor: pointer;
        color: #333;
        background: none;
        border: none;
        line-height: 1;
    }
    .mobile-logo {
        display: block !important;
        text-align: center;
        flex: 0 1 auto;
        position: relative;
        z-index: 5;
    }
    .mobile-logo img {
        max-height: 44px;
        width: auto;
        vertical-align: middle;
        display: inline-block;
    }
    .dh-navbar-right {
        flex-shrink: 0;
        display: flex !important;
        align-items: center;
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        gap: 4px;
    }
    .dh-navbar-right .theme-toggle {
        margin-right: 4px;
        width: 34px;
        height: 34px;
        font-size: 20px;
    }
    .header-banner .dh-navbar-left:empty { display: none; }

    .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; }
}

/* ============================================================
   移动端 · 侧边栏抽屉（兼容 .is-open / .open / .active）
   ============================================================ */
@media (max-width: 768px) {
    .main-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        max-height: 100vh !important;
        z-index: 9999 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
        visibility: visible !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .main-sidebar.is-open,
    .main-sidebar.open,
    .main-sidebar.active {
        transform: translateX(0) !important;
    }
}

/* ============================================================
   新导航条（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: 60px;
    overflow: visible;
    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%;
    padding: 0;
    gap: 12px;
}
.header-nav-top ul {
    display: flex;
    gap: 8px;
    list-style: none;
    padding: 6px 0;
    margin: 0;
    flex-wrap: nowrap;
    justify-content: center;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scrollbar-gutter: stable;
}
.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: 8px 16px;
    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 {
    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.active {
    background: linear-gradient(135deg, #4a6cf7 0%, #6a8cff 100%);
    color: #ffffff;
}
.header-nav-top ul li a.active i { color: #ffffff; }
.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: 6px !important;
    flex-shrink: 0 !important;
    flex-wrap: nowrap !important;
}
.header-nav-right .user-nav-login,
.header-nav-right .user-nav-link,
.header-nav-right .user-nav-logout {
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    letter-spacing: 0 !important;
    font-family: inherit !important;
}
.header-nav-right .user-nav-login {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    padding: 6px 18px !important;
    border-radius: 30px !important;
    color: #4a5568 !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    transition: all 0.25s ease !important;
}
.header-nav-right .user-nav-login:hover {
    background: rgba(74, 108, 247, 0.08) !important;
    color: #4a6cf7 !important;
    border-color: rgba(74, 108, 247, 0.15) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.06) !important;
}
.header-nav-right .user-nav-login i,
.header-nav-right .user-nav-link i {
    font-size: 16px !important;
    line-height: 1 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    margin: 0 !important;
}
.header-nav-right .user-nav-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.header-nav-right .user-nav-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 6px 14px !important;
    border-radius: 30px !important;
    background: rgba(74, 108, 247, 0.08) !important;
    color: #4a5568 !important;
    text-decoration: none !important;
    transition: all 0.25s ease !important;
}
.header-nav-right .user-nav-link:hover {
    background: rgba(74, 108, 247, 0.15) !important;
    color: #4a6cf7 !important;
}
.header-nav-right .user-nav-logout {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: rgba(229, 62, 62, 0.10) !important;
    color: #e53e3e !important;
    text-decoration: none !important;
    transition: all 0.25s ease !important;
}
.header-nav-right .user-nav-logout:hover { background: rgba(229, 62, 62, 0.20) !important; }
.header-nav-right .user-nav-logout i { font-size: 16px !important; line-height: 1 !important; }
.header-nav-right .theme-toggle {
    width: 32px !important;
    height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    padding: 0 !important;
    margin-left: 4px !important;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.25s ease;
}
.header-nav-right .theme-toggle:hover {
    background: rgba(74, 108, 247, 0.10);
    color: #4a6cf7;
}
.header-nav-right .weather-widget {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    white-space: nowrap !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; }
    .header-nav-right { gap: 4px !important; }
    .header-nav-right .user-nav-login,
    .header-nav-right .user-nav-link {
        font-size: 13px !important;
        padding: 5px 12px !important;
    }
    .header-nav-right .user-nav-login i,
    .header-nav-right .user-nav-link i { font-size: 15px !important; }
    .header-nav-right .user-nav-logout,
    .header-nav-right .theme-toggle {
        width: 30px !important;
        height: 30px !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; }
}

/* ============================================================
   搜索模式容器（固定高度防跳动）
   ============================================================ */
.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 !important;
}
.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"] {
    display: block !important;
    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;
}

/* ============================================================
   顶部渐变背景
   ============================================================ */
.header-banner {
    position: relative;
    background: linear-gradient(
        180deg,
        rgba(74, 108, 247, 0.08) 0%,
        rgba(124, 58, 237, 0.04) 40%,
        rgba(255, 255, 255, 0) 80%
    );
}
@media (max-width: 768px) {
    .header-banner {
        background: linear-gradient(
            180deg,
            rgba(74, 108, 247, 0.06) 0%,
            rgba(255, 255, 255, 0) 70%
        );
    }
}

/* ============================================================
   API 接口入口（侧边栏渐变按钮）
   ============================================================ */
.sidebar-menu .api-nav-li {
    margin: 10px 12px 6px 12px;
    position: relative;
}
.sidebar-menu .api-nav-li .api-nav-link {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 11px 14px !important;
    background: linear-gradient(135deg, #4a6cf7 0%, #7c3aed 50%, #a855f7 100%);
    border-radius: 12px;
    border-left: none !important;
    color: #fff !important;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(74, 108, 247, 0.35);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.sidebar-menu .api-nav-li .api-nav-link:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 32px rgba(124, 58, 237, 0.55), 0 0 0 4px rgba(74, 108, 247, 0.18);
    color: #fff !important;
    background: linear-gradient(135deg, #3a5cd9 0%, #6c2bd9 50%, #9333ea 100%);
}
.sidebar-menu .api-nav-li .api-nav-link .api-nav-icon {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    margin: 0 !important;
    font-size: 16px !important;
    color: #fff !important;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}
.sidebar-menu .api-nav-li .api-nav-link:hover .api-nav-icon {
    transform: rotate(-8deg) scale(1.1);
}
.sidebar-menu .api-nav-li .api-nav-badge {
    margin-left: auto;
    background: #fff;
    color: #7c3aed;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}
.sidebar-menu .api-nav-li::after {
    content: '🔥 限时免费';
    position: absolute;
    top: -8px;
    right: 8px;
    background: linear-gradient(135deg, #f89250, #f1404b);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(241, 64, 75, 0.4);
    transform: rotate(3deg);
    z-index: 10;
}
.main-sidebar.collapsed .api-nav-li { margin: 10px 8px; }
.main-sidebar.collapsed .api-nav-li .api-nav-link {
    padding: 10px !important;
    justify-content: center;
    gap: 0;
}
.main-sidebar.collapsed .api-nav-li .api-nav-link span:not(.api-nav-icon) {
    display: none !important;
}
.main-sidebar.collapsed .api-nav-li .api-nav-badge {
    display: none !important;
}
@media (max-width: 768px) {
    .sidebar-menu .api-nav-li { margin: 8px 10px 6px 10px; }
    .sidebar-menu .api-nav-li .api-nav-link {
        padding: 12px 14px !important;
        font-size: 15px;
    }
}

/* ============================================================
   深色模式 - 导航/侧边栏/搜索
   ============================================================ */
body.dark-mode {
    background: #1a1a2e;
    color: #d0d0d0;
}
body.dark-mode .main-sidebar {
    background: #16213e;
    border-right-color: #2a2a4a;
}
body.dark-mode .sidebar-logo { border-bottom-color: #2a2a4a; }
body.dark-mode .sidebar-menu li a { color: #aaa; }
body.dark-mode .sidebar-menu li a:hover,
body.dark-mode .sidebar-menu li a.on {
    background: rgba(74, 108, 247, 0.15);
    color: #6a8cff;
}
body.dark-mode .sidebar-menu li a .dh-item-icon { color: #888; }
body.dark-mode .sidebar-menu.sidebar-bottom { border-top-color: #2a2a4a; }
body.dark-mode .sidebar-toggle { background: #2a2a4a; color: #888; }
body.dark-mode .sidebar-toggle:hover { background: #3a3a5a; color: #6a8cff; }
body.dark-mode .main-content { background: #1a1a2e; }
body.dark-mode .dh-header { background: transparent; }

body.dark-mode .dh-search-tabs {
    background: #16213e;
    border-color: #2a3a5a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
body.dark-mode .search-tab { color: #a0aec0; }
body.dark-mode .search-tab:hover:not(.active) {
    color: #6a8cff;
    background: rgba(106, 140, 255, 0.08);
}
body.dark-mode .search-tab.active {
    background: linear-gradient(135deg, #5a7cf7 0%, #6a8cff 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(106, 140, 255, 0.35);
}
body.dark-mode .search-tab:not(:last-child):not(.active)::after { background: #2a3a5a; }
body.dark-mode .search-form {
    background: #2a2a4a;
    border-color: #3a3a5a;
}
body.dark-mode .search-input { color: #d0d0d0; background: transparent; }
body.dark-mode .search-input::placeholder { color: #777; }
body.dark-mode .dh-search-engines .engine-item { color: #999; }
body.dark-mode .dh-search-engines .engine-item:hover { background: #3a3a5a; }
body.dark-mode .dh-search-engines .engine-item.active {
    background: #4a6cf7;
    color: #fff;
}

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 {
    background: rgba(74, 108, 247, 0.15);
    color: #6a8cff;
    border-color: rgba(74, 108, 247, 0.2);
}
body.dark-mode .header-nav-top ul li a.active {
    background: linear-gradient(135deg, #5a7cf7 0%, #6a8cff 100%);
    color: #ffffff;
    border-color: #5a7cf7;
}
body.dark-mode .header-nav-right .user-nav-login { color: #a0aec0; }
body.dark-mode .header-nav-right .user-nav-login:hover {
    background: rgba(74, 108, 247, 0.15);
    color: #6a8cff;
    border-color: rgba(74, 108, 247, 0.2);
}
body.dark-mode .header-nav-right .user-nav-link {
    color: #cbd5e0;
    background: rgba(106, 140, 255, 0.12);
}
body.dark-mode .header-nav-right .user-nav-link:hover {
    background: rgba(106, 140, 255, 0.2);
    color: #6a8cff;
}
body.dark-mode .header-nav-right .user-nav-logout { background: rgba(229, 62, 62, 0.15); }
body.dark-mode .header-nav-right .user-nav-logout:hover { background: rgba(229, 62, 62, 0.25); }
body.dark-mode .header-nav-right .theme-toggle { color: #a0aec0; }
body.dark-mode .header-nav-right .weather-widget { color: #cbd5e0; }

body.dark-mode #dh-nav .navbar-item a { color: #aaa; }
body.dark-mode #dh-nav .navbar-item a:hover { color: #6a8cff; }
body.dark-mode #dh-nav .navbar-item a.on,
body.dark-mode #dh-nav .navbar-item a.active {
    background: #4a6cf7;
    color: #fff;
}
body.dark-mode .navbar-left-btn { color: #d0d0d0; }

body.dark-mode .site-footer {
    background: #0e1a2e;
    border-top-color: #2a2a4a;
    color: #888;
}
body.dark-mode .footer-copyright a { color: #6a8cff; }
body.dark-mode .footer-links a { color: #6a8cff; }

body.dark-mode .suggestions-box {
    background: #1e2a4a;
    border-color: #3a3a5a;
}
body.dark-mode .suggestions-box .suggestion-item {
    color: #d0d0d0;
    border-bottom-color: #2a3a5a;
}
body.dark-mode .suggestions-box .suggestion-item:hover { background: #2a3a6a; }
body.dark-mode .suggestions-box .suggestion-item .suggestion-highlight { color: #6a8cff; }
body.dark-mode .suggestions-loading { color: #888; }
body.dark-mode .sidebar-overlay { background: rgba(0, 0, 0, 0.7); }

/* ============================================================
   移动端 · 搜索区（合并版 + 模式区分）
   ============================================================ */
@media (max-width: 768px) {
    .dh-search-tabs {
        max-width: 300px !important;
        width: 100% !important;
        margin: 0 auto 12px !important;
        padding: 3px !important;
        gap: 3px !important;
    }
    .search-tab {
        padding: 7px 10px !important;
        font-size: 13px !important;
        letter-spacing: 0 !important;
    }

    /* 只有「搜索引擎」那一排按钮需要横向滚动 + 左对齐 */
    #searchModeSite .dh-search-engines {
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 6px !important;
        padding: 0 2px 4px !important;
        scrollbar-width: none !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior-x: contain !important;
    }
    #searchModeSite .dh-search-engines::-webkit-scrollbar { display: none !important; }
    #searchModeSite .dh-search-engines .engine-item {
        flex-shrink: 0 !important;
        padding: 2px 8px !important;
        white-space: nowrap !important;
    }

    /* 「资源搜寻」「企业查询」的提示文字居中 */
    #searchModeResource .dh-search-engines,
    #searchModeCompany .dh-search-engines {
        justify-content: center !important;
        flex-wrap: wrap !important;
        overflow: visible !important;
        text-align: center !important;
        padding: 0 !important;
    }
    #searchModeResource .dh-search-engines > span,
    #searchModeCompany .dh-search-engines > span {
        text-align: center !important;
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .dh-search-tabs {
        max-width: 100% !important;
        padding: 2px !important;
    }
    .search-tab {
        padding: 5px 10px !important;
        font-size: 13px !important;
    }
}

@media (max-width: 400px) {
    .dh-search-tabs { max-width: 270px !important; }
    .search-tab { padding: 6px 8px !important; font-size: 12.5px !important; }
}

/* ============================================================
   全局修正（合并版）
   ============================================================ */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* 只保护媒体元素，不对 div/p 强制宽度 */
img, video, iframe, table {
    max-width: 100%;
    height: auto;
}

/* 移动端侧栏类模块占满整行 */
@media (max-width: 768px) {
    .detail-sidebar,
    .news-sidebar,
    .post-sidebar-right,
    .rank-sidebar,
    .app-detail-sidebar {
        width: 100% !important;
        flex: 0 0 100% !important;
        margin-left: 0 !important;
    }
}

/* ============================================================
   首页专属（最新收录 / H1 / 友情链接 / AI 弹窗）
   ============================================================ */

/* ---------- 首页 H1 ---------- */
.home-h1 {
    font-size: 20px;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 12px 2px;
    letter-spacing: 0.2px;
    line-height: 1.4;
}
body.dark-mode .home-h1 { color: #e2e8f0; }

/* ---------- 最新收录 ---------- */
.latest-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    padding: 4px 0;
}
.latest-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 36px 12px 14px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border: 1px solid #eef2f6;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    min-height: 66px;
}
.latest-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #4a6cf7, #7c3aed);
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 0.3s ease;
    border-radius: 0 3px 3px 0;
}
.latest-card:hover::before { transform: scaleY(1); }
.latest-card:hover {
    border-color: #d0d9f0;
    background: linear-gradient(135deg, #ffffff 0%, #f5f8ff 100%);
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(74, 108, 247, 0.10);
}
.latest-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #edf2f7;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.latest-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
}
.latest-card:hover .latest-icon {
    border-color: #d0d9f0;
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.12);
}
.latest-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.latest-name {
    font-size: 13px;
    font-weight: 600;
    color: #1a202c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    margin-bottom: 4px;
    transition: color 0.2s;
}
.latest-card:hover .latest-name { color: #4a6cf7; }
.latest-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    line-height: 1;
}
.latest-type {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.latest-type.type-site { background: linear-gradient(135deg, #e8f0ff, #d6e4ff); color: #4a6cf7; }
.latest-type.type-ai   { background: linear-gradient(135deg, #f0e8ff, #e2d6ff); color: #7c3aed; }
.latest-type.type-news { background: linear-gradient(135deg, #fff3e0, #ffe0b3); color: #d97706; }
.latest-time {
    color: #a0aec0;
    font-size: 12px;
    white-space: nowrap;
}
.latest-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #cbd5e0;
    transition: all 0.3s ease;
    opacity: 0.6;
}
.latest-card:hover .latest-arrow {
    color: #4a6cf7;
    opacity: 1;
    transform: translateY(-50%) translateX(3px);
}

/* 最新收录 - 响应式 */
@media (max-width: 1400px) {
    .latest-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 1200px) {
    .latest-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 992px) {
    .latest-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .latest-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .latest-card {
        padding: 10px 26px 10px 10px;
        min-height: 58px;
        gap: 8px;
        border-radius: 10px;
    }
    .latest-icon {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }
    .latest-arrow { font-size: 14px; right: 8px; }
    .latest-type { padding: 1px 6px; }
    .latest-grid .latest-card:nth-child(n+7) { display: none !important; }
}
@media (max-width: 420px) {
    .latest-grid { gap: 6px; }
    .latest-card { padding: 8px 22px 8px 8px; min-height: 52px; }
    .latest-icon { width: 28px; height: 28px; }
    .latest-meta { gap: 4px; }
}

/* 最新收录 - 暗色 */
body.dark-mode .latest-card {
    background: linear-gradient(135deg, #1a2a4a 0%, #16213e 100%);
    border-color: #2a3a5a;
}
body.dark-mode .latest-card:hover {
    background: linear-gradient(135deg, #1e2a4a 0%, #1a2a4a 100%);
    border-color: #4a6cf7;
    box-shadow: 0 10px 28px rgba(74, 108, 247, 0.2);
}
body.dark-mode .latest-icon {
    background: #16213e;
    border-color: #2a3a5a;
}
body.dark-mode .latest-name { color: #e2e8f0; }
body.dark-mode .latest-card:hover .latest-name { color: #6a8cff; }
body.dark-mode .latest-arrow { color: #4a5568; }
body.dark-mode .latest-card:hover .latest-arrow { color: #6a8cff; }
body.dark-mode .latest-time { color: #718096; }
body.dark-mode .latest-type.type-site {
    background: linear-gradient(135deg, rgba(74,108,247,0.2), rgba(74,108,247,0.1));
    color: #6a8cff;
}
body.dark-mode .latest-type.type-ai {
    background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(124,58,237,0.1));
    color: #a78bfa;
}
body.dark-mode .latest-type.type-news {
    background: linear-gradient(135deg, rgba(217,119,6,0.2), rgba(217,119,6,0.1));
    color: #f6ad55;
}

/* ---------- 友情链接 ---------- */
.friend-links-section { margin-top: 10px; }
.friend-links-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 14px;
    padding: 4px 0;
}
.friend-link-text {
    color: #4a5568;
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.friend-link-text:hover {
    color: #4a6cf7;
    background: #f0f5ff;
}
.friend-links-sep { color: #cbd5e0; margin: 0 2px; }
body.dark-mode .friend-link-text { color: #a0aec0; }
body.dark-mode .friend-link-text:hover {
    color: #6a8cff;
    background: rgba(74, 108, 247, 0.10);
}
body.dark-mode .friend-links-sep { color: #4a5568; }

/* ---------- AI 工具弹窗 ---------- */
#aiModal.ai-modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    background: rgba(15, 23, 42, 0.45) !important;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 9999 !important;
}
#aiModal.ai-modal-overlay.active { display: flex !important; }

#aiModal .ai-modal-box {
    width: 100% !important;
    max-width: 420px !important;
    box-sizing: border-box !important;
    background: #fff !important;
    border-radius: 18px !important;
    padding: 24px 26px !important;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22) !important;
}
#aiModal .ai-modal-title {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    color: #1a202c !important;
    margin: 0 0 18px !important;
}
#aiModal .ai-modal-title .close-btn {
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    color: #a0aec0;
}
#aiModal .ai-modal-title .close-btn:hover { color: #1a202c; }

#aiModal .form-group { margin-bottom: 16px !important; }
#aiModal .form-group label {
    display: block !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #374151 !important;
    margin-bottom: 6px !important;
}

#aiModal input[type="text"],
#aiModal input[type="url"] {
    display: block !important;
    width: 100% !important;
    height: 42px !important;
    padding: 0 14px !important;
    box-sizing: border-box !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    background: #fff !important;
    font-size: 14px !important;
    color: #1a202c !important;
    outline: none !important;
}
#aiModal input:focus {
    border-color: #4a6cf7 !important;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.12) !important;
}
#aiModal .btn-submit {
    display: block !important;
    width: 100% !important;
    height: 44px !important;
    margin-top: 4px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: linear-gradient(135deg, #4a6cf7, #7c3aed) !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer;
}
#aiModal .btn-submit:hover { filter: brightness(1.07); }

/* 弹窗 - 暗色 */
body.dark-mode #aiModal .ai-modal-box { background: #1a2035 !important; }
body.dark-mode #aiModal .ai-modal-title { color: #e2e8f0 !important; }
body.dark-mode #aiModal .form-group label { color: #cbd5e1 !important; }
body.dark-mode #aiModal input[type="text"],
body.dark-mode #aiModal input[type="url"] {
    background: #141a2e !important;
    border-color: #26304a !important;
    color: #e2e8f0 !important;
}