/* Inventory SaaS — Theme Package 5
   POS redesign
*/

.pos-page {
    max-width: 1600px;
    margin: 0 auto;
}

.pos-page .page-header {
    margin-bottom: 16px;
}

.pos-layout,
.pos-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(360px, .7fr);
    gap: 18px;
    align-items: start;
}

/* Left side: catalogue */
.pos-products,
.pos-catalogue {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.pos-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.pos-panel-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
}

.pos-panel-subtitle {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.pos-search-row {
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.pos-search {
    flex: 1;
    position: relative;
}

.pos-search input {
    margin: 0;
    min-height: 46px;
    padding-left: 40px;
    font-size: 14px;
    background: #fff;
}

.pos-search::before {
    content: "⌕";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 20px;
    z-index: 2;
}

.pos-barcode-btn {
    min-width: 48px;
    padding-inline: 13px;
}

.pos-category-tabs {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    scrollbar-width: thin;
}

.pos-category-tabs a,
.pos-category-tabs button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 6px 11px;
    background: #fff;
    color: #475569;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    box-shadow: none;
}

.pos-category-tabs .active,
.pos-category-tabs a:hover,
.pos-category-tabs button:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #bfdbfe;
}

.product-list,
.pos-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 12px;
    padding: 16px;
    margin: 0;
    max-height: calc(100vh - 285px);
    min-height: 420px;
    overflow-y: auto;
}

.product-item,
.pos-product-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 132px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
    transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.product-item:hover,
.pos-product-card:hover {
    transform: translateY(-1px);
    border-color: #bfdbfe;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .08);
    background: #fff;
}

.product-item:active,
.pos-product-card:active {
    transform: translateY(0);
}

.pos-product-name {
    color: var(--text);
    font-size: 13px;
    font-weight: 750;
    line-height: 1.35;
}

.pos-product-sku {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
}

.pos-product-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-end;
    margin-top: 12px;
}

.pos-product-price {
    color: #0f172a;
    font-size: 16px;
    font-weight: 850;
    letter-spacing: -.02em;
}

.pos-product-stock {
    color: var(--muted);
    font-size: 10px;
    text-align: right;
}

.pos-product-stock.low {
    color: var(--danger);
    font-weight: 750;
}

.pos-product-card.out-of-stock,
.product-item.out-of-stock {
    opacity: .55;
    cursor: not-allowed;
    background: #f8fafc;
}

/* Right side: cart */
.pos-cart {
    position: sticky;
    top: calc(var(--topbar-height) + 18px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.pos-cart-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pos-cart-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
}

.pos-cart-count {
    display: inline-grid;
    place-items: center;
    min-width: 27px;
    height: 27px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
}

.pos-customer-box {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.pos-customer-box label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .045em;
}

.pos-customer-box select,
.pos-customer-box input {
    margin: 5px 0 0;
}

.pos-cart-items {
    max-height: 355px;
    overflow-y: auto;
}

.pos-cart-empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--muted);
}

.pos-cart-empty strong {
    display: block;
    color: var(--text);
    margin-bottom: 5px;
}

.pos-cart-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #edf2f7;
}

.pos-cart-row:hover {
    background: #fafcff;
}

.pos-cart-item-name {
    font-weight: 750;
    line-height: 1.3;
}

.pos-cart-item-meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.pos-cart-item-total {
    text-align: right;
    font-weight: 800;
}

.pos-qty-controls {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
}

.pos-qty-controls button {
    width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    background: #fff;
    color: #334155;
    border: 1px solid var(--border);
    box-shadow: none;
}

.pos-qty-controls button:hover {
    background: #f8fafc;
}

.pos-qty-value {
    min-width: 30px;
    text-align: center;
    font-weight: 750;
}

.pos-remove {
    margin-top: 7px;
    padding: 0;
    min-height: auto;
    background: transparent;
    color: var(--danger);
    font-size: 11px;
}

.pos-remove:hover {
    background: transparent;
    text-decoration: underline;
}

.cart-summary,
.pos-summary {
    margin: 0;
    padding: 14px 16px;
    background: #f8fafc;
    border-radius: 0;
    border-top: 1px solid var(--border);
}

.pos-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 5px 0;
    color: #475569;
}

.pos-summary-row strong {
    color: var(--text);
}

.pos-summary-row.total {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px dashed #cbd5e1;
    color: var(--text);
    font-size: 19px;
    font-weight: 850;
}

