/* ===========================================================================
   pos-demo.css — أنماط محاكي الكاشير (واجهة نقاط البيع التفاعلية)
   هوية بصرية نظيفة وحديثة متّسقة مع روح منتج "سوادي".
   ========================================================================= */

.pos {
  --pos-bg: var(--surface-solid);
  --pos-line: var(--line);
  --pos-accent: var(--brand);
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--pos-bg);
  box-shadow: var(--shadow-lg);
  min-height: 560px;
}
@media (max-width: 860px) { .pos { grid-template-columns: 1fr; } }

/* شريط علوي للتطبيق */
.pos-topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: .8rem;
  padding: .8rem 1.2rem;
  border-bottom: 1px solid var(--pos-line);
  background: var(--surface);
}
.pos-topbar .pos-logo { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--font-display); font-weight: 700; color: var(--text-strong); }
.pos-topbar .pos-logo .dot { width: 26px; height: 26px; border-radius: 8px; background: var(--grad-brand); display: grid; place-items: center; color: var(--brand-ink); font-size: .8rem; }
.pos-topbar .pos-cashier { margin-inline-start: auto; display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); font-size: var(--fs-300); }
.pos-topbar .pos-cashier .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--grad-violet); }

/* العمود الأيسر: المنتجات */
.pos-products { padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.pos-tabs { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .2rem; scrollbar-width: thin; }
.pos-tab {
  flex: 0 0 auto; padding: .6rem 1rem; border-radius: var(--r-pill);
  border: 1px solid var(--pos-line); background: var(--surface); color: var(--muted);
  font-weight: 600; font-size: var(--fs-300); display: inline-flex; align-items: center; gap: .4rem;
  transition: all var(--t-fast);
}
.pos-tab:hover { color: var(--text); border-color: var(--line-strong); }
.pos-tab.is-active { background: var(--grad-brand); color: var(--brand-ink); border-color: transparent; }

.pos-search { display: flex; align-items: center; gap: .5rem; padding: .65rem .9rem; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--pos-line); color: var(--muted); }
.pos-search input { width: 100%; background: none; border: 0; color: var(--text); outline: none; }

.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .7rem; overflow-y: auto; align-content: start; padding-inline-end: .2rem; flex: 1; max-height: 380px; }

.pos-item {
  text-align: start; border-radius: var(--r-md); border: 1px solid var(--pos-line);
  background: var(--surface); padding: .75rem; display: flex; flex-direction: column; gap: .5rem;
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  position: relative;
}
.pos-item:hover { transform: translateY(-2px); border-color: var(--pos-accent); box-shadow: var(--glow-brand); }
.pos-item:active { transform: scale(.97); }
.pos-item .emoji { font-size: 1.7rem; line-height: 1; }
.pos-item .nm { font-weight: 600; font-size: var(--fs-300); color: var(--text-strong); }
.pos-item .pr { color: var(--pos-accent); font-weight: 700; font-size: var(--fs-300); margin-top: auto; }
.pos-item.added { animation: pop .35s var(--ease); }
@keyframes pop { 50% { transform: scale(1.06); } }

/* العمود الأيمن: الفاتورة/السلة */
.pos-cart { display: flex; flex-direction: column; border-inline-start: 1px solid var(--pos-line); background: var(--bg-2); }
html[dir="ltr"] .pos-cart { border-inline-start: 1px solid var(--pos-line); }
.pos-cart-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.1rem; border-bottom: 1px solid var(--pos-line); }
.pos-cart-head h3 { font-size: var(--fs-500); }
.pos-cart-head .count { font-size: var(--fs-300); color: var(--muted); background: var(--surface-2); padding: .2rem .6rem; border-radius: var(--r-pill); }

.pos-lines { flex: 1; overflow-y: auto; padding: .6rem .9rem; display: flex; flex-direction: column; gap: .5rem; min-height: 160px; max-height: 300px; }
.pos-empty { margin: auto; text-align: center; color: var(--faint); display: grid; gap: .5rem; padding: 2rem 1rem; }
.pos-empty svg { width: 44px; height: 44px; opacity: .5; margin-inline: auto; }

