/* ============================================================ */
/* ========== SHOP MERCHANT (商家系统) Styles ================== */
/* Stage 1: 开店 + 装修 + 商品管理                              */
/* ============================================================ */

/* 顶部导航 */
#layer-shop-merchant { display: flex; flex-direction: column; overflow: hidden; }

.merchant-nav {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: #fff;
    border-bottom: 1px solid #ececec;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.merchant-nav-back {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: #333;
    font-size: 18px;
}

.merchant-nav-title {
    font-size: 16px;
    font-weight: 600;
    color: #222;
}

.merchant-nav-right { width: 32px; }

.merchant-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 40px;
}

/* ========== 通用表单 ========== */
.merchant-form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
}

.merchant-form-row label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.merchant-form-row input,
.merchant-form-row select,
.merchant-form-row textarea {
    width: 100%;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    background: #fafafa;
    box-sizing: border-box;
    color: #222;
    outline: none;
    resize: vertical;
}

.merchant-form-row input:focus,
.merchant-form-row select:focus,
.merchant-form-row textarea:focus {
    border-color: #ff4500;
    background: #fff;
}

.merchant-form-row-h {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
}

.merchant-form-row-h .merchant-half {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.merchant-form-row-h label {
    font-size: 13px;
    color: #666;
}

.merchant-form-row-h input {
    width: 100%;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    background: #fafafa;
    box-sizing: border-box;
    outline: none;
}

/* 开关行 */
.merchant-switch-row {
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
}

.merchant-switch {
    position: relative;
    display: inline-block;
    width: 44px; height: 24px;
    flex-shrink: 0;
}

.merchant-switch input {
    opacity: 0; width: 0; height: 0;
}

.merchant-switch span {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    border-radius: 24px;
    transition: .25s;
}

.merchant-switch span:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: .25s;
}

.merchant-switch input:checked + span {
    background: #ff4500;
}

.merchant-switch input:checked + span:before {
    transform: translateX(20px);
}

