/*
==============================================
【移动端导航增强样式 - 从 hxs 项目迁移】
专门针对移动端导航的额外样式和优化
配合navigation.css使用，提供更好的移动端体验
==============================================
*/

/* 移动端导航增强样式 */
@media (max-width: 768px) {
    /* 强制隐藏移动端菜单，防止自动显示 */
    .mobile-menu:not(.active) {
        transform: translateX(100%) !important;
        right: -100% !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    /* 确保汉堡菜单在移动端正确显示 */
    .hamburger-menu {
        display: flex !important;
        z-index: 1002;
    }
    
    /* 移动端导航容器优化 */
    .nav-container {
        position: relative;
        z-index: 1001;
    }
    
    /* 移动端Logo区域优化 */
    .logo-section {
        flex: 1;
        min-width: 0;
    }
    
    .logo-image {
        max-height: 35px;
        width: auto;
    }
    
    .brand-text {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }
    
    .brand-name,
    .brand-tagline {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    /* 移动端菜单容器 */
    .mobile-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 320px;
        height: 100vh;
        background-color: #ffffff;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        z-index: 1100;
        overflow-y: auto;
        transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        padding-top: 70px;
    }
    
    .mobile-menu.active {
        right: 0;
    }
    
    /* 移动端菜单遮罩 */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1050;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* 移动端菜单头部 */
    .mobile-menu-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px;
        border-bottom: 1px solid #e5e7eb;
        background-color: #f9fafb;
    }
    
    .mobile-menu-header h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        color: #1f2937;
        font-family: 'Arial', sans-serif;
    }
    
    .mobile-menu-close {
        background: none;
        border: none;
        cursor: pointer;
        color: #6b7280;
        padding: 4px;
        border-radius: 6px;
        transition: all 0.2s ease;
    }
    
    .mobile-menu-close:hover {
        background-color: #f3f4f6;
        color: #374151;
    }
    
    /* 移动端导航链接 */
    .mobile-nav {
        padding: 0;
    }
    
    .mobile-nav-link {
        display: block;
        font-family: 'Arial', sans-serif;
        font-size: 16px;
        font-weight: 500;
        color: #374151;
        text-decoration: none;
        padding: 16px 20px;
        border-bottom: 1px solid #f3f4f6;
        transition: all 0.2s ease;
        position: relative;
    }
    
    .mobile-nav-link:hover {
        color: #f97316;
        background-color: #fef3f2;
        padding-left: 24px;
        border-left: 3px solid #f97316;
    }
    
    .mobile-nav-link:after {
        display: none !important;
    }
    
    .mobile-nav-link:last-child {
        border-bottom: none;
    }
    
    /* 移动端功能区域 */
    .mobile-functions {
        border-bottom: 1px solid #e5e7eb;
    }
    
    /* 功能切换按钮 */
    .mobile-function-toggle {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 16px 20px;
        background: none;
        border: none;
        text-align: left;
        cursor: pointer;
        transition: all 0.2s ease;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .mobile-function-toggle:hover {
        background-color: #fef3f2;
        padding-left: 24px;
    }
    
    .mobile-function-toggle.active {
        background-color: #fef3f2;
        border-left: 3px solid #f97316;
    }
    
    .mobile-function-toggle:last-child {
        border-bottom: none;
    }
    
    .function-icon {
        margin-right: 12px;
        color: #6b7280;
        display: flex;
        align-items: center;
    }
    
    .function-text {
        flex: 1;
        font-size: 16px;
        font-weight: 500;
        color: #374151;
        font-family: 'Arial', sans-serif;
    }
    
    .function-arrow {
        color: #9ca3af;
        transition: transform 0.3s ease;
        display: flex;
        align-items: center;
    }
    
    .mobile-function-toggle.active .function-arrow {
        transform: rotate(180deg);
    }
    
    /* 移动端搜索功能区域样式 */
    .mobile-search {
        padding: 20px;
        background-color: #ffffff;
        border-top: 1px solid #e5e7eb;
        /*margin-top: 300px;*/
        position: relative;
        z-index: 2;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .mobile-search h4 {
        margin: 0 0 15px 0;
        font-size: 16px;
        font-weight: 600;
        color: #1f2937;
        font-family: 'Arial', sans-serif;
    }
    
    .mobile-search-input {
        width: 100%;
        padding: 12px 16px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        font-size: 14px;
        outline: none;
        transition: border-color 0.2s ease;
        font-family: 'Arial', sans-serif;
        margin-bottom: 15px;
    }
    
    .mobile-search-input:focus {
        border-color: #f97316;
    }
    
    .mobile-search-input::placeholder {
        color: #9ca3af;
    }
    
    .mobile-search-submit {
        width: 100%;
        padding: 12px 16px;
        background-color: #f97316;
        color: #ffffff;
        border: none;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: background-color 0.2s ease;
        font-family: 'Arial', sans-serif;
        margin-bottom: 15px;
    }
    
    .mobile-search-submit:hover {
        background-color: #ea580c;
    }
    
    .mobile-suggestion-title {
        font-size: 14px;
        font-weight: 500;
        color: #6b7280;
        margin-bottom: 12px;
        font-family: 'Arial', sans-serif;
    }
    
    .mobile-suggestion-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .mobile-search-tag {
        padding: 6px 12px;
        background-color: #f3f4f6;
        border: 1px solid #e5e7eb;
        border-radius: 20px;
        font-size: 12px;
        color: #6b7280;
        cursor: pointer;
        transition: all 0.2s ease;
        font-family: 'Arial', sans-serif;
    }
    
    .mobile-search-tag:hover {
        background-color: #fef3f2;
        border-color: #f97316;
        color: #f97316;
    }
    
    /* 移动端触摸优化 */
    .mobile-nav-link,
    .mobile-function-toggle,
    .mobile-search-tag,
    .mobile-lang-item {
        -webkit-tap-highlight-color: rgba(249, 115, 22, 0.1);
    }
    
    /* 移动端搜索弹框优化 */
    .search-popup-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
        border-radius: 8px;
    }
    
    /* 移动端语言选择优化 */
    .language-popup {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
        width: 90vw !important;
        max-width: 400px !important;
        max-height: 70vh;
        overflow-y: auto;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .nav-container {
        height: 50px;
        padding: 0 10px;
    }
    
    .logo-image {
        max-height: 30px;
    }
    
    .brand-text span {
        font-size: 10px;
    }
    
    .mobile-menu {
        padding-top: 10px;
    }
    
    .mobile-nav-link {
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* 确保移动端菜单在所有情况下都能正确显示 */
@media (max-width: 768px) {
    /* 强制隐藏桌面端导航 */
    .nav-menu,
    .search-container,
    .language-selector {
        display: none !important;
    }
    
    /* 显示移动端汉堡菜单 */
    .hamburger-menu {
        display: flex !important;
    }
}

/* 确保z-index层级正确 */
.mobile-menu-overlay {
    z-index: 1050 !important;
}

.mobile-menu {
    z-index: 1100 !important;
}

/* 移动端菜单动画优化 */
@keyframes mobileMenuSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0.8;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes mobileMenuSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0.8;
    }
}

.mobile-menu.active {
    animation: mobileMenuSlideIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 超小屏幕适配 */
@media (max-width: 480px) {
    /* 超小屏幕下的移动端菜单强制隐藏 */
    .mobile-menu:not(.active) {
        transform: translateX(100%) !important;
        right: -100% !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        display: none !important;
    }
    
    .brand-name {
        font-size: 14px;
        max-width: 150px;
    }
    
    .brand-tagline {
        font-size: 10px;
        max-width: 150px;
    }
    
    .hamburger-menu {
        padding: 6px;
    }
    
    .hamburger-line {
        width: 20px;
        height: 2px;
    }
    
    .mobile-menu {
        width: 100vw;
        right: -100vw;
    }
    
    .mobile-menu.active {
        right: 0;
    }
    
    /* 小屏幕下的语言选择器 */
    .language-popup {
        width: 95vw !important;
        max-width: 300px !important;
    }
    
    .language-items {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px;
    }
    
    .lang-item {
        font-size: 11px;
        padding: 8px 4px;
        min-height: 50px;
    }
    
    .lang-item img {
        width: 20px;
        height: 15px;
    }
}
