/* Oasis Dental ERP — POS page layout and interaction states. */
.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
  min-height: calc(100vh - 120px);
}

.pos-products,
.pos-cart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.pos-products {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pos-search-panel {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-hover), transparent);
}

.pos-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pos-results {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 360px;
}

.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
}

.pos-product {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: var(--t-fast);
  position: relative;
}

.pos-product:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.pos-product.out,
.pos-product[aria-disabled="true"] {
  opacity: .58;
  cursor: not-allowed;
}

.pos-product.out:hover,
.pos-product[aria-disabled="true"]:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

.pos-product.variant {
  border-color: rgba(6, 182, 212, .35);
  background: linear-gradient(180deg, rgba(6, 182, 212, .06), var(--bg-page));
}

.pos-product .pp-name {
  font-size: .86rem;
  font-weight: 800;
  color: var(--text-1);
  min-height: 38px;
  line-height: 1.35;
  overflow: hidden;
}

.pos-product .pp-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: .75rem;
  color: var(--text-3);
}

.pos-product .pp-price {
  font-size: 1rem;
  font-weight: 900;
  color: var(--primary);
  margin-top: 7px;
}

.pos-product .pp-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: .65rem;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
  background: var(--warning);
  font-weight: 800;
}

.pos-product .pp-badge.out {
  background: var(--danger);
}

.pos-cart {
  display: flex;
  flex-direction: column;
  min-height: 560px;
}

.cart-head {
  padding: 14px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.cart-item {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 8px;
}

.cart-item-name {
  font-size: .88rem;
  font-weight: 800;
}

.cart-item-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.qty-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .9rem;
}

.qty-btn:hover {
  background: var(--primary);
  color: #fff;
}

.cart-input {
  width: 62px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px;
  font-weight: 800;
  background: var(--bg-card);
  color: var(--text-1);
  font-size: .85rem;
}

.cart-input.price {
  width: 92px;
}

.cart-totals {
  padding: 14px;
  background: var(--bg-hover);
  border-top: 1px solid var(--border);
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: .88rem;
}

.total-row.grand {
  padding: 12px 0 0;
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--primary);
  border-top: 1px dashed var(--border);
  margin-top: 8px;
}

.barcode-preview-pop {
  position: fixed;
  left: 50%;
  top: 86px;
  transform: translateX(-50%) translateY(-8px);
  z-index: 99999;
  background: var(--bg-card);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-xl);
  min-width: min(92vw, 420px);
  padding: 14px 16px;
  opacity: 0;
  pointer-events: none;
  transition: .18s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.barcode-preview-pop.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.barcode-preview-pop .bp-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.pos-scanner-box {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: #000;
  min-height: 280px;
  border: 1px solid var(--border);
}

.pos-scanner-box video {
  width: 100%;
  max-height: 62vh;
  display: block;
  object-fit: cover;
  background: #000;
}

.pos-scan-line {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 2px;
  background: rgba(34, 197, 94, .95);
  box-shadow: 0 0 18px rgba(34, 197, 94, .9);
  animation: posScanLine 1.4s ease-in-out infinite alternate;
}

.pos-scan-help {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: .85rem;
  text-align: center;
}

.pos-keyboard-hint {
  margin-top: 8px;
  font-size: .75rem;
  color: var(--text-3);
}

@keyframes posScanLine {
  from { transform: translateY(-82px); }
  to { transform: translateY(82px); }
}

@media (max-width: 992px) {
  .pos-layout { grid-template-columns: 1fr; }
  .pos-cart { min-height: auto; max-height: 65vh; }
}