/* 主按钮 */
.merchant-btn-primary {
    width: calc(100% - 32px);
    margin: 20px 16px;
    padding: 13px;
    background: linear-gradient(135deg, #ff4500, #ff6b35);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(255,69,0,0.25);
    transition: transform .15s;
}

.merchant-btn-primary:active { transform: scale(0.98); }

.merchant-btn-fab {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 12px 16px;
    padding: 11px;
}

.merchant-btn-ai {
    margin-top: 6px;
    padding: 6px 12px;
    background: #fff5ef;
    color: #ff4500;
    border: 1px solid #ffd4bf;
    border-radius: 14px;
    font-size: 12px;
    cursor: pointer;
    align-self: flex-start;
}

.merchant-btn-ai:hover { background: #ffe8d9; }

/* ========== 注册页面 ========== */
.merchant-register {
    padding: 20px 0;
}

.merchant-register-hero {
    padding: 32px 24px;
    text-align: center;
    background: linear-gradient(135deg, #fff5ef 0%, #fff 100%);
}

.merchant-hero-icon {
    font-size: 56px;
    margin-bottom: 12px;
}

.merchant-hero-title {
    font-size: 22px;
    font-weight: 700;
    color: #222;
    margin-bottom: 8px;
}

.merchant-hero-desc {
    font-size: 13px;
    color: #888;
    line-height: 1.7;
}

.merchant-form {
    margin-top: 20px;
}

.merchant-tip {
    text-align: center;
    padding: 16px 24px 40px;
    font-size: 12px;
    color: #999;
    line-height: 1.6;
}

/* ========== 仪表盘 ========== */
.merchant-dashboard {
    padding: 14px 14px 40px;
}

.merchant-store-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.merchant-store-banner {
    height: 120px;
    background-size: cover;
    background-position: center;
}

.merchant-store-info {
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-top: -30px;
    position: relative;
}

.merchant-store-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #fff;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.merchant-store-meta {
    flex: 1;
    padding-top: 32px;
    min-width: 0;
}

.merchant-store-name {
    font-size: 17px;
    font-weight: 700;
    color: #222;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.merchant-store-sub {
    font-size: 12px;
    color: #999;
    margin-bottom: 6px;
}

.merchant-store-announce {
    font-size: 12px;
    color: #ff4500;
    background: #fff5ef;
    padding: 5px 10px;
    border-radius: 10px;
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 统计 */
.merchant-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.merchant-stat {
    background: #fff;
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
}

.merchant-stat-v {
    font-size: 18px;
    font-weight: 700;
    color: #ff4500;
    margin-bottom: 3px;
}

.merchant-stat-l {
    font-size: 11px;
    color: #888;
}

.merchant-section-title {
    padding: 14px 4px 8px;
    font-size: 13px;
    font-weight: 600;
    color: #666;
}

/* 菜单 */
.merchant-menu {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
}

.merchant-menu-item {
    display: flex;
    align-items: center;
    padding: 15px 16px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    position: relative;
}

.merchant-menu-item:last-child { border-bottom: none; }

.merchant-menu-item:active { background: #fafafa; }

.merchant-menu-item > i:first-child {
    font-size: 17px;
    width: 24px;
    text-align: center;
    margin-right: 12px;
}

.merchant-menu-item > span {
    flex: 1;
    font-size: 14px;
    color: #222;
}

.merchant-menu-hint {
    font-size: 12px !important;
    color: #999 !important;
    flex: 0 !important;
    white-space: nowrap;
    margin-right: 8px;
}

.merchant-chevron {
    color: #ccc;
    font-size: 12px;
}

.merchant-badge {
    position: static !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px; height: 18px;
    padding: 0 6px;
    background: #fa5151;
    color: #fff;
    font-size: 11px;
    font-style: normal;
    font-weight: 600;
    border-radius: 9px;
    margin-right: 8px;
}

/* ========== 装修页 ========== */
.merchant-decorate { padding: 4px 0 20px; }

.merchant-avatar-upload {
    width: 80px; height: 80px;
    border: 2px dashed #e5e5e5;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    cursor: pointer;
    background: #fafafa;
    align-self: flex-start;
}

.merchant-banner-upload {
    width: 100%;
    height: 120px;
    border: 2px dashed #e5e5e5;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: #fafafa;
}

/* ========== 商品列表 ========== */
.merchant-products { padding-bottom: 20px; }

.merchant-product-list {
    padding: 0 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.merchant-product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    padding: 12px;
    gap: 12px;
}

.merchant-product-img {
    width: 90px; height: 90px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
}

.merchant-product-img img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.merchant-product-noimg {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: #ccc;
    font-size: 24px;
}

.merchant-product-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.merchant-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.35;
}

.merchant-product-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.merchant-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
}

.merchant-product-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.merchant-product-price {
    font-size: 16px;
    font-weight: 700;
    color: #ff4500;
}

.merchant-product-stock {
    font-size: 11px;
    color: #999;
}

.merchant-product-status {
    font-size: 12px;
    font-weight: 500;
}

.merchant-product-actions {
    display: flex;
    gap: 6px;
}

.merchant-mini-btn {
    padding: 4px 10px;
    background: #f5f5f5;
    color: #555;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.merchant-mini-btn:active { background: #eaeaea; }

.merchant-mini-btn-del {
    background: #fff0f0;
    color: #fa5151;
}

/* ========== 商品编辑器 ========== */
.merchant-editor { padding-bottom: 30px; }

.merchant-editor-actions {
    padding: 10px 0 0;
}

/* 图片上传网格 */
.merchant-img-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 10px 16px 4px;
    background: #fff;
}

.merchant-img-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.merchant-img-item img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.merchant-img-del {
    position: absolute;
    top: 4px; right: 4px;
    width: 22px; height: 22px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    cursor: pointer;
}

.merchant-img-add {
    aspect-ratio: 1 / 1;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #aaa;
    cursor: pointer;
    background: #fafafa;
}

.merchant-img-add i { font-size: 20px; }
.merchant-img-add span { font-size: 11px; }

.merchant-img-hint {
    padding: 0 16px 12px;
    font-size: 11px;
    color: #999;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
}

/* 标签网格 */
.merchant-tag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}

.merchant-tag-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: #f5f5f5;
    border-radius: 14px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    user-select: none;
}

.merchant-tag-option input[type="checkbox"] {
    width: auto !important;
    margin: 0;
    accent-color: #ff4500;
}

.merchant-tag-option:has(input:checked) {
    background: #fff0e8;
    color: #ff4500;
}

/* ========== 空状态 ========== */
.merchant-empty {
    padding: 60px 20px;
    text-align: center;
    color: #999;
}

