/* ========================================
   移动端优化样式 - Touch/Mobile Enhancements
   使用方式：在 base.html head 中 <link rel="stylesheet" href="/static/css/mobile.css">
   ======================================== */

/* ── 底部导航栏（仅手机显示）── */
.mobile-tab-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    z-index: 1029;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.mobile-tab-bar .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    text-decoration: none;
    font-size: 11px;
    transition: color 0.2s;
    position: relative;
}

.mobile-tab-bar .tab-item.active {
    color: #0d6efd;
}

.mobile-tab-bar .tab-item i {
    font-size: 20px;
    margin-bottom: 2px;
}

.mobile-tab-bar .tab-item .tab-badge {
    position: absolute;
    top: 2px;
    right: 50%;
    margin-right: -16px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    text-align: center;
    line-height: 16px;
    padding: 0 4px;
}

/* ── 下拉刷新 ── */
.pull-to-refresh {
    display: none;
    text-align: center;
    padding: 12px;
    color: #6b7280;
    font-size: 13px;
}

.pull-to-refresh.refreshing {
    color: #0d6efd;
}

/* ── 触控优化 ── */
@media (max-width: 768px) {
    /* 底部导航栏显示 */
    .mobile-tab-bar {
        display: flex;
    }

    /* 页面底部留出导航栏空间 */
    .content-wrapper {
        padding-bottom: 70px !important;
    }

    /* 增大点击区域 */
    .btn, .nav-link, .dropdown-item {
        min-height: 44px;
        line-height: 1.4;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .form-control, .form-select {
        min-height: 44px;
        font-size: 16px; /* 防iOS缩放 */
    }

    /* 卡片触摸反馈 */
    .card {
        -webkit-tap-highlight-color: rgba(13,110,253,0.1);
    }
    .card:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }

    /* 表格水平滚动 */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    /* 侧边栏滑入模式优化 */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
    }
    .sidebar.open {
        transform: translateX(0);
    }

    /* 面包屑简化 */
    .breadcrumb {
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 模态框全屏 */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
    }

    /* 下拉刷新显示 */
    .pull-to-refresh {
        display: block;
    }

    /* Toast 位置调整（避开底部导航栏） */
    .toast, [style*="position:fixed"] {
        bottom: 70px !important;
    }
}

/* ── 滑动手势指示器 ── */
.swipe-indicator {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 2px;
    background: #cbd5e1;
    margin-right: 2px;
}
.swipe-indicator.active {
    background: #0d6efd;
    width: 16px;
}

/* ── 列表项滑动操作 ── */
.list-item-swipe {
    position: relative;
    overflow: hidden;
}
.list-item-swipe .swipe-actions {
    position: absolute;
    top: 0;
    right: -120px;
    bottom: 0;
    width: 120px;
    display: flex;
    transition: right 0.3s ease;
}
.list-item-swipe.swiped .swipe-actions {
    right: 0;
}
.list-item-swipe .swipe-actions .swipe-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border: none;
    font-size: 14px;
}

/* ── 底部安全区（iPhone X+）── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-tab-bar {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(60px + env(safe-area-inset-bottom));
    }
}
