/**
 * 潮商黄页 · 移动端苹果科技风格
 * Apple-style Mobile UI for teochew.com.cn
 * 适配 iPhone / Android 手机浏览器
 */

/* ============================================================
   1. 全局字体 & 重置
   ============================================================ */
@media (max-width: 768px) {
    body {
        font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
                     "Noto Sans SC", "PingFang SC", "Hiragino Sans GB",
                     "Microsoft YaHei", sans-serif !important;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        background: #f2f2f7 !important; /* iOS 系统灰背景 */
    }

    /* 修复固定头部遮挡 —— 隐藏顶部公告栏，只保留主导航 */
    .header-bar { display: none !important; }
    .header-main { padding: 0 12px !important; height: 54px !important; min-height: 54px !important; }
    .header { height: 54px !important; overflow: hidden !important; }

    /* 关键：覆盖 style.css 中的 margin-top，改用 padding-top 与头部高度一致 */
    .main {
        margin-top: 0 !important;
        padding-top: 54px !important;
    }
    .m-page {
        padding-top: 54px !important;
        background: #f2f2f7 !important;
    }

    /* 社团等列表页：手机端有自己的 .m-header，隐藏主 .header，避免双重头部 */
    body:has(.m-page > .m-header) .header { display: none !important; }
    body:has(.m-page > .m-header) .m-page { padding-top: 0 !important; }
}


/* ============================================================
   2. 头部 —— 毛玻璃 Apple 风格
   ============================================================ */
@media (max-width: 768px) {
    .header {
        background: rgba(29, 78, 216, 0.92) !important;
        backdrop-filter: saturate(180%) blur(20px) !important;
        -webkit-backdrop-filter: saturate(180%) blur(20px) !important;
        box-shadow: 0 0.5px 0 rgba(255,255,255,0.15), 0 2px 12px rgba(0,0,0,0.18) !important;
    }

    .header-bar {
        font-size: 11px !important;
        letter-spacing: 0.3px !important;
    }

    /* 导航菜单隐藏，只留logo + 按钮 */
    .nav-menu { display: none !important; }

    .header-actions .btn-outline { display: none !important; }

    /* 登录按钮苹果胶囊样式 */
    .header-actions .btn-blue {
        padding: 6px 16px !important;
        font-size: 13px !important;
        border-radius: 20px !important;
        font-weight: 600 !important;
        letter-spacing: 0 !important;
        min-height: 32px !important;
        line-height: 1.2 !important;
    }

    /* 汉堡菜单按钮放大触摸区域 */
    .mobile-menu-btn {
        width: 40px !important;
        height: 40px !important;
        font-size: 20px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 10px !important;
        background: rgba(255,255,255,0.15) !important;
    }

    /* Logo 恢复正常尺寸 */
    .logo { height: 44px !important; display: flex !important; align-items: center !important; flex-shrink: 0 !important; }
    .logo-emblem { width: auto !important; height: 44px !important; display: flex !important; align-items: center !important; flex-shrink: 0 !important; }
    .logo-emblem img {
        height: 40px !important;
        width: auto !important;
        min-width: 40px !important;
        max-width: 160px !important;
        object-fit: contain !important;
        display: block !important;
    }
    .logo-text { font-size: 17px !important; font-weight: 700 !important; }
}


/* ============================================================
   3. 移动端首页（.m-page）苹果风格优化
   ============================================================ */
