/* =====================================================
   移动端底部 Tab Bar + 移动端通用体验优化
   只在 ≤ 768px 生效，PC 端不可见 / 不影响布局
   ===================================================== */

/* 默认 PC 端隐藏 */
.m-tabbar { display: none; }

@media (max-width: 768px) {
    /* 1. 把 Tab Bar 固定到屏幕底部 */
    .m-tabbar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1080;
        height: 56px;
        background: #ffffff;
        border-top: 1px solid #e8edf3;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, .04);
        /* 兼容 iPhone 底部安全区 */
        padding-bottom: env(safe-area-inset-bottom);
    }

    .m-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 2px;
        text-decoration: none !important;
        color: #7a8090;
        font-size: 11px;
        line-height: 1.2;
        position: relative;
        transition: color .15s;
        /* 关闭手机长按高亮 */
        -webkit-tap-highlight-color: transparent;
    }

    .m-tab:active { background: rgba(0, 0, 0, .03); }
    .m-tab:visited { color: #7a8090; }

    .m-tab-icon {
        font-size: 20px;
        line-height: 1;
        margin-bottom: 2px;
    }

    .m-tab-label {
        font-size: 11px;
        font-weight: 500;
        white-space: nowrap;
    }

    /* 当前页高亮 */
    .m-tab.active {
        color: #5cb85c;
    }
    .m-tab.active .m-tab-label {
        font-weight: 700;
    }
    .m-tab.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 30%;
        right: 30%;
        height: 3px;
        background: #5cb85c;
        border-radius: 0 0 3px 3px;
    }

    /* 2. 给 body 加底部内边距，避免被 fixed tabbar 遮挡内容尾部 */
    body {
        padding-bottom: calc(56px + env(safe-area-inset-bottom));
    }

    /* 3. 头部 hamburger 点击区放大 + 间距优化 */
    .navbar-default .navbar-toggle {
        margin-top: 12px;
        margin-right: 8px;
        padding: 10px 12px;
        border-color: #d6dde6;
    }
    .navbar-default .navbar-toggle .icon-bar {
        background-color: #5b6573;
        height: 3px;
        width: 24px;
    }
    .navbar-default .navbar-toggle:focus,
    .navbar-default .navbar-toggle:hover {
        background-color: #f5f7fa;
    }
    .navbar-brand {
        padding: 12px 14px !important;
    }
    .navbar-brand span {
        font-size: 1.1rem !important;
    }
    /* hamburger 展开后的菜单项更高，方便手指点击 */
    .navbar-default .navbar-collapse .navbar-nav > li > a {
        padding-top: 14px;
        padding-bottom: 14px;
        font-size: 15px;
    }

    /* 4. 全站可点击元素最小 44px 高度（Apple HIG 标准），改善误触 */
    .btn, .btn-default, .btn-primary, .btn-success, .btn-warning, .btn-danger,
    .form-control {
        min-height: 38px;
    }

    /* 5. 容器边距收紧，让内容区域更宽 */
    .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}

/* 暗色模式 Tab Bar */
body.dark-mode .m-tabbar {
    background: #1c2228;
    border-top-color: #2e3640;
}
body.dark-mode .m-tab { color: #9aa3ad; }
body.dark-mode .m-tab.active { color: #5cb85c; }
body.dark-mode .m-tab:active { background: rgba(255,255,255,.04); }

/* ============= 悬浮 CTA（右下角， 滚动 ≥ 一屏才出现） ============= */
.float-cta {
    position: fixed;
    right: 18px;
    bottom: 22px;
    z-index: 998;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 6px 0 0;
    background: linear-gradient(135deg, #f5576c, #f093fb);
    color: #fff;
    border-radius: 30px;
    box-shadow: 0 8px 24px rgba(245, 87, 108, .35);
    transform: translateY(120%);
    opacity: 0;
    transition: transform .35s cubic-bezier(.2,.8,.3,1.2), opacity .25s;
    pointer-events: none;
    font-size: 14px;
    max-width: calc(100% - 36px);
}
.float-cta.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.float-cta-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 6px 12px 18px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    line-height: 1;
}
.float-cta-link:hover, .float-cta-link:focus {
    color: #fff;
    text-decoration: none;
}
.float-cta-emoji { font-size: 18px; }
.float-cta-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: rgba(255,255,255,.85);
    font-size: 18px;
    width: 28px; height: 28px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    margin-right: 4px;
}
.float-cta-close:hover {
    background: rgba(255,255,255,.18);
    color: #fff;
}

/* 移动端：避开底部 Tab Bar 占位 */
@media (max-width: 768px) {
    .float-cta {
        bottom: calc(70px + env(safe-area-inset-bottom));
        right: 12px;
        font-size: 13px;
    }
    .float-cta-link { padding: 10px 6px 10px 14px; }
    .float-cta-emoji { font-size: 16px; }
}

/* 联系页 / 案例页本身就是目的地，不再展示悬浮 CTA */
body[data-cta-suppress="1"] .float-cta { display: none !important; }
