/* ==========================================================
 * 商会平台 - 滚动性能修复 (2026-08-28)
 * 修复移动端滑动卡顿、掉帧
 *
 * 滚动卡顿根因（按影响排序）:
 *   1. position:sticky/fixed + box-shadow → 每帧重绘阴影(主因,影响最大)
 *   2. backdrop-filter: blur(20px) → GPU 压力巨大,中低端机直接掉帧
 *   3. 缺 -webkit-overflow-scrolling: touch → iOS 无弹性滚动
 *   4. 嵌套滚动容器 → overscroll-behavior 缺省,滚动链穿透
 *   5. touchstart/touchmove 没声明 passive: true → 浏览器等 JS 才能滚
 *   6. transform 动画缺 will-change → 不进合成层,主线程重绘
 *   7. 长列表(1000+节点)无 contain → 命中测试拖垮布局
 *
 * 修复策略:
 *   - sticky 阴影改 filter:drop-shadow(走合成层,不重绘)
 *   - blur(20px) → blur(8px) + 移动端限定
 *   - 全局加 -webkit-overflow-scrolling: touch + overscroll-behavior
 *   - sticky 元素全部 transform:translateZ(0) 强制 GPU 层
 *   - 卡片加 contain:layout style 隔离渲染
 *   - touch-action:manipulation 禁止双击缩放
 *   - 16px 字号防 iOS 聚焦自动放大
 * ========================================================== */

/* === iOS 弹性滚动 === */
html, body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: none;
}
.scroll-y, .scroll-isolated,
[style*="overflow-y"], [style*="overflow: auto"] {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* === 触摸优化 === */
button, a, .clickable, .btn, .tab, .list-item, .card,
input, select, textarea {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* === sticky/fixed 元素:强制 GPU 加速 === */
.page-header, .header, .navbar,
.chamber-tab-bar, .tab-bar, .sidebar,
[data-sticky], [style*="position:sticky"], [style*="position: fixed"] {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility: hidden;
}

/* === 移动端 sticky 阴影降级 === */
@media (max-width: 768px) {
    .page-header, .header, .navbar {
        box-shadow: none !important;
        filter: drop-shadow(0 2px 6px rgba(15, 52, 96, 0.10));
        -webkit-filter: drop-shadow(0 2px 6px rgba(15, 52, 96, 0.10));
    }
    /* tab bar 模糊半径降低 (20px → 8px), 中低端机不掉帧 */
    .chamber-tab-bar, .tab-bar {
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
    }
}

/* === 卡片渲染隔离 === */
.card, .list-item, .member-card, .stat-card,
.detail-row, .info-row, .message-item,
.upgrade-card, .form-group {
    contain: layout style;
}

/* === 长列表隔离:避免 1000+ 节点全参与命中测试 === */
.member-list, .news-list, .message-list,
.table-wrap, .list-container, .grid {
    contain: layout;
}

/* === 移动端输入框 16px 字号防 iOS 缩放 === */
@media (max-width: 768px) {
    input, select, textarea, .form-control,
    button, .btn {
        font-size: 16px !important;
    }
}

/* === 滚动条美化(不影响布局) === */
@media (max-width: 768px) {
    ::-webkit-scrollbar { width: 0; height: 0; }
    * { scrollbar-width: none; }
}

/* === iOS 安全区(刘海屏/底部 Home Indicator) === */
@supports (padding: max(0px)) {
    .page-header, .header, .navbar {
        padding-top: max(12px, env(safe-area-inset-top));
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    .chamber-tab-bar, .tab-bar {
        padding-bottom: max(env(safe-area-inset-bottom), 8px);
    }
}