/* 
 * 成都嘉美地毯 - 导航栏专用样式
 * 文件：navbar.css
 * 版本：1.0.0
 * 日期：2026年3月13日
 * 描述：营销型网站导航栏样式，响应式设计
 */

/* ============================================
   导航栏基础样式
============================================ */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    height: var(--header-height);
    transition: all var(--transition-normal);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

/* Logo样式 */
.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--primary-dark);
}

.logo-img {
    height: 50px;
    margin-right: 12px;
    transition: transform var(--transition-normal);
}

.logo-img:hover {
    transform: scale(1.05);
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin: 0;
    line-height: 1.2;
}

.brand-tagline {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
    font-weight: 500;
}

/* ============================================
   主导航菜单
============================================ */

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-item {
    margin-left: 1.5rem;
    position: relative;
}

.nav-link {
    color: var(--text-dark);
    font-weight: 600;
    padding: 0.5rem 0;
    position: relative;
    text-decoration: none;
    transition: color var(--transition-fast);
    font-size: 1rem;
}

.nav-link:hover {
    color: var(--primary-blue);
    text-decoration: none;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-blue);
    transition: width var(--transition-normal);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link.active {
    color: var(--primary-blue);
}

.nav-link.active::after {
    width: 100%;
    background-color: var(--primary-blue);
}

/* CTA按钮在导航栏中 */
.nav-item .btn {
    margin-left: 0.5rem;
    padding: 8px 20px;
    font-weight: 600;
    border-radius: var(--radius-md);
}

/* ============================================
   移动端菜单按钮
============================================ */

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--primary-dark);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ============================================
   响应式设计
============================================ */

/* 平板设备 */
@media (max-width: 992px) {
    .nav-item {
        margin-left: 1rem;
    }
    
    .nav-link {
        font-size: 0.95rem;
    }
    
    .nav-item .btn {
        padding: 6px 16px;
        font-size: 0.9rem;
    }
}

/* 手机设备 */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        align-items: stretch;
        box-shadow: var(--shadow-lg);
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: all 0.3s ease;
        padding: 0;
    }
    
    .nav-menu.active {
        max-height: 400px;
        opacity: 1;
        padding: 1rem 0;
    }
    
    .nav-item {
        margin: 0;
        width: 100%;
    }
    
    .nav-link {
        display: block;
        padding: 1rem 2rem;
        text-align: center;
        border-bottom: 1px solid var(--medium-gray);
    }
    
    .nav-link::after {
        display: none;
    }
    
    .nav-link:hover {
        background-color: var(--light-gray);
    }
    
    .nav-item:last-child .nav-link {
        border-bottom: none;
    }
    
    .nav-item .btn {
        display: block;
        margin: 1rem auto;
        width: 80%;
        max-width: 200px;
    }
    
    /* Logo调整 */
    .logo-img {
        height: 40px;
    }
    
    .brand-name {
        font-size: 1.3rem;
    }
    
    .brand-tagline {
        font-size: 0.75rem;
    }
}

/* 小手机设备 */
@media (max-width: 576px) {
    .navbar .container {
        padding: 0 15px;
    }
    
    .logo-img {
        height: 35px;
        margin-right: 8px;
    }
    
    .brand-name {
        font-size: 1.2rem;
    }
    
    .brand-tagline {
        font-size: 0.7rem;
    }
    
    .nav-menu.active {
        padding: 0.5rem 0;
    }
    
    .nav-link {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* ============================================
   导航栏滚动效果
============================================ */

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    height: 70px;
}

.navbar.scrolled .logo-img {
    height: 40px;
}

.navbar.scrolled .brand-name {
    font-size: 1.3rem;
}

.navbar.scrolled .nav-link {
    font-size: 0.95rem;
}

/* ============================================
   下拉菜单（如果需要）
============================================ */

.nav-item.has-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: white;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
    list-style: none;
}

.nav-item.has-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--light-gray);
    color: var(--primary-blue);
    padding-left: 2rem;
}

/* 移动端下拉菜单调整 */
@media (max-width: 768px) {
    .dropdown-menu {
        position: static;
        box-shadow: none;
        background: var(--light-gray);
        border-radius: 0;
        max-height: 0;
        overflow: hidden;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: max-height 0.3s ease;
    }
    
    .nav-item.has-dropdown:hover .dropdown-menu {
        transform: none;
    }
    
    .dropdown-menu.active {
        max-height: 300px;
    }
    
    .dropdown-item {
        padding: 0.75rem 3rem;
    }
    
    .dropdown-item:hover {
        padding-left: 3.5rem;
    }
}

/* ============================================
   徽章和标记
============================================ */

.nav-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background: var(--accent-red);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
}

.nav-hot {
    color: var(--accent-red);
    font-size: 0.7rem;
    margin-left: 4px;
    font-weight: 700;
}

/* ============================================
   动画效果
============================================ */

@keyframes navFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.navbar {
    animation: navFadeIn 0.5s ease;
}

.nav-item {
    animation: navFadeIn 0.5s ease forwards;
    animation-delay: calc(var(--item-index, 0) * 0.1s);
    opacity: 0;
}

/* ============================================
   深色主题支持
============================================ */

@media (prefers-color-scheme: dark) {
    .navbar {
        background: var(--primary-dark);
        color: white;
    }
    
    .nav-link {
        color: rgba(255, 255, 255, 0.9);
    }
    
    .nav-link:hover {
        color: white;
    }
    
    .brand-name {
        color: white;
    }
    
    .brand-tagline {
        color: rgba(255, 255, 255, 0.7);
    }
    
    .menu-toggle span {
        background-color: white;
    }
    
    .dropdown-menu {
        background: var(--text-dark);
    }
    
    .dropdown-item {
        color: rgba(255, 255, 255, 0.9);
    }
    
    .dropdown-item:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: white;
    }
}

/* ============================================
   无障碍支持
============================================ */

.nav-link:focus,
.menu-toggle:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

.nav-link:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .nav-link {
        color: var(--text-dark);
    }
    
    .nav-link:hover {
        color: var(--primary-blue);
        text-decoration: underline;
    }
    
    .nav-link::after {
        display: none;
    }
}