/* ──────────────────────────────────────────────────────────────────────────
   Sales Order — POS layout: product catalog pane, cart pane and checkout.

   These rules style markup that lives in child components of SalesOrderForm
   (ProductPane / CartPane / OrderSummary). Blazor's scoped CSS stamps its
   isolation attribute only on a component's own elements, so rules kept in
   SalesOrderForm.razor.css never matched the child markup even under ::deep —
   the catalog rendered unstyled. They live here as global rules instead,
   namespaced by the pos-/cart- prefixes.
   ────────────────────────────────────────────────────────────────────────── */

/* ── Page-standard type scale ──
   The POS page reads at the theme's fs-3 (1.5rem on desktop) so it stays legible
   at arm's length; form controls and buttons scale up with it. */
.pos-page {
    font-size: calc(1.275rem + 0.3vw);
}

@media (min-width: 1200px) {
    .pos-page {
        font-size: 1.5rem;
    }
}

.pos-page .form-control,
.pos-page .form-control-sm {
    font-size: 1.15rem;
}

.pos-page .btn {
    font-size: 1.1rem;
}

/* ── Two-pane POS layout ──
   The panes sit in a standard bootstrap row (col-lg-7 / col-lg-5). The theme
   sizes every .card to calc(100% - 30px) with a 1.875rem bottom margin, which
   stretched the pane to its column height and spread the cart line cards apart -
   neutralize both inside the panes so cards take their natural height. */
.pos-cart-pane,
.pos-cart-pane .card,
.pos-grid > .card {
    height: auto;
    margin-bottom: 0;
}

/* Search + filter chips stay reachable while the grid scrolls under them. */
.pos-pane-toolbar {
    position: sticky;
    top: 4.25rem;
    z-index: 5;
    background: #fff;
    padding-bottom: 0.5rem;
}

/* Fixed bottom summary bar for small screens; hidden on desktop where the
   cart pane is always visible. */
.pos-mobile-bar {
    display: none;
}

@media (max-width: 991.98px) {
    .pos-mobile-bar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1030;
        background: #00273a;
        color: #fff;
        padding: 0.6rem 1rem;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        box-shadow: 0 -0.25rem 0.75rem rgba(0, 0, 0, 0.2);
    }

    /* Keeps the last cart rows tappable above the fixed bar. */
    .pos-page-pad {
        padding-bottom: 4.5rem;
    }
}

.pos-category-menu {
    max-height: 320px;
    overflow-y: auto;
}

/* ── Product grid ──
   Capped at 3 across so cards stay wide and the product images read large,
   stepping down on narrow screens. */
.pos-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (max-width: 767.98px) {
    .pos-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.pos-card {
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    overflow: hidden;
}

.pos-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.pos-card-selected {
    outline: 2px solid #1A3263;
}

/* Zero stock stays clickable - the cart shows an over-stock warning and
   validation blocks the save, which is more useful than hiding the product. */
.pos-card-muted .pos-thumb,
.pos-card-muted .card-body {
    opacity: 0.55;
}

/* Exhausted differs: the order already holds every available unit, so adding
   is refused and the card must read as unavailable. */
.pos-card-exhausted {
    cursor: not-allowed;
}

.pos-card-exhausted:hover {
    transform: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.pos-thumb {
    height: 140px;
    overflow: hidden;
}

.pos-thumb-icon {
    color: #547792;
}

.pos-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Product names wrap rather than truncate - two lines, with the reserved
   height keeping the price row aligned across cards in a row. */
/* Font sizes come from the standard fs-* utilities in markup; only the
   two-line clamp behavior needs custom rules. */
.pos-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    min-height: 2.4em;
    line-height: 1.2;
}

.pos-price {
    color: #1A3263;
}

.pos-total {
    color: #1A3263;
}

.pos-cart-icon {
    color: #547792;
}

@media (max-width: 575.98px) {
    .pos-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .pos-thumb {
        height: 96px;
    }
}

/* ── Cart lines ── */
/* Lets the product name truncate inside a flex row rather than widening it. */
.cart-line-main {
    min-width: 0;
}

/* Product names wrap onto as many lines as they need instead of being clipped —
   long descriptions are common and the item cell is the widest column anyway.
   overflow-wrap covers unbroken strings (SKU-like names) that have no space to break on. */
.cart-item-name {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Preserves the line breaks a user typed into a line item description. */
.text-prewrap {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ── Line amounts ──
   Right-aligned inputs on label/value rows; capped so the row reads label-left,
   figure-right without the input stretching the full card width. */
.cart-amount-input {
    max-width: 8rem;
}

/* ── Quantity stepper ──
   A compact inline -/+ control; the value sits between the two buttons and is
   never typed into directly. */
.cart-qty-stepper .cart-qty-value {
    min-width: 2.5rem;
    text-align: center;
}