.pos-summary-row.total strong {
    font-size: 22px;
    letter-spacing: -.03em;
}

.pos-payment {
    padding: 14px 16px 16px;
    border-top: 1px solid var(--border);
}

.pos-payment-title {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .045em;
}

.pos-payment-methods {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 12px;
}

.pos-payment-method {
    min-height: 42px;
    background: #fff;
    color: #334155;
    border: 1px solid var(--border);
    box-shadow: none;
}

.pos-payment-method:hover,
.pos-payment-method.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #93c5fd;
}

.pos-tender-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.pos-tender-grid .form-field {
    margin: 0;
}

.pos-tender-grid input,
.pos-tender-grid select {
    margin: 0;
}

.pos-change-box {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--success-bg);
    color: #166534;
    font-weight: 750;
}

.pos-checkout-actions {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 8px;
    margin-top: 13px;
}

.pos-clear-cart {
    background: #fff;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.pos-clear-cart:hover {
    background: var(--danger-bg);
}

.pos-complete-sale {
    min-height: 48px;
    font-size: 15px;
    font-weight: 800;
}

/* Register status */
.pos-register-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 750;
}

.pos-register-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.pos-register-status.open {
    background: var(--success-bg);
    color: #166534;
}

.pos-register-status.open::before {
    background: #22c55e;
}

.pos-register-status.closed {
    background: var(--danger-bg);
    color: #991b1b;
}

.pos-register-status.closed::before {
    background: #ef4444;
}

/* POS alert strip */
.pos-alert {
    margin-bottom: 14px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    font-size: 12px;
    font-weight: 650;
}

.pos-alert-warning {
    background: var(--warning-bg);
    color: #854d0e;
    border-color: #fde68a;
}

.pos-alert-danger {
    background: var(--danger-bg);
    color: #991b1b;
    border-color: #fecaca;
}

/* Receipt refinements */
.receipt-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.receipt {
    width: min(100%, 420px);
    background: #fff;
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.receipt .center {
    text-align: center;
}

.receipt table {
    width: 100%;
    margin-top: 12px;
    background: transparent;
}

.receipt table th,
.receipt table td {
    padding: 7px 3px;
    background: transparent;
    border-bottom: 1px dashed #e2e8f0;
    font-size: 12px;
}

.receipt-buttons {
    margin-top: 18px;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.grand {
    font-size: 18px;
    font-weight: 850;
}

/* Fullscreen-friendly POS */
body.pos-focus-mode .sidebar {
    display: none;
}

body.pos-focus-mode .main-area {
    margin-left: 0;
    width: 100%;
}

body.pos-focus-mode .content {
    max-width: none;
}

/* Responsive */
@media (max-width: 1180px) {
    .pos-layout,
    .pos-wrapper {
        grid-template-columns: minmax(0, 1fr) 390px;
    }

    .product-list,
    .pos-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media (max-width: 980px) {
    .pos-layout,
    .pos-wrapper {
        grid-template-columns: 1fr;
    }

    .pos-cart {
        position: static;
    }

    .product-list,
    .pos-product-grid {
        max-height: 480px;
        min-height: 320px;
    }

    .pos-cart-items {
        max-height: 320px;
    }
}

@media (max-width: 620px) {
    .pos-panel-header,
    .pos-search-row,
    .pos-category-tabs,
    .product-list,
    .pos-product-grid,
    .pos-cart-header,
    .pos-customer-box,
    .pos-payment {
        padding-left: 12px;
        padding-right: 12px;
    }

    .product-list,
    .pos-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .product-item,
    .pos-product-card {
        min-height: 122px;
        padding: 11px;
    }

    .pos-payment-methods {
        grid-template-columns: 1fr;
    }

    .pos-tender-grid {
        grid-template-columns: 1fr;
    }

    .pos-checkout-actions {
        grid-template-columns: 1fr;
    }

    .pos-complete-sale {
        order: -1;
    }
}

@media print {
    .pos-page,
    .pos-wrapper,
    .pos-layout,
    .pos-products,
    .pos-catalogue,
    .pos-cart,
    .receipt-buttons {
        box-shadow: none;
    }

    .pos-products,
    .pos-catalogue,
    .pos-cart {
        display: none !important;
    }

    .receipt {
        width: 100%;
        border: 0;
        box-shadow: none;
        padding: 0;
    }
}
