/* ============================================================
   手机端 H5 专用样式
   底部导航 / 触摸优化 / 移动布局
   ============================================================ */

/* ============= 底部 Tabbar ============= */
.mobile-tabbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--color-border);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
}
.mobile-tabbar__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 0 4px;
    color: var(--color-text-muted);
    font-size: 10px;
    text-decoration: none;
    transition: color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}
.mobile-tabbar__item.active { color: var(--color-primary); }
.mobile-tabbar__item span { font-size: 10px; line-height: 1.2; }

.mobile-tabbar__item--center { position: relative; }
.mobile-tabbar__fab {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -20px;
    box-shadow: 0 4px 12px rgba(26, 86, 196, 0.3);
    border: 3px solid #fff;
}

/* ============= 手机端响应式 ============= */
@media (max-width: 768px) {
    body { padding-bottom: 60px; }

    /* 底部导航显示 */
    .mobile-tabbar {
        display: flex;
        height: 56px;
    }

    /* 隐藏桌面端 header 导航(用底部导航替代) */
    .site-header__nav { display: none !important; }
    .site-header__inner { height: 48px; gap: var(--space-3); flex-wrap: wrap; }
    .site-header__brand { font-size: var(--text-sm); }
    .site-header__brand .slogan { display: none; }
    .site-header__brand .logo { width: 28px; height: 28px; font-size: var(--text-xs); }
    .site-header__search { display: none !important; }
    .site-header__search-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--color-border); border-radius: var(--radius-full); background: #fff; color: var(--color-text-soft); margin-left: auto; }
    .site-header__mobile-search { width: 100%; order: 5; padding: 4px 0 6px; }
    .site-header__mobile-search input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--color-border); border-radius: var(--radius-full); background: var(--color-bg-soft); font-size: var(--text-sm); }
    .site-header__stage {
        display: inline-flex;
        margin-left: auto;
        gap: 1px;
        font-size: 11px;
    }
    .site-header__stage a { padding: 5px 7px; }
    .site-header__user .btn--sm { padding: 4px 10px; font-size: var(--text-xs); }
    .site-header__user .muted-link { display: none; }
    .site-header__toggle { display: none; }
    .mobile-tabbar__item { min-width: 0; }

    /* container 全宽 */
    .container { padding: 0 12px; }
    .site-main { padding: 12px 0 80px; }

    /* Hero */
    .hero { padding: var(--space-6) var(--space-4); border-radius: var(--radius-md); margin-bottom: 12px; }
    .hero h1 { font-size: var(--text-2xl); }
    .hero__slogan { font-size: var(--text-sm); margin: 4px 0 16px; }
    .hero__stats { gap: var(--space-4); margin: 16px 0; }
    .hero__stat .num { font-size: var(--text-xl); }
    .hero__stat .label { font-size: 10px; }
    .hero__actions .btn { width: 100%; }

    /* 首页侧边栏变上下排列 */
    .home-layout { grid-template-columns: 1fr !important; }

    /* Section */
    .section { margin: 16px 0; }
    .section__header { margin-bottom: 10px; }
    .section__header h2 { font-size: var(--text-md); }

    /* Grid 全部单列 */
    .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr !important; gap: 10px; }

    /* 卡片更紧凑 */
    .question-card, .paper-card, .entry-card { padding: 12px; }
    .question-card__stem, .paper-card__title { font-size: var(--text-sm); min-height: auto; }
    .entry-card { padding: 10px 12px; }
    .entry-card__title { font-size: var(--text-sm); }

    /* 筛选栏优化 */
    .filter-bar { padding: 8px 12px; border-radius: var(--radius); }
    .filter-bar__row { flex-direction: column; gap: 6px; padding: 6px 0; }
    .filter-bar__label { width: auto; padding-top: 0; }
    .filter-bar__values { gap: 4px; }
    .chip { padding: 5px 10px; font-size: var(--text-xs); }

    /* 表单 */
    .form--two { grid-template-columns: 1fr !important; }
    .form--inline { flex-direction: column; align-items: stretch; }

    /* 练习页 */
    .practice, .question-detail { padding: 12px; border-radius: var(--radius); }
    .practice__stem, .question-detail__stem { font-size: var(--text-sm); line-height: 1.7; }
    .practice__audio, .question-detail__audio { padding: 10px; margin: 10px 0; }
    .audio-player__controls { gap: 6px; }
    .audio-player__progress { min-width: 100%; order: 99; margin-top: 6px; }
    .audio-player__rate select { font-size: var(--text-xs); }
    .practice__actions { flex-direction: column; }
    .practice__actions .btn { width: 100%; }
    .practice-session__head { align-items: flex-start; flex-direction: column; gap: var(--space-2); }
    .practice-session__summary { width: 100%; justify-content: flex-start; }
    .practice-session__group { padding: var(--space-3); }
    .practice-session__group-head { align-items: flex-start; flex-direction: column; }
    .session-audio { width: 100%; }
    .practice-session__actions { flex-direction: column; }
    .practice-session__actions .btn { width: 100%; }

    /* 答题结果 */
    .answer-grid { grid-template-columns: 1fr !important; }
    .result-card { padding: var(--space-4); }
    .result-card__stats { gap: var(--space-4); }
    .result-card__stat .num { font-size: var(--text-2xl); }

    /* 表格变滚动 */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { min-width: 500px; }

    /* 会员中心 */
    .member-center__head { padding: 12px; gap: 10px; }
    .member-center__avatar { width: 44px; height: 44px; font-size: var(--text-md); }
    .member-center__info h1 { font-size: var(--text-md); }

    /* Auth */
    .auth { padding: 16px 0; }
    .auth__card { padding: 20px 16px; box-shadow: var(--shadow-md); }

    /* 试卷详情 */
    /* Footer 隐藏(有底部导航) */
    .site-footer { display: none; }

    /* 分页 */
    .pagination ul { gap: 2px; }
    .pagination li a { min-width: 30px; height: 30px; font-size: var(--text-xs); }

    /* VIP 套餐 */
    .vip-plans { grid-template-columns: 1fr !important; }

    /* 空状态 */
    .empty-state { padding: 32px 16px; }

    /* 输入框触摸优化 */
    input, select, textarea { font-size: 16px; }
    input[type="text"], input[type="email"], input[type="password"],
    input[type="search"], input[type="tel"], select, textarea {
        padding: 10px 12px;
        min-height: 40px;
    }

    /* 按钮触摸优化 */
    .btn { min-height: 38px; }
    .btn--lg { min-height: 44px; }
    .btn--sm { min-height: 30px; }

    /* 弹窗移动端 */
    .modal-content { width: 92% !important; max-height: 85vh; overflow-y: auto; }

    /* 搜索栏移动端 */
    .page-head { flex-direction: column; align-items: stretch; }
    .page-head__search { max-width: 100%; }
    .page-head__search input { min-width: 0; }

    /* 面包屑 */
    .breadcrumb { padding: 4px 0; }

    /* 音频播放器移动端优化 */
    .audio-player { padding: 8px; }
    .audio-player--lg { padding: 10px; }
    .audio-player__controls { flex-wrap: wrap; }

    /* 选项列表触摸优化 */
    .option-list li { padding: 12px; }
    .option-item { font-size: var(--text-sm); }

    /* 标签更紧凑 */
    .tag { font-size: 10px; padding: 1px 6px; }

    /* page-title */
    .page-title { font-size: var(--text-lg); }

    /* transcript 移动端 */
    .transcript { font-size: var(--text-xs); padding: 10px; max-height: 300px; }

    /* progress 移动端 */
    .progress { height: 4px; }

    /* 统计卡片 */
    .stat-card { padding: 12px; }
    .stat-card__num { font-size: var(--text-lg); }
    .stat-card--lg .stat-card__num { font-size: var(--text-xl); }
}

/* ============= 平板适配 ============= */
@media (min-width: 769px) and (max-width: 1024px) {
    .grid--4 { grid-template-columns: repeat(2, 1fr); }
    .site-header__search { max-width: 200px; }
    .site-header__brand .slogan { display: none; }
}

/* ============= 触摸交互 ============= */
@media (hover: none) and (pointer: coarse) {
    .question-card:hover,
    .paper-card:hover,
    .entry-card:hover {
        transform: none;
        box-shadow: var(--shadow-sm);
    }
    .btn:hover { transform: none; }
}

/* ============= 安全区域 ============= */
@supports (padding: env(safe-area-inset-bottom)) {
    .mobile-tabbar { padding-bottom: env(safe-area-inset-bottom); }
    .practice__actions { padding-bottom: env(safe-area-inset-bottom); }
}

/* ============= 下拉刷新指示器 ============= */
.pull-refresh {
    display: none;
    text-align: center;
    padding: 10px;
    color: var(--color-text-muted);
    font-size: var(--text-xs);
}
.pull-refresh--visible { display: block; }
.pull-refresh__spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
