/* ============================================================
   pos.css — Point of Sale layout & components
   ============================================================ */

/* ── Layout ─────────────────────────────────────────────────── */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  grid-template-rows: auto 1fr;
  height: 100vh;
  overflow: hidden;
  background: #f1f5f9;
}

.pos-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1.25rem;
  background: #1e293b;
  color: white;
  flex-shrink: 0;
}

.pos-topbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pos-topbar-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

.pos-topbar-meta strong {
  color: white;
}

/* ── Left panel: Menu ───────────────────────────────────────── */
.pos-menu-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8fafc;
}

.pos-search-bar {
  padding: 0.75rem 1rem 0.5rem;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.pos-search-bar input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.2rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #f8fafc;
  outline: none;
  box-sizing: border-box;
  color: #1f2937;
}

.pos-search-bar input:focus {
  border-color: #6366f1;
  background: white;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.pos-search-wrap {
  position: relative;
}

.pos-search-wrap svg {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* ── Category scroll wrapper ────────────────────────────────── */
.pos-cat-bar-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.pos-cat-scroll-btn {
  flex-shrink: 0;
  width: 28px;
  min-height: 36px;
  border: none;
  background: white;
  color: #64748b;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}

.pos-cat-scroll-btn:hover { background: #f1f5f9; color: #1e293b; }
.pos-cat-scroll-btn.hidden { visibility: hidden; pointer-events: none; }
.pos-cat-scroll-left  { border-right: 1px solid #e2e8f0; }
.pos-cat-scroll-right { border-left:  1px solid #e2e8f0; }

/* ── Category tabs ──────────────────────────────────────────── */
.pos-cat-bar {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 0.5rem;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
}

.pos-cat-bar::-webkit-scrollbar { display: none; }

.pos-cat-btn {
  padding: 0.35rem 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  background: white;
  color: #475569;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.pos-cat-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.pos-cat-btn.active {
  background: #6366f1;
  color: white;
  border-color: #6366f1;
}

/* ── Item grid ──────────────────────────────────────────────── */
.pos-items-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
}

.pos-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem;
}

.pos-item-card {
  background: white;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem 0.65rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  user-select: none;
  position: relative;
}

.pos-item-card:hover {
  border-color: #6366f1;
  box-shadow: 0 2px 12px rgba(99,102,241,0.15);
  transform: translateY(-1px);
}

.pos-item-card:active {
  transform: scale(0.97);
}

.pos-item-card.unavailable {
  opacity: 0.45;
  cursor: not-allowed;
}

.pos-item-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 8px;
  object-fit: cover;
  background: #f1f5f9;
}

.pos-item-thumb-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #cbd5e1;
}

.pos-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.pos-item-price {
  font-size: 0.88rem;
  font-weight: 700;
  color: #6366f1;
}
.pos-item-price-unit {
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.65;
  margin-left: 1px;
}

/* ── Total quantity progress bar ─────────────────────────────────────────── */
.pos-item-qty-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.1rem;
}
.pos-item-qty-track {
  flex: 1;
  height: 4px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.pos-item-qty-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}
.pos-item-qty-fill.ok     { background: #10b981; }
.pos-item-qty-fill.warn   { background: #f97316; }
.pos-item-qty-fill.danger { background: #ef4444; }
.pos-item-qty-label {
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.pos-item-qty-label.ok     { color: #16a34a; }
.pos-item-qty-label.warn   { color: #ea580c; }
.pos-item-qty-label.danger { color: #dc2626; }

/* ── Going Fast banner ── */
.pos-going-fast-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0.6rem 0.5rem 0.25rem;
  padding: 0.7rem 0.85rem;
  background: #fffbeb;
  border: 1.5px solid #fbbf24;
  border-radius: 10px;
  font-size: 0.83rem;
  line-height: 1.5;
}
.pos-going-fast-banner.hidden { display: none; }
.pos-gf-icon { font-size: 1.25rem; flex-shrink: 0; margin-top: 0.05rem; }
.pos-gf-body { flex: 1; min-width: 0; }
.pos-gf-title { font-weight: 800; color: #92400e; font-size: 0.85rem; margin-bottom: 0.15rem; }
.pos-gf-items { color: #78350f; margin-bottom: 0.2rem; }
.pos-gf-items strong { color: #b45309; }
.pos-gf-advice { font-size: 0.75rem; color: #a16207; }
.pos-gf-dismiss {
  flex-shrink: 0;
  background: none;
  border: 1px solid #fbbf24;
  border-radius: 6px;
  color: #92400e;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  margin-top: 0.05rem;
  transition: background 0.15s;
}
.pos-gf-dismiss:hover { background: #fef3c7; }

.pos-item-badges {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  display: flex;
  gap: 0.25rem;
}

.pos-item-badge {
  background: #10b981;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.pos-item-badge.veg { background: #16a34a; }
.pos-item-badge.nonveg { background: #dc2626; }
.pos-item-badge.spicy { background: #c0392b; font-size: 0.7rem; }
.pos-item-badge.high-demand {
  background: linear-gradient(135deg, #f97316, #ef4444);
  animation: demandPulse 2s ease-in-out infinite;
}
@keyframes demandPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.75; }
}

/* ── Item context menu (long-press / right-click) ───────────────────────────── */
.pos-item-ctx-menu {
  position: fixed;
  z-index: 999;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 0.4rem;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  animation: ctxIn 0.12s ease;
}
@keyframes ctxIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
.pos-item-ctx-menu.hidden { display: none; }
.pos-ctx-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  padding: 0.2rem 0.6rem 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  margin-bottom: 0.3rem;
}
.pos-ctx-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: #e2e8f0;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.pos-ctx-btn:hover { background: rgba(255,255,255,0.08); }
.pos-ctx-btn.active { color: #34d399; }
.pos-ctx-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 0.3rem 0;
}

/* ── Context menu: Total Quantity section ── */
.pos-ctx-qty-section {
  margin: 0.3rem 0.25rem 0.25rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 0.65rem 0.75rem 0.6rem;
}
.pos-ctx-qty-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 0.15rem;
}
.pos-ctx-qty-hint {
  font-size: 0.7rem;
  color: #64748b;
  margin-bottom: 0.5rem;
}
.pos-ctx-qty-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.pos-ctx-qty-input {
  flex: 1;
  background: #0f172a;
  border: 1.5px solid rgba(99,102,241,0.45);
  border-radius: 6px;
  color: #f1f5f9;
  padding: 0.4rem 0.6rem;
  font-size: 0.88rem;
  font-family: inherit;
  font-weight: 600;
  outline: none;
  min-width: 0;
  transition: border-color 0.15s;
}
.pos-ctx-qty-input:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}
.pos-ctx-qty-input::placeholder { color: #475569; }
.pos-ctx-qty-save-btn {
  background: rgba(99,102,241,0.8);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.pos-ctx-qty-save-btn:hover { background: #6366f1; }
.pos-ctx-qty-served {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  color: #94a3b8;
}
.pos-ctx-qty-served strong {
  color: #34d399;
  font-weight: 700;
}
.pos-ctx-reset-btn {
  color: #f87171 !important;
  font-size: 0.8rem !important;
  opacity: 0.85;
}
.pos-ctx-reset-btn:hover { opacity: 1; }

/* ── Sold Out overlay on item card ─────────────────────────────────────────── */
.pos-item-soldout {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15,23,42,0.62);
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #f87171;
  pointer-events: none;
  z-index: 2;
}

/* ── Right panel: Cart ──────────────────────────────────────── */
.pos-cart-panel {
  display: flex;
  flex-direction: column;
  background: white;
  border-left: 1px solid #e2e8f0;
  overflow: hidden;
}

.pos-cart-header {
  padding: 0.9rem 1rem 0.6rem;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.pos-cart-header h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: #1e293b;
}

.pos-order-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.pos-service-type-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.pos-order-type-btn {
  flex: 1;
  padding: 0.35rem 0.5rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  background: white;
  color: #475569;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pos-order-type-btn.active {
  background: #ede9fe;
  border-color: #6366f1;
  color: #4338ca;
}

.pos-order-num-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.pos-order-num-wrap label {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 0;
  font-weight: 500;
  white-space: nowrap;
}

.pos-order-num-wrap input {
  width: 70px;
  padding: 0.35rem 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
}

/* ── Order context fields (table / room / name / address / mobile) ── */
.pos-order-context-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: flex-end;
  margin-top: 0.35rem;
  width: 100%;
}

.pos-ctx-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 90px;
}

.pos-ctx-field label {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 500;
  white-space: nowrap;
  margin: 0;
}

.pos-ctx-field input,
.pos-ctx-field textarea {
  padding: 0.32rem 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.83rem;
  width: 100%;
  resize: none;
  font-family: inherit;
}

.pos-ctx-field textarea {
  line-height: 1.35;
}

/* ── Cart items list ────────────────────────────────────────── */
.pos-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
}

.pos-cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #94a3b8;
  font-size: 0.9rem;
  gap: 0.5rem;
  padding: 2rem 0;
}

.pos-cart-empty span { font-size: 2.5rem; }

.pos-cart-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.pos-cart-row:last-child { border-bottom: none; }

.pos-cart-row-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
}

.pos-cart-row-sub {
  font-size: 0.78rem;
  color: #64748b;
}

.pos-cart-qty-ctrl {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.pos-qty-btn {
  width: 26px;
  height: 26px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  color: #475569;
  transition: background 0.12s;
  padding: 0;
  line-height: 1;
}

.pos-qty-btn:hover { background: #e2e8f0; }
.pos-qty-btn.remove { border-color: #fecaca; color: #dc2626; }
.pos-qty-btn.remove:hover { background: #fee2e2; }

.pos-qty-num {
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  color: #1e293b;
}

/* ── Cart footer: totals + payment ─────────────────────────── */
.pos-cart-footer {
  border-top: 1px solid #e2e8f0;
  padding: 0.75rem 1rem;
  flex-shrink: 0;
}

.pos-discount-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.pos-discount-row label {
  font-size: 0.78rem;
  color: #64748b;
  margin: 0;
  font-weight: 500;
  white-space: nowrap;
}

.pos-discount-row input {
  flex: 1;
  padding: 0.3rem 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
}

.pos-discount-row select {
  padding: 0.3rem 0.4rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.8rem;
  background: white;
}

.pos-totals {
  margin-bottom: 0.75rem;
}

.pos-totals-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.83rem;
  color: #64748b;
  padding: 0.18rem 0;
}

.pos-totals-row.total {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  border-top: 1px solid #e2e8f0;
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

.pos-pay-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pos-pay-btn {
  padding: 0.65rem;
  border: none;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.pos-pay-btn:active { transform: scale(0.97); }
.pos-pay-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.pos-pay-btn.cash {
  background: #dcfce7;
  color: #166534;
}

.pos-pay-btn.cash:hover:not(:disabled) { background: #bbf7d0; }

.pos-pay-btn.card {
  background: #dbeafe;
  color: #1e40af;
}

.pos-pay-btn.card:hover:not(:disabled) { background: #bfdbfe; }

/* UPI, Wallet, Credit and any custom payment method */
.pos-pay-btn.upi {
  background: #ede9fe;
  color: #5b21b6;
}
.pos-pay-btn.upi:hover:not(:disabled) { background: #ddd6fe; }

.pos-pay-btn.wallet {
  background: #fef9c3;
  color: #854d0e;
}
.pos-pay-btn.wallet:hover:not(:disabled) { background: #fef08a; }

.pos-pay-btn.credit {
  background: #fce7f3;
  color: #9d174d;
}
.pos-pay-btn.credit:hover:not(:disabled) { background: #fbcfe8; }

/* Fallback for any unrecognised key */
.pos-pay-btn:not(.cash):not(.card):not(.upi):not(.wallet):not(.credit) {
  background: #f1f5f9;
  color: #334155;
}
.pos-pay-btn:not(.cash):not(.card):not(.upi):not(.wallet):not(.credit):hover:not(:disabled) { background: #e2e8f0; }

.pos-clear-btn {
  width: 100%;
  padding: 0.45rem;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: white;
  color: #dc2626;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}

.pos-clear-btn:hover { background: #fff1f2; }

/* ── Receipt Modal ──────────────────────────────────────────── */
.pos-receipt-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.pos-receipt-overlay.hidden { display: none; }

.pos-receipt-box {
  background: white;
  border-radius: 16px;
  max-width: 360px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.pos-receipt-box h3 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  text-align: center;
  color: #1e293b;
}

.pos-receipt-restaurant {
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.15rem;
  color: #1e293b;
}

.pos-receipt-contact {
  text-align: center;
  font-size: 0.75rem;
  color: #475569;
  margin-bottom: 0.2rem;
  line-height: 1.5;
}

.pos-receipt-caption {
  text-align: center;
  font-size: 0.78rem;
  font-style: italic;
  color: #64748b;
  margin-bottom: 0.1rem;
}

.pos-receipt-address {
  text-align: center;
  font-size: 0.74rem;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 0.1rem;
}

.pos-receipt-bill-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.15rem;
}

.pos-receipt-order-ctx {
  text-align: center;
  font-size: 0.74rem;
  color: #64748b;
  margin-bottom: 0.25rem;
  line-height: 1.5;
}

.pos-receipt-cashier {
  text-align: center;
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 0.35rem;
}

.pos-receipt-subtotal-row {
  color: #475569;
  font-size: 0.82rem;
}

.pos-receipt-upi-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.85rem;
  min-height: 0;
}

.pos-receipt-footer {
  text-align: center;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.85rem;
  padding-top: 0.6rem;
  border-top: 1px dashed #e2e8f0;
}

.pos-receipt-divider {
  border: none;
  border-top: 1px dashed #cbd5e1;
  margin: 0.75rem 0;
}

.pos-receipt-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #334155;
  padding: 0.2rem 0;
}

.pos-receipt-total {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  padding: 0.4rem 0 0 0;
  border-top: 1px solid #e2e8f0;
  margin-top: 0.3rem;
}

.pos-receipt-payment {
  text-align: center;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #16a34a;
}

.pos-receipt-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.pos-receipt-actions button {
  flex: 1;
  padding: 0.6rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}

.pos-receipt-actions .print-btn {
  background: #1e293b;
  color: white;
}

.pos-receipt-actions .wa-btn {
  background: #25d366;
  color: white;
}

.pos-receipt-actions .new-btn {
  background: #6366f1;
  color: white;
}

/* ── Order history drawer ───────────────────────────────────── */
.pos-history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  background: white;
  border-left: 1px solid #e2e8f0;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  z-index: 900;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.pos-history-drawer.open {
  transform: translateX(0);
}

.pos-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.pos-history-header h3 {
  margin: 0;
  font-size: 1rem;
  color: #1e293b;
}

.pos-history-close {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  color: #64748b;
}

.pos-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

.pos-history-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.pos-history-item:hover {
  border-color: #6366f1;
  background: #faf9ff;
}

.pos-history-item-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.pos-history-order-id {
  font-weight: 700;
  font-size: 0.85rem;
  color: #1e293b;
}

.pos-history-time {
  font-size: 0.75rem;
  color: #94a3b8;
}

.pos-history-summary {
  font-size: 0.78rem;
  color: #64748b;
}

.pos-history-total {
  font-weight: 700;
  font-size: 0.88rem;
  color: #6366f1;
  margin-top: 0.25rem;
}

.pos-history-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-weight: 600;
  margin-top: 0.25rem;
}

.pos-history-badge.cash { background: #dcfce7; color: #166534; }
.pos-history-badge.card { background: #dbeafe; color: #1e40af; }

/* ── Today's Sales drawer ───────────────────────────────────── */
.pos-sales-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  background: white;
  border-left: 1px solid #e2e8f0;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  z-index: 900;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.pos-sales-drawer.open {
  transform: translateX(0);
}

.pos-sales-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.pos-sales-header h3 {
  margin: 0;
  font-size: 1rem;
  color: #1e293b;
}

.pos-sales-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

/* KPI cards */
.sales-summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.sales-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
}

.sales-card-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e293b;
}

.sales-card-lbl {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Payment breakdown */
.sales-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0.75rem 0 0.4rem;
}

.sales-pm-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #334155;
  padding: 0.3rem 0;
  border-bottom: 1px solid #f1f5f9;
}

/* Top items bar chart */
.sales-item-row {
  display: grid;
  grid-template-columns: 1fr auto 80px auto;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  padding: 0.25rem 0;
  color: #334155;
}

.sales-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #1e293b;
  font-weight: 500;
}

.sales-item-qty {
  color: #94a3b8;
  font-size: 0.75rem;
  white-space: nowrap;
}

.sales-item-bar-wrap {
  background: #f1f5f9;
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}

.sales-item-bar {
  height: 100%;
  background: #6366f1;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.sales-item-val {
  text-align: right;
  font-weight: 600;
  color: #059669;
  white-space: nowrap;
}

/* ── Spinner overlay ────────────────────────────────────────── */
#pos-spinner {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

#pos-spinner.hidden { display: none; }

.pos-spinner-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: white;
  font-size: 0.9rem;
}

/* ── Qty Input Modal ────────────────────────────────────────── */
.pos-qty-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pos-qty-modal-overlay.hidden { display: none; }
.pos-qty-modal {
  background: white;
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  min-width: 260px;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.pos-qty-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pos-qty-modal-unit {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: -0.5rem;
}
.pos-qty-modal-input {
  width: 100%;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  text-align: center;
  outline: none;
  box-sizing: border-box;
}
.pos-qty-modal-input:focus { border-color: #6366f1; }
.pos-qty-modal-actions {
  display: flex;
  gap: 0.75rem;
}
.pos-qty-modal-cancel {
  flex: 1;
  padding: 0.6rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.pos-qty-modal-confirm {
  flex: 2;
  padding: 0.6rem;
  border: none;
  border-radius: 8px;
  background: #6366f1;
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}
.pos-qty-modal-confirm:hover { background: #4f46e5; }

/* Variable-qty cart row input */
.pos-qty-inline-input {
  width: 54px;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  color: #1e293b;
  outline: none;
}
.pos-qty-inline-input:focus { border-color: #6366f1; }

/* ── Responsive: narrow screens ─────────────────────────────── */
@media (max-width: 768px) {
  .pos-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    height: auto;
    min-height: 100vh;
  }

  .pos-cart-panel {
    border-left: none;
    border-top: 2px solid #e2e8f0;
    max-height: 55vh;
  }

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

@media print {
  /* Hide everything except the receipt */
  body * { visibility: hidden; }
  .pos-receipt-overlay,
  .pos-receipt-overlay * { visibility: visible; }
  .pos-receipt-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: white !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    padding: 1cm !important;
  }
  .pos-receipt-box {
    box-shadow: none !important;
    border-radius: 0 !important;
    max-width: 8cm !important;
    width: 100% !important;
  }
  .pos-receipt-actions { display: none !important; }
  /* Ensure QR canvas prints */
  .pos-receipt-upi-qr canvas { display: block !important; }
}

/* ── Weather Chip (topbar) ──────────────────────────────────── */
.pos-weather-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 0.22rem 0.65rem;
  font-size: 0.82rem;
  color: #e2e8f0;
  white-space: nowrap;
  cursor: default;
}
.pos-weather-chip-label { font-weight: 600; }
.pos-weather-chip-temp  { color: #94a3b8; font-size: 0.78rem; }
.pos-weather-info-btn {
  background: rgba(99,102,241,0.35);
  border: none;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s;
  flex-shrink: 0;
  line-height: 1;
  padding: 0;
}
.pos-weather-info-btn:hover { background: rgba(99,102,241,0.6); }

/* ── Weather Advice Modal ───────────────────────────────────── */
.pos-weather-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}
.pos-weather-modal.hidden { display: none; }

.pos-weather-modal-box {
  background: #1e293b;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  animation: weatherModalIn 0.2s ease;
}
@keyframes weatherModalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.pos-weather-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
}
.pos-weather-modal-close {
  background: rgba(255,255,255,0.08);
  border: none;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
  transition: background 0.12s, color 0.12s;
}
.pos-weather-modal-close:hover { background: rgba(255,255,255,0.15); color: white; }

.pos-weather-modal-conditions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.82rem;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
}
.pos-weather-modal-conditions span { display: flex; align-items: center; gap: 0.3rem; }

.pos-weather-modal-body {
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 90px;
}
.pos-weather-modal-loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #64748b;
  font-size: 0.85rem;
  padding: 0.5rem 0;
}
.pos-weather-tip-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
}
.pos-weather-tip-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}
.pos-weather-tip-text {
  font-size: 0.85rem;
  color: #e2e8f0;
  line-height: 1.5;
}
.pos-weather-tip-error {
  color: #f87171;
  font-size: 0.84rem;
  padding: 0.25rem 0;
}
.pos-weather-refresh-btn {
  background: rgba(99,102,241,0.25);
  border: 1px solid rgba(99,102,241,0.4);
  color: #a5b4fc;
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  margin-top: 0.25rem;
  transition: background 0.15s;
}
.pos-weather-refresh-btn:hover { background: rgba(99,102,241,0.4); }
