/* ================= 移动端 Header 适配 ================= */
/* 断点：1023px 及以下（含平板端） */

/* PC端隐藏汉堡按钮 */
.mobile-menu-btn {
    display: none;
}

@media (max-width: 1023px) {
    /* 0. 兜底：禁止页面水平滚动 */
    html, body {
        overflow-x: hidden !important;
    }

    /* 1. Header 基础重置 — 使用包含 Tailwind class 的高优先级选择器，确保覆盖 */
    html body header.min-w-\[1536px\].overflow-hidden,
    header[class*="min-w-[1536px]"] {
        min-width: 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }

    header[style*="height: 960px"] {
        height: auto !important;
    }

    /* 导航条容器 */
    header > div:first-child.absolute {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        height: 60px !important;
        min-height: 60px !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        justify-content: space-between !important;
        z-index: 1000 !important;
        background: linear-gradient(180deg, #901C1C 0%, rgba(144,28,28,0) 100%) !important;
        box-sizing: border-box !important;
    }

    /* 2. Logo 区域适配 */
    header > div:first-child > div:first-child.min-w-\[648\.92px\] {
        min-width: auto !important;
        margin-left: 0 !important;
        line-height: normal !important;
        padding-left: 16px;
    }

    header > div:first-child > div:first-child img {
        width: auto !important;
        max-width: 220px !important;
        height: auto !important;
        max-height: 40px !important;
        object-fit: contain;
    }

    /* 隐藏PC端用来占位的 240px div */
    header > div:first-child > div:nth-child(2).w-\[240px\] {
        display: none !important;
    }

    /* 3. 汉堡菜单按钮 */
    .mobile-menu-btn {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 48px;
        height: 48px;
        margin-right: 8px;
        margin-left: auto !important;
        flex-shrink: 0 !important;
        background: transparent;
        border: none;
        cursor: pointer;
        z-index: 1002;
    }

    .mobile-menu-btn span {
        display: block;
        width: 24px;
        height: 2px;
        background: #fff;
        margin: 3px 0;
        transition: all 0.3s ease;
        border-radius: 1px;
    }

    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

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

    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    /* 4. 导航菜单（移动端下拉式） */
    header nav.w-\[900px\],
    header nav[class*="w-[900px]"] {
        position: fixed !important;
        top: 60px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: auto !important;
        max-height: calc(100vh - 60px) !important;
        overflow-y: auto !important;
        background: #901C1C !important;
        flex-direction: column !important;
        line-height: normal !important;
        padding: 8px 0 16px !important;
        margin-top: 0 !important;

        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s ease;
        pointer-events: none;
    }

    header nav.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    header nav > a,
    header nav > .dropdown {
        width: 100% !important;
        text-align: left !important;
        padding: 0 20px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    header nav > a {
        display: block !important;
        height: 48px !important;
        line-height: 48px !important;
        color: #fff !important;
        font-size: 15px !important;
        font-weight: 500 !important;
    }

    header nav > .dropdown {
        position: relative !important;
        z-index: auto !important;
    }

    header nav > .dropdown > a {
        display: block !important;
        width: 100% !important;
        height: 48px !important;
        line-height: 48px !important;
        color: #fff !important;
        font-size: 15px !important;
        font-weight: 500 !important;
        position: relative;
    }

    /* 下拉箭头：仅在有子菜单时显示 */
    header nav > .dropdown.has-menu > a::after {
        content: '';
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top: 5px solid rgba(255, 255, 255, 0.7);
        transition: transform 0.3s ease;
    }

    header nav > .dropdown.has-menu.open > a::after {
        transform: translateY(-50%) rotate(180deg);
    }

    /* 移动端下拉菜单样式 */
    header nav .dropdown-menu {
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        width: 100% !important;
        background: rgba(0, 0, 0, 0.15) !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        display: none;
        padding: 4px 0;
        margin: 0 -20px;
        width: calc(100% + 40px) !important;
    }

    header nav > .dropdown.open .dropdown-menu {
        display: block;
    }

    header nav .dropdown-item {
        text-align: left !important;
        padding: 12px 32px !important;
        color: rgba(255, 255, 255, 0.9) !important;
        font-size: 14px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    header nav .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.1) !important;
        color: #fff !important;
    }

    /* 搜索按钮在移动端导航中 */
    header nav > a.flex {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        border-bottom: none;
    }

    header nav > a.flex img {
        width: 20px !important;
        height: 20px !important;
        margin-right: 8px;
    }

    /* 5. 搜索弹层微调 */
    .ser-layer .serform .input-group .inp {
        font-size: 16px;
    }

    .ser-layer .serclose {
        right: 1rem;
        top: 1rem;
    }

    /* 6. 轮播图高度适配 */
    header.h-\[960px\] {
        height: 300px !important;
    }

    header > div.h-\[960px\] {
        height: 300px !important;
    }

    header .swiper,
    header .swiper-wrapper {
        height: 300px !important;
    }

    header .swiper-slide img.h-\[960px\] {
        height: 300px !important;
    }

    /* ================= 最新动态模块移动端适配 ================= */

    /* 最新动态容器 */
    .section-container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* 标题区域 */
    .section-container .text-center.mb-10 {
        margin-bottom: 24px !important;
    }

    .section-container .text-center .text-\[36px\] {
        font-size: 24px !important;
    }

    /* 背景英文装饰文字移动端缩放 */
    .section-container .text-center > p.font-thin {
        font-size: 20px !important;
        margin-top: -22px !important;
        display: block !important;
    }

    /* 查看更多定位调整 */
    .section-container .text-center .absolute.right-0.bottom-0 {
        position: static !important;
        justify-content: flex-end !important;
        margin-top: 8px;
    }

    /* 内容区域：取消grid，改为单列堆叠 */
    .section-container .grid.grid-cols-1.md\:grid-cols-3.bg-\[\#F5F6FA\] {
        display: flex !important;
        flex-direction: column !important;
    }

    /* 左侧轮播图区域 */
    .section-container .md\:col-span-2 {
        width: 100% !important;
    }

    .section-container .md\:col-span-2 .overflow-hidden.relative.h-\[579px\],
    .section-container .news-carousel-container,
    .section-container .news-carousel-container .news-carousel-container {
        height: 220px !important;
    }

    .section-container .carousel-slide img.h-\[579px\] {
        height: 220px !important;
    }

    /* 轮播图底部标题遮罩 */
    .section-container .carousel-slide .w-\[662px\].h-\[58px\] {
        width: 100% !important;
        height: 48px !important;
    }

    .section-container .carousel-slide .text-lg.font-semibold {
        font-size: 14px !important;
        padding: 12px 16px !important;
    }

    /* 分页控制器位置调整 */
    .section-container .paginate {
        left: auto !important;
        right: 0 !important;
        bottom: 0 !important;
    }

    /* 右侧新闻列表区域 */
    .section-container .h-\[583px\].w-\[490px\] {
        width: 100% !important;
        height: auto !important;
        margin-top: 16px;
    }

    .section-container .h-\[583px\].w-\[490px\] .h-\[102px\].w-\[450px\] {
        width: 100% !important;
        height: auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 10px 0;
    }

    .section-container .h-\[583px\].w-\[490px\] .h-\[102px\].w-\[450px\] > .flex {
        width: 100% !important;
    }

    .section-container .h-\[583px\].w-\[490px\] img.w-\[158px\].h-\[90px\] {
        width: 120px !important;
        height: 72px !important;
    }

    .section-container .h-\[583px\].w-\[490px\] .w-\[272px\].h-\[90px\] {
        width: calc(100% - 130px) !important;
        height: auto !important;
    }

    .section-container .h-\[583px\].w-\[490px\] h3.text-\[16px\] {
        font-size: 14px !important;
        margin-top: 0 !important;
        line-height: 1.4;
    }

    /* 底部背景装饰 */
    .section-container .empty-bg {
        height: 150px !important;
    }

    /* ================= 通知公告模块移动端适配 ================= */

    /* 外层容器内边距 */
    .py-12.bg-\[\#E5F5FD\] > .container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* 两列网格改为单列，减小间距 */
    .py-12.bg-\[\#E5F5FD\] .grid.grid-cols-1.lg\:grid-cols-2 {
        gap: 32px !important;
    }

    /* 通知公告标题字号 */
    .py-12.bg-\[\#E5F5FD\] .grid > div:first-child .text-\[36px\].font-bold {
        font-size: 24px !important;
    }

    /* 背景英文装饰文字 */
    .py-12.bg-\[\#E5F5FD\] .grid > div:first-child .font-thin.absolute.bottom-\[-12px\] {
        font-size: 20px !important;
        bottom: -18px !important;
        letter-spacing: 2px !important;
    }

    /* 查看更多定位调整 */
    .py-12.bg-\[\#E5F5FD\] .grid > div:first-child .absolute.right-0.bottom-0 {
        position: static !important;
        justify-content: flex-end !important;
        margin-top: 8px;
        display: flex;
    }

    /* 列表条目宽度自适应 */
    .py-12.bg-\[\#E5F5FD\] .grid > div:first-child .w-\[571px\].h-\[74px\] {
        width: 100% !important;
        height: auto !important;
        margin-bottom: 16px !important;
        padding-bottom: 12px !important;
    }

    .py-12.bg-\[\#E5F5FD\] .grid > div:first-child h3.text-\[18px\] {
        font-size: 15px !important;
    }

    /* ================= 学术活动模块移动端适配 ================= */

    /* 顶部标题 + tab 链接区域：允许换行 */
    .academic-activities > .flex:first-of-type {
        flex-direction: column !important;
        gap: 12px !important;
    }

    /* 标题字号 */
    .academic-activities .text-\[36px\].font-bold {
        font-size: 24px !important;
    }

    /* 背景英文装饰文字 */
    .academic-activities .font-thin.absolute.bottom-\[-12px\] {
        font-size: 20px !important;
        bottom: -18px !important;
        letter-spacing: 2px !important;
    }

    /* Tab 链接换行与间距 */
    .academic-activities .flex.space-x-2.mb-6 {
        flex-wrap: wrap !important;
        gap: 8px !important;
        margin-bottom: 16px !important;
    }

    .academic-activities .tab-link {
        font-size: 15px !important;
    }

    /* 内容区域改为垂直堆叠 */
    .academic-activities > .flex:nth-of-type(2) {
        flex-direction: column !important;
    }

    /* 左侧内容区宽度自适应 */
    .academic-activities .tab-content .w-\[446px\].h-\[452px\] {
        width: 100% !important;
        height: auto !important;
    }

    /* 右侧内容区宽度自适应 */
    .academic-activities .w-\[354px\].h-\[452px\] {
        width: 100% !important;
        height: auto !important;
        margin-top: 16px;
    }

    .academic-activities .w-\[354px\] img.w-\[354px\].h-\[240px\] {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 354 / 240;
    }

    .academic-activities .h-\[212px\].bg-white {
        height: auto !important;
    }

    .academic-activities .text-\[17px\].mb-10 {
        font-size: 15px !important;
        margin-bottom: 16px !important;
    }

    /* 移动端隐藏学术活动图片 */
    .academic-activities .cover {
        display: none !important;
    }

    .academic-activities .h-\[212px\].bg-white img {
        display: none !important;
    }

    /* ================= 科研成果模块移动端适配 ================= */
    section.h-\[856px\] {
        height: auto !important;
        min-height: auto !important;
        padding-top: 40px !important;
        padding-bottom: 40px !important;
    }

    section.h-\[856px\] .text-center h2.text-\[36px\] {
        font-size: 24px !important;
    }

    section.h-\[856px\] .text-center > p.font-thin {
        font-size: 20px !important;
        margin-top: -22px !important;
    }

    #certify {
        padding: 20px 16px !important;
    }

    #certify .swiper-container {
        padding-bottom: 40px !important;
    }

    #certify .swiper-slide {
        width: 90% !important;
        max-width: 340px !important;
        height: auto !important;
        aspect-ratio: 734 / 425 !important;
    }

    #certify .custom-prev,
    #certify .custom-next {
        width: 36px !important;
        height: 36px !important;
    }

    #certify .custom-prev {
        left: 4px !important;
    }

    #certify .custom-next {
        right: 4px !important;
    }

    #certify .text-container {
        height: auto !important;
        padding: 0 8px;
    }

    #certify .text-item {
        font-size: 15px !important;
    }

    #certify .text-item p.font-\[bold\].text-\[19px\] {
        font-size: 16px !important;
    }

    #certify .text-item .text-\[16px\] {
        font-size: 14px !important;
        margin-top: 12px !important;
    }

    /* ================= Footer 移动端适配 ================= */
    footer > .container > .flex {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 20px;
    }

    footer > .container > .flex > div:first-child img {
        width: 100% !important;
        max-width: 280px !important;
        height: auto !important;
    }

    /* 隐藏 PC 端垂直分隔线 */
    footer > .container > .flex > div[style*="width: 1px"] {
        display: none !important;
    }

    footer > .container > .flex > .flex.flex-col {
        margin: 0 !important;
        width: 100%;
    }

    footer > .container > .flex > .flex.flex-col h4 {
        font-size: 16px;
    }

    footer > .container > .flex > .flex.flex-col .flex.items-center {
        align-items: flex-start !important;
    }

    footer > .container > .flex > .flex.flex-col span {
        font-size: 13px;
        line-height: 1.6;
    }

    footer .text-center p {
        font-size: 12px;
        padding: 0 16px;
    }
}
