/* ── POS Screen Styles ────────────────────────────────────────────────────── */
.pos-page {
  display: grid;
  grid-template-columns: 1fr 340px;
  grid-template-rows: auto 1fr;
  height: 100vh;
  background: var(--cream);
  font-family: 'Space Grotesk', sans-serif;
}

/* ── Topbar ────────────────────────────────────────────────────────────────── */
.pos-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--green);
  color: white;
  gap: 16px;
}
.pos-logo { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 20px; color: white; }
.pos-logo span { color: var(--amber); }
.offline-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 100px;
  padding: 5px 12px;
  color: rgba(255,255,255,0.8);
}
.offline-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #40916C; }
.offline-badge.offline .dot { background: #E85C5C; }
.offline-badge.offline { color: #FFBABA; border-color: rgba(232,92,92,0.3); }
.pos-date { font-size: 13px; color: rgba(255,255,255,0.6); }

/* ── Main product area ──────────────────────────────────────────────────────── */
.pos-main {
  overflow-y: auto;
  padding: 20px 24px;
}
.pos-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--amber);
  margin-bottom: 12px;
}

/* Search */
.pos-search-wrap {
  position: relative;
  margin-bottom: 16px;
}
.pos-search {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 2px solid rgba(27,67,50,0.15);
  border-radius: var(--radius-md);
  background: white;
  font-size: 15px;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.pos-search:focus { border-color: var(--green); }
.pos-search::placeholder { color: var(--text-muted); }
.pos-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* Category chips */
.cat-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.cat-chip {
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid rgba(27,67,50,0.15);
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.cat-chip:hover, .cat-chip.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.product-card {
  background: white;
  border: 1.5px solid rgba(0,0,0,0.07);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(27,67,50,0.1);
  border-color: var(--green-light);
}
.product-card.out-of-stock { opacity: 0.55; pointer-events: none; }
.product-card.out-of-stock::after {
  content: 'Out of Stock';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  background: rgba(232,92,92,0.9);
  color: white;
  padding: 2px 7px;
  border-radius: 100px;
  font-weight: 600;
}
.product-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--charcoal);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-sku {
  font-size: 11px;
  color: var(--text-muted);
}
.product-price {
  font-family: 'Syne', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--green);
}
.product-stock {
  font-size: 11px;
  color: var(--text-muted);
}
.product-stock.low { color: #E8A443; }
.product-stock.out { color: #E85C5C; }
.add-icon {
  width: 28px; height: 28px;
  background: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  line-height: 1;
  margin-top: auto;
  align-self: flex-end;
  transition: background 0.15s;
}
.product-card:hover .add-icon { background: var(--amber); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state svg { margin: 0 auto 16px; opacity: 0.4; }
.empty-state p { font-size: 15px; }

/* ── Cart panel ─────────────────────────────────────────────────────────────── */
.pos-cart {
  background: white;
  border-left: 1px solid rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cart-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cart-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--charcoal);
}
.cart-count {
  background: var(--amber);
  color: var(--charcoal);
  font-size: 12px;
  font-weight: 700;
  border-radius: 100px;
  padding: 2px 8px;
  min-width: 24px;
  text-align: center;
}
.clear-btn {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'Space Grotesk', sans-serif;
  text-decoration: underline;
}
.clear-btn:hover { color: #E85C5C; }

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}
.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--charcoal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-item-price {
  font-size: 12px;
  color: var(--text-muted);
}
.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
}
.qty-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.15);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  color: var(--charcoal);
  font-family: 'Space Grotesk', sans-serif;
  transition: border-color 0.15s, background 0.15s;
}
.qty-btn:hover { border-color: var(--green); background: var(--cream); }
.qty-num {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--charcoal);
  min-width: 20px;
  text-align: center;
}
.item-total {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
  min-width: 52px;
  text-align: right;
}
.remove-btn {
  font-size: 18px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.remove-btn:hover { color: #E85C5C; }

.cart-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}
.cart-empty svg { opacity: 0.3; margin-bottom: 12px; }
.cart-empty p { font-size: 14px; }

/* Cart footer */
.cart-footer {
  padding: 16px 20px;
  background: var(--cream);
  border-top: 1px solid rgba(0,0,0,0.08);
}
.cart-totals { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cart-total-row.grand { border-top: 2px solid var(--green); padding-top: 10px; margin-top: 4px; }
.cart-total-label { font-size: 13px; color: var(--text-muted); }
.cart-total-label.grand { font-size: 15px; font-weight: 700; color: var(--charcoal); }
.cart-total-value { font-size: 14px; font-weight: 600; color: var(--text); }
.cart-total-value.grand {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--green);
}
.pay-btn {
  width: 100%;
  padding: 14px;
  background: var(--green);
  color: white;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.pay-btn:hover { background: var(--green-mid); transform: translateY(-1px); }
.pay-btn:disabled { background: #ccc; cursor: not-allowed; transform: none; }

/* Payment method */
.pay-method-select {
  margin-bottom: 12px;
}
.pay-method-select select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Space Grotesk', sans-serif;
  background: white;
  color: var(--text);
  cursor: pointer;
  outline: none;
}

/* ── Receipt Modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }

.receipt-modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
}
.receipt-header {
  background: var(--green);
  padding: 28px 24px;
  text-align: center;
}
.receipt-check {
  width: 56px; height: 56px;
  background: var(--amber);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 28px;
}
.receipt-header h2 {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: white;
  margin-bottom: 4px;
}
.receipt-header p { font-size: 14px; color: rgba(255,255,255,0.65); }
.receipt-body { padding: 24px; }
.receipt-items { margin-bottom: 20px; }
.receipt-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(0,0,0,0.08);
  font-size: 14px;
}
.receipt-item-name { color: var(--text); flex: 1; padding-right: 12px; }
.receipt-item-qty { color: var(--text-muted); font-size: 12px; margin-right: 8px; }
.receipt-item-price { font-weight: 600; color: var(--charcoal); }
.receipt-totals { border-top: 2px solid var(--charcoal); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.receipt-total-row { display: flex; justify-content: space-between; font-size: 14px; }
.receipt-total-row.grand .rl { font-size: 16px; font-weight: 700; }
.receipt-total-row.grand .rv { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; color: var(--green); }
.receipt-order-num { margin-top: 16px; text-align: center; font-size: 12px; color: var(--text-muted); }
.receipt-actions {
  padding: 0 24px 24px;
  display: flex;
  gap: 10px;
}
.receipt-btn {
  flex: 1;
  padding: 13px;
  border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.receipt-btn:hover { transform: translateY(-1px); }
.receipt-btn.print {
  background: var(--green);
  color: white;
}
.receipt-btn.whatsapp {
  background: #25D366;
  color: white;
}

/* ── Toasts ─────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--charcoal);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2000;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--green); }
.toast.error { background: #E85C5C; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .pos-page { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .pos-cart {
    border-left: none;
    border-top: 2px solid var(--green);
    max-height: 45vh;
  }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}