.pos-line { display: grid; grid-template-columns: 1fr auto; gap: .3rem .6rem; align-items: center; padding: .6rem .7rem; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--pos-line); }
.pos-line .l-name { font-weight: 600; font-size: var(--fs-300); color: var(--text-strong); }
.pos-line .l-price { color: var(--muted); font-size: var(--fs-300); grid-column: 1 / -1; }
.pos-line .l-controls { display: inline-flex; align-items: center; gap: .4rem; }
.qbtn { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--pos-line); display: grid; place-items: center; color: var(--text); font-weight: 700; transition: all var(--t-fast); }
.qbtn:hover { background: var(--surface-2); border-color: var(--pos-accent); color: var(--pos-accent); }
.pos-line .qty { min-width: 1.4ch; text-align: center; font-weight: 700; }
.l-remove { color: var(--faint); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; }
.l-remove:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

.pos-summary { padding: .9rem 1.1rem; border-top: 1px solid var(--pos-line); display: grid; gap: .5rem; background: var(--surface); }
.pos-summary .row { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--fs-400); }
.pos-summary .row.total { color: var(--text-strong); font-weight: 800; font-size: var(--fs-600); padding-top: .5rem; border-top: 1px dashed var(--pos-line); }
.pos-summary .row.total .val { color: var(--brand); }
.pos-actions { padding: 0 1.1rem 1.1rem; display: grid; gap: .5rem; }

/* فاتورة منبثقة — Receipt modal */
.pos-receipt-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(2, 6, 14, .72); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 1.2rem; opacity: 0; pointer-events: none; transition: opacity var(--t-med); }
.pos-receipt-backdrop.open { opacity: 1; pointer-events: auto; }
.pos-receipt {
  width: min(360px, 100%); background: #fff; color: #14181f; border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); padding: 1.4rem 1.3rem; max-height: 90vh; overflow: auto;
  transform: translateY(14px) scale(.98); transition: transform var(--t-med) var(--ease);
  font-family: var(--font-mono);
}
.pos-receipt-backdrop.open .pos-receipt { transform: none; }
.pos-receipt .r-head { text-align: center; border-bottom: 1px dashed #c9ced8; padding-bottom: .8rem; margin-bottom: .8rem; }
.pos-receipt .r-head h4 { color: #0a0e17; font-family: var(--font-display); }
.pos-receipt .r-head small { color: #6b7280; display: block; }
.pos-receipt .r-line { display: flex; justify-content: space-between; font-size: .82rem; padding: .2rem 0; color: #2a2f3a; }
.pos-receipt .r-tot { border-top: 1px dashed #c9ced8; margin-top: .6rem; padding-top: .6rem; }
.pos-receipt .r-tot .row { display: flex; justify-content: space-between; font-size: .85rem; padding: .15rem 0; }
.pos-receipt .r-tot .grand { font-weight: 800; font-size: 1.05rem; color: #0a0e17; }
.pos-receipt .r-qr { display: flex; flex-direction: column; align-items: center; gap: .4rem; margin-top: 1rem; padding-top: .8rem; border-top: 1px dashed #c9ced8; }
.pos-receipt .r-qr svg { width: 116px; height: 116px; }
.pos-receipt .r-qr small { color: #6b7280; font-size: .68rem; text-align: center; word-break: break-all; }
.pos-receipt .r-sample { background: #fff7e6; color: #92670a; border: 1px solid #f3d27a; border-radius: 8px; font-size: .68rem; padding: .3rem .5rem; text-align: center; margin-top: .6rem; }
.receipt-actions { display: flex; gap: .5rem; margin-top: 1rem; }
.receipt-actions .btn { flex: 1; }

/* شارة "عرض حي" */
.demo-flag { display: inline-flex; align-items: center; gap: .5rem; font-size: var(--fs-300); font-weight: 700; color: var(--brand); }
.demo-flag .live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 0 var(--brand); animation: livepulse 2s infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 60%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .demo-flag .live-dot { animation: none; } }
