/* ===== POS Layout ===== */
.pos-root {
    position: fixed; inset: 0;
    background: #f1f5f9;
    display: flex; flex-direction: column;
    overflow: hidden;
    font-family: 'Inter Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --- Top Bar --- */
.pos-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; height: 52px; min-height: 52px;
    background: #fff; border-bottom: 1px solid #e2e8f0;
}
.pos-topbar-left { display: flex; align-items: center; gap: 12px; }
.pos-topbar-left .cinema-name { font-weight: 700; font-size: 15px; color: #1e293b; }
.pos-topbar-center { font-size: 13px; color: #64748b; font-weight: 500; }
.pos-topbar-right { display: flex; align-items: center; gap: 8px; }

.pos-held-badge {
    position: relative; display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 500;
    background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; cursor: pointer;
    transition: all .15s;
}
.pos-held-badge:hover { background: #ffedd5; }
.pos-held-badge .count {
    background: #ea580c; color: #fff; font-size: 11px; font-weight: 700;
    width: 20px; height: 20px; border-radius: 50%; display: inline-flex;
    align-items: center; justify-content: center;
}

.pos-exit-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 500;
    background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0;
    cursor: pointer; transition: all .15s;
}
.pos-exit-btn:hover { background: #e2e8f0; color: #334155; }

/* --- Main Area --- */
.pos-main {
    flex: 1; display: flex; gap: 0; overflow: hidden;
}

/* --- Left Panel: Items --- */
.pos-items-panel {
    flex: 3; display: flex; flex-direction: column; padding: 16px 20px;
    overflow: hidden;
}
.pos-search-bar {
    display: flex; gap: 10px; margin-bottom: 12px;
}
.pos-search-bar input {
    flex: 1; padding: 10px 14px; border-radius: 10px; border: 1px solid #e2e8f0;
    font-size: 14px; background: #fff; outline: none; transition: border-color .15s;
}
.pos-search-bar input:focus { border-color: var(--brand-400); box-shadow: 0 0 0 3px rgba(99,102,241,.08); }

.pos-category-pills {
    display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px;
}
.pos-pill {
    padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 500;
    border: 1px solid #e2e8f0; background: #fff; color: #64748b;
    cursor: pointer; transition: all .15s; white-space: nowrap;
}
.pos-pill:hover { border-color: var(--brand-300); color: var(--brand-600); }
.pos-pill.active {
    background: var(--brand-600); color: #fff; border-color: var(--brand-600);
}

.pos-items-list {
    flex: 1; overflow-y: auto; background: #fff; border-radius: 12px;
    border: 1px solid #e2e8f0;
}
.pos-items-list table { width: 100%; border-collapse: collapse; }
.pos-items-list thead th {
    position: sticky; top: 0; background: #f8fafc; padding: 10px 14px;
    font-size: 12px; font-weight: 600; color: #64748b; text-transform: uppercase;
    letter-spacing: .03em; border-bottom: 1px solid #e2e8f0; z-index: 1;
}
.pos-items-list tbody tr {
    cursor: pointer; transition: background .1s;
}
.pos-items-list tbody tr:hover { background: #f8fafc; }
.pos-items-list tbody tr.in-cart { background: #f1f5f9; }
.pos-items-list tbody tr.in-cart:hover { background: #e2e8f0; }
.pos-items-list tbody td { padding: 10px 14px; font-size: 13px; border-bottom: 1px solid #f1f5f9; }
.pos-items-list .item-name { font-weight: 600; color: #1e293b; }
.pos-items-list .item-sku { color: #94a3b8; font-size: 12px; }
.pos-items-list .item-price { font-weight: 600; color: var(--brand-600); }

.pos-add-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--brand-50); color: var(--brand-600); border: 1px solid var(--brand-200);
    font-size: 18px; font-weight: 700; cursor: pointer; transition: all .15s;
}
.pos-add-btn:hover { background: var(--brand-600); color: #fff; }

/* --- Right Panel: Cart --- */
.pos-cart-panel {
    flex: 2; display: flex; flex-direction: column;
    background: #fff; border-left: 1px solid #e2e8f0;
    min-width: 340px; max-width: 440px;
}
.pos-cart-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid #f1f5f9;
}
.pos-cart-header h3 { font-size: 15px; font-weight: 700; color: #1e293b; margin: 0; }
.pos-cart-count { font-size: 12px; color: #94a3b8; font-weight: 500; }

.pos-cart-items {
    flex: 1; overflow-y: auto; padding: 0;
}
.pos-cart-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; color: #94a3b8; font-size: 14px; gap: 8px;
}
.pos-cart-empty i { font-size: 40px; color: #cbd5e1; }

.pos-cart-line {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px; border-bottom: 1px solid #f1f5f9;
    transition: background .1s;
}
.pos-cart-line:hover { background: #f8fafc; }
.pos-cart-line-info { flex: 1; min-width: 0; }
.pos-cart-line-name { font-size: 13px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-cart-line-price { font-size: 12px; color: #94a3b8; }

.pos-qty-control {
    display: flex; align-items: center; gap: 0; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden;
}
.pos-qty-btn {
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    background: #f8fafc; border: none; cursor: pointer; font-size: 14px; font-weight: 700;
    color: #64748b; transition: all .1s;
}
.pos-qty-btn:hover { background: #e2e8f0; color: #1e293b; }
.pos-qty-val {
    width: 32px; text-align: center; font-size: 13px; font-weight: 600; color: #1e293b;
    border-left: 1px solid #e2e8f0; border-right: 1px solid #e2e8f0;
    background: #fff; line-height: 28px;
}

.pos-cart-line-total { font-size: 13px; font-weight: 700; color: #1e293b; white-space: nowrap; min-width: 60px; text-align: right; }

.pos-cart-line-remove {
    width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
    border-radius: 6px; background: none; border: none; cursor: pointer; color: #cbd5e1;
    font-size: 14px; transition: all .1s;
}
.pos-cart-line-remove:hover { color: #ef4444; background: #fef2f2; }

/* --- Cart Footer --- */
.pos-cart-footer {
    padding: 16px 18px; border-top: 1px solid #e2e8f0;
}
.pos-cart-totals {
    display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px;
}
.pos-cart-total-row {
    display: flex; justify-content: space-between; font-size: 13px; color: #64748b;
}
.pos-cart-total-row.grand {
    font-size: 20px; font-weight: 800; color: #1e293b; padding-top: 8px;
    border-top: 2px solid #1e293b; margin-top: 4px;
}
.pos-cart-total-row.grand .amount { color: var(--brand-600); }

.pos-cart-actions { display: flex; gap: 8px; }
.pos-btn-hold {
    flex: 1; padding: 12px; border-radius: 10px; font-weight: 600; font-size: 13px;
    background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; cursor: pointer;
    transition: all .15s; text-align: center;
}
.pos-btn-hold:hover { background: #ffedd5; }
.pos-btn-clear {
    flex: 1; padding: 12px; border-radius: 10px; font-weight: 600; font-size: 13px;
    background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; cursor: pointer;
    transition: all .15s; text-align: center;
}
.pos-btn-clear:hover { background: #fee2e2; }
.pos-btn-checkout {
    flex: 2; padding: 12px; border-radius: 10px; font-weight: 700; font-size: 14px;
    background: #16a34a; color: #fff; border: none; cursor: pointer;
    transition: all .15s; text-align: center;
}
.pos-btn-checkout:hover { background: #15803d; }
.pos-btn-checkout:disabled { opacity: .4; cursor: not-allowed; }

/* --- Modals --- */
.pos-modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 100;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px); animation: posFadeIn .2s ease;
}
.pos-modal {
    background: #fff; border-radius: 16px; box-shadow: 0 25px 60px rgba(0,0,0,.15);
    max-height: 90vh; overflow-y: auto; width: 480px; animation: posSlideUp .25s ease;
}
.pos-modal-lg { width: 560px; }
.pos-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px; border-bottom: 1px solid #f1f5f9;
}
.pos-modal-header h3 { font-size: 16px; font-weight: 700; margin: 0; color: #1e293b; }
.pos-modal-close {
    width: 32px; height: 32px; border-radius: 8px; display: flex;
    align-items: center; justify-content: center; background: #f1f5f9;
    border: none; cursor: pointer; font-size: 16px; color: #64748b;
    transition: all .15s;
}
.pos-modal-close:hover { background: #e2e8f0; color: #1e293b; }
.pos-modal-body { padding: 20px 24px; }
.pos-modal-footer { padding: 16px 24px; border-top: 1px solid #f1f5f9; }

/* Payment method buttons */
.pos-pay-methods { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.pos-pay-method {
    padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
    border: 1px solid #e2e8f0; background: #fff; color: #64748b;
    cursor: pointer; transition: all .15s;
}
.pos-pay-method:hover { border-color: var(--brand-300); color: var(--brand-600); }
.pos-pay-method.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }

/* Payment lines */
.pos-pay-line {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.pos-pay-line .method-label {
    min-width: 70px; font-size: 13px; font-weight: 600; color: #1e293b;
}
.pos-pay-line input {
    flex: 1; padding: 8px 12px; border-radius: 8px; border: 1px solid #e2e8f0;
    font-size: 14px; font-weight: 600; text-align: right;
}
.pos-pay-line input:focus { border-color: var(--brand-400); outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,.08); }
.pos-pay-line-remove {
    width: 28px; height: 28px; border-radius: 6px; display: flex;
    align-items: center; justify-content: center; background: #fef2f2;
    border: none; cursor: pointer; color: #ef4444; font-size: 14px;
}

.pos-pay-summary {
    margin-top: 12px; padding: 12px; border-radius: 10px; background: #f8fafc;
    border: 1px solid #e2e8f0;
}
.pos-pay-summary-row {
    display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0;
}
.pos-pay-summary-row.remaining { color: #dc2626; font-weight: 700; }
.pos-pay-summary-row.change { color: #16a34a; font-weight: 700; }
.pos-pay-summary-row.paid { color: #1e293b; font-weight: 600; }

.pos-complete-btn {
    width: 100%; padding: 14px; border-radius: 10px; font-weight: 700; font-size: 15px;
    background: #16a34a; color: #fff; border: none; cursor: pointer; transition: all .15s;
}
.pos-complete-btn:hover { background: #15803d; }
.pos-complete-btn:disabled { opacity: .4; cursor: not-allowed; }

/* --- Held Orders Dropdown --- */
.pos-held-dropdown {
    position: absolute; top: 100%; right: 0; margin-top: 6px;
    width: 320px; background: #fff; border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,.12); border: 1px solid #e2e8f0;
    z-index: 50; animation: posSlideUp .15s ease;
}
.pos-held-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid #f1f5f9;
}
.pos-held-item:last-child { border-bottom: none; }
.pos-held-item-info { flex: 1; }
.pos-held-item-name { font-size: 13px; font-weight: 600; color: #1e293b; }
.pos-held-item-detail { font-size: 12px; color: #94a3b8; }
.pos-held-item-actions { display: flex; gap: 4px; }

/* --- Receipt --- */
.pos-receipt { font-size: 13px; color: #1e293b; }
.pos-receipt-header { text-align: center; margin-bottom: 16px; }
.pos-receipt-header h4 { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.pos-receipt-header p { font-size: 12px; color: #64748b; margin: 0; }
.pos-receipt-divider { border-top: 1px dashed #cbd5e1; margin: 12px 0; }
.pos-receipt table { width: 100%; font-size: 12px; }
.pos-receipt th { font-weight: 600; color: #64748b; padding: 4px 0; text-align: left; }
.pos-receipt td { padding: 4px 0; }
.pos-receipt .text-right { text-align: right; }
.pos-receipt-total { font-size: 18px; font-weight: 800; text-align: center; margin: 12px 0; }

/* --- Animations --- */
@keyframes posFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes posSlideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* --- Print --- */
@media print {
    body * { visibility: hidden; }
    .pos-receipt, .pos-receipt * { visibility: visible; }
    .pos-receipt { position: absolute; left: 0; top: 0; width: 80mm; font-size: 11px; }
    .pos-modal-header, .pos-modal-footer, .pos-modal-close { display: none !important; }
}
