:root {
    --main-color: #5D3FD3;
    --light-purple: #f0edff;
    --dark-purple: #4a2fb8;
    --gradient-primary: linear-gradient(135deg, #5D3FD3 0%, #8D71FF 100%);
}

/* 顶部导航栏 */
.top-nav {
    background: var(--gradient-primary);
    box-shadow: 0 8px 24px rgba(93, 63, 211, 0.18);
}

.main-nav {
    padding: 14px 0 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.nav-container {
    max-width: 1360px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    padding: 0 28px;
    position: relative;
    gap: 10px;
}

.logo {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.2s ease;
}

.logo:hover {
    opacity: 0.88;
    color: #fff;
}

.logo-mark {
    flex-shrink: 0;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.18));
    transition: transform 0.3s ease;
}

.logo:hover .logo-mark {
    transform: rotate(15deg);
}

.logo-text {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 3px;
    color: #fff;
    line-height: 1;
}

.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    padding: 8px 14px;
    border-radius: 10px;
}

.nav-link:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.nav-link i {
    font-size: 12px;
}

.nav-auth-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding-left: 16px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
}

/* 下拉菜单 */
.nav-dropdown {
    position: static;
    display: inline-block;
}

.nav-dropdown.nav-dropdown-regular {
    position: relative;
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #fff;
    min-width: 200px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    overflow: hidden;
}

.nav-dropdown-regular:hover .nav-dropdown-content,
.nav-dropdown-content.show {
    display: block;
}

.nav-dropdown-item {
    color: #333;
    padding: 15px 20px;
    text-decoration: none;
    display: block;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.nav-dropdown-item:last-child {
    border-bottom: none;
}

.nav-dropdown-item:hover {
    background-color: var(--light-purple);
    color: var(--main-color);
}

/* ============================================================
   Mega Menu - 重新设计版
   ============================================================ */

/* 让 top-nav 作为 mega menu 的定位基准 */
.top-nav { position: relative; }

.nav-dropdown-content.nav-mega-menu {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    width: 92vw;
    max-width: 1160px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(93, 63, 211, 0.18), 0 4px 16px rgba(0,0,0,0.12);
    border: 1px solid rgba(93, 63, 211, 0.12);
    overflow: hidden;
    z-index: 2000;
    background: #fff;
    /* 入场动画 */
    animation: megaMenuIn 0.18s ease;
}

@keyframes megaMenuIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.nav-dropdown-content.nav-mega-menu.show {
    display: flex !important;
}

/* ---- 侧边栏 ---- */
.mega-menu-sidebar {
    width: 180px;
    flex-shrink: 0;
    background: #f5f3ff;
    border-right: 1px solid #e8e2ff;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mega-menu-category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    color: #4a4a6a;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
    margin: 0 8px;
    border-radius: 8px;
}

.mega-menu-category span {
    flex: 1;
}

.mega-menu-category i.fa-chevron-right {
    font-size: 0.65rem;
    opacity: 0.4;
}

.mega-menu-category.active i.fa-chevron-right {
    opacity: 0.7;
}

.mega-menu-category:hover {
    background: #ede9fe;
    color: #5D3FD3;
}

.mega-menu-category.active {
    background: #5D3FD3;
    color: #fff;
    font-weight: 700;
    border-left: 3px solid #F5C842;
    border-radius: 0 8px 8px 0;
    margin-left: 0;
    padding-left: 19px;
}

/* ---- 右侧内容区 ---- */
.mega-menu-content-wrapper {
    flex: 1;
    padding: 0;
    min-height: 380px;
    overflow: hidden;
}

.mega-menu-pane {
    display: none;
    padding: 20px 28px 24px;
    height: 100%;
}

.mega-menu-pane.active {
    display: block;
}

/* 热门推荐行 */
.mega-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid #f0edff;
}

.header-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #8888aa;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.header-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: #5D3FD3;
    transition: all 0.18s;
}

.header-tag:hover {
    background: linear-gradient(135deg, #5D3FD3, #7B61FF);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(93,63,211,0.25);
}

/* 内容列网格 */
.mega-menu-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0 24px;
}

.mega-menu-content.columns-5 {
    grid-template-columns: repeat(4, 1fr); /* 统一用4列，避免空白 */
}

/* 列标题 */
.mega-menu-column { }

.column-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid #5D3FD3;
    display: inline-block;
    letter-spacing: 0.03em;
}

/* 列链接 */
.column-link {
    display: flex;
    align-items: center;
    color: #4a4a6a;
    text-decoration: none;
    padding: 7px 8px;
    font-size: 0.88rem;
    border-radius: 6px;
    margin-bottom: 1px;
    transition: background 0.15s, color 0.15s, padding-left 0.15s;
    position: relative;
}

.column-link::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #5D3FD3;
    margin-right: 8px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.column-link:hover {
    background: #f0edff;
    color: #5D3FD3;
    padding-left: 12px;
}

.column-link:hover::before {
    opacity: 1;
}

/* 搜索栏 */
.search-nav {
    padding: 12px 0 14px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(2px);
}

.search-nav-container {
    max-width: 1360px;
    margin: 0 auto;
    padding: 0 28px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.search-container {
    flex: 1 1 58%;
    max-width: 740px;
    position: relative;
}

.search-input {
    width: 100%;
    height: 44px;
    padding: 0 120px 0 16px;
    border-radius: 24px;
    border: 1px solid #d9d9ea;
    background: #fff;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--main-color);
    box-shadow: 0 0 0 3px rgba(93, 63, 211, 0.14);
}

.search-container .search-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--main-color);
    color: #fff;
    border: none;
    border-radius: 18px;
    height: 34px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.price-query-menu {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1 1 auto;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.price-query-item {
    position: relative;
    color: var(--main-color);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 18px;
    border: 1px solid #e0e0e0;
    background: #fff;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.price-query-item:hover {
    transform: translateY(-1px);
    border-color: #c9bfff;
    box-shadow: 0 6px 16px rgba(93, 63, 211, 0.14);
}

.hot-icon,
.new-icon {
    position: absolute;
    top: -8px;
    right: -5px;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}

.hot-icon {
    background-color: #dc3545;
}

.new-icon {
    background-color: #28a745;
}

@media (max-width: 991px) {
    .mobile-menu-toggle {
        display: inline-flex;
    }

    .nav-links {
        width: 100%;
        display: none;
    }

    .search-nav-container {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .price-query-menu {
        gap: 10px;
    }

    .nav-dropdown-content.nav-mega-menu {
        position: static;
        width: 100%;
        transform: none;
        max-width: none;
    }
}

@media (min-width: 992px) and (max-width: 1280px) {
    .nav-container,
    .search-nav-container {
        padding-left: 18px;
        padding-right: 18px;
    }

    .nav-link {
        font-size: 13px;
        padding: 7px 8px;
    }

    .price-query-item {
        font-size: 12px;
        padding: 7px 10px;
    }
}
