/* ═══════════════════════════════════════════════════════════════
   POS — Point of Sale Screen Styles
   Full-screen layout optimized for cashier workflow
   ═══════════════════════════════════════════════════════════════ */

/* ─── POS Shell ─── */
.pos-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-page);
    overflow: hidden;
}

/* ─── POS Header ─── */
.pos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding-inline: var(--space-l);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}

.pos-header__start {
    display: flex;
    align-items: center;
    gap: var(--space-m);
}

.pos-header__back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-m);
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--duration-fast), color var(--duration-fast);
}

.pos-header__back:hover {
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
}

.pos-header__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.pos-header__center {
    display: flex;
    align-items: center;
    gap: var(--space-m);
    font-size: 13px;
    color: var(--text-secondary);
}

.pos-header__separator {
    color: var(--border-default);
}

.pos-header__end {
    display: flex;
    align-items: center;
    gap: var(--space-l);
}

.pos-header__stats {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 13px;
    color: var(--text-secondary);
}

.pos-header__stats strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ─── POS Body ─── */
.pos-body {
    display: grid;
    grid-template-columns: 1fr 380px;
    flex: 1;
    overflow: hidden;
}

/* ─── Products Panel ─── */
.pos-products {
    display: flex;
    flex-direction: column;
    border-inline-start: 1px solid var(--border-default);
    overflow: hidden;
}

/* ─── Search ─── */
.pos-search {
    position: relative;
    padding: var(--space-m) var(--space-l);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}

.pos-search__icon {
    position: absolute;
    top: 50%;
    inset-inline-start: calc(var(--space-l) + var(--space-m));
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.pos-search__input {
    width: 100%;
    height: 40px;
    padding-inline-start: 36px;
    padding-inline-end: var(--space-xl);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-m);
    font-family: var(--font-family);
    font-size: 14px;
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: border-color var(--duration-fast);
}

.pos-search__input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 1px var(--brand-primary);
}

.pos-search__input::placeholder {
    color: var(--text-tertiary);
}

.pos-search__clear {
    position: absolute;
    top: 50%;
    inset-inline-end: calc(var(--space-l) + var(--space-s));
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--bg-surface-secondary);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: background var(--duration-fast), color var(--duration-fast);
}

.pos-search__clear:hover {
    background: var(--bg-surface-tertiary);
    color: var(--text-primary);
}

/* ─── Category Filter ─── */
.pos-categories {
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-s) var(--space-l);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    overflow-x: auto;
    flex-shrink: 0;
}

.pos-categories::-webkit-scrollbar {
    height: 0;
}

.pos-categories__btn {
    flex-shrink: 0;
    height: 28px;
    padding-inline: var(--space-m);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    font-family: var(--font-family);
    font-size: 12px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--duration-fast);
}

.pos-categories__btn:hover {
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
}

.pos-categories__btn.active {
    background: var(--brand-primary);
    color: var(--text-on-brand);
    border-color: var(--brand-primary);
}

/* ─── Products Grid ─── */
.pos-products__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-s);
    padding: var(--space-l);
    overflow-y: auto;
    flex: 1;
}

.pos-products__empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-m);
    padding: var(--space-xxxxl);
    color: var(--text-tertiary);
    font-size: 14px;
}

/* ─── Product Card ─── */
.pos-product-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--space-m);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-m);
    cursor: pointer;
    font-family: var(--font-family);
    text-align: start;
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
    min-height: 72px;
}

.pos-product-card:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 1px var(--brand-primary);
}

.pos-product-card:active {
    background: var(--brand-lightest);
}

.pos-product-card--unavailable {
    opacity: 0.5;
    cursor: not-allowed;
}

.pos-product-card--unavailable:hover {
    border-color: var(--border-default);
    box-shadow: none;
}

.pos-product-card--skeleton {
    cursor: default;
}

.pos-product-card__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: var(--space-s);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pos-product-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pos-product-card__price {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-primary);
    direction: ltr;
}

.pos-product-card__price small {
    font-weight: 400;
    font-size: 11px;
    color: var(--text-secondary);
}

.pos-product-card__stock {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    background: var(--bg-surface-secondary);
    color: var(--text-secondary);
}

.pos-product-card__stock.low {
    background: var(--status-warning-bg);
    color: var(--status-warning);
}

.pos-product-card__stock.out {
    background: var(--status-error-bg);
    color: var(--status-error);
}

/* ─── Cart Panel ─── */
.pos-cart {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-inline-start: 1px solid var(--border-default);
    overflow: hidden;
}

.pos-cart__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-m) var(--space-l);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}

.pos-cart__title {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.pos-cart__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding-inline: 4px;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    color: var(--text-on-brand);
    font-size: 11px;
    font-weight: 600;
}

/* ─── Cart Items ─── */
.pos-cart__items {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-s) 0;
}

.pos-cart__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-s);
    padding: var(--space-xxxxl) var(--space-l);
    color: var(--text-tertiary);
    text-align: center;
}

.pos-cart__empty span {
    font-size: 14px;
}

.pos-cart__empty small {
    font-size: 12px;
}

/* ─── Cart Item ─── */
.pos-cart-item {
    padding: var(--space-s) var(--space-l);
    border-bottom: 1px solid var(--border-divider);
    transition: background var(--duration-fast);
}

.pos-cart-item:hover {
    background: var(--bg-surface-secondary);
}

.pos-cart-item__info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.pos-cart-item__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-inline-end: var(--space-s);
}

