/* ===========================================
   Main Navigation Styles - 主导航样式
   高度: 80px
   =========================================== */

/* 基础导航样式 - 默认有背景 */
.main-nav {
    height: 80px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: none;
    position: relative;
    z-index: 1000;
    transition: all 0.3s ease;
    width: 100%;
}

/* 首页特殊处理 - 透明背景 */
.homepage .main-nav {
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
}

/* 首页透明状态下的文字颜色 */
.homepage .nav-link,
.homepage .logo-text,
.homepage .search-btn,
.homepage .mobile-menu-btn span {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.homepage .nav-link:hover {
    color: #3498db;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Nav Scrolled State */
.main-nav.scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(238, 238, 238, 0.5);
}

/* 滚动后恢复正常文字颜色 */
.main-nav.scrolled .nav-link,
.main-nav.scrolled .logo-text,
.main-nav.scrolled .search-btn,
.main-nav.scrolled .mobile-menu-btn span {
    color: #2c3e50;
    text-shadow: none;
}

/* Nav Sticky State */
.main-nav.sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Logo */
.logo {
    flex-shrink: 0;
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-left: 10px;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 30px;
    flex: 1;
    justify-content: center;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 25px 0;
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: #3498db;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: #3498db;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link i {
    margin-left: 5px;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.nav-item:hover .nav-link i {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 200px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    list-style: none;
    margin: 0;
}

.nav-item:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-link {
    display: block;
    padding: 12px 20px;
    color: #2c3e50;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.dropdown-link:hover {
    background: #f8f9fa;
    color: #3498db;
    padding-left: 25px;
}

/* Special Button Style for Get Quote */
.inquiry-btn {
    background: #3498db;
    color: #fff !important;
    padding: 12px 20px !important;
    border-radius: 6px;
    margin: 13px 0;
    transition: all 0.3s ease;
}

.inquiry-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.inquiry-btn::after {
    display: none;
}

/* Navigation Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* Search Button */
.search-btn {
    background: none;
    border: none;
    color: #2c3e50;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: #f8f9fa;
    color: #3498db;
}

/* Search Bar */
.search-bar {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 20px;
    min-width: 300px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.search-bar.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-container {
    display: flex;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    overflow: hidden;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    outline: none;
    font-size: 14px;
}

.search-submit {
    background: #3498db;
    border: none;
    color: #fff;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.search-submit:hover {
    background: #2980b9;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    gap: 4px;
}

.mobile-menu-btn span {
    width: 25px;
    height: 3px;
    background: #2c3e50;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover span {
    background: #3498db;
}

/* ===========================================
   响应式设计 - 只在移动端覆盖必要样式
   =========================================== */

/* 平板端样式 */
@media (max-width: 1024px) {
    .nav-content {
        padding: 0 15px;
    }
    
    .nav-menu {
        gap: 20px;
    }
    
    .logo-img {
        height: 45px;
    }
    
    .logo-text {
        font-size: 1.3rem;
    }
}

/* 移动端样式 - 保持PC端逻辑，只在移动端强制背景 */
@media (max-width: 768px) {
    /* 移动端导航始终固定且有背景 */
    .main-nav {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        background: #fff !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
        border-bottom: 1px solid #eee;
        height: 80px;
        z-index: 1001;
    }
    
    /* 移动端首页也强制背景 */
    .homepage .main-nav {
        background: #fff !important;
        backdrop-filter: none !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* 移动端文字颜色统一 */
    .main-nav .nav-link,
    .homepage .nav-link,
    .main-nav .logo-text,
    .homepage .logo-text,
    .main-nav .search-btn,
    .homepage .search-btn,
    .main-nav .mobile-menu-btn span,
    .homepage .mobile-menu-btn span {
        color: #2c3e50 !important;
        text-shadow: none !important;
    }
    
    /* 修复移动端导航内容垂直居中 */
    .nav-content {
        padding: 0 15px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 100%;
        min-height: 80px;
    }
    
    /* 移动端侧滑菜单样式 - 在nav下方 */
    .nav-menu {
        position: fixed;
        top: 80px; /* 从导航栏下方开始 */
        left: -100%; /* 初始隐藏在左侧 */
        width: 280px;
        height: calc(100vh - 80px); /* 减去导航栏高度 */
        background: #fff;
        flex-direction: column;
        padding: 0;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
    }
    
    /* 菜单显示状态 - 从左滑出 */
    .nav-menu.show {
        left: 0; /* 滑出到可见位置 */
    }
    
    /* 菜单项样式 */
    .nav-item {
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .nav-item:last-child {
        border-bottom: none;
        margin-top: auto; /* Get Quote按钮推到底部 */
    }
    
    .nav-link {
        padding: 16px 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 16px;
        font-weight: 500;
        color: #333;
        border-left: 4px solid transparent;
        transition: all 0.3s ease;
        text-decoration: none;
    }
    
    .nav-link:hover {
        background: #f8f9fa;
        border-left-color: #3498db;
        color: #3498db;
    }
    
    /* 箭头样式 - 修复方向控制 */
    .nav-link i {
        font-size: 14px;
        transition: transform 0.3s ease;
        transform: rotate(0deg); /* 默认向下箭头 */
        margin-left: 8px;
    }
    
    /* Products展开时箭头向上 - 修正旋转角度 */
    .nav-item.dropdown-open .nav-link i {
        transform: rotate(180deg); /* 使用正180度旋转 */
    }
    
    /* 下拉菜单 - 正常文档流，不覆盖 */
    .dropdown-menu {
        position: static; /* 使用静态定位，正常文档流 */
        width: 100%;
        background: #f8f9fa;
        border-radius: 0;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border: none;
        border-left: 4px solid #3498db;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        list-style: none;
    }
    
    /* 展开状态的下拉菜单 */
    .nav-item.dropdown-open .dropdown-menu {
        max-height: 400px; /* 足够的高度容纳所有子项 */
        padding: 8px 0; /* 展开时添加内边距 */
    }
    
    /* 下拉菜单项 */
    .dropdown-link {
        padding: 12px 30px;
        font-size: 14px;
        color: #666;
        display: block;
        text-decoration: none;
        transition: all 0.3s ease;
        border-left: 2px solid transparent;
    }
    
    .dropdown-link:hover {
        background: #e9ecef;
        color: #3498db;
        border-left-color: #3498db;
        padding-left: 35px;
    }
    
    /* Get Quote 按钮特殊样式 */
    .nav-item:last-child .nav-link {
        background: #3498db;
        color: #fff;
        margin: 15px;
        border-radius: 8px;
        border-left: none;
        text-align: center;
        justify-content: center;
    }
    
    .nav-item:last-child .nav-link:hover {
        background: #2980b9;
        transform: translateY(-2px);
    }
    
    /* 遮罩层 - 从导航栏下方开始 */
    .nav-overlay {
        position: fixed;
        top: 80px; /* 从导航栏下方开始 */
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .nav-overlay.show {
        opacity: 1;
        visibility: visible;
    }
    
    /* 汉堡按钮样式 */
    .mobile-menu-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 30px;
        height: 30px;
        cursor: pointer;
        z-index: 1001;
        background: none;
        border: none;
        padding: 0;
    }
    
    .mobile-menu-btn span {
        width: 25px;
        height: 3px;
        background: #333;
        margin: 2px 0;
        transition: all 0.3s ease;
        border-radius: 2px;
        display: block;
    }
    
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    /* 防止body滚动 */
    body.mobile-menu-open {
        overflow: hidden;
    }
    
    .logo {
        display: flex;
        align-items: center;
    }
    
    .logo-img {
        height: 40px;
    }
    
    .logo-text {
        font-size: 1.2rem;
    }
    
    .nav-actions {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .search-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
    }
    
    .search-bar {
        position: fixed;
        top: 80px;
        left: 15px;
        right: 15px;
        min-width: auto;
    }
    
    /* 为移动端页面内容添加顶部间距 */
    body {
        padding-top: 80px;
    }
}

/* 小屏手机样式 */
@media (max-width: 480px) {
    .nav-content {
        padding: 0 10px;
        min-height: 80px; /* 确保最小高度 */
    }
    
    .logo-img {
        height: 35px;
    }
    
    .logo-text {
        font-size: 1.1rem;
        margin-left: 8px;
    }
    
    .mobile-menu-btn span {
        width: 22px;
        height: 2px;
    }
    
    .search-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .search-bar {
        left: 10px;
        right: 10px;
        padding: 15px;
    }
    
    .search-input {
        padding: 10px 12px;
        font-size: 16px; /* 防止iOS缩放 */
    }
}