/*
 * File: css/header.css
 * Description: 导航栏样式 - v5.0 (线条贯穿/Dropdown过渡动画优化/移动端紧凑化)
 */

/* -------------------------------------- */
/* 1. 基础变量 & 顶部动态栏 */
/* -------------------------------------- */
:root {
    --color-primary: #007bff;
    --color-text: #333;
    --color-bg-light: #f8f9fa;
    --color-white: #fff;
    --color-hover-bg: rgba(0, 123, 255, 0.04);
    --color-secondary: #6c757d;
    --header-height: 70px;
    --dynamic-bar-height: 40px;
}

/* 动态栏 (保持不变) */
.dynamic-bar {
    position: relative;
    z-index: 1001;
    height: var(--dynamic-bar-height);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 40px;
    font-size: 14px;
    background-image: linear-gradient(90deg, #ffc107, #ffe79e, #ffc107);
    color: #333;
    transition: all 0.4s ease-in-out;
}

.dynamic-bar .close-btn {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #333;
}

.dynamic-bar .mobile-content {
    display: none;
}

/* -------------------------------------- */
/* 2. 导航栏主体 (PC端 - 线条优化) */
/* -------------------------------------- */
#main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--color-white);
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
}

/* LOGO */
.nav-logo a {
    display: flex;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    color: var(--color-primary);
    text-decoration: none;
}

.nav-logo img {
    height: 38px;
    margin-right: 10px;
}

/* 菜单项容器 */
.desktop-nav {
    flex-grow: 1;
    text-align: center;
    height: 100%;
}

.nav-menu {
    display: flex;
    justify-content: center;
    height: 100%;
}

.nav-item {
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    position: relative;
}

/* 链接样式 */
.nav-item a {
    display: flex;
    align-items: center;
    height: 100%;
    color: var(--color-text);
    font-weight: 500;
    font-size: 15px;
    transition: color 0.3s;
    text-decoration: none;
    position: relative;
}

.nav-item a:hover {
    color: var(--color-primary);
}

/* 底部贯穿线条 */
.nav-item::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 3px;
    background-color: var(--color-primary);
    transition: width 0.3s ease-out;
    left: 50%;
    transform: translateX(-50%);
}

.nav-item:hover::after {
    width: 100%;
}

/* 右侧按钮 */
.nav-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-login {
    color: #555;
    font-weight: 500;
}

.btn-login:hover {
    color: var(--color-primary);
    background: none;
}

/* -------------------------------------- */
/* 3. 下拉菜单通用容器 (过渡优化) */
/* -------------------------------------- */
.nav-dropdown-overlay {
    position: absolute;
    top: calc(var(--header-height) + 1px);
    left: 0;
    width: 100%;
    background-color: var(--color-white);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
    z-index: 999;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    /* 关键优化：鼠标离开时，visibility延迟隐藏，确保opacity过渡完成 */
    transition: max-height 0.4s ease-out,
        opacity 0.4s ease-out,
        visibility 0s linear 0.4s;
    border-top: 1px solid #f5f5f5;
}

.nav-dropdown-overlay.active-dropdown {
    max-height: 650px;
    opacity: 1;
    visibility: visible;
    /* 鼠标进入时，visibility不延迟 */
    transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1),
        opacity 0.4s ease-in,
        visibility 0s linear 0s;
}

.dropdown-content {
    display: none;
    padding: 30px 0 40px;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
    animation: fadeInContent 0.3s ease-out;
}