.pos-cart-item__price {
    font-size: 12px;
    color: var(--text-secondary);
    direction: ltr;
    flex-shrink: 0;
}

.pos-cart-item__controls {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.pos-cart-item__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-s);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--duration-fast);
}

.pos-cart-item__btn:hover {
    background: var(--bg-surface-secondary);
}

.pos-cart-item__qty {
    width: 44px;
    height: 24px;
    text-align: center;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-s);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-surface);
    direction: ltr;
}

.pos-cart-item__qty:focus {
    outline: none;
    border-color: var(--brand-primary);
}

/* Remove spin buttons */
.pos-cart-item__qty::-webkit-outer-spin-button,
.pos-cart-item__qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.pos-cart-item__qty[type=number] {
    -moz-appearance: textfield;
}

.pos-cart-item__total {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    direction: ltr;
    min-width: 70px;
    text-align: end;
    flex-shrink: 0;
}

.pos-cart-item__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: var(--radius-s);
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: background var(--duration-fast), color var(--duration-fast);
}

.pos-cart-item__remove:hover {
    background: var(--status-error-bg);
    color: var(--status-error);
}

/* ─── Cart Totals ─── */
.pos-cart__totals {
    padding: var(--space-m) var(--space-l);
    border-top: 1px solid var(--border-default);
    background: var(--bg-surface-secondary);
    flex-shrink: 0;
}

.pos-cart__total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    padding: var(--space-xxs) 0;
}

.pos-cart__total-row--grand {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    padding-top: var(--space-s);
    margin-top: var(--space-xs);
    border-top: 1px solid var(--border-default);
}

.pos-cart__total-row--grand small {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
}

/* ─── Cart Actions ─── */
.pos-cart__actions {
    padding: var(--space-m) var(--space-l);
    border-top: 1px solid var(--border-default);
    flex-shrink: 0;
}

/* ─── Payment Overlay ─── */
.pos-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Payment Dialog ─── */
.pos-payment-dialog {
    background: var(--bg-surface);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-64);
    width: 520px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-payment-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-l) var(--space-xxl);
    border-bottom: 1px solid var(--border-divider);
}

.pos-payment-dialog__header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.pos-payment-dialog__body {
    padding: var(--space-xxl);
    overflow-y: auto;
    flex: 1;
}

.pos-payment-dialog__footer {
    display: flex;
    align-items: center;
    gap: var(--space-m);
    padding: var(--space-l) var(--space-xxl);
    border-top: 1px solid var(--border-divider);
}

.pos-payment-dialog__due {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-m) var(--space-l);
    background: var(--brand-lightest);
    border: 1px solid var(--brand-light);
    border-radius: var(--radius-m);
    margin-bottom: var(--space-l);
}

.pos-payment-dialog__due span:first-child {
    font-size: 14px;
    color: var(--text-secondary);
}

.pos-payment-dialog__due-amount {
    font-size: 22px;
    font-weight: 700;
    color: var(--brand-primary);
    direction: ltr;
}

.pos-payment-dialog__due-amount small {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
}

/* ─── Payment Tabs ─── */
.pos-payment-tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-l);
    flex-wrap: wrap;
}

.pos-payment-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    height: 32px;
    padding-inline: var(--space-m);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-m);
    font-family: var(--font-family);
    font-size: 13px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast);
    white-space: nowrap;
}

.pos-payment-tab:hover {
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
}

.pos-payment-tab.active {
    background: var(--brand-primary);
    color: var(--text-on-brand);
    border-color: var(--brand-primary);
}

.pos-payment-tab svg {
    width: 16px;
    height: 16px;
}

/* ─── Payment Form ─── */
.pos-payment-form {
    margin-bottom: var(--space-m);
}

.pos-payment-quick-amounts {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-m);
    flex-wrap: wrap;
}

.pos-payment-quick-btn {
    height: 32px;
    padding-inline: var(--space-l);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-m);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    direction: ltr;
    transition: background var(--duration-fast);
}

.pos-payment-quick-btn:hover {
    background: var(--bg-surface-secondary);
}

.pos-payment-quick-btn--exact {
    background: var(--brand-lightest);
    border-color: var(--brand-light);
    color: var(--brand-primary);
}

.pos-payment-quick-btn--exact:hover {
    background: var(--brand-light);
}

.pos-payment-change {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-m) var(--space-l);
    background: var(--status-success-bg);
    border-radius: var(--radius-m);
    border: 1px solid var(--status-success);
}

.pos-payment-change span:first-child {
    font-size: 14px;
    color: var(--text-secondary);
}

.pos-payment-change__amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--status-success);
    direction: ltr;
}

.pos-payment-remaining {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-m) var(--space-l);
    background: var(--status-warning-bg);
    border-radius: var(--radius-m);
    font-size: 14px;
    color: var(--status-warning);
}

/* ─── Invoice Success ─── */
.pos-invoice-success {
    background: var(--bg-surface);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-64);
    width: 400px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}

/* ─── Thermal Receipt ─── */
.pos-receipt {
    background: #FFFFFF;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-m);
    padding: var(--space-l);
    margin: 0 auto;
    max-width: 280px;
    text-align: start;
    font-family: var(--font-family-mono), monospace;
    font-size: 12px;
}

.pos-receipt__header {
    text-align: center;
    margin-bottom: var(--space-s);
}

.pos-receipt__divider {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 10px;
    margin: var(--space-xs) 0;
    letter-spacing: -1px;
}
