/* 移动端手风琴菜单 - 优雅紫主题 */
/* Mobile Accordion Menu - Elegant Purple Theme */

/* ========== 移动端菜单触发器 ========== */
@media (max-width: 1024px) {
    /* 强制所有电话链接为白色 - 覆盖浏览器默认样式 */
    a[href^="tel:"] {
        color: white !important;
        text-decoration: none !important;
        pointer-events: auto !important;
    }

    /* 禁用移动浏览器自动为电话号码添加的颜色 */
    a[href^="tel:"]::-webkit-any-link {
        color: white !important;
    }

    a[href^="tel:"]:visited,
    a[href^="tel:"]:active,
    a[href^="tel:"]:hover {
        color: white !important;
        text-decoration: none !important;
    }

    /* 隐藏桌面导航 */
    .nav {
        display: none !important;
    }

    /* 移动端菜单按钮 */
    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
        border: none;
        border-radius: 12px;
        cursor: pointer;
        padding: 0;
        position: relative;
        z-index: 10001;
        box-shadow: 0 4px 12px rgba(107, 70, 193, 0.3);
        transition: all 0.3s ease;
    }

    .menu-toggle:hover {
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(107, 70, 193, 0.4);
    }

    .menu-toggle:active {
        transform: scale(0.95);
    }

    /* 汉堡图标 */
    .menu-toggle span {
        display: block;
        width: 24px;
        height: 2px;
        background: white;
        border-radius: 2px;
        position: relative;
        transition: all 0.3s ease;
    }

    .menu-toggle span::before,
    .menu-toggle span::after {
        content: '';
        position: absolute;
        width: 24px;
        height: 2px;
        background: white;
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    .menu-toggle span::before {
        top: -8px;
    }

    .menu-toggle span::after {
        bottom: -8px;
    }

    /* 菜单打开状态 */
    .menu-toggle.active span {
        background: transparent;
    }

    .menu-toggle.active span::before {
        top: 0;
        transform: rotate(45deg);
    }

    .menu-toggle.active span::after {
        bottom: 0;
        transform: rotate(-45deg);
    }

    /* ========== 移动端手风琴导航菜单 ========== */
    .mobile-nav {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: 320px;
        max-width: 85vw;
        height: 100vh;
        background: linear-gradient(180deg, var(--bg-dark) 0%, var(--primary) 100%);
        z-index: 10000;
        padding: 80px 20px 20px;
        overflow-y: auto;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-nav.active {
        display: block;
        transform: translateX(0);
    }

    /* 菜单遮罩 */
    .mobile-nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 9999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .mobile-nav-overlay.active {
        display: block;
        opacity: 1;
    }

    /* ========== 手风琴菜单样式 ========== */
    .accordion-menu {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .accordion-item {
        margin-bottom: 4px;
        border-radius: 12px;
        overflow: hidden;
        background: rgba(255, 255, 255, 0.05);
        transition: all 0.3s ease;
    }

    .accordion-item:hover {
        background: rgba(255, 255, 255, 0.08);
    }

    .accordion-item.active {
        background: rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    /* 手风琴标题 */
    .accordion-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        cursor: pointer;
        user-select: none;
        position: relative;
        overflow: hidden;
    }

    .accordion-header::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255, 255, 255, 0.1);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .accordion-header:hover::before,
    .accordion-header:active::before {
        transform: translateX(0);
    }

    .accordion-title {
        display: flex;
        align-items: center;
        gap: 12px;
        color: rgba(255, 255, 255, 0.9);
        font-size: 16px;
        font-weight: 500;
        transition: all 0.3s ease;
        position: relative;
        z-index: 1;
    }

    .accordion-title .nav-icon {
        font-size: 18px;
        width: 24px;
        text-align: center;
    }

    .accordion-item.active .accordion-title {
        color: white;
        font-weight: 600;
    }

    /* 手风琴箭头 */
    .accordion-arrow {
        width: 24px;
        height: 24px;
        position: relative;
        transition: transform 0.3s ease;
        flex-shrink: 0;
    }

    .accordion-arrow::before,
    .accordion-arrow::after {
        content: '';
        position: absolute;
        background: rgba(255, 255, 255, 0.7);
        border-radius: 2px;
    }

    .accordion-arrow::before {
        width: 12px;
        height: 2px;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .accordion-arrow::after {
        width: 2px;
        height: 12px;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .accordion-item.active .accordion-arrow {
        transform: rotate(180deg);
    }

    .accordion-item.active .accordion-arrow::before,
    .accordion-item.active .accordion-arrow::after {
        background: white;
    }

    /* 手风琴内容 */
    .accordion-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        background: rgba(0, 0, 0, 0.1);
    }

    .accordion-item.active .accordion-content {
        max-height: 500px;
        padding: 12px 0;
    }

    .accordion-content-inner {
        padding: 0 20px;
    }

    /* 子菜单样式 */
    .submenu-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .submenu-item {
        margin-bottom: 2px;
    }

    .submenu-link {
        display: flex;
        align-items: center;
        padding: 12px 16px 12px 48px;
        color: rgba(255, 255, 255, 0.8);
        text-decoration: none;
        border-radius: 8px;
        font-size: 14px;
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
    }

    .submenu-link::before {
        content: '';
        position: absolute;
        left: 36px;
        top: 50%;
        transform: translateY(-50%);
        width: 6px;
        height: 6px;
        background: rgba(255, 255, 255, 0.5);
        border-radius: 50%;
        transition: all 0.3s ease;
    }

    .submenu-link:hover {
        background: rgba(255, 255, 255, 0.1);
        color: white;
        padding-left: 52px;
    }

    .submenu-link:hover::before {
        background: white;
        transform: translateY(-50%) scale(1.3);
    }

    .submenu-link.active-page {
        background: rgba(255, 255, 255, 0.15);
        color: white;
        font-weight: 600;
    }

    .submenu-link.active-page::before {
        background: white;
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }

    /* ========== 菜单底部信息 ========== */
    .mobile-nav-footer {
        margin-top: 30px;
        padding-top: 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        color: rgba(255, 255, 255, 0.7);
        font-size: 13px;
        text-align: center;
    }

    .mobile-nav-footer p {
        margin: 8px 0;
        word-wrap: break-word;
        color: rgba(255, 255, 255, 0.9);
    }

    .mobile-nav-footer a {
        display: inline;
        color: rgba(255, 255, 255, 0.9);
        padding: 0;
        font-size: 13px;
        text-decoration: none;
    }

    .mobile-nav-footer a[href^="tel:"] {
        color: white !important;
        text-decoration: none;
    }

    /* 强制所有电话链接为白色 */
    .mobile-nav-footer a[href^="tel:"],
    .mobile-nav-footer a[href^="tel:"]:visited,
    .mobile-nav-footer a[href^="tel:"]:active,
    .mobile-nav-footer a[href^="tel:"]:hover {
        color: white !important;
        text-decoration: none;
    }

    /* 邮箱链接颜色 */
    .mobile-nav-footer a[href^="mailto:"] {
        color: rgba(255, 255, 255, 0.9) !important;
        text-decoration: none;
    }

    .mobile-nav-footer a:hover {
        color: white !important;
        text-decoration: underline;
    }

    /* ========== 关闭按钮 ========== */
    .mobile-nav-close {
        position: absolute;
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        border-radius: 50%;
        color: white;
        font-size: 20px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
    }

    .mobile-nav-close:hover,
    .mobile-nav-close:active {
        background: rgba(255, 255, 255, 0.2);
        transform: rotate(90deg);
    }

    /* ========== 滚动条样式 ========== */
    .mobile-nav::-webkit-scrollbar {
        width: 4px;
    }

    .mobile-nav::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
    }

    .mobile-nav::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }

    /* ========== 防止页面滚动 ========== */
    body.mobile-menu-open {
        overflow: hidden;
    }

    /* ========== 头部调整 ========== */
    .header {
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    /* ========== iPad特定优化 ========== */
    @media (min-width: 768px) and (max-width: 1024px) {
        .mobile-nav {
            width: 400px;
            max-width: 70vw;
        }

        .accordion-header {
            padding: 18px 24px;
        }

        .accordion-title {
            font-size: 17px;
        }

        .submenu-link {
            font-size: 15px;
            padding: 14px 20px 14px 56px;
        }

        .submenu-link:hover {
            padding-left: 60px;
        }

        .mobile-nav-footer {
            font-size: 14px;
        }
    }

    /* ========== 动画效果 ========== */
    @keyframes slideInRight {
        from {
            opacity: 0;
            transform: translateX(30px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    .mobile-nav.active .accordion-item {
        animation: slideInRight 0.4s ease forwards;
        opacity: 0;
    }

    .mobile-nav.active .accordion-item:nth-child(1) { animation-delay: 0.05s; }
    .mobile-nav.active .accordion-item:nth-child(2) { animation-delay: 0.1s; }
    .mobile-nav.active .accordion-item:nth-child(3) { animation-delay: 0.15s; }
    .mobile-nav.active .accordion-item:nth-child(4) { animation-delay: 0.2s; }
    .mobile-nav.active .accordion-item:nth-child(5) { animation-delay: 0.25s; }
    .mobile-nav.active .accordion-item:nth-child(6) { animation-delay: 0.3s; }
    .mobile-nav.active .accordion-item:nth-child(7) { animation-delay: 0.35s; }
    .mobile-nav.active .accordion-item:nth-child(8) { animation-delay: 0.4s; }
    .mobile-nav.active .accordion-item:nth-child(9) { animation-delay: 0.45s; }
    .mobile-nav.active .accordion-item:nth-child(10) { animation-delay: 0.5s; }
}

/* ========== iPad横屏优化 ========== */
@media (min-width: 1025px) and (max-width: 1366px) and (orientation: landscape) {
    /* iPad Pro等大屏横屏时也使用移动端菜单 */
    .nav {
        display: none !important;
    }

    .menu-toggle {
        display: flex !important;
    }

    .mobile-nav {
        width: 450px;
        max-width: 60vw;
    }
}
}

/* ========== 触摸设备优化 ========== */
@media (hover: none) and (pointer: coarse) and (max-width: 1024px) {
    .accordion-header,
    .submenu-link {
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
    }

    .accordion-header:active {
        background: rgba(255, 255, 255, 0.15);
    }

    .submenu-link:active {
        background: rgba(255, 255, 255, 0.15);
    }
}

/* ========== 小屏幕优化 ========== */
@media (max-width: 374px) {
    /* 公司介绍图片网格 */
    .company-images-grid,
    .technology-images-grid,
    .endorsement-images-grid,
    .cooperation-images-grid,
    .product-principle-images,
    .product-details-images {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        padding: 0 5px;
    }

    .company-images-grid img,
    .technology-images-grid img,
    .endorsement-images-grid img,
    .cooperation-images-grid img,
    .product-principle-images img,
    .product-details-images img {
        width: 100%;
        height: auto;
        object-fit: contain;
    }

    .mobile-nav {
        width: 100%;
        max-width: 100%;
    }

    .accordion-header {
        padding: 14px 16px;
    }

    .accordion-title {
        font-size: 15px;
    }

    .submenu-link {
        font-size: 13px;
        padding-left: 44px;
    }

    .submenu-link:hover {
        padding-left: 48px;
    }

    .mobile-nav-footer {
        font-size: 12px;
    }
}