.dropdown-content.active {
    display: block;
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -------------------------------------- */
/* 4. 电脑端下拉内容样式 (核心功能/资源中心调整) */
/* -------------------------------------- */
/* 核心功能 - 间距和对齐优化 */
.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.category-title {
    color: var(--color-primary);
    font-size: 17px;
    /* 字体加大 */
    font-weight: 700;
    margin-bottom: 12px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    padding-left: 12px;
    /* 关键对齐：与下方功能项的左边距保持一致 */
}

.feature-list a {
    display: block;
    padding: 14px 12px;
    /* 调整垂直间距 */
    border-radius: 6px;
    color: var(--color-text);
    transition: all 0.3s;
    border: 1px solid transparent;
}

.feature-list a:hover {
    background-color: var(--color-hover-bg);
    color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.feature-item-content {
    display: flex;
    align-items: flex-start;
}

.feature-item-content img {
    width: 22px;
    height: 22px;
    margin-right: 12px;
    margin-top: 2px;
}

.feature-text strong {
    display: block;
    font-size: 15px;
    margin-bottom: 2px;
}

/* 加大标题字体 */
.feature-text p {
    font-size: 13px;
    color: #777;
    margin: 0;
    line-height: 1.3;
}

/* 加大描述字体，调整颜色 */

/* 案例 */
.case-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.case-item {
    display: block;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s;
    text-decoration: none;
}

.case-item:hover {
    border-color: var(--color-primary);
    background-color: var(--color-hover-bg);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.1);
}

.case-title {
    color: var(--color-text);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    transition: color 0.3s;
}

.case-item:hover .case-title {
    color: var(--color-primary);
}

.case-desc {
    font-size: 12px;
    color: #888;
    line-height: 1.5;
}

/* 资源中心 - 调整大小，避免过大 */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
}

.resource-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    text-decoration: none;
}

.resource-item:hover {
    background-color: var(--color-hover-bg);
    transform: translateY(-3px);
}

.resource-item img {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
}

/* 缩小图标 */
.resource-title {
    font-size: 15px;
    color: var(--color-text);
    margin-bottom: 4px;
    font-weight: 600;
}

.resource-item:hover .resource-title {
    color: var(--color-primary);
}

.resource-desc {
    font-size: 12px;
    color: #888;
    text-align: center;
}

/* -------------------------------------- */
/* 5. 移动端菜单样式 (紧凑度优化) */
/* -------------------------------------- */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 26px;
    cursor: pointer;
    color: var(--color-primary);
    padding: 5px;
}

.mobile-nav-menu {
    position: absolute;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background-color: var(--color-white);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    z-index: 998;
    overflow-y: auto;
    border-top: 1px solid #eee;

    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in-out, visibility 0.4s;
}

.mobile-nav-menu.active {
    max-height: 85vh;
    opacity: 1;
    visibility: visible;
}

/* 一级菜单项 */
.mobile-nav-item>a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    /* 缩小垂直间距 */
    border-bottom: 1px solid #f9f9f9;
    color: #333;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
}

.menu-toggle-icon {
    font-size: 20px;
    color: #bbb;
    font-weight: normal;
    transition: transform 0.3s, color 0.3s;
}

/* 二级菜单容器 (动画修复) */
.mobile-submenu {
    background-color: #f8f9fa;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s;
}

.mobile-submenu.active {
    max-height: 3000px;
    opacity: 1;
    border-bottom: 1px solid #eee;
}

/* 移动端核心功能列表样式 (紧凑度优化) */
.mobile-feature-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 25px;
    /* 缩小垂直间距 */
    text-decoration: none;
    border-bottom: 1px dashed #eee;
    color: inherit;
}

.mobile-feature-icon {
    width: 24px;
    height: 24px;
    margin-right: 15px;
    flex-shrink: 0;
}

.mobile-feature-title {
    display: block;
    font-size: 15px;
    color: #333;
    font-weight: 500;
    margin-bottom: 2px;
    /* 缩小与描述的间距 */
}

.mobile-feature-desc {
    display: block;
    font-size: 12px;
    color: #888;
    line-height: 1.4;
    margin-top: 2px;
}

/* 移动端分类标题 */
.mobile-category-title {
    padding: 15px 25px 8px;
    /* 缩小间距 */
    font-size: 13px;
    color: var(--color-primary);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
}

.mobile-category-title::after {
    content: '';
    flex-grow: 1;
    height: 1px;
    background-color: #e0e0e0;
    margin-left: 10px;
    opacity: 0.5;
}

/* 移动端底部按钮 */
.mobile-auth-buttons {
    padding: 20px 25px;
    /* 缩小上下间距 */
    display: flex;
    gap: 15px;
    background-color: var(--color-white);
    border-top: 1px solid #eee;
}

.mobile-auth-buttons .btn {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    font-size: 16px;
}