/*
 * Wave D1: 移动端适配公共补丁
 * 引入方式: 在 admin/base.html 和 lead/base.html 中添加 <link href="/static/css/responsive.css" rel="stylesheet">
 */

/* ===== 全局 ===== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* ===== Admin 后台移动端适配 ===== */

/* 侧边栏: 移动端折叠 */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed !important;
        top: 0;
        left: -260px;
        width: 260px;
        height: 100vh;
        z-index: 1040;
        transition: left 0.3s ease;
        overflow-y: auto;
    }
    .sidebar.show { left: 0; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,.4);
        z-index: 1035;
    }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0 !important; }
}

/* 导航栏汉堡按钮 */
.navbar-toggler-custom {
    display: none;
    border: none;
    background: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    color: #333;
}
@media (max-width: 991.98px) {
    .navbar-toggler-custom { display: block; }
}

/* 表格移动端: 水平滚动 */
@media (max-width: 767.98px) {
    .table-responsive { -webkit-overflow-scrolling: touch; }
    .table { font-size: 0.82rem; }
    .table th, .table td { padding: 6px 8px; white-space: nowrap; }

    /* 隐藏非关键列 */
    .table .hide-mobile { display: none !important; }
}

/* KPI卡片: 移动端2列 */
@media (max-width: 575.98px) {
    .kpi-card { padding: 12px 14px; }
    .kpi-card .kpi-value { font-size: 1.4rem; }
    .kpi-card .kpi-label { font-size: 0.75rem; }
}

/* 图表卡片 */
@media (max-width: 767.98px) {
    .chart-card { padding: 14px; }
    .chart-card canvas { max-height: 220px; }
}

/* 模态框移动端全屏 */
@media (max-width: 575.98px) {
    .modal-dialog { margin: 0; max-width: 100%; }
    .modal-content { border-radius: 0; min-height: 100vh; }
    .modal-body { padding: 16px; }
}

/* 按钮组: 移动端垂直排列 */
@media (max-width: 575.98px) {
    .btn-group-mobile .btn { display: block; width: 100%; margin-bottom: 4px; border-radius: 8px !important; }
}

/* 分页器 */
@media (max-width: 575.98px) {
    .pagination { font-size: 0.82rem; }
    .pagination .page-link { padding: 4px 10px; }
}

/* ===== 线索表单移动端优化 ===== */
@media (max-width: 767.98px) {
    /* 表单容器全宽 */
    .container { padding-left: 12px; padding-right: 12px; }
    .col-lg-8, .col-xl-7 { max-width: 100%; flex: 0 0 100%; }

    /* 输入框更大触摸区域 */
    .form-control, .form-select {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 12px 14px;
        border-radius: 10px;
    }

    /* 步骤进度条精简 */
    .progress-steps {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .step-item { font-size: 0.75rem; padding: 4px 8px; }

    /* 移动端底部操作栏 */
    .mobile-sticky-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        padding: 12px 16px;
        box-shadow: 0 -2px 10px rgba(0,0,0,.08);
        z-index: 100;
    }

    /* 避免内容被底栏遮挡 */
    main.container.pb-5 { padding-bottom: 80px !important; }

    /* OCR上传区域 */
    .ocr-upload-area {
        min-height: 120px;
        padding: 20px;
    }
}

/* ===== H5落地页 ===== */
@media (max-width: 767.98px) {
    .hero { padding: 40px 0 30px; }
    .hero h1 { font-size: 1.5rem; }
    .hero .btn-glow { padding: 12px 28px; font-size: 0.95rem; }
    .trust-bar .num { font-size: 1.4rem; }
    .section { padding: 40px 0; }
    .section-title { font-size: 1.3rem; }
    .feature-card { padding: 24px 16px; }
    .feature-icon { width: 52px; height: 52px; font-size: 24px; }
}

/* ===== 客户查询门户 ===== */
@media (max-width: 480px) {
    .lead-card { padding: 16px; }
    .eval-info .row { font-size: 0.82rem; }
    .report-card { margin: 12px; padding: 18px; }
}

/* ===== 安全区域（刘海屏） ===== */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ===== 打印优化 ===== */
@media print {
    .sidebar, .navbar, .share-bar, .mobile-sticky-bar { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .report-card { box-shadow: none; border: 1px solid #eee; page-break-inside: avoid; }
}
