/* pos/pos.css – POS Screen Styles */
body { overflow: hidden; }

.pos-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  height: calc(100vh - 56px);
  gap: 0;
}

/* LEFT PANEL */
.pos-left {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.pos-search-bar {
  padding: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.pos-search-bar .form-control {
  font-size: 15px;
  padding: 10px 14px;
}

.search-dropdown {
  position: absolute;
  top: calc(100% - 4px);
  left: 16px;
  right: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 50;
  max-height: 320px;
  overflow-y: auto;
}

.dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: #eff6ff; }
.dropdown-item .prod-name { font-weight: 500; font-size: 13px; }
.dropdown-item .prod-sku  { font-size: 11px; color: var(--text-muted); }
.dropdown-item .prod-price { font-weight: 700; color: var(--primary); font-size: 13px; }
.dropdown-item .prod-stock { font-size: 11px; color: var(--text-muted); }
.dropdown-item.out-of-stock { opacity: .5; pointer-events: none; }

#cartContainer {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

#cartTable { font-size: 13px; }
#cartTable th { position: sticky; top: 0; background: var(--surface); z-index: 5; }

.cart-qty-control {
  display: flex;
  align-items: center;
  gap: 6px;
}
.qty-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all .1s;
}
.qty-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.qty-input {
  width: 52px;
  text-align: center;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.disc-input {
  width: 56px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  text-align: center;
}
.remove-btn {
  background: none; border: none;
  color: var(--danger); cursor: pointer;
  font-size: 16px; padding: 4px;
  border-radius: 4px;
  transition: background .1s;
}
.remove-btn:hover { background: #fee2e2; }

/* RIGHT PANEL */
.pos-right {
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  background: var(--surface);
}

.pos-customer { }
.pos-customer .form-control { font-size: 13px; }
/* Customer dropdown reuses .search-dropdown but anchors to the inner wrapper */
.pos-customer .search-dropdown {
  top: 100%;
  left: 0;
  right: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
}

.pos-totals .total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.pos-totals .total-row:last-child { border-bottom: none; }
.discount-row { flex-wrap: wrap; gap: 8px; }
.disc-controls { display: flex; gap: 6px; align-items: center; }
.disc-controls .form-control { padding: 4px 8px; font-size: 12px; }
.total-final {
  font-size: 20px !important;
  font-weight: 700;
  padding: 12px 0 !important;
  color: var(--primary);
}

.pay-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pay-btn {
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  text-align: center;
}
.pay-btn:hover  { border-color: var(--primary); color: var(--primary); }
.pay-btn.active { border-color: var(--primary); background: #eff6ff; color: var(--primary); font-weight: 700; }

.change-label {
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #dcfce7;
  color: #166534;
}

.pos-actions { margin-top: auto; padding-top: 8px; }

/* Responsive – tablet landscape */
@media (max-width: 900px) {
  .pos-layout { grid-template-columns: 1fr; height: auto; overflow: auto; }
  body { overflow: auto; }
  .pos-left { min-height: 60vh; }
  .pos-right { border-top: 1px solid var(--border); }
}

/* ── Receipt Preview – fully scoped so styles never leak into POS ──────────
   All selectors that were previously in the inline <style>${RECEIPT_CSS}</style>
   injected via buildReceiptHTML() are now scoped under #receiptPreviewContent.
   The <style> tag has been removed from buildReceiptHTML; styles only live here
   (for screen preview) and in RECEIPT_CSS constant (for the print window only). */
#receiptPreviewContent {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: normal;
  width: 260px;
  margin: 0 auto;
  padding: 2px 0 2px;
  color: #000;
  background: #fff;
}
#receiptPreviewContent .dash  { border: none; border-top: 1px dashed #000; margin: 5px 0; }
#receiptPreviewContent .solid { border: none; border-top: 2px solid #000;  margin: 5px 0; }
#receiptPreviewContent .biz-name { font-size: 17px; font-weight: bold; text-align: center; letter-spacing: 1px; margin-bottom: 3px; }
#receiptPreviewContent .biz-sub  { font-size: 12px; text-align: center; line-height: 1.7; }
#receiptPreviewContent .bill-id   { text-align: center; font-size: 13px; font-weight: bold; padding: 4px 0 1px; }
#receiptPreviewContent .bill-date { text-align: center; font-size: 11px; padding-bottom: 4px; }
#receiptPreviewContent .t     { width: 100%; border-collapse: collapse; }
#receiptPreviewContent .t td  { font-size: 11px; padding: 2px 0; vertical-align: top; }
#receiptPreviewContent .t td.v { text-align: right; white-space: nowrap; }
#receiptPreviewContent .t th  { font-size: 10px; font-weight: bold; padding: 3px 0 2px; border-bottom: 1px solid #000; }
#receiptPreviewContent .t th.r { text-align: right; }
#receiptPreviewContent .iname { font-size: 12px; padding: 4px 0 1px; word-break: break-word; }
#receiptPreviewContent .isub  { font-size: 10px; padding: 0 0 4px 4px; display: flex; justify-content: space-between; }
#receiptPreviewContent .iamt  { font-weight: bold; white-space: nowrap; }
#receiptPreviewContent .tot   { width: 100%; border-collapse: collapse; }
#receiptPreviewContent .tot td { font-size: 11px; padding: 2px 0; }
#receiptPreviewContent .tot td.r { text-align: right; white-space: nowrap; }
#receiptPreviewContent .grand td { font-size: 16px; font-weight: bold; padding: 5px 0; }
#receiptPreviewContent .cust-row { font-size: 11px; padding: 3px 0; display: flex; justify-content: space-between; }
#receiptPreviewContent .footer { text-align: center; font-size: 10px; line-height: 1.8; margin-top: 6px; }
#receiptPreviewContent .status-badge { font-size: 11px; font-weight: bold; letter-spacing: 1px; margin-top: 2px; }
