﻿/* ============================================================
   POS Terminal — Dedicated Styles
   Overrides and extensions for the POS page layout.
   ============================================================ */

/* ── Two-column POS layout ── */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--space-4);
    height: calc(100vh - var(--header-height) - var(--space-6) * 2);
    min-height: 500px;
}

/* ── Left panel: products ── */
.pos-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    overflow: hidden;
}

.pos-shift-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--border-radius);
    font-size: var(--text-sm);
    font-weight: 500;
}

.pos-shift-banner.shift-closed {
    background: var(--color-warning-light);
    color: var(--color-warning);
    border: 1px solid rgba(217, 119, 6, 0.2);
}

.pos-shift-banner.shift-open {
    background: var(--color-success-light);
    color: var(--color-success);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.pos-search-row {
    display: flex;
    gap: var(--space-3);
}

.pos-search-row .form-input {
    flex: 1;
}

/* ── Category tabs ── */
.pos-category-tabs {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    padding-bottom: var(--space-1);
    scrollbar-width: thin;
}

.pos-category-tabs::-webkit-scrollbar {
    height: 4px;
}

.pos-category-tabs::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.cat-tab {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--border-radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    transition: all var(--transition);
}

.cat-tab:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.cat-tab.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text-inverse);
}

/* ── Product grid ── */
.pos-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-3);
    overflow-y: auto;
    flex: 1;
    padding: var(--space-1);
    align-content: start;
}

.pos-product-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--space-3);
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
    text-align: center;
    user-select: none;
}

.pos-product-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.pos-product-card:active {
    transform: scale(0.97);
}

.pos-product-card .product-card-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: var(--space-1);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pos-product-card .product-card-price {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-primary);
    font-family: var(--font-mono);
}

.pos-product-card .product-card-vendor {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
}

/* ── Right panel: order ── */
.pos-right {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.pos-order-header {
    display: flex;
    border-bottom: 1px solid var(--color-border);
}

.pos-order-tab {
    flex: 1;
    padding: var(--space-3);
    text-align: center;
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--color-text-muted);
    transition: all var(--transition);
    background: none;
}

.pos-order-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.pos-order-tab:hover {
    color: var(--color-text);
}

/* ── Cart ── */
.pos-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);
}

.cart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.cart-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-divider);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-family: var(--font-mono);
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.cart-item-qty button {
    width: 28px;
    height: 28px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    font-size: var(--text-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition);
}

.cart-item-qty button:hover {
    background: var(--color-bg);
}

.cart-item-qty span {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
    font-size: var(--text-sm);
}

.cart-item-subtotal {
    font-size: var(--text-sm);
    font-weight: 600;
    font-family: var(--font-mono);
    min-width: 70px;
    text-align: right;
}

.cart-item-remove {
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: var(--text-lg);
    padding: 0 var(--space-1);
    transition: color var(--transition);
    background: none;
    border: none;
}

.cart-item-remove:hover {
    color: var(--color-danger);
}

/* ── Cart footer / totals ── */
.pos-cart-footer {
    border-top: 1px solid var(--color-border);
    padding: var(--space-4);
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.cart-total-label {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.cart-total-value {
    font-size: var(--text-lg);
    font-weight: 700;
    font-family: var(--font-mono);
}

.pos-payment-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.pos-payment-buttons .btn {
    padding: var(--space-3);
    font-size: var(--text-sm);
}

/* ── History tab ── */
.pos-history-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-divider);
    font-size: var(--text-sm);
}

.history-item-order {
    font-weight: 500;
    font-family: var(--font-mono);
}

.history-item-time {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.history-item-total {
    font-weight: 600;
    font-family: var(--font-mono);
}

/* ── Cashout list ── */
.pos-cashout-section {
    margin-top: var(--space-3);
}

.cashout-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg);
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--space-1);
    font-size: var(--text-xs);
}

/* ── Payment modals ── */
.payment-modal-total {
    text-align: center;
    margin-bottom: var(--space-6);
}

.payment-modal-total .total-label {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-1);
}

.payment-modal-total .total-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--color-text);
}

.quick-amount-buttons {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-top: var(--space-2);
}

.quick-amount-buttons .btn {
    flex: 1;
    min-width: 70px;
}

.change-display {
    text-align: center;
    padding: var(--space-4);
    background: var(--color-success-light);
    border-radius: var(--border-radius);
    margin-top: var(--space-3);
}

.change-display .change-label {
    font-size: var(--text-sm);
    color: var(--color-success);
}

.change-display .change-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--color-success);
}

/* ── Close shift wizard ── */
.denomination-grid {
    display: grid;
    grid-template-columns: 1fr 100px 100px;
    gap: var(--space-2);
    align-items: center;
}

.denomination-grid .denom-label {
    font-size: var(--text-sm);
    font-weight: 500;
}

.denomination-grid .form-input {
    text-align: center;
}

.denomination-grid .denom-subtotal {
    font-size: var(--text-sm);
    font-family: var(--font-mono);
    text-align: right;
}

.shift-summary-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-2) 0;
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--color-divider);
}

.shift-summary-row:last-child {
    border-bottom: none;
}

.shift-summary-row .label {
    color: var(--color-text-secondary);
}

.shift-summary-row .value {
    font-weight: 600;
    font-family: var(--font-mono);
}

.variance-positive {
    color: var(--color-success);
}

.variance-negative {
    color: var(--color-danger);
}

