/* ============================================================
   JXS 发卡平台 · 手机端适配（luna 主题）
   加载顺序：layui.css → main.css → theme.css → mobile.css（本文件最后加载，负责收口）
   断点：≤768px 手机/小平板，≤420px 窄屏手机
   ============================================================ */

/* ---------- 0. 全局：防横向溢出 ---------- */
@media (max-width: 768px) {
    html, body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
    }

    img, svg, video, canvas {
        max-width: 100%;
    }

    /* 顶部/底部留白，避免浮动按钮压住内容 */
    .main {
        padding-bottom: 8px;
    }

    body {
        padding-bottom: 96px;
    }
}

/* ---------- 1. 顶部导航：小屏显示完整入口 ---------- */
@media (max-width: 768px) {
    /* 顶栏分两行：第一行品牌，第二行功能入口（横向可滑动） */
    .header .header-box {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
    }

    .header .header-box > a {
        flex: 1 1 100%;
        width: 100%;
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
    }

    .header .header-box img {
        flex: 0 0 34px;
        width: 34px;
        height: 34px;
        border-radius: 9px;
    }

    .header .header-box .info {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
        font-size: 16px;
        font-weight: 700;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: keep-all;
    }

    /* 顶栏右侧按钮：小屏整行排列，可左右滑动 */
    .header .header-box .header-actions {
        flex: 1 1 100%;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 6px;
        margin-left: 0;
        padding-bottom: 2px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .header .header-box .header-actions::-webkit-scrollbar {
        display: none;
    }

    /* 覆盖 layui-hide-xs：手机端不再隐藏这些入口 */
    .header .header-box .header-actions .query.layui-hide-xs {
        display: block !important;
    }

    .header .header-box .query a {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        height: 32px;
        padding: 0 10px;
        border-radius: 16px;
        background: #EEF4FF;
        color: #165DFF !important;
        font-size: 12px;
        white-space: nowrap;
    }

    .header .header-box .query a svg {
        width: 15px;
        height: 15px;
    }

    .header .header-box .query a span {
        font-size: 12px;
    }
}

/* ---------- 2. 首页 ---------- */
@media (max-width: 768px) {
    .main .main-box {
        margin: 12px 0 12px;
        padding: 14px 14px 18px;
        border-radius: 16px;
    }

    .hero {
        gap: 14px;
        padding: 18px 16px;
    }

    .hero h1 {
        font-size: 21px;
        line-height: 1.35;
    }

    .hero p {
        font-size: 13px;
        line-height: 1.7;
    }

    .hero-points {
        flex-wrap: wrap;
        gap: 8px;
    }

    .hero-points span {
        font-size: 12px;
    }

    .hero-stats {
        padding: 12px;
        gap: 14px;
    }

    .main .cate {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .main .cate .cate-box {
        min-width: calc(50% - 4px);
        flex: 1 1 calc(50% - 4px);
        padding: 12px 12px;
    }

    .main .cate .cate-box p {
        font-size: 14px;
    }

    .main .cate .cate-box div {
        font-size: 12px;
    }

    .main .goods .goods-list {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .main .goods .goods-box {
        padding: 10px;
        border-radius: 14px;
    }

    .main .goods .picture {
        width: 100%;
        height: 96px;
        margin: 0 0 8px;
        border-radius: 10px;
        overflow: hidden;
    }

    .main .goods .picture img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .main .goods .msg .goods-name {
        font-size: 13px;
        line-height: 1.45;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .main .goods .msg .goods-price {
        font-size: 17px;
        margin-top: 6px;
        flex-wrap: wrap;
        gap: 4px;
    }

    .main .goods .msg .goods-price div {
        font-size: 11px;
        margin-bottom: 2px;
    }

    .main .goods .msg .goods-num span {
        font-size: 11px;
    }

    .empty-goods {
        padding: 28px 12px;
        font-size: 14px;
    }
}

/* 窄屏（≤420px）：商品单列，避免两列挤成一团 */
@media (max-width: 420px) {
    .main .goods .goods-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .main .goods .goods-box {
        display: flex;
        gap: 10px;
        align-items: flex-start;
    }

    .main .goods .picture {
        flex: 0 0 84px;
        width: 84px;
        height: 84px;
        margin: 0;
    }

    .main .goods .msg {
        flex: 1 1 auto;
        min-width: 0;
        margin: 0;
    }

    .main .cate .cate-box {
        min-width: 100%;
        flex: 1 1 100%;
    }

    .hero h1 {
        font-size: 19px;
    }
}

/* ---------- 3. 发卡/下单页 ---------- */
@media (max-width: 768px) {
    .main .title {
        font-size: 16px;
        padding: 4px 0 8px;
    }

    .main-box .goods-msg {
        margin: 14px 0 0;
        padding: 0;
    }

    .goods-msg .goods-name {
        font-size: 17px;
        line-height: 1.45;
    }

    .goods-msg .price {
        display: flex;
        align-items: baseline;
        gap: 3px;
        margin-top: 8px;
    }

    .goods-msg .price .price-num {
        font-size: 26px;
    }

    .goods-msg .price .price-sign {
        font-size: 15px;
    }

    .goods-msg .price .price-c {
        font-size: 13px;
    }

    /* 下单须知：小屏压缩行高，避免占满整屏 */
    .buy-warning {
        margin: 12px 0 0;
        padding: 12px 12px 10px;
        border-radius: 12px;
    }

    .buy-warning-title {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .buy-warning-body {
        font-size: 12px;
        line-height: 1.75;
        /* 不再限高滚动：全部展开，避免滚动条压住文字、最后一行被裁 */
        max-height: none;
        overflow: visible;
        padding-right: 2px;
        -webkit-overflow-scrolling: touch;
    }

    .buy-warning-body::-webkit-scrollbar {
        width: 4px;
    }

    .buy-warning-body::-webkit-scrollbar-thumb {
        background: rgba(180, 83, 9, .32);
        border-radius: 2px;
    }

    .buy-warning-body::-webkit-scrollbar-track {
        background: transparent;
    }

    .buy-warning-body ul {
        padding-left: 16px;
        margin: 0;
    }

    .buy-warning-body li {
        margin-bottom: 7px;
    }

    /* 表单行：标签在上、输入框在下，宽度铺满 */
    .entry {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        margin: 14px 0 0;
    }

    .entry .l-msg {
        width: auto;
        text-align: left;
        font-size: 13px;
        color: #4E5969;
    }

    .entry .input {
        width: 100%;
        box-sizing: border-box;
    }

    .entry .input input {
        width: 100%;
        height: 44px;
        box-sizing: border-box;
        font-size: 15px;
        border-radius: 10px;
    }

    /* 购买数量：减号/数字/加号三段铺满 */
    .entry .input.pay-num-box,
    .entry .input:has(.pay-num) {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .entry .input .sub,
    .entry .input .add {
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
        display: grid;
        place-items: center;
        border-radius: 10px;
        background: #F2F6FF;
    }

    .entry .input .pay-num {
        flex: 1 1 auto;
        width: auto;
        text-align: center;
    }

    /* 支付方式：两列等宽，点击区域足够大 */
    .pay {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-top: 16px;
    }

    .pay .pay-type {
        width: 100% !important;
        height: 56px;
        margin: 0;
        box-sizing: border-box;
        border-radius: 12px;
    }

    .pay .pay-type .pay-name,
    .pay .pay-type span {
        font-size: 14px;
    }

    /* 下单按钮铺满，贴底好点 */
    .buy-actions {
        margin-top: 18px;
    }

    .buy-actions button {
        width: 100%;
        max-width: 100%;
        height: 50px;
        line-height: 50px;
        font-size: 17px;
        border-radius: 13px;
    }

    .buy-tip {
        margin-top: 10px;
        font-size: 11px;
        line-height: 1.6;
        color: #86909C;
    }

    .intro img {
        border-radius: 10px;
    }
}

/* ---------- 4. 订单查询 / 售后工单 / 代理IP 列表 ---------- */
@media (max-width: 768px) {
    /* 表单标签：手机端统一左对齐，不再居中 */
    .layui-form-label {
        width: auto !important;
        float: none !important;
        display: block;
        padding: 0 0 6px !important;
        text-align: left !important;
        font-size: 13px;
        color: #4E5969;
    }

    .layui-input-block {
        margin-left: 0 !important;
        min-height: 0;
    }

    .layui-form-item {
        margin-bottom: 12px;
    }

    .layui-form-item .layui-input,
    .layui-form-item .layui-textarea {
        font-size: 15px;
        box-sizing: border-box;
    }

    /* 表格：小屏允许横向滑动，不要撑破页面 */
    .layui-table,
    .order-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .layui-table table,
    .order-table table {
        min-width: 560px;
    }

    /* 订单详情：键值行改成上下结构 */
    .info-ui {
        display: flex;
        flex-wrap: wrap;
    }

    .info-ui strong {
        width: 100%;
        margin-bottom: 2px;
        font-size: 12px;
        color: #86909C;
    }

    .info-ui span,
    .info-ui div {
        width: 100%;
        margin-bottom: 10px;
        word-break: break-all;
    }

    .query-m a,
    .query-m a span {
        font-size: 12px;
    }
}

/* ---------- 5. 浮动按钮（查单 / 手机下单） ---------- */
@media (max-width: 768px) {
    .query-m {
        position: fixed;
        right: 14px;
        bottom: 18px;
        z-index: 900;
        display: block !important;
    }

    .query-m a {
        width: 58px;
        height: 58px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        border-radius: 50%;
        box-shadow: 0 10px 22px rgba(22, 93, 255, .30);
    }

    .query-m a svg {
        width: 20px;
        height: 20px;
    }

    .query-m a span {
        width: auto;
        font-size: 10px;
        line-height: 1.1;
        white-space: nowrap;
    }

    /* 手机下单二维码按钮：小屏隐藏，避免与支付/下单按钮叠压 */
    .order-m {
        display: none !important;
    }

    .footer {
        padding: 16px 12px 8px;
        font-size: 12px;
    }
}

/* ---------- 6. 弹窗（公告 / 提示） ---------- */
@media (max-width: 768px) {
    .jxs-home-notice {
        padding: 12px;
    }

    .jxs-home-notice-panel {
        max-height: 90vh;
        border-radius: 16px;
    }

    .jxs-home-notice-head {
        padding: 18px 46px 14px 16px;
    }

    .jxs-home-notice-head h2 {
        font-size: 17px;
    }

    .jxs-home-notice-body {
        padding: 16px 16px 10px;
        font-size: 13px;
        line-height: 1.8;
    }

    .jxs-home-notice-foot {
        padding: 12px 16px 16px;
    }

    .jxs-home-notice-ok {
        width: 100%;
        min-width: 0;
    }

    /* layui layer 弹层不要越过屏幕 */
    .layui-layer {
        max-width: calc(100vw - 24px) !important;
    }
}
