/* ============================================================
   闽西职业技术学院汀州校区 - 响应式优化样式表
   ============================================================
   功能：优化移动端体验、汉堡菜单、触摸友好交互
   版本：v1.0（2026优化版）
   ============================================================ */

/* ==================== 移动端汉堡菜单 ==================== */
@media (max-width: 900px) {
    .header-container {
        padding: 0 16px;
    }
    
    /* 汉堡菜单按钮 */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        margin-right: 12px;
    }
    
    .mobile-menu-btn span {
        display: block;
        width: 24px;
        height: 2px;
        background: var(--text-primary);
        position: relative;
        transition: var(--transition);
    }
    
    .mobile-menu-btn span::before,
    .mobile-menu-btn span::after {
        content: '';
        display: block;
        width: 24px;
        height: 2px;
        background: var(--text-primary);
        position: absolute;
        left: 0;
        transition: var(--transition);
    }
    
    .mobile-menu-btn span::before {
        top: -7px;
    }
    
    .mobile-menu-btn span::after {
        bottom: -7px;
    }
    
    /* 汉堡菜单激活状态 */
    .mobile-menu-btn.active span {
        background: transparent;
    }
    
    .mobile-menu-btn.active span::before {
        top: 0;
        transform: rotate(45deg);
    }
    
    .mobile-menu-btn.active span::after {
        bottom: 0;
        transform: rotate(-45deg);
    }
    
    /* 移动端导航菜单 */
    .main-nav {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        background: #fff;
        box-shadow: var(--shadow-xl);
        flex-direction: column;
        padding: 80px 0 20px;
        transition: left 0.3s ease;
        z-index: 1200;
        overflow-y: auto;
    }
    
    .main-nav.active {
        left: 0;
    }
    
    .main-nav > ul {
        display: none;
    }
    
    .main-nav .mobile-nav {
        display: flex;
        flex-direction: column;
    }
    
    .main-nav .mobile-nav a {
        padding: 14px 24px;
        font-size: 15px;
        border-bottom: 1px solid var(--border-light);
        width: 100%;
        display: flex;
        align-items: center;
        gap: 10px;
        color: var(--text-primary);
        text-decoration: none;
        transition: var(--transition);
    }
    
    .main-nav .mobile-nav a:last-child {
        border-bottom: none;
    }
    
    .main-nav .mobile-nav a:hover,
    .main-nav .mobile-nav a.active {
        background: var(--primary-bg);
        color: var(--primary);
    }
    
    /* 移动端菜单遮罩 */
    .mobile-nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1199;
    }
    
    .mobile-nav-overlay.active {
        display: block;
    }
}

/* ==================== 触摸友好的按钮和链接 ==================== */
@media (max-width: 900px) {
    /* 增大触摸目标尺寸 */
    button,
    .btn,
    input[type="submit"],
    input[type="button"],
    a {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 表单元素优化 */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important; /* 防止iOS缩放 */
        padding: 12px 14px;
    }
    
    /* 按钮优化 */
    .btn,
    button {
        padding: 12px 24px;
        font-size: 15px;
    }
    
    /* 卡片触摸优化 */
    .card,
    .news-card,
    .notice-card {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
    }
    
    .card:active,
    .news-card:active,
    .notice-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* ==================== 移动端首页优化 ==================== */
@media (max-width: 900px) {
    /* Hero区域优化 */
    .hero {
        height: 60vh;
        min-height: 400px;
    }
    
    .hero-content h1 {
        font-size: 28px;
    }
    
    .hero-content p {
        font-size: 15px;
    }
    
    /* 数据概览优化 */
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-item {
        padding: 16px 12px;
    }
    
    .stat-item .num {
        font-size: 28px;
    }
    
    /* 卡片布局优化 */
    .news-grid,
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* 视频展示区优化 */
    .video-showcase-inner {
        flex-direction: column;
    }
    
    .video-player-wrap {
        width: 100%;
        margin-bottom: 20px;
    }
    
    .video-info {
        width: 100%;
        padding: 0 10px;
    }
}

/* ==================== 移动端表格优化 ==================== */
@media (max-width: 768px) {
    /* 表格横向滚动 */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 卡片式表格（可选） */
    .table-responsive-card {
        border: none;
        background: none;
    }
    
    .table-responsive-card thead {
        display: none;
    }
    
    .table-responsive-card tbody tr {
        display: block;
        background: #fff;
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        margin-bottom: 12px;
        padding: 16px;
    }
    
    .table-responsive-card tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border: none;
        border-bottom: 1px solid var(--border-light);
    }
    
    .table-responsive-card tbody td:last-child {
        border-bottom: none;
    }
    
    .table-responsive-card tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        margin-right: 12px;
        flex-shrink: 0;
    }
}

/* ==================== 移动端表单优化 ==================== */
@media (max-width: 768px) {
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-label {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .form-input,
    .form-textarea,
    .form-select {
        padding: 12px 14px;
        font-size: 15px;
    }
    
    /* 表单按钮组 */
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

/* ==================== 移动端后台管理优化 ==================== */
@media (max-width: 900px) {
    /* 后台侧边栏优化 */
    .admin-sidebar {
        position: fixed;
        left: -260px;
        width: 260px;
        height: 100vh;
        z-index: 1300;
        transition: left 0.3s ease;
    }
    
    .admin-sidebar.open {
        left: 0;
    }
    
    .admin-main {
        margin-left: 0;
        padding: 16px;
    }
    
    /* 后台移动端菜单切换按钮 */
    .admin-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: none;
        border: none;
        cursor: pointer;
        font-size: 20px;
        color: var(--text-primary);
    }
}

/* ==================== 移动端导航附加样式 ==================== */
@media (max-width: 900px) {
    /* 移动端导航头部（LOGO + 标题） */
    .mobile-nav-header {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 16px 24px;
        border-bottom: 1px solid var(--border-light);
        margin-bottom: 8px;
    }

    .mobile-nav-logo {
        width: 40px;
        height: auto;
    }

    .mobile-nav-title {
        font-size: 15px;
        font-weight: 600;
        color: var(--text-primary);
    }

    /* 确保桌面端菜单在移动端隐藏 */
    .main-nav > ul {
        display: none;
    }

    /* 移动端菜单中的图标颜色 */
    .main-nav .mobile-nav a i {
        width: 20px;
        text-align: center;
        color: var(--primary);
    }

    /* 搜索框在移动端优化 */
    .header-search {
        display: none;
    }

    .header-search.mobile-show {
        display: flex;
        padding: 12px 16px;
        border-bottom: 1px solid var(--border-light);
    }
}

/* ==================== 打印样式优化 ==================== */
@media print {
    .header,
    .footer,
    .main-nav,
    .sidebar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content,
    .admin-main {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }
}

/* ==================== 暗色模式支持（可选） ==================== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1a1a2e;
        --bg-card: #22223a;
        --text-primary: #e0e0e0;
        --text-secondary: #a0a0b0;
        --border: #333355;
        --border-light: #2a2a45;
    }
    
    .header,
    .footer,
    .card,
    .admin-sidebar {
        background: var(--bg-card);
    }
}

/* ==================== 减少动画（无障碍） ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==================== 高对比度模式 ==================== */
@media (prefers-contrast: high) {
    :root {
        --primary: #0000ff;
        --text-primary: #000;
        --text-secondary: #333;
        --border: #000;
    }
    
    .btn,
    button {
        border: 2px solid currentColor;
    }
}
