/* Header Component Specific Styles */

#navbarNav {
   border: 0;
  
}

/* 确保导航链接悬停时不显示下划线 */
.navbar-nav .nav-link:hover,
.navbar-nav .dropdown-item:hover,
.navbar-nav a:hover {
    text-decoration: none !important;
}

.header-container {
    position: relative;
    z-index: 1000;
}

.navbar {
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border-bottom: none;
    min-height: 99px !important; /* 确保导航栏高度固定 */
}

.navbar.scrolled {
    background-color: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    border-bottom: none;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.logo-circle {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    animation: rotate 10s linear infinite;
    box-shadow: 0 2px 10px rgba(74, 144, 226, 0.3);
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.brand-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.navbar-nav {
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    font-weight: 500;
    margin: 0 0.5rem;
    position: relative;
    transition: all 0.3s ease;
    padding: 0.75rem 1rem !important;
    border-radius: 0;
    white-space: nowrap; /* 防止文字换行 */
}

.nav-link:hover {
    background-color: transparent;
    color: var(--primary-color) !important;
}

.nav-link.active {
    color: var(--primary-color) !important;
    background-color: transparent;
    border-bottom: 2px solid var(--primary-color);
}

.search-container {
    position: relative;
    margin-left: 1rem;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border-radius: 25px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
    background: white;
    width: 100%;
    min-width: 100px;
}

.search-box input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
    border-color: var(--primary-color);
    transform: scale(1.02);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    transition: all 0.3s ease;
    cursor: pointer;
}

.search-box input:focus + .search-icon {
    color: var(--primary-color);
}

.login-btn {
    background: var(--gradient-primary);
    border: none;
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-left: 1rem;
    box-shadow: 0 2px 10px rgba(74, 144, 226, 0.3);
    white-space: nowrap;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(74, 144, 226, 0.4);
    color: white;
}

/* 汉堡菜单按钮样式 */
.navbar-toggler.hamburger-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    position: fixed;
    top: 30px;
    left: 20px;
    outline: none !important;
    box-shadow: none !important;
    z-index: 1050;
    opacity: 0.8;
}

.hamburger-icon {
    width: 30px;
    height: 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger-icon .line {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #333;
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* 汉堡菜单激活状态 */
.navbar-toggler.active .line-1 {
    transform: translateY(10.5px) rotate(45deg);
}

.navbar-toggler.active .line-2 {
    opacity: 0;
    transform: scale(0);
}

.navbar-toggler.active .line-3 {
    transform: translateY(-10.5px) rotate(-45deg);
}

/* Dropdown Styles */
.dropdown-menu {
    border-radius: 0;
    border: none;
    box-shadow: none;
    padding: 1rem 0;
    margin-top: 0.5rem;
    transition: all 0.3s ease;
}

.dropdown-item {
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
    border-radius: 0;
    margin: 0 0.5rem;
}

.dropdown-item:hover {
    background: rgba(74, 144, 226, 0.05);
    color: var(--primary-color);
    transform: none;
    border-left: 2px solid var(--primary-color);
}

.dropdown-divider {
    margin: 0.5rem 1rem;
    border-color: rgba(74, 144, 226, 0.2);
}

/* 导航指示条样式 - 集中在header.css中管理 */
.nav-link {
    position: relative;
}

/* 导航指示条样式定义 - 默认禁用 */
.nav-link::after {
    content: none; /* 禁用指示条 */
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 50%;
    background: var(--gradient-primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
    display: none; /* 确保不显示 */
}

/* 禁用悬停和激活状态的指示条 */
.nav-link:hover::after,
.nav-link.active::after {
    width: 0;
}

/* 桌面端下拉菜单样式 */
@media (min-width: 992px) {
    .dropdown-menu {
        display: none;
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        margin-top: 0;
        padding-top: 0.5rem;
        transition: all 0.3s ease, visibility 0s;
        border-radius: 8px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        border: 1px solid rgba(0,0,0,0.05);
    }
    
    /* 桌面端悬停显示下拉菜单 */
    .nav-item.dropdown:hover .dropdown-menu,
    .dropdown-menu:hover {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    /* 为下拉菜单创建缓冲区，防止鼠标移出导航项时菜单立即消失 */
    .nav-item.dropdown {
        position: relative;
    }
    
    .nav-item.dropdown::after {
        content: '';
        position: absolute;
        bottom: -10px;
        left: 0;
        width: 100%;
        height: 10px;
        background: transparent;
    }
    
    /* 桌面端下拉箭头样式 */
    .dropdown-toggle::after {
        margin-left: 0.5em;
        vertical-align: middle;
        border-top: 0.3em solid;
        border-right: 0.3em solid transparent;
        border-left: 0.3em solid transparent;
        transition: transform 0.3s ease;
    }
    
    /* 桌面端鼠标悬停时旋转下拉箭头 */
    .nav-item.dropdown:hover .dropdown-toggle::after {
        transform: rotate(180deg);
    }
}

/* 中等屏幕尺寸优化 */
@media (min-width: 992px) and (max-width: 1199px) {
    /* 调整导航链接内边距，使其更紧凑 */
    .nav-link {
        padding: 0.75rem 0.5rem !important;
        margin: 0 0.25rem;
    }
    
    /* 确保搜索框宽度适当 */
    .input-group {
        min-width: 160px;
    }
}

/* 移动端样式 */
@media (max-width: 991.98px) {
    #navbarNav {
        border: 0;
        height: 500px !important;
        top: -15px;
        position:  relative ;
     }
    /* 导航菜单容器 */
    .navbar-collapse {
        background: white;
        padding: 0;
        transition: all 0.3s ease;
    }
    .input-group{
        width: 50%;
    }
    .d-flex{
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin-bottom: 30px;
    }
    
    /* 导航项布局 - 修改为横向排列 */
    div.navbar-nav {
        display: flex;
        flex-direction: column;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* 导航项样式 */
    .navbar-nav .nav-item {
        position: relative;
    }
    
    /* 子菜单直接显示在主菜单下方，作为横排的一部分 */
    .dropdown-menu {
        position: relative;
        left: auto;
        top: auto;
        margin: 0;
        padding: 0;
        border: none;
        background: transparent;
        width: auto;
        min-width: auto;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        z-index: 1;
    }
    
    /* 移除下拉菜单的悬停效果 */
    .nav-item.dropdown:hover .dropdown-menu {
        transform: none;
    }
    
    /* 子菜单项样式 */
    .dropdown-item {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        margin: 0;
        border: none;
    }
    
    /* 下拉菜单触发器样式 - 隐藏下拉箭头 */
    .dropdown-toggle::after {
        display: none;
    }
    
    /* 导航链接样式 */
    .nav-link {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0.5rem 0.75rem !important;
        font-size: 1rem !important;
    }
    
    /* 搜索框和登录按钮容器 */
    .d-flex {
        justify-content: center;
        margin-top: 1rem;
        width: 100%;
    }
}

/* 小屏幕优化 - 介于移动端和桌面端之间 */
@media (min-width: 992px) and (max-width: 1099px) {
    /* 优化搜索框和按钮的尺寸 */
    .input-group {
        min-width: 140px;
    }
    
    .login-btn {
        padding: 0.5rem 1rem;
    }
    
    /* 减少搜索框和登录按钮之间的间距 */
    .d-flex .me-3 {
        margin-right: 0.5rem !important;
    }
}