/* ============================================
   DEMAX Header Styles
   ============================================ */

/* Reset and Base Styles */
.demax-header {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(229, 229, 229, 0.5);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: background-color 0.3s ease, border-bottom-color 0.3s ease, box-shadow 0.3s ease;
}

.demax-header.scrolled {
    background-color: #ffffff;
    border-bottom-color: #e5e5e5;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ============================================
   PC端布局样式 (默认样式)
   ============================================ */

/* PC端容器 - 默认显示 */
.header-pc {
    display: block;
}

/* 移动端容器 - 默认隐藏 */
.header-mobile {
    display: none;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    position: relative;
}

/* PC端 Logo */
.logo-section {
    flex-shrink: 0;
}

.logo-link {
    text-decoration: none;
    display: inline-block;
    line-height: 0;
}

.demax-logo-img {
    height: 60px;
    width: auto;
    max-width: 200px;
    display: block;
    object-fit: contain;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

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

/* PC端导航菜单 */
.main-navigation {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.nav-menu-pc > li {
    position: relative;
    margin: 0 8px;
}

.nav-menu-pc .nav-link {
    display: block;
    padding: 10px 18px;
    text-decoration: none;
    color: #333333;
    font-size: 16px;
    font-weight: 500;
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
    position: relative;
    white-space: nowrap;
    z-index: 1003;
    pointer-events: auto;
}

.nav-menu-pc .nav-link:hover {
    color: #dc3545;
}

.nav-menu-pc > li.active {
    border-bottom: 2px solid #dc3545;
}

.nav-menu-pc > li.active > .nav-link,
.nav-menu-pc > li.active > .nav-link:hover {
    color: #dc3545;
}

/* PC端下拉菜单 */
.nav-menu-pc > li.has-children > .nav-link {
    position: relative;
    z-index: 1004;
    pointer-events: auto !important;
}

.drop-menu-pc {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0;
    padding-top: 8px;
    background-color: #ffffff;
    list-style: none;
    padding: 10px 0;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    pointer-events: none;
    margin: 0;
}

/* 显示下拉菜单 - 当鼠标悬停在父菜单项上时 */
.nav-menu-pc > li:hover > .drop-menu-pc,
.nav-menu-pc > li.has-children:hover .drop-menu-pc {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* 保持下拉菜单在鼠标悬停时可见 */
.drop-menu-pc:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* 创建桥接区域，连接父菜单和下拉菜单，防止鼠标移动时菜单消失 */
.nav-menu-pc > li.has-children::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 8px;
    z-index: 999;
    pointer-events: auto;
    background: transparent;
}

/* 确保下拉菜单内容区域可以接收鼠标事件 */
.drop-menu-pc::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background: transparent;
    pointer-events: auto;
    z-index: 1001;
}

.drop-menu-pc li {
    margin: 0;
}

.drop-menu-pc a {
    display: block;
    padding: 10px 20px;
    color: #333333;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.drop-menu-pc a:hover {
    background-color: #f5f5f5;
    color: #dc3545;
}

/* PC端右侧图标 */
.header-icons {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    text-decoration: none;
    color: #333333;
    font-size: 18px;
    transition: color 0.3s ease, transform 0.3s ease;
    border-radius: 50%;
}

.icon-btn:hover {
    color: #dc3545;
    transform: scale(1.1);
}

/* PC端响应式调整 */
@media (max-width: 1200px) {
    .header-container {
        padding: 0 30px;
    }
    
    .nav-menu-pc .nav-link {
        padding: 10px 15px;
        font-size: 15px;
    }
}

/* ============================================
   移动端布局样式 (992px以下)
   ============================================ */

@media (max-width: 992px) {
    /* 隐藏PC端布局 */
    .header-pc {
        display: none;
    }

    /* 显示移动端布局 */
    .header-mobile {
        display: block;
    }

    /* 移动端顶部栏 */
    .mobile-top-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 16px;
        height: 56px;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        position: sticky;
        top: 0;
        z-index: 1001;
    }

    .mobile-logo img {
        height: 28px;
        width: auto;
        display: block;
    }

    .mobile-icons {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    /* 移动端菜单按钮 */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border: none;
        background: none;
        color: #333;
        font-size: 22px;
        cursor: pointer;
        transition: all 0.3s ease;
        padding: 0;
    }

    .mobile-menu-toggle:hover {
        color: #dc3545;
    }

    .mobile-menu-toggle.open i {
        transform: rotate(90deg);
        transition: transform 0.3s ease;
    }

    /* 移动端导航菜单 */
    .mobile-navigation {
        display: block;
    }

    .nav-menu-mobile {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding: 76px 20px 24px;
        background: #fff;
        box-shadow: 6px 0 20px rgba(0,0,0,0.12);
        transition: left 0.3s ease;
        z-index: 1002;
        overflow-y: auto;
        gap: 0;
        list-style: none;
        margin: 0;
    }

    .nav-menu-mobile.active {
        left: 0;
    }

    .nav-menu-mobile > li {
        width: 100%;
        text-align: left;
        border-bottom: 1px solid #f5f5f5;
        margin: 0;
        padding: 12px 0;
        background: #fff;
    }

    .nav-menu-mobile .nav-link {
        padding: 8px 0;
        border-bottom: none;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 16px;
        font-weight: 600;
        color: #600;
        text-decoration: none;
        text-transform: none;
        letter-spacing: 0;
    }

    .nav-menu-mobile > li.has-children {
        padding-right: 0;
    }

    .nav-caret {
        margin-left: 10px;
        color: #600;
        transition: transform 0.2s ease;
        flex-shrink: 0;
    }

    .nav-menu-mobile > li.open .nav-caret {
        transform: rotate(180deg);
    }

    /* 移动端下拉菜单 */
    .drop-menu-mobile {
        width: 100%;
        padding: 8px 0 0 12px;
        margin: 0;
        background: transparent;
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        display: none;
        list-style: none;
    }

    .nav-menu-mobile > li.open > .drop-menu-mobile {
        display: block;
    }

    .drop-menu-mobile li {
        margin: 0;
        padding: 10px 0;
        border: none;
    }

    .drop-menu-mobile a {
        padding: 8px 0;
        display: block;
        color: #111;
        font-size: 15px;
        font-weight: 600;
        text-decoration: none;
    }

    /* 移动端遮罩层 */
    .mobile-nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.45);
        z-index: 4;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }

    .mobile-nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* 移动端小屏幕优化 */