@media (max-width: 768px) {

    /* 搜索栏 */
    .m-search-bar {
        position: sticky;
        top: 0;
        z-index: 100;
        padding: 10px 16px !important;
        background: rgba(242, 242, 247, 0.94) !important;
        backdrop-filter: blur(16px) !important;
        -webkit-backdrop-filter: blur(16px) !important;
        border-bottom: 0.5px solid rgba(0,0,0,0.08) !important;
    }

    .m-search-box {
        background: rgba(116, 116, 128, 0.12) !important;
        border-radius: 10px !important;
        padding: 0 12px !important;
        height: 36px !important;
    }

    .m-search-box input {
        font-size: 15px !important;
        letter-spacing: -0.1px !important;
    }

    /* 快捷分类区 */
    .m-category-section {
        background: #fff !important;
        border-radius: 16px !important;
        margin: 0 12px 12px !important;
        padding: 16px 8px !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 0 0 0.5px rgba(0,0,0,0.04) !important;
    }

    /* 一行4个图标 */
    .m-category-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 16px 0 !important;
    }

    .m-category-icon {
        width: 50px !important;
        height: 50px !important;
        border-radius: 14px !important;
        transition: transform 0.12s ease !important;
    }

    .m-category-item:active .m-category-icon {
        transform: scale(0.90) !important;
    }

    .m-category-label {
        font-size: 11px !important;
        color: #3c3c43 !important;
        font-weight: 400 !important;
    }

    /* 统计条 */
    .m-stats-bar {
        background: #fff !important;
        border-radius: 16px !important;
        margin: 0 12px 12px !important;
        overflow: hidden !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 0 0 0.5px rgba(0,0,0,0.04) !important;
    }

    .m-stat-item {
        padding: 14px 0 12px !important;
        border-right: 0.5px solid rgba(60,60,67,0.1) !important;
    }

    .m-stat-num {
        font-size: 22px !important;
        font-weight: 700 !important;
        letter-spacing: -0.5px !important;
        color: #007aff !important;  /* Apple Blue */
    }

    .m-stat-label {
        font-size: 11px !important;
        color: #8e8e93 !important;
        margin-top: 3px !important;
    }

    /* 区块标题 */
    .m-section-header {
        padding: 18px 16px 10px !important;
    }

    .m-section-title {
        font-size: 17px !important;
        font-weight: 700 !important;
        color: #1c1c1e !important;
        letter-spacing: -0.3px !important;
    }

    .m-section-title::before {
        width: 3px !important;
        height: 17px !important;
        background: #007aff !important;
        border-radius: 2px !important;
    }

    .m-section-more {
        font-size: 13px !important;
        color: #007aff !important;
        font-weight: 400 !important;
        display: flex !important;
        align-items: center !important;
        gap: 2px !important;
    }


    /* ---- 社团横向卡片（仅首页横向滚动容器内生效）---- */
    .m-assoc-scroll {
        padding: 0 12px 16px !important;
        gap: 10px !important;
    }

    /* 首页横向滚动中的社团卡片：固定宽度 */
    .m-assoc-scroll .m-assoc-card {
        min-width: 140px !important;
        max-width: 140px !important;
        border-radius: 16px !important;
        padding: 14px 12px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 0 0 0.5px rgba(0,0,0,0.04) !important;
        background: #fff !important;
        transition: transform 0.12s ease !important;
    }

    .m-assoc-scroll .m-assoc-card:active { transform: scale(0.97) !important; }

    .m-assoc-card-logo {
        width: 52px !important; height: 52px !important;
        border-radius: 14px !important;
        background: linear-gradient(140deg, #007aff, #5ac8fa) !important;
        box-shadow: 0 4px 10px rgba(0,122,255,0.25) !important;
    }

    .m-assoc-card-name {
        font-size: 13px !important;
        font-weight: 600 !important;
        color: #1c1c1e !important;
        margin-top: 10px !important;
    }

    .m-assoc-card-tag {
        font-size: 11px !important;
        color: #007aff !important;
        background: rgba(0,122,255,0.1) !important;
        padding: 2px 8px !important;
        border-radius: 6px !important;
        margin-top: 6px !important;
        display: inline-block !important;
    }

    .m-assoc-card-region {
        font-size: 11px !important;
        color: #8e8e93 !important;
    }


    /* ---- 企业列表 ---- */
    .m-company-list {
        padding: 0 12px 8px !important;
    }

    .m-company-item {
        border-radius: 14px !important;
        padding: 14px !important;
        margin-bottom: 8px !important;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 0.5px rgba(0,0,0,0.04) !important;
        background: #fff !important;
        transition: transform 0.12s ease !important;
    }

    .m-company-item:active { transform: scale(0.98) !important; }

    .m-company-logo {
        width: 46px !important; height: 46px !important;
        border-radius: 12px !important;
        background: linear-gradient(140deg, #ff6b35, #ff9f40) !important;
        box-shadow: 0 3px 8px rgba(255,107,53,0.25) !important;
    }

    .m-company-name {
        font-size: 15px !important;
        font-weight: 600 !important;
        color: #1c1c1e !important;
    }

    .m-company-meta {
        font-size: 12px !important;
        color: #8e8e93 !important;
        gap: 10px !important;
    }


    /* ---- 供需信息 ---- */
    .m-board-tabs {
        padding: 0 12px !important;
        margin-bottom: 10px !important;
        gap: 0 !important;
        background: #fff !important;
        border-radius: 12px !important;
        margin-left: 12px !important;
        margin-right: 12px !important;
        overflow: hidden !important;
        box-shadow: 0 0 0 0.5px rgba(0,0,0,0.06) !important;
    }

    .m-board-tab {
        padding: 10px 0 !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        color: #8e8e93 !important;
        background: transparent !important;
        border-bottom: 2px solid transparent !important;
        transition: color 0.15s, border-color 0.15s !important;
    }

    .m-board-tab.active {
        color: #007aff !important;
        border-bottom-color: #007aff !important;
        font-weight: 600 !important;
    }

    .m-board-list {
        padding: 0 12px 8px !important;
    }

    /* 修复供需卡片左侧白块 —— 隔离全局 board-card 样式 */
    .m-board-item {
        display: block !important;
        background: #fff !important;
        border-radius: 14px !important;
        padding: 14px !important;
        margin-bottom: 8px !important;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 0.5px rgba(0,0,0,0.04) !important;
        text-decoration: none !important;
        color: inherit !important;
        /* 覆盖任何 card/board 全局样式 */
        border: none !important;
        position: relative !important;
        overflow: hidden !important;
        transition: transform 0.12s ease !important;
    }

    /* 取消全局 board-card 可能加的伪元素覆盖 */
    .m-board-item::before,
    .m-board-item::after {
        display: none !important;
        content: none !important;
    }

    .m-board-item:active { transform: scale(0.98) !important; }

    .m-board-item-header {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        margin-bottom: 8px !important;
    }

    .m-board-item-title {
        font-size: 15px !important;
        font-weight: 600 !important;
        color: #1c1c1e !important;
        flex: 1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .m-board-tag-supply {
        font-size: 11px !important;
        color: #007aff !important;
        background: rgba(0,122,255,0.1) !important;
        padding: 3px 9px !important;
        border-radius: 6px !important;
        font-weight: 500 !important;
        white-space: nowrap !important;
    }

    .m-board-tag-demand {
        font-size: 11px !important;
        color: #ff3b30 !important;
        background: rgba(255,59,48,0.1) !important;
        padding: 3px 9px !important;
        border-radius: 6px !important;
        font-weight: 500 !important;
        white-space: nowrap !important;
    }

    .m-board-item-meta {
        font-size: 12px !important;
        color: #8e8e93 !important;
        display: flex !important;
        justify-content: space-between !important;
    }


    /* ---- 招聘列表 ---- */
    .m-job-list {
        padding: 0 12px 8px !important;
    }

    .m-job-item {
        display: block !important;
        background: #fff !important;
        border-radius: 14px !important;
        padding: 14px !important;
        margin-bottom: 8px !important;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 0.5px rgba(0,0,0,0.04) !important;
        text-decoration: none !important;
        color: inherit !important;
        border: none !important;
        position: relative !important;
        overflow: hidden !important;
        transition: transform 0.12s ease !important;
    }

    .m-job-item::before,
    .m-job-item::after {
        display: none !important;
        content: none !important;
    }

    .m-job-item:active { transform: scale(0.98) !important; }

    .m-job-item-top {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin-bottom: 8px !important;
        gap: 8px !important;
    }

    .m-job-title {
        font-size: 15px !important;
        font-weight: 600 !important;
        color: #1c1c1e !important;
        flex: 1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .m-job-salary {
        font-size: 15px !important;
        font-weight: 700 !important;
        color: #ff9500 !important;  /* Apple Orange */
        white-space: nowrap !important;
        letter-spacing: -0.3px !important;
    }

    .m-job-company {
        font-size: 13px !important;
        color: #3c3c43 !important;
        margin-bottom: 4px !important;
        font-weight: 400 !important;
    }

    .m-job-location {
        font-size: 12px !important;
        color: #8e8e93 !important;
    }

    .m-job-location .fa-location-dot { color: #ff3b30 !important; }


    /* ---- 潮团信息 ---- */
    .m-news-list {
        padding: 0 12px 8px !important;
    }

    .m-news-item {
        background: #fff !important;
        border-radius: 14px !important;
        padding: 14px !important;
        margin-bottom: 8px !important;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 0.5px rgba(0,0,0,0.04) !important;
        text-decoration: none !important;
        display: flex !important;
        align-items: center !important;
        transition: transform 0.12s ease !important;
    }

    .m-news-item:active { transform: scale(0.98) !important; }

    .m-news-title {
        font-size: 14px !important;
        font-weight: 500 !important;
        color: #1c1c1e !important;
        line-height: 1.45 !important;
    }

    .m-news-date {
        font-size: 12px !important;
        color: #8e8e93 !important;
        white-space: nowrap !important;
    }


    /* ---- 底部 Tabbar（苹果风） ---- */
    .m-tabbar {
        height: 56px !important;
        background: rgba(255,255,255,0.94) !important;
        backdrop-filter: saturate(180%) blur(20px) !important;
        -webkit-backdrop-filter: saturate(180%) blur(20px) !important;
        border-top: 0.5px solid rgba(0,0,0,0.12) !important;
        box-shadow: none !important;
        padding-bottom: env(safe-area-inset-bottom, 0) !important;
    }

    .m-tabbar-item {
        color: #8e8e93 !important;
        font-size: 10px !important;
        font-weight: 400 !important;
        gap: 3px !important;
        transition: color 0.12s !important;
    }

    .m-tabbar-item.active {
        color: #007aff !important;
    }

    .m-tabbar-item i {
        font-size: 22px !important;
    }

    /* 隐藏 mobile-tabbar（PHP端），只用 #mobileBottomNav（HTML端，已统一） */
    .mobile-tabbar { display: none !important; }
}


/* ============================================================
   4. 列表页（associations / talents / jobs 等）PC端手机显示修复
   ============================================================ */
@media (max-width: 768px) {

    /* 所有 main 容器补偿头部 */
    .main {
        padding-top: 82px !important;
    }

    .main .content-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* 社团网格 → 单列 */
    .assoc-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .assoc-card {
        border-radius: 14px !important;
        padding: 14px !important;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 0.5px rgba(0,0,0,0.04) !important;
        cursor: pointer !important;
    }

    /* 企业网格 → 单列 */
    .company-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    /* 面包屑 */
    .breadcrumb {
        font-size: 12px !important;
        margin-bottom: 10px !important;
    }

    /* 搜索框全宽 */
    .assoc-search-box,
    .company-search-form {
        padding: 14px !important;
        border-radius: 14px !important;
    }

    /* 分页 */
    .pagination-nav,
    .page-num {
        font-size: 13px !important;
    }

    /* section 标题 */
    .section-header {
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }

    .section-title {
        font-size: 20px !important;
    }
}


/* ============================================================
   5. 供需/招聘列表页 PC端card在手机上修复
   ============================================================ */
@media (max-width: 768px) {

    /* board-card PC端样式修复 */
    .board-card {
        border-radius: 14px !important;
        margin-bottom: 10px !important;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 0.5px rgba(0,0,0,0.04) !important;
        border: none !important;
    }

    /* 供需卡片图片区隐藏（手机不需要） */
    .board-card-img-wrap {
        display: none !important;
    }

    .board-card-body {
        padding: 14px !important;
    }

    /* 招聘卡片 */
    .job-card {
        border-radius: 14px !important;
        margin-bottom: 10px !important;
        padding: 14px !important;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 0.5px rgba(0,0,0,0.04) !important;
        border: none !important;
    }

    .job-list-layout {
        flex-direction: column !important;
    }

    .job-list-sidebar {
        display: none !important;
    }

    /* 供需列表容器 */
    .board-list-wrap {
        padding: 0 !important;
    }

    /* 标签筛选横向滚动 */
    .board-filter-tabs,
    .job-filter-bar {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        flex-wrap: nowrap !important;
        scrollbar-width: none !important;
    }

    .board-filter-tabs::-webkit-scrollbar,
    .job-filter-bar::-webkit-scrollbar { display: none !important; }
}


/* ============================================================
   6. 侧滑导航美化（苹果风格）
   ============================================================ */
@media (max-width: 768px) {

    .mobile-nav {
        background: #f2f2f7 !important;
        border-radius: 0 24px 24px 0 !important;
    }

    .mobile-nav-header {
        padding: 20px 20px 16px !important;
        background: #fff !important;
        border-radius: 0 24px 0 0 !important;
    }

    .mobile-nav-header h3 {
        font-size: 20px !important;
        font-weight: 700 !important;
        color: #1c1c1e !important;
    }

    .mobile-nav-menu {
        padding: 8px 12px !important;
        background: #fff !important;
        margin: 12px !important;
        border-radius: 14px !important;
    }

    .mobile-nav-menu a {
        padding: 13px 8px !important;
        font-size: 16px !important;
        color: #1c1c1e !important;
        border-bottom: 0.5px solid rgba(60,60,67,0.08) !important;
        font-weight: 400 !important;
    }

    .mobile-nav-menu a:last-child {
        border-bottom: none !important;
    }

    .mobile-nav-menu a.active {
        color: #007aff !important;
        font-weight: 600 !important;
    }

    .mobile-nav-menu a .fas,
    .mobile-nav-menu a .fa-solid {
        color: #007aff !important;
        width: 22px !important;
        font-size: 16px !important;
    }

    .mobile-nav-actions {
        padding: 12px !important;
    }

    .mobile-nav-actions .btn-blue {
        border-radius: 14px !important;
        height: 50px !important;
        font-size: 17px !important;
        font-weight: 600 !important;
    }

    .mobile-nav-overlay {
        background: rgba(0,0,0,0.35) !important;
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
    }
}


/* ============================================================
   7. 底部 mobile-tabbar（_footer.html 里的） 苹果风
   ============================================================ */
@media (max-width: 768px) {

    .mobile-tabbar {
        height: auto !important;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6px) !important;
        background: rgba(255,255,255,0.94) !important;
        backdrop-filter: saturate(180%) blur(20px) !important;
        -webkit-backdrop-filter: saturate(180%) blur(20px) !important;
        border-top: 0.5px solid rgba(0,0,0,0.12) !important;
        box-shadow: none !important;
    }

    .mobile-tabbar a {
        color: #8e8e93 !important;
        font-size: 10px !important;
        padding: 6px 0 !important;
        gap: 3px !important;
        transition: color 0.12s !important;
    }

    .mobile-tabbar a.active {
        color: #007aff !important;
    }

    .mobile-tabbar a .tab-icon {
        font-size: 22px !important;
        line-height: 1.2 !important;
    }

    .mobile-tabbar a .tab-label {
        font-size: 10px !important;
        font-weight: 500 !important;
    }

    /* 有底部 tabbar 的页面，给 body/main 加 padding */
    body:has(.mobile-tabbar) .main,
    body:has(.mobile-tabbar) .content-container {
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
    }
}


/* ============================================================
   8. 通用触摸优化
   ============================================================ */
@media (max-width: 768px) {

    /* 所有按钮最小触摸高度 44px (Apple HIG) */
    .btn, button, [role="button"] {
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* 禁止双击缩放 */
    * { touch-action: manipulation; }

    /* 输入框放大防缩放 */
    input, select, textarea {
        font-size: 16px !important;
    }

    /* 滚动平滑 */
    html { scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }

    /* 隐藏 PC 端 hero banner */
    .hero-banner { display: none !important; }

    /* 搜索框在桌面布局里的隐藏 */
    .hero-search { display: none !important; }
}
