/* 移动端优化样式 - Mobile Optimization Styles */

/* 基础移动端设置 */
@media screen and (max-width: 768px) {
    /* 防止横向滚动 */
    html, body {
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    /* 改进触摸目标大小 */
    button, .btn, a, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 优化容器布局 */
    .container {
        padding: 0 16px;
        max-width: 100%;
    }
    
    /* 头部区域优化 */
    .header {
        padding: 8px 0;
        background: var(--white);
        border-bottom: 1px solid var(--border-color);
        position: sticky !important;
        top: 0 !important;
        z-index: 1002 !important;
        transition: all 0.3s ease !important;
        backdrop-filter: blur(10px) !important;
        background-color: rgba(255, 255, 255, 0.95) !important;
    }
    
    .header .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 56px;
        flex-wrap: nowrap;
    }
    
    /* Logo 优化 */
    .logo {
        flex-shrink: 0;
        margin-right: 12px;
    }
    
    .logo-img {
        height: 40px;
        max-width: 200px;
        width: auto;
    }
    
    /* 汉堡菜单优化 */
    .navbar-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 44px;
        height: 44px;
        background: none;
        border: none;
        padding: 8px;
        cursor: pointer;
        z-index: 1002;
        position: relative;
        transition: all 0.3s ease;
        border-radius: 8px;
    }
    
    .navbar-toggle:hover {
        background-color: var(--light-purple);
    }
    
    .navbar-toggle:active {
        transform: scale(0.95);
    }
    
    .navbar-toggle .icon-bar {
        display: block;
        width: 22px;
        height: 2px;
        background: var(--text-primary);
        border-radius: 1px;
        transition: all 0.3s ease;
        margin: 2px 0;
    }
    
    /* 搜索区域移动端优化 */
    .search {
        display: none; /* 在移动端头部隐藏，添加到菜单中 */
    }
    
    /* 移动端导航菜单 */
    .nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 300px;
        height: 100vh;
        background: var(--white);
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        transition: left 0.3s ease;
        z-index: 1001;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 移动端滚动时的header效果 */
    .header.scrolled {
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15) !important;
        background-color: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(15px) !important;
    }
    
    .nav.active {
        left: 0;
    }
    
    .nav .container {
        padding: 0;
        max-width: none;
    }
    
    .daohang {
        flex-direction: column;
        padding: 80px 0 20px 0;
        margin: 0;
        list-style: none;
    }
    
    .daohang > li {
        width: 100%;
        border-bottom: 1px solid var(--gray-200);
    }
    
    .daohang > li > a {
        display: block;
        padding: 16px 20px;
        color: var(--text-primary);
        text-decoration: none;
        font-weight: 500;
        font-size: 16px;
        transition: all 0.3s ease;
        position: relative;
    }
    
    .daohang > li > a:hover,
    .daohang > li > a.active {
        background: var(--light-purple);
        color: var(--primary-color);
    }
    
    /* 子菜单优化 */
    .nav_item {
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none !important;
        background: var(--gray-100) !important;
        margin: 0 !important;
        border-radius: 0 !important;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        /* 移动端完全隐藏子菜单 */
        display: none !important;
    }
    
    .daohang > li:hover .nav_item,
    .daohang > li.active .nav_item {
        max-height: 300px;
        /* 移动端不显示子菜单 */
        display: none !important;
    }
    
    .nav_item li a {
        padding: 12px 20px 12px 40px;
        font-size: 14px;
        color: var(--text-secondary);
        border-bottom: 1px solid var(--gray-300);
    }
    
    .nav_item li a:hover {
        background: var(--white);
        color: var(--primary-color);
    }
    
    /* 移动端搜索框（在菜单内） */
    .mobile-search {
        padding: 20px;
        border-bottom: 1px solid var(--gray-200);
        background: var(--gray-100);
    }
    
    .mobile-search .search-container {
        display: flex;
        align-items: center;
        background: var(--white);
        border-radius: 8px;
        border: 2px solid var(--gray-300);
        overflow: hidden;
    }
    
    .mobile-search .search-input {
        flex: 1;
        border: none;
        padding: 12px 16px;
        font-size: 16px;
        outline: none;
    }
    
    .mobile-search .search-button {
        background: var(--primary-color);
        color: var(--white);
        border: none;
        padding: 12px 16px;
        cursor: pointer;
        font-size: 16px;
    }
    
    /* 语言切换器移动端优化 */
    .mobile-language-switcher {
        padding: 20px;
        border-bottom: 1px solid var(--gray-200);
        text-align: center;
    }
    
    .mobile-language-switcher .lang-btn {
        margin: 0 8px;
        padding: 8px 16px;
        border: 2px solid var(--gray-300);
        background: var(--white);
        color: var(--text-primary);
        border-radius: 20px;
        font-size: 14px;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .mobile-language-switcher .lang-btn.active {
        background: var(--primary-color);
        color: var(--white);
        border-color: var(--primary-color);
    }
    
    /* 遮罩层 */
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* 页面横幅优化 */
    .page-banner {
        padding: 40px 0;
        min-height: auto;
    }
    
    .page-banner h1 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 12px;
    }
    
    .page-banner p {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    /* 轮播图移动端优化 */
    .banner {
        height: 300px;
    }
    
    .slide-caption {
        padding: 20px 16px;
        bottom: 0;
        background: linear-gradient(transparent, rgba(0,0,0,0.7));
    }
    
    .slide-caption h3 {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }
    
    .slide-caption p {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    .slider-nav {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .slider-nav.prev {
        left: 16px;
    }
    
    .slider-nav.next {
        right: 16px;
    }
    
    .slider-dots {
        bottom: 16px;
    }
    
    /* 卡片布局优化 */
    .news-featured,
    .research-rec,
    .group-rec {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .member-grid,
    .stats-cards,
    .equipment-grid,
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* 表单优化 */
    .filter-controls {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .search-input,
    .year-filter,
    input, select, textarea {
        padding: 12px 16px;
        font-size: 16px; /* 防止iOS缩放 */
        border-radius: 8px;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* 按钮优化 */
    .btn,
    button {
        padding: 12px 24px;
        font-size: 16px;
        border-radius: 8px;
        min-height: 44px;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    /* 文本内容优化 */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    h5 { font-size: 1.125rem; }
    h6 { font-size: 1rem; }
    
    p, li {
        font-size: 1rem;
        line-height: 1.6;
        margin-bottom: 16px;
    }
    
    /* 图片响应式 */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* 表格响应式 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
    
    /* 时间轴优化 */
    .timeline-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    
    .timeline-date {
        margin-bottom: 12px;
        order: -1;
    }
    
    /* 联系信息优化 */
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .contact-card {
        padding: 20px;
        text-align: center;
    }
    
    /* 底部优化 */
    .footer {
        padding: 40px 0 20px;
    }
    
    .footer-link ul {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .footer-copyright {
        text-align: center;
        margin-top: 20px;
    }
    
    .footer-copyright p {
        margin-bottom: 8px;
        font-size: 0.875rem;
    }
    
    /* 移动端ICP备案号样式 */
    .icp-beian {
        margin-top: 20px !important;
        padding-top: 16px;
        border-top: 1px solid var(--border-color);
        text-align: center;
    }
    
    .icp-beian a {
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 0.8rem;
        transition: color 0.2s ease;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 8px 12px;
        border-radius: 6px;
        background: rgba(107, 58, 160, 0.05);
        border: 1px solid rgba(107, 58, 160, 0.1);
    }
    
    .icp-beian a:hover {
        color: var(--primary-color);
        background: rgba(107, 58, 160, 0.1);
        border-color: rgba(107, 58, 160, 0.2);
    }
    
    .icp-beian a::before {
        content: "🔗";
        font-size: 0.7rem;
    }
    
    /* 返回顶部按钮优化 */
    .back-to-top {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
        font-size: 1.25rem;
    }

    /* 新闻动态板块移动端优化 */
    .news {
        margin-bottom: 40px;
    }
    
    /* 特色新闻移动端优化 */
    .news-featured {
        background: var(--white);
        border-radius: 16px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
        border: 1px solid var(--border-color);
        margin-bottom: 24px;
        overflow: hidden;
        transition: all 0.3s ease;
    }
    
    .news-featured:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
        border-color: var(--primary-light);
    }
    
    .news-featured .news-img {
        position: relative;
        overflow: hidden;
        height: 200px;
    }
    
    .news-featured .news-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }
    
    .news-featured:hover .news-img img {
        transform: scale(1.05);
    }
    
    .news-featured .news-text {
        padding: 18px 20px;
    }
    
    .news-featured .news-text h3 {
        font-size: 1.15rem;
        color: var(--text-primary);
        margin-bottom: 10px;
        line-height: 1.4;
        font-weight: 600;
        word-break: break-word;
    }
    
    .news-featured .news-text p {
        font-size: 0.9rem;
        color: var(--text-secondary);
        line-height: 1.5;
        margin: 0;
        word-break: break-word;
        -webkit-line-clamp: 3;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    /* 特色新闻日期样式优化 */
    .news-featured .date-boxs {
        position: absolute;
        top: 12px;
        left: 12px;
        z-index: 2;
    }
    
    .news-featured .date-box {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border-radius: 12px;
        padding: 8px 12px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .news-featured .date-text p {
        color: var(--primary-color);
        font-weight: 700;
        font-size: 0.875rem;
        margin: 0;
        line-height: 1.2;
    }
    
    .news-featured .date-text h6 {
        color: var(--text-secondary);
        font-size: 0.75rem;
        margin: 2px 0 0 0;
        font-weight: 500;
        line-height: 1.2;
    }
    
    /* 新闻列表移动端样式修复 */
    .news-list {
        padding: 0;
        margin: 0;
    }
    
    .news-list li {
        background: var(--white);
        margin-bottom: 12px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        transition: all 0.3s ease;
        border: 1px solid var(--border-color);
        overflow: hidden;
    }
    
    .news-list li:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        border-color: var(--primary-light);
    }
    
    /* 新闻内容容器样式 */
    .news-list .news-content {
        display: flex;
        flex-direction: column;
        padding: 16px 18px;
        min-height: 100px;
        position: relative;
    }
    
    /* 文本内容区域 */
    .news-list .text {
        flex: 1;
        margin-bottom: 12px;
        padding-right: 0;
    }
    
    .news-list .text h4 {
        color: var(--text-primary);
        font-size: 1.05rem;
        margin-bottom: 8px;
        font-weight: 600;
        line-height: 1.4;
        word-break: break-word;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .news-list .text p {
        color: var(--text-secondary);
        font-size: 0.875rem;
        line-height: 1.5;
        margin: 0;
        word-break: break-word;
        -webkit-line-clamp: 3;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    /* 时间显示样式 */
    .news-list .time {
        color: var(--primary-color);
        font-weight: 600;
        font-size: 0.8rem;
        text-align: right;
        align-self: flex-end;
        background: var(--light-purple);
        padding: 4px 10px;
        border-radius: 16px;
        white-space: nowrap;
        margin-top: auto;
        border: 1px solid rgba(107, 58, 160, 0.2);
    }
    
    /* 新闻卡片动画入场效果 */
    .news-list li.animate-in {
        opacity: 0;
        transform: translateY(20px);
        animation: slideInUp 0.6s ease-out forwards;
    }
    
    .news-list li:nth-child(1).animate-in { animation-delay: 0.1s; }
    .news-list li:nth-child(2).animate-in { animation-delay: 0.2s; }
    .news-list li:nth-child(3).animate-in { animation-delay: 0.3s; }
    .news-list li:nth-child(4).animate-in { animation-delay: 0.4s; }
    
    @keyframes slideInUp {
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* 新闻标题优化 */
    .index-title {
        margin-bottom: 24px;
        padding: 0 4px;
    }
    
    .index-title h3 {
        font-size: 1.4rem;
        color: var(--text-primary);
        margin-bottom: 8px;
    }
    
    .index-title .more {
        font-size: 0.875rem;
        color: var(--primary-color);
        text-decoration: none;
        font-weight: 500;
    }
}

/* 超小屏幕优化 */
@media screen and (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .logo-img {
        height: 36px;
        max-width: 160px;
    }
    
    .nav {
        width: 280px;
    }
    
    .page-banner {
        padding: 30px 0;
    }
    
    .page-banner h1 {
        font-size: 1.75rem;
    }
    
    .banner {
        height: 250px;
    }
    
    .slide-caption h3 {
        font-size: 1.25rem;
    }
    
    .slide-caption p {
        font-size: 0.875rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .stats-value {
        font-size: 1.5rem;
    }
    
    .member-card,
    .position-card,
    .achievement-item {
        padding: 16px;
    }
    
    /* 超小屏幕新闻列表优化 */
    .news-list .news-content {
        padding: 14px 16px;
        min-height: 90px;
    }
    
    .news-list .text h4 {
        font-size: 1rem;
        margin-bottom: 6px;
        line-height: 1.3;
    }
    
    .news-list .text p {
        font-size: 0.8rem;
        line-height: 1.4;
        -webkit-line-clamp: 2;
    }
    
    .news-list .time {
        font-size: 0.75rem;
        padding: 3px 8px;
        border-radius: 12px;
    }
    
    /* 超小屏幕特色新闻优化 */
    .news-featured .news-img {
        height: 180px;
    }
    
    .news-featured .news-text {
        padding: 16px 18px;
    }
    
    .news-featured .news-text h3 {
        font-size: 1.05rem;
        margin-bottom: 8px;
    }
    
    .news-featured .news-text p {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }
    
    .news-featured .date-box {
        padding: 6px 10px;
    }
    
    .news-featured .date-text p {
        font-size: 0.8rem;
    }
    
    .news-featured .date-text h6 {
        font-size: 0.7rem;
    }
    
    .index-title h3 {
        font-size: 1.25rem;
    }
    
    .index-title .more {
        font-size: 0.8rem;
    }
}

/* 触摸设备特殊优化 */
@media (hover: none) and (pointer: coarse) {
    /* 为触摸设备优化悬停效果 */
    .member-card:hover,
    .position-card:hover,
    .achievement-item:hover {
        transform: none;
        box-shadow: var(--shadow-md);
    }
    
    /* 优化点击反馈 */
    button:active,
    .btn:active,
    a:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* 移动端导航按钮触摸优化 */
    .navbar-toggle {
        min-height: 44px;
        min-width: 44px;
    }
    
    .navbar-toggle:active {
        background-color: var(--primary-color);
        color: var(--white);
    }
    
    /* 确保移动端header在触摸时有足够的触摸区域 */
    .header {
        min-height: 60px;
    }
    
    .header .container {
        min-height: 60px;
    }
}

/* 高分辨率显示器优化 */
@media screen and (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
    /* 为高分辨率屏幕提供清晰的边框和阴影 */
    .member-card,
    .position-card,
    .achievement-item {
        border: 0.5px solid var(--border-color);
    }
} 