/* Shared order-entry workspace for Create Order and POS.
 * Presentation only: stock, pricing, payment and order submission logic stays in
 * the existing page scripts and services.
 */
.order-workspace-header {
    min-height: 76px;
    height: auto;
}

.order-entry-page {
    --order-sidebar-width: 390px;
    padding: 1.25rem;
}

.order-entry-page .order-entry-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) var(--order-sidebar-width);
    gap: 1.25rem !important;
    align-items: start;
}

.order-entry-page .order-product-catalog {
    min-width: 0;
}

.order-catalog-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding: 0 0.125rem;
}

.order-catalog-meta__title {
    color: var(--text-main);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.order-catalog-meta__status,
.order-catalog-meta__hint {
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
}

.order-entry-page #productGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(195px, 100%), 1fr));
    gap: 0.875rem !important;
    align-items: start;
}

.order-entry-page .product-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    border-radius: 0.875rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.order-entry-page .product-card:hover,
.order-entry-page .product-card:focus-visible {
    border-color: color-mix(in srgb, var(--primary) 58%, var(--border));
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.09);
    outline: none;
}

.order-entry-page .product-card:active {
    transform: translateY(0);
}

.order-entry-page .product-card__media {
    display: flex;
    height: clamp(142px, 10.5vw, 172px);
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: #f8fafc;
}

.order-entry-page .product-card__image {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    transform: none;
}

.order-entry-page .product-card:hover .product-card__image {
    transform: scale(1.018);
}

.order-entry-page .product-card__body {
    display: flex;
    min-height: 102px;
    flex: 1;
    flex-direction: column;
    padding: 0.75rem !important;
}

.order-entry-page .product-card__body h4 {
    min-height: 2.125rem;
    margin-bottom: 0.375rem;
    line-height: 1.3;
}

.order-entry-page .order-entry-sidebar {
    width: var(--order-sidebar-width) !important;
    max-height: calc(100vh - 92px);
    max-height: calc(100dvh - 92px);
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 0.25rem;
    position: sticky !important;
    top: 78px !important;
    scrollbar-gutter: stable;
}

.order-entry-page .order-entry-sidebar > * {
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 28px rgba(15, 23, 42, .035);
}

.order-entry-page .order-entry-sidebar #cartContainer {
    min-height: 132px;
    max-height: min(34vh, 310px);
}

.order-entry-page .cart-item img {
    background: #f8fafc;
    object-fit: contain !important;
}

.order-mobile-cart-bar {
    display: none;
}

@media (min-width: 1536px) {
    .order-entry-page {
        --order-sidebar-width: 410px;
        padding: 1.5rem;
    }

    .order-entry-page #productGrid {
        grid-template-columns: repeat(auto-fill, minmax(min(226px, 100%), 1fr));
    }
}

@media (max-width: 1180px) {
    .order-entry-page {
        --order-sidebar-width: 360px;
    }

    .order-entry-page #productGrid {
        grid-template-columns: repeat(auto-fill, minmax(min(176px, 100%), 1fr));
    }
}

@media (max-width: 1023px) {
    .order-entry-page {
        padding: 1rem;
        padding-bottom: 6.25rem;
    }

    .order-entry-page .order-entry-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem !important;
    }

    .order-entry-page .order-entry-sidebar {
        width: 100% !important;
        max-height: none;
        overflow: visible;
        padding-right: 0;
        position: static !important;
    }

    .order-entry-page .order-entry-sidebar #cartContainer {
        max-height: 360px;
    }

    .order-mobile-cart-bar {
        position: fixed;
        z-index: 45;
        right: max(14px, env(safe-area-inset-right));
        bottom: max(14px, env(safe-area-inset-bottom));
        left: max(14px, env(safe-area-inset-left));
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        min-height: 58px;
        padding: 0.625rem 0.75rem 0.625rem 1rem;
        border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
        border-radius: 16px;
        background: color-mix(in srgb, var(--bg-card) 96%, transparent);
        color: var(--text-main);
        box-shadow: 0 18px 45px rgba(15, 23, 42, .2);
        opacity: 0;
        pointer-events: none;
        transform: translateY(18px);
        transition: opacity .2s ease, transform .2s ease;
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
    }

    .order-mobile-cart-bar.is-active {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .order-mobile-cart-bar__copy {
        display: flex;
        min-width: 0;
        flex-direction: column;
        align-items: flex-start;
        line-height: 1.2;
    }

    .order-mobile-cart-bar__copy small {
        color: var(--text-muted);
        font-size: 0.625rem;
        font-weight: 800;
        letter-spacing: .06em;
        text-transform: uppercase;
    }

    .order-mobile-cart-bar__copy strong {
        margin-top: 0.2rem;
        overflow: hidden;
        font-size: 0.875rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .order-mobile-cart-bar__action {
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        gap: 0.5rem;
        min-height: 38px;
        padding: 0.6rem 0.85rem;
        border-radius: 11px;
        background: var(--primary);
        color: #fff;
        font-size: 0.75rem;
        font-weight: 800;
    }
}

@media (max-width: 639px) {
    .order-workspace-header {
        min-height: 68px;
        padding-right: 0.875rem !important;
        padding-left: 0.875rem !important;
    }

    .order-entry-page {
        padding: 0.875rem;
        padding-bottom: 6.25rem;
    }

    .order-catalog-meta__hint {
        display: none;
    }

    .order-entry-page #productGrid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.625rem !important;
    }

    .order-entry-page .product-card__media {
        height: clamp(116px, 37vw, 150px);
        padding: 0.375rem;
    }

    .order-entry-page .product-card__body {
        min-height: 98px;
        padding: 0.625rem !important;
    }

    .order-entry-page .product-card__body h4 {
        min-height: 2rem;
        font-size: 0.75rem;
    }

    .order-entry-page .order-entry-sidebar > div,
    .order-entry-page .order-entry-sidebar #checkoutSection {
        border-radius: 0.875rem;
    }
}

@media (max-width: 374px) {
    .order-entry-page #productGrid {
        grid-template-columns: 1fr;
    }

    .order-entry-page .product-card__media {
        height: 188px;
    }
}

@media (orientation: landscape) and (max-height: 600px) and (max-width: 1023px) {
    .dashboard-body[data-oms-page="pos"] .order-entry-page {
        padding: 0.625rem;
    }

    .dashboard-body[data-oms-page="pos"] .order-entry-page .order-entry-layout {
        grid-template-columns: minmax(0, 1fr) 330px;
    }

    .dashboard-body[data-oms-page="pos"] .order-entry-page .order-entry-sidebar {
        width: 330px !important;
        max-height: calc(100dvh - 64px);
        overflow-y: auto;
        position: sticky !important;
        top: 54px !important;
    }

    .dashboard-body[data-oms-page="pos"] .order-mobile-cart-bar {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .order-entry-page .product-card,
    .order-entry-page .product-card__image,
    .order-mobile-cart-bar {
        transition: none !important;
    }
}
