/* ========================================
   CASHIER POS INTERFACE
   ======================================== */

body {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* --- POS Header --- */
.pos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: 56px;
}
.pos-header-right,
.pos-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.pos-back {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}
.pos-back:hover {
  background: var(--glass-light);
  color: var(--text-primary);
}
.pos-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pos-logo {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--red);
}
.pos-badge {
  padding: 3px 10px;
  background: rgba(196,30,58,0.1);
  border: 1px solid rgba(196,30,58,0.2);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--red-light);
}
.pos-clock {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
.pos-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}

/* --- POS Layout --- */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
}

/* --- Menu Panel --- */
.pos-menu {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px;
  gap: 12px;
}
.pos-search {
  position: relative;
  display: flex;
  align-items: center;
}
.pos-search svg {
  position: absolute;
  right: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.pos-search .form-input {
  padding-right: 42px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
}
.pos-categories {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  flex-shrink: 0;
}
.pos-categories::-webkit-scrollbar { height: 0; }
.pos-cat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
}
.pos-cat:hover {
  border-color: var(--red);
  color: var(--text-primary);
}
.pos-cat.active {
  background: var(--red);
  border-color: var(--red);
  color: white;
}
.cat-icon {
  font-size: 1rem;
}
.pos-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  padding: 2px;
  align-content: start;
}
.pos-items::-webkit-scrollbar { width: 4px; }
.pos-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.pos-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.pos-item:hover {
  border-color: rgba(196,30,58,0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.pos-item:active {
  transform: scale(0.97);
}
.pos-item-img {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
}
.pos-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pos-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
}
.pos-item-price {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--red);
}
.pos-item-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

/* --- Order Panel --- */
.pos-order {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
}
.order-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.order-header h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.order-type-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  padding: 3px;
}
.type-btn {
  flex: 1;
  padding: 6px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
  white-space: nowrap;
}
.type-btn.active {
  background: var(--red);
  color: white;
}
.order-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.order-items::-webkit-scrollbar { width: 3px; }
.order-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.order-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  gap: 8px;
}
.order-empty span {
  font-size: 2.5rem;
  opacity: 0.3;
}
.order-empty p {
  font-size: 0.85rem;
}

.order-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.order-item-info {
  flex: 1;
  min-width: 0;
}
.order-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.order-item-extras {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.order-item-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}
.order-item-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--red);
}
.order-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}
.order-qty button {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: var(--transition);
}
.order-qty button:hover {
  border-color: var(--red);
  color: var(--red);
}
.order-qty button.remove-btn:hover {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
.order-qty span {
  font-weight: 700;
  min-width: 18px;
  text-align: center;
  font-size: 0.9rem;
}
.order-item-remove {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}
.order-item-remove:hover {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
}

/* --- Order Totals --- */
.order-totals {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.total-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.total-row.grand {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.order-actions {
  padding: 12px 16px;
  display: flex;
  gap: 8px;
}
.pos-clear {
  padding: 12px 16px;
  font-size: 0.85rem;
  gap: 6px;
}
.pos-pay {
  flex: 1;
  padding: 14px 24px;
  font-size: 1rem;
  justify-content: space-between;
}

/* --- Payment Modal --- */
.pay-content {
  max-width: 440px;
  padding: 32px;
}
.pay-content h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 20px;
  text-align: center;
}
.pay-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}
.pay-total span:first-child {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.pay-total span:last-child {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--red);
}
.pay-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.pay-method {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
}
.pay-method:hover { border-color: var(--red); }
.pay-method.active {
  border-color: var(--red);
  background: rgba(196,30,58,0.1);
  color: var(--red-light);
}
.method-icon { font-size: 1.5rem; }
.cash-input-wrap {
  position: relative;
  margin-bottom: 12px;
}
.cash-input {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  padding: 16px;
  padding-left: 50px;
}
.cash-currency {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 600;
}
.quick-cash {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.quick-cash-btn {
  padding: 8px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
}
.quick-cash-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.cash-change {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.cash-change span:first-child {
  color: #22c55e;
  font-weight: 600;
}
#changeAmount {
  font-size: 1.2rem;
  font-weight: 800;
  color: #22c55e;
}

/* --- Receipt --- */
.receipt-content {
  max-width: 380px;
  padding: 0;
  background: #fff;
  color: #000;
}
.receipt {
  padding: 32px 24px;
  font-family: 'Cairo', monospace;
  font-size: 0.85rem;
}
.receipt-header {
  text-align: center;
  margin-bottom: 8px;
}
.receipt-header h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--red);
}
.receipt-header p {
  font-size: 0.8rem;
  color: #666;
}
.receipt-divider {
  text-align: center;
  color: #ccc;
  margin: 8px 0;
  font-size: 0.8rem;
  letter-spacing: 2px;
}
.receipt-info {
  font-size: 0.8rem;
  color: #555;
}
.receipt-info div {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}
.receipt-items .receipt-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.85rem;
}
.receipt-items .receipt-item .item-qty {
  color: #888;
  font-size: 0.75rem;
}
.receipt-totals .receipt-total-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 0.85rem;
}
.receipt-totals .receipt-total-row.grand-total {
  font-weight: 800;
  font-size: 1.1rem;
  border-top: 2px solid #000;
  padding-top: 8px;
  margin-top: 4px;
}
.receipt-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 0.85rem;
  color: #666;
}
.receipt-actions {
  display: flex;
  gap: 8px;
  padding: 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}