@media (max-width: 480px) {
    .mobile-top-bar {
        padding: 10px 12px;
    }

    .mobile-logo img {
        height: 24px;
    }

    .nav-menu-mobile {
        width: 260px;
        left: -260px;
    }
}

/* ============================================
   搜索弹窗 (PC和移动端共用)
   ============================================ */

.searchBar-m {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.searchBar-m .mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.searchBar-m .mask-ico {
    position: absolute;
    top: 30px;
    right: 40px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 24px;
    text-decoration: none;
    z-index: 10001;
    transition: transform 0.3s ease;
}

.searchBar-m .mask-ico:hover {
    transform: rotate(90deg);
}

.searchBar-m .form-group {
    position: relative;
    z-index: 10001;
    width: 100%;
    max-width: 600px;
    padding: 0 40px;
}

.searchBar-m .form-group form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.searchBar-m input[type="text"] {
    flex: 1;
    padding: 15px 20px;
    font-size: 18px;
    border: 2px solid #ffffff;
    border-radius: 50px;
    background-color: transparent;
    color: #ffffff;
    outline: none;
}

.searchBar-m input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.searchBar-m input[type="text"]:focus {
    border-color: #dc3545;
}

.searchBar-m button[type="submit"] {
    padding: 15px 30px;
    background-color: #dc3545;
    color: #ffffff;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.searchBar-m button[type="submit"]:hover {
    background-color: #c82333;
}

@media (max-width: 480px) {
    .searchBar-m .form-group {
        padding: 0 20px;
    }

    .searchBar-m .mask-ico {
        top: 20px;
        right: 20px;
    }
}

/* ============================================
   Utility Classes
   ============================================ */

.clearfix {
    clear: both;
}
