/**
 * System-Wide Semantic Status Color Standard (Storefront + CMS)
 * Single source of truth for per-status pill colors across orders, consignments, quick view, chat, wallet & CMS.
 * Rule: Distinct statuses MUST have distinct, readable, high-contrast hues; identical statuses MUST match everywhere.
 */

.app-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 4px;
    background: var(--app-st-bg, #f3f4f6);
    color: var(--app-st-fg, #374151);
    border: 1px solid var(--app-st-border, #e5e7eb);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.35;
    white-space: nowrap;
}

/* Order & Consignment Lifecycle Palette (14 distinct tokens) */
.is-status-pending_payment,
.is-status-status-pending {
    --app-st-bg: #fefce8;
    --app-st-fg: #a16207;
    --app-st-border: #fde047;
}

.is-status-deposited,
.is-status-status-deposited {
    --app-st-bg: #fffbeb;
    --app-st-fg: #b45309;
    --app-st-border: #fcd34d;
}

.is-status-declared {
    --app-st-bg: #f0f9ff;
    --app-st-fg: #0369a1;
    --app-st-border: #bae6fd;
}

.is-status-purchasing,
.is-status-status-processing {
    --app-st-bg: #eef2ff;
    --app-st-fg: #4338ca;
    --app-st-border: #c7d2fe;
}

.is-status-awaiting_purchase_approval,
.is-status-status-awaiting-approval {
    --app-st-bg: #f5f3ff;
    --app-st-fg: #6d28d9;
    --app-st-border: #ddd6fe;
}

.is-status-ordered,
.is-status-status-ordered {
    --app-st-bg: #ecfeff;
    --app-st-fg: #0e7490;
    --app-st-border: #a5f3fc;
}

.is-status-shipping,
.is-status-status-shipped,
.is-status-status-shipping {
    --app-st-bg: #eff6ff;
    --app-st-fg: #1d4ed8;
    --app-st-border: #bfdbfe;
}

.is-status-warehouse_vn,
.is-status-status-warehouse,
.is-status-status-warehouse_vn {
    --app-st-bg: #f0fdfa;
    --app-st-fg: #0f766e;
    --app-st-border: #99f6e4;
}

.is-status-pending_settlement,
.is-status-status-pending-settlement,
.is-status-status-pending_settlement {
    --app-st-bg: #fff1f2;
    --app-st-fg: #be123c;
    --app-st-border: #fecdd3;
}

.is-status-ready_to_ship,
.is-status-status-ready-to-ship,
.is-status-status-ready_to_ship {
    --app-st-bg: #f7fee7;
    --app-st-fg: #3f6212;
    --app-st-border: #d9f99d;
}

.is-status-delivering,
.is-status-status-delivering {
    --app-st-bg: #fff5ef;
    --app-st-fg: #e84900;
    --app-st-border: #ffd0b5;
}

.is-status-completed,
.is-status-status-completed {
    --app-st-bg: #ecfdf5;
    --app-st-fg: #047857;
    --app-st-border: #a7f3d0;
}

.is-status-cancelled,
.is-status-status-cancelled {
    --app-st-bg: #f3f4f6;
    --app-st-fg: #6b7280;
    --app-st-border: #e5e7eb;
}

.is-status-cancel_requested {
    --app-st-bg: #fef2f2;
    --app-st-fg: #b91c1c;
    --app-st-border: #fecaca;
}

/* Wallet Withdrawal Statuses */
.is-status-requested {
    --app-st-bg: #fffbeb;
    --app-st-fg: #b45309;
    --app-st-border: #fcd34d;
}

.is-status-processing {
    --app-st-bg: #eff6ff;
    --app-st-fg: #1d4ed8;
    --app-st-border: #bfdbfe;
}

.is-status-paid {
    --app-st-bg: #ecfdf5;
    --app-st-fg: #047857;
    --app-st-border: #a7f3d0;
}

.is-status-rejected {
    --app-st-bg: #fef2f2;
    --app-st-fg: #b91c1c;
    --app-st-border: #fecaca;
}

/* Delivery Request (PG) & Outbound (PXK) Statuses */
.is-status-draft,
.is-status-customer_confirmed {
    --app-st-bg: #fff1f2;
    --app-st-fg: #be123c;
    --app-st-border: #fecdd3;
}

.is-status-settled,
.is-status-confirmed {
    --app-st-bg: #f0fdfa;
    --app-st-fg: #0f766e;
    --app-st-border: #99f6e4;
}

.is-status-picking {
    --app-st-bg: #eef2ff;
    --app-st-fg: #4338ca;
    --app-st-border: #c7d2fe;
}

.is-status-ready,
.is-status-dispatched {
    --app-st-bg: #fff5ef;
    --app-st-fg: #e84900;
    --app-st-border: #ffd0b5;
}

.is-status-delivered {
    --app-st-bg: #ecfdf5;
    --app-st-fg: #047857;
    --app-st-border: #a7f3d0;
}

/* Apply semantic CSS variables across all UI surfaces with priority over legacy fallback/Bootstrap rules */
.app-status-pill[class*="is-status-"],
.account-order-status-pill[class*="is-status-"],
.orders-qv-status[class*="is-status-"],
.order-detail-page .order-hero-badge[class*="is-status-"],
.order-detail-page .order-history-status[class*="is-status-"],
.buyer-chat-context-status-pill[class*="is-status-"],
.buyer-order-index .label.app-status-pill[class*="is-status-"],
.buyer-consignment-index .label.app-status-pill[class*="is-status-"],
.cms-badge.app-status-pill[class*="is-status-"] {
    background: var(--app-st-bg, #f3f4f6) !important;
    color: var(--app-st-fg, #374151) !important;
    border: 1px solid var(--app-st-border, #e5e7eb) !important;
}

/* Compact typography on Storefront surfaces vs balanced bold in CMS tables */
.buyer-order-index .label.app-status-pill,
.buyer-consignment-index .label.app-status-pill,
.buyer-order-status.app-status-pill {
    font-weight: 600;
}