.merchant-empty i { display: block; margin: 0 auto 12px; }
.merchant-empty p { margin: 6px 0; font-size: 14px; }

/* ========== 商家入口Badge（挂在购物App"我的"页面） ========== */
.shop-me-merchant-entry {
    background: linear-gradient(135deg, #fff5ef, #fff) !important;
    position: relative;
    overflow: hidden;
}

.shop-me-merchant-entry::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 60px; height: 60px;
    background: radial-gradient(circle, rgba(255,69,0,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.shop-me-merchant-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: #ff4500;
    color: #fff;
    border-radius: 10px;
    margin-left: auto;
    margin-right: 8px;
}

/* 适配深色模式（如果有） */
@media (prefers-color-scheme: dark) {
    /* 保持亮色为主，这里只做最小适配 */
}

/* ============================================================ */
/* =========== Stage 2: 店铺消息 & 会话面板样式 ================= */
/* ============================================================ */

.merchant-msgs { padding-bottom: 30px; }

.merchant-msg-header {
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 10px;
}

.merchant-msg-stats {
    display: flex;
    gap: 14px;
    padding-bottom: 12px;
    font-size: 12px;
    color: #666;
}

.merchant-msg-stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.merchant-btn-refresh {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #ff4500, #ff6b35);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 3px 10px rgba(255,69,0,0.25);
}

.merchant-btn-refresh:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.merchant-msg-hint {
    margin-top: 10px;
    font-size: 11px;
    color: #999;
    text-align: center;
    line-height: 1.6;
}

.merchant-msg-list { padding: 0 14px; }

.merchant-msg-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform .15s;
}

.merchant-msg-item:active { transform: scale(0.98); }

.merchant-msg-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
}

.merchant-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

