/* ============================================================
 * 前台工单（guest/order）专用样式
 * 包含：工单列表（orders） + 工单详情（orderdetail）两部分的样式。
 * 单独文件，仅在 guest/order 相关的列表/详情页加载。
 * ============================================================

/* ---------- 工单列表 ---------- */
/* ============================================================
 * 工单展示页（guest/orders）专用样式
 * 单独文件，仅在工单展示页加载。
 * ============================================================ */

.orders-page { padding: 24px 0 48px; }

/* ===== 状态统计筛选栏 ===== */
.orders-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.orders-filter .filter-tab {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid #d9d9d9;
    border-radius: 20px;
    font-size: 13px;
    color: #555;
    background: #fff;
    white-space: nowrap;
    transition: all 0.2s;
}
.orders-filter .filter-tab:hover { border-color: #1890ff; color: #1890ff; }
.orders-filter .filter-tab.active { background: #1890ff; border-color: #1890ff; color: #fff; }
.orders-filter .filter-num { font-weight: 700; font-size: 12px; opacity: 0.9; }

/* ===== 移动端：筛选栏垂直方向换行铺满一屏，不横向滚动 ===== */
@media (max-width: 767px) {
    .orders-filter {
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 16px;
    }
    .orders-filter .filter-tab {
        flex: 1 1 auto;
        justify-content: center;
        padding: 7px 8px;
        font-size: 12px;
        gap: 4px;
        min-width: 0;
    }
}

.orders-head { text-align: center; margin-bottom: 28px; }
.orders-head h2 { font-size: 24px; color: #333; }
.orders-head .orders-sub { color: #999; font-size: 14px; margin-top: 8px; }

.orders-table-wrap {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    overflow: hidden;
}
.orders-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.orders-table thead { background: #f8f9fa; }
.orders-table th {
    padding: 13px 14px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e9ecef;
    font-size: 14px;
    white-space: nowrap;
}
.orders-table td {
    padding: 14px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
    vertical-align: middle;
}
.orders-table tbody tr:last-child td { border-bottom: none; }
.orders-table tbody tr:hover { background: #f8f9ff; }
/* 列表行可点击进入详情 */
.orders-table .orders-row { cursor: pointer; }
.orders-table .customer-name { color: #333; }
.orders-table .orders-row:hover .customer-name { color: #1890ff; }

.col-no { width: 48px; text-align: center; color: #999; }
.col-date { width: 96px; white-space: nowrap; }
.col-customer { width: 96px; }
.customer-name { font-weight: 600; }
.col-worker { width: 84px; white-space: nowrap; }
.worker-name { color: #1890ff; }
.col-status { width: 96px; white-space: nowrap; }
.col-location { width: 210px; }
.col-content { width: 220px; }
.col-photo { width: 250px; }
.muted { color: #999; }

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.status-s1 { background: #e8f4fd; color: #3498db; }
.status-s2 { background: #fff3e0; color: #f39c12; }
.status-s3 { background: #f1e7fc; color: #9b59b6; }
.status-s4 { background: #fff3e0; color: #f39c12; }
.status-s5 { background: #fffbe6; color: #e6a700; }
.status-s6 { background: #e8f8f0; color: #2ecc71; }
.status-s9 { background: #f2f2f2; color: #999; }

.location-text { color: #555; }
/* 客户超长省略 */
.customer-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
/* 地点：分行显示（保留镇名等足够显示空间） */
.location-text {
    display: block;
    line-height: 1.5;
    word-break: break-all;
}

/* 维修内容：取前50字 + 溢出隐藏（2 行省略） */
.content-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
    max-height: 42px;
    color: #555;
    word-break: break-all;
}

/* 缩略图：只展示缩略图，不提供原图链接；
   强制限定尺寸（不受 common.css 的 img max-width:100% 影响） */
.process-photos { display: flex; gap: 8px; flex-wrap: wrap; }
.process-photos .thumb-item { display: block; flex: 0 0 auto; cursor: default; }
.process-photos img {
    width: 74px;
    height: 74px;
    max-width: 74px;
    max-height: 74px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
    display: block;
    background: #f4f4f4;
}

.orders-empty { text-align: center; padding: 60px 20px; color: #999; background: #fff; border-radius: 10px; box-shadow: 0 2px 12px rgba(0,0,0,0.05); }
.orders-empty-icon { font-size: 44px; margin-bottom: 14px; }

/* 分页 */
.orders-page .pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 24px;
}
.orders-page .pagination a,
.orders-page .pagination .page-current,
.orders-page .pagination .disabled {
    padding: 7px 13px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    color: #666;
    background: #fff;
}
.orders-page .pagination a:hover { background: #1890ff; color: #fff; border-color: #1890ff; }
.orders-page .pagination .page-current { background: #1890ff; color: #fff; border-color: #1890ff; }
.orders-page .pagination .disabled { opacity: 0.5; cursor: not-allowed; }
.orders-page .pagination .page-info { align-self: center; color: #999; font-size: 13px; margin-left: 6px; }

/* ===== 工单展示 移动端卡片（更清晰的卡片式排版） ===== */
@media (max-width: 767px) {
    .orders-page { padding: 16px 0 32px; }
    .orders-table-wrap { background: transparent; box-shadow: none; border-radius: 0; }
    .orders-table thead { display: none; }
    .orders-table,
    .orders-table tbody,
    .orders-table tr,
    .orders-table td { display: block; width: 100%; }

    .orders-table tbody { display: flex; flex-direction: column; gap: 14px; }
    .orders-table tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "customer  status"
            "content   content"
            "meta      meta"
            "location  location"
            "photo     photo";
        gap: 8px 12px;
        padding: 14px 16px;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.06);
        border: 1px solid #f0f0f0;
    }
    .orders-table td { border: none; padding: 0; }

    /* 客户名称：左，醒目标题 */
    .orders-table .col-customer { grid-area: customer; display: flex; align-items: center; }
    .orders-table .col-customer .customer-name {
        font-size: 16px;
        font-weight: 700;
        color: #2c3e50;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
    /* 状态：右上 */
    .orders-table .col-status { grid-area: status; display: flex; align-items: center; justify-content: flex-end; }
    .orders-table .col-no { display: none; }

    /* 维修内容：整行 */
    .orders-table .col-content { grid-area: content; }
    .content-clamp { color: #333; font-size: 14px; }

    /* 工单日期 + 维修师傅：同一行元信息 */
    .orders-table .col-date,
    .orders-table .col-worker {
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 13px;
        color: #666;
    }
    .orders-table .col-date { grid-area: meta; }
    .orders-table .col-worker { grid-area: meta; }
    /* 把日期和师傅放到 meta 一行：用 pseudo 做「日期 · 师傅」 */
    .orders-table .col-date::before { content: "工单日期"; color: #999; margin-right: 8px; }
    .orders-table .col-worker { display: none; }
    /* 师傅并入日期行右侧：改为在日期后显示 */
    .orders-table .col-date::after {
        content: attr(data-worker);
        margin-left: auto;
        color: #1890ff;
    }

    /* 地点：整行 */
    .orders-table .col-location { grid-area: location; font-size: 13px; }

    /* 缩略图：整行（无 label） */
    .orders-table .col-photo { grid-area: photo; }
    .process-photos { gap: 10px; }
    .process-photos img { width: 74px; height: 74px; max-width: 74px; max-height: 74px; border-radius: 10px; }
}


/* ---------- 工单详情 ---------- */
/* ============================================================
 * 工单详情页（guest/orderdetail）专用样式
 * 单独文件，仅在工单详情页加载。
 * ============================================================ */

.order-detail { padding: 24px 0 48px; max-width: 800px; }

.detail-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    padding: 20px 22px;
    margin-bottom: 20px;
}
.detail-title { font-size: 20px; color: #2c3e50; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #f0f0f0; }

.detail-row {
    display: flex;
    align-items: flex-start;
    padding: 9px 0;
    border-bottom: 1px dashed #f0f2f5;
    font-size: 14px;
    line-height: 1.6;
}
.detail-row:last-of-type { border-bottom: none; }
.detail-label { flex: 0 0 86px; color: #999; }
.detail-value { flex: 1; color: #333; word-break: break-all; }

/* 状态徽标 */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.status-s1 { background: #e8f4fd; color: #3498db; }
.status-s2 { background: #fff3e0; color: #f39c12; }
.status-s3 { background: #f1e7fc; color: #9b59b6; }
.status-s4 { background: #fff3e0; color: #f39c12; }
.status-s5 { background: #fffbe6; color: #e6a700; }
.status-s6 { background: #e8f8f0; color: #2ecc71; }
.status-s9 { background: #f2f2f2; color: #999; }

.detail-block { margin-top: 14px; }
.detail-label-block { font-size: 14px; font-weight: 600; color: #666; margin-bottom: 6px; }
.detail-content-text { font-size: 14px; color: #333; line-height: 1.7; word-break: break-all; white-space: pre-wrap; }

/* ===== 进度时间线（横向） ===== */
.detail-timeline {
    display: flex;
    align-items: flex-start;
    gap: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    padding: 16px 18px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tl-node {
    position: relative;
    flex: 1 0 auto;
    min-width: 96px;
    padding: 0 14px;
    text-align: center;
}
.tl-node:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 9px;
    right: -4px;
    width: 8px;
    height: 8px;
    border-top: 1px solid #ccc;
    border-right: 1px solid #ccc;
    transform: rotate(45deg);
}
.tl-label {
    font-size: 13px;
    color: #1890ff;
    font-weight: 600;
    margin-bottom: 6px;
}
.tl-node.last .tl-label { color: #2ecc71; }
.tl-time {
    font-size: 12px;
    color: #666;
    background: #f5f7fa;
    border-radius: 6px;
    padding: 3px 8px;
    display: inline-block;
    white-space: nowrap;
}

/* ===== 图片分类：施工前/中/后并排三列，每列内竖直往下 ===== */
.detail-photos { background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); padding: 18px 22px; margin-bottom: 20px; display: flex; align-items: flex-start; gap: 16px; }
.photo-group { flex: 1; min-width: 0; }
.photo-group-title { font-size: 14px; font-weight: 600; color: #555; margin-bottom: 10px; text-align: center; }
.photo-thumbs { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.photo-thumbs .thumb-item { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; cursor: default; }
.photo-thumbs img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
    display: block;
    background: #f4f4f4;
}
.photo-thumbs .thumb-time {
    font-size: 11px;
    color: #999;
    white-space: normal;
    text-align: center;
    word-break: break-all;
}

.detail-actions { text-align: center; margin-top: 24px; }
.detail-actions .btn { padding: 10px 32px; }

/* ===== 移动端 ===== */
@media (max-width: 767px) {
    .order-detail { padding: 14px 0 32px; }
    .detail-card, .detail-photos { padding: 16px; }
    .detail-row { font-size: 13px; }
    .detail-label { flex-basis: 74px; }
    /* 详情照片：三列并排保持不变，列间留小间距 */
    .detail-photos { gap: 10px; }

    /* 进度时间条：自动换行铺满一屏，不横向滚动/不超屏宽 */
    .detail-timeline {
        flex-wrap: wrap;
        overflow-x: visible;
        gap: 12px 6px;
        padding: 14px 12px;
    }
    .tl-node {
        flex: 1 1 30%;
        min-width: 0;
        max-width: 33.33%;
        padding: 0 8px;
    }
    /* 换行后隐藏步骤之间的箭头 */
    .tl-node:not(:last-child)::after { display: none; }
    .tl-time { font-size: 11px; padding: 3px 6px; }
}