.receipt-actions .btn {
  flex: 1;
}
.receipt-actions .btn-ghost {
  color: var(--text-secondary);
}

/* --- Orders Panel --- */
.orders-panel {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 100;
}
.orders-toggle {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  position: relative;
}
.orders-toggle:hover {
  border-color: var(--red);
  color: var(--red);
}
.orders-count {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: var(--red);
  color: white;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.orders-drawer {
  position: absolute;
  bottom: 56px;
  left: 0;
  width: 320px;
  max-height: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 16px;
  display: none;
  overflow-y: auto;
}
.orders-drawer.active {
  display: block;
  animation: fadeInUp 0.3s ease-out;
}
.orders-drawer h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.order-card {
  padding: 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.order-card-id {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--red);
}
.order-card-status {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
}
.status-pending {
  background: rgba(255,215,0,0.1);
  color: var(--gold);
  border: 1px solid rgba(255,215,0,0.2);
}
.status-preparing {
  background: rgba(59,130,246,0.1);
  color: #3b82f6;
  border: 1px solid rgba(59,130,246,0.2);
}
.status-ready {
  background: rgba(34,197,94,0.1);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,0.2);
}
.order-card-items {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.order-card-total {
  font-weight: 700;
  font-size: 0.85rem;
}

/* --- Responsive POS --- */
@media (max-width: 900px) {
  .pos-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .pos-order {
    border-right: none;
    border-top: 2px solid var(--border);
  }
  .pos-items {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .pos-header {
    padding: 8px 12px;
    height: 48px;
  }
  .pos-layout {
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
  }
  .pos-menu {
    padding: 10px;
    gap: 8px;
    min-height: 0;
  }
  .order-header {
    padding: 10px 12px;
  }
  .order-header h3 {
    font-size: 0.9rem;
    margin-bottom: 6px;
  }
  .order-totals {
    padding: 8px 12px;
  }
  .order-actions {
    padding: 8px 12px;
  }
  .order-items {
    padding: 8px 12px;
    max-height: 100px;
    min-height: 0;
  }
  .order-empty {
    padding: 8px 0;
    height: auto;
  }
  .order-empty span {
    font-size: 1.5rem;
  }
  .order-empty p {
    font-size: 0.75rem;
  }
  .pay-content {
    padding: 20px;
    max-width: 100%;
    margin: 10px;
  }
  .receipt-content {
    max-width: 100%;
    margin: 10px;
  }
}
@media (max-width: 480px) {
  .pos-items {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .pos-item {
    padding: 8px;
    gap: 4px;
  }
  .pos-item-img {
    width: 52px;
    height: 52px;
  }
  .pos-item-name {
    font-size: 0.72rem;
  }
  .pos-item-price {
    font-size: 0.8rem;
  }
  .pos-brand .pos-logo {
    font-size: 0.9rem;
  }
  .pos-badge {
    font-size: 0.6rem;
    padding: 2px 6px;
  }
  .pos-clock {
    font-size: 0.75rem;
  }
  .pos-user span {
    display: none;
  }
  .user-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }
  .pos-cat {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
  .cat-icon {
    font-size: 0.85rem;
  }
  .type-btn {
    font-size: 0.7rem;
    padding: 5px 4px;
  }
  .total-row {
    font-size: 0.8rem;
  }
  .total-row.grand {
    font-size: 1rem;
  }
  .pos-pay {
    padding: 10px 16px;
    font-size: 0.9rem;
  }
  .pos-clear {
    padding: 10px 12px;
    font-size: 0.8rem;
  }
  .orders-panel {
    bottom: 10px;
    left: 10px;
  }
  .orders-drawer {
    width: 280px;
  }
  .pay-methods {
    gap: 6px;
  }
  .pay-method {
    padding: 12px 4px;
    font-size: 0.78rem;
  }
}