.merchant-msg-avatar-ph {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #ffb58c, #ff6b35);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.merchant-msg-avatar-ph.me { background: linear-gradient(135deg, #4facfe, #1890ff); }

.merchant-msg-body { flex: 1; min-width: 0; }

.merchant-msg-row1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.merchant-msg-name { font-size: 14px; font-weight: 600; color: #222; }
.merchant-msg-time { font-size: 11px; color: #aaa; }

.merchant-msg-row2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.merchant-msg-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.merchant-msg-product {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.merchant-msg-preview {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.merchant-msg-side { display: flex; align-items: center; margin-left: 4px; }

.merchant-msg-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 8px;
    white-space: nowrap;
    font-weight: 500;
}

.merchant-msg-badge.pending { background: #fff0f0; color: #fa5151; animation: merchant-pulse 1.2s infinite; }
.merchant-msg-badge.dealing { background: #e6f7ff; color: #1890ff; }
.merchant-msg-badge.shipped { background: #e8f5e9; color: #07c160; }
.merchant-msg-badge.done    { background: #f5f5f5; color: #888; }
.merchant-msg-badge.refunding { background: #fff7e6; color: #fa8c16; }
.merchant-msg-badge.refunded { background: #f5f5f5; color: #999; }
.merchant-msg-badge.closed  { background: #fafafa; color: #ccc; }

@keyframes merchant-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ====== 会话详情 Modal ====== */
.merchant-msg-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
}

.merchant-msg-modal.show { opacity: 1; }

.merchant-msg-sheet {
    width: 100%;
    max-width: 500px;
    height: 88vh;
    background: #f5f5f7;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1);
}

.merchant-msg-modal.show .merchant-msg-sheet { transform: translateY(0); }

.merchant-msg-sheet-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.merchant-msg-sheet-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: #f5f5f5;
    flex-shrink: 0;
}

.merchant-msg-sheet-avatar img,
.merchant-msg-sheet-avatar .merchant-msg-avatar-ph {
    width: 100%; height: 100%;
    object-fit: cover;
}

.merchant-msg-sheet-title { flex: 1; min-width: 0; }
.merchant-msg-sheet-name { font-size: 15px; font-weight: 600; color: #222; }
.merchant-msg-sheet-sub { font-size: 11px; color: #999; margin-top: 2px; }

.merchant-msg-sheet-close {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: #888;
    font-size: 18px;
    border-radius: 50%;
}

.merchant-msg-sheet-close:hover { background: #f5f5f5; }

/* 商品卡片 */
.merchant-msg-product-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.merchant-msg-product-card img {
    width: 48px; height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.merchant-msg-product-noimg {
    width: 48px; height: 48px;
    background: #f5f5f5;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #ccc;
    flex-shrink: 0;
}

.merchant-msg-product-info { flex: 1; min-width: 0; }

.merchant-msg-product-name {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.merchant-msg-product-price { font-size: 14px; color: #ff4500; font-weight: 600; }

.merchant-msg-product-tag {
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 11px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 会话气泡区 */
.merchant-msg-replies {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.merchant-bubble {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    max-width: 85%;
}

.merchant-bubble-customer { align-self: flex-start; }
.merchant-bubble-me { align-self: flex-end; flex-direction: row-reverse; }

.merchant-bubble-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
}

.merchant-bubble-avatar img { width: 100%; height: 100%; object-fit: cover; }

.merchant-bubble-body {
    padding: 9px 13px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
    max-width: 100%;
}

.merchant-bubble-customer .merchant-bubble-body {
    background: #fff;
    color: #222;
    border-top-left-radius: 4px;
}

.merchant-bubble-me .merchant-bubble-body {
    background: #ff4500;
    color: #fff;
    border-top-right-radius: 4px;
}

.merchant-bubble-sys {
    align-self: center;
    font-size: 11px;
    color: #999;
    background: rgba(0,0,0,0.05);
    padding: 4px 12px;
    border-radius: 10px;
    max-width: 80%;
    text-align: center;
}

/* 输入指示器 */
.merchant-typing-dots {
    display: inline-flex;
    gap: 3px;
    padding: 4px 2px;
}

.merchant-typing-dots span {
    width: 6px; height: 6px;
    background: #bbb;
    border-radius: 50%;
    animation: merchant-typing 1.2s infinite;
}

.merchant-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.merchant-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes merchant-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%           { transform: translateY(-4px); opacity: 1; }
}

/* 动作按钮区 */
.merchant-msg-actions {
    padding: 10px 16px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.merchant-msg-actions-done { background: #f6ffed; }

.merchant-msg-offer {
    font-size: 13px;
    color: #333;
    margin-bottom: 10px;
    text-align: center;
}

.merchant-msg-info {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    text-align: center;
}

.merchant-msg-btns { display: flex; gap: 8px; }

.merchant-msg-btn {
    flex: 1;
    padding: 9px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.merchant-msg-btn.accept { background: #07c160; color: #fff; }
.merchant-msg-btn.counter { background: #faad14; color: #fff; }
.merchant-msg-btn.reject { background: #f0f0f0; color: #555; }
.merchant-msg-btn:active { opacity: 0.85; }

/* 评价展示 */
.merchant-review {
    padding: 10px 12px;
    background: #fff;
    border-radius: 8px;
    margin-top: 8px;
}

.merchant-review-stars {
    display: flex;
    gap: 3px;
    margin-bottom: 6px;
    font-size: 14px;
}

.merchant-review-text { font-size: 13px; color: #333; line-height: 1.5; }

/* 输入区 */
.merchant-msg-input-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px 14px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
    align-items: flex-end;
}

.merchant-quick-replies {
    flex: 0 0 100%;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}
.merchant-quick-replies::-webkit-scrollbar { display: none; }
.merchant-quick-replies button {
    flex: 0 0 auto;
    border: 1px solid #e5e5e5;
    background: #fafafa;
    color: #666;
    border-radius: 13px;
    padding: 4px 8px;
    font-size: 11px;
    white-space: nowrap;
}

.merchant-msg-input-wrap textarea {
    flex: 1;
    border: 1px solid #e5e5e5;
    border-radius: 18px;
    padding: 8px 14px;
    font-size: 14px;
    background: #f8f8f8;
    outline: none;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
    max-height: 100px;
}

.merchant-msg-input-wrap textarea:focus { background: #fff; border-color: #ff4500; }

.merchant-msg-send-btn {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, #ff4500, #ff6b35);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}

.merchant-msg-send-btn:disabled { opacity: 0.5; }

/* [FIX-商铺闪退v1] 键盘弹出时商铺聊天modal的适配
   merchant-msg-modal不是.layer，需要单独处理键盘适配
   界面不动，输入框贴合键盘上弹 */
html.keyboard-active .merchant-msg-modal {
    /* modal保持全屏fixed，不改变高度 */
    top: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
}
html.keyboard-active .merchant-msg-sheet {
    /* sheet通过padding-bottom让输入框贴合键盘 */
    height: 100% !important;
    max-height: 100% !important;
    box-sizing: border-box !important;
}
/* 非 native-resize（iOS / 老安卓 / 鸿蒙等 webview 不缩小的场景）：
   用 padding-bottom 让输入框贴合键盘上弹 */
html.keyboard-active:not(.kb-native-resize) .merchant-msg-sheet {
    padding-bottom: var(--keyboard-height, 0px) !important;
}
/* [FIX-APK二手/商家聊天输入框飞天-2026-07-12]
   APK 走 native resize（capacitor Keyboard resize:native），键盘弹出时 WebView 已被系统
   自动缩小(减去键盘高度)，sheet 的 height:100% 就是缩小后的高度、输入框自然贴在键盘正上方。
   若此时再加 padding-bottom:var(--keyboard-height) 会二次补偿，把输入框顶到键盘上方
   整整一个键盘高度——即"输入框飞天"。故 native-resize 下 padding 归零。
   与主聊天 apk-perf.css 里 .kb-native-resize 排除 transform 的处理保持一致。 */
html.kb-native-resize.keyboard-active .merchant-msg-sheet {
    padding-bottom: 0 !important;
}
html.keyboard-active .merchant-msg-replies {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
}
html.keyboard-active .merchant-msg-input-wrap {
    flex-shrink: 0 !important;
}

/* [FIX-二手咨询跳转] 二手聊天 modal(.sh-modal) 也需要键盘适配，
   否则键盘弹出时全屏 fixed 容器被可视视口挤压/位移，露出底层购物界面。
   与 .merchant-msg-modal 保持一致：容器保持全屏不变，输入框贴合键盘上弹。 */
html.keyboard-active .sh-modal {
    top: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
}

/* ============================================================ */
/* =========== Stage 3: 好友二手市场 Feed 样式 ================= */
/* ============================================================ */

.sh-feed-block {
    margin: 0 12px 14px;
    background: linear-gradient(135deg, #fff 0%, #faf5ff 100%);
    border-radius: 14px;
    padding: 12px;
    border: 1px solid #f0e6ff;
}

.sh-feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.sh-feed-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.sh-refresh-btn {
    padding: 6px 12px;
    background: linear-gradient(135deg, #9b59b6, #b06dd0);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sh-refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sh-section-divider {
    text-align: center;
    font-size: 11px;
    color: #bbb;
    padding: 10px 0 6px;
}

.sh-section-divider span {
    display: inline-block;
    padding: 0 10px;
}

.sh-empty {
    padding: 30px 20px;
    text-align: center;
}

.sh-empty i { display: block; margin-bottom: 10px; }

.sh-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.sh-card {
    position: relative;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: transform .15s;
}

.sh-card:active { transform: scale(0.98); }

.sh-card-cover {
    position: relative;
    height: 90px;
    background: linear-gradient(135deg, #fff0f7, #fff5ef);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sh-card-emoji { font-size: 40px; }

.sh-card-cond {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 10px;
}

.sh-card-body { padding: 8px 10px 10px; }

.sh-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}

.sh-card-desc {
    font-size: 11px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    margin-bottom: 6px;
    line-height: 1.3;
    min-height: 14px;
}

.sh-card-price-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.sh-card-price {
    font-size: 15px;
    font-weight: 700;
    color: #fa5151;
}

.sh-card-original {
    font-size: 10px;
    color: #aaa;
    text-decoration: line-through;
}

.sh-discount {
    font-size: 10px;
    color: #ff6b35;
    background: #fff0e8;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: auto;
}

.sh-card-seller {
    display: flex;
    align-items: center;
    gap: 5px;
}

.sh-card-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    overflow: hidden;
    background: #eee;
    flex-shrink: 0;
}

.sh-card-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sh-avatar-ph {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #ffb58c, #9b59b6);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
}

.sh-card-seller-name {
    font-size: 11px;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.sh-sold-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    border-radius: inherit;
}

/* ====== 二手商品详情 Modal ====== */
.sh-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

.sh-modal.show { opacity: 1; pointer-events: auto; }

.sh-detail-sheet {
    width: 100%;
    max-width: 500px;
    max-height: 92vh;
    background: #fff;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sh-modal.show .sh-detail-sheet { transform: translateY(0); }
.sh-modal.show .merchant-msg-sheet { transform: translateY(0); }

.sh-detail-header {
    display: flex;
    justify-content: flex-end;
    padding: 10px 12px;
    flex-shrink: 0;
}

.sh-detail-close {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: #888;
    border-radius: 50%;
}

.sh-detail-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 20px 20px;
}

.sh-detail-cover {
    height: 180px;
    background: linear-gradient(135deg, #fff0f7, #fff5ef);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.sh-detail-emoji { font-size: 80px; }

.sh-detail-title {
    font-size: 19px;
    font-weight: 700;
    color: #222;
    margin-bottom: 8px;
}

.sh-detail-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}

.sh-detail-price {
    font-size: 26px;
    font-weight: 700;
    color: #fa5151;
}

.sh-detail-original {
    font-size: 13px;
    color: #aaa;
    text-decoration: line-through;
}

.sh-detail-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.sh-meta-tag {
    padding: 3px 10px;
    background: #f5f5f5;
    border-radius: 12px;
    font-size: 12px;
    color: #666;
}

.sh-meta-view {
    font-size: 12px;
    color: #bbb;
    margin-left: auto;
}

.sh-detail-section { margin-bottom: 18px; }

.sh-detail-sec-title {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

.sh-detail-desc,
.sh-detail-reason {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #fafafa;
    padding: 12px 14px;
    border-radius: 10px;
    white-space: pre-wrap;
}

.sh-detail-reason {
    background: #fff8e1;
    color: #8b6914;
    font-style: italic;
}

.sh-detail-seller {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fafafa;
    border-radius: 10px;
}

.sh-detail-seller-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: #eee;
    flex-shrink: 0;
}

.sh-detail-seller-avatar img { width:100%; height:100%; object-fit:cover; }

.sh-detail-seller-info { flex: 1; min-width: 0; }

.sh-detail-seller-name {
    font-size: 14px;
    font-weight: 600;
    color: #222;
}

.sh-detail-seller-sub {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.sh-detail-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.sh-detail-sold {
    justify-content: center;
    font-size: 14px;
    color: #999;
    padding: 16px;
}

.sh-action-btn {
    flex: 1;
    border: none;
    padding: 11px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.sh-action-btn i { font-size: 15px; }
.sh-action-btn span { font-size: 12px; }

.sh-action-btn.secondary {
    background: #f5f5f5;
    color: #555;
}

.sh-action-btn.primary {
    background: linear-gradient(135deg, #ff4500, #ff6b35);
    color: #fff;
    flex: 2;
}

.sh-action-btn:active { opacity: 0.85; }

/* 会话中的商品快捷卡 */
.sh-chat-item-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #fffaf0;
    border-bottom: 1px solid #f0e0c0;
    cursor: pointer;
    flex-shrink: 0;
}

.sh-chat-item-emoji {
    width: 36px; height: 36px;
    background: #fff;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.sh-chat-item-info { flex: 1; min-width: 0; }

.sh-chat-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sh-chat-item-price {
    font-size: 13px;
    color: #fa5151;
    font-weight: 600;
}

.sh-chat-item-status {
    font-size: 11px;
    color: #07c160;
    background: #e8f5e9;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.sh-chat-item-status.sold {
    color: #999;
    background: #f0f0f0;
}

/* ==================== [购物补丁-2026] ==================== */

/* [补丁2] 折扣角标 */
.merchant-product-img { position: relative; }
.merchant-product-discount {
    position: absolute;
    top: 6px; left: 6px;
    background: linear-gradient(135deg, #ff4d4f, #ff7875);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(255,77,79,0.35);
    letter-spacing: 0.3px;
}
.merchant-product-origprice {
    color: #aaa;
    text-decoration: line-through;
    font-size: 12px;
    margin-left: 6px;
}

/* [补丁4] 第二排经营数据卡片 */
.merchant-stats-biz { margin-top: 8px; }
.merchant-stats-biz .merchant-stat-v { font-size: 18px; }
.merchant-stats-biz .merchant-stat-l { font-size: 11px; color: #888; }

/* [补丁3] 消息未读红点 */
.merchant-msg-avatar { position: relative; }
.merchant-msg-unread-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #fa5151;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(250,81,81,0.3);
}
.merchant-msg-item.is-unread {
    background: linear-gradient(90deg, rgba(250,81,81,0.04), transparent 40%);
}
.merchant-msg-item.is-unread .merchant-msg-name {
    font-weight: 700;
}
