/* Marketplace-style product picker for Mesin Kasir. */
.pos-products .product-grid:not(.list-view) {
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
  align-items: start;
}

.pos-products .marketplace-card {
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #e9e9ee;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(34, 41, 57, .055);
  cursor: pointer;
  transform: translateZ(0);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.pos-products .marketplace-card:focus-visible {
  outline: 3px solid rgba(99, 102, 241, .23);
  outline-offset: 2px;
}

.pos-products .marketplace-media {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  border-radius: 0;
  background: #f5f5f7;
}

.pos-products .marketplace-media .product-image,
.pos-products .marketplace-media .product-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  transition: transform 240ms ease;
}

.pos-products .marketplace-promo {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 4px 8px;
  color: #fff;
  background: linear-gradient(90deg, #5f67ef, #8755ec);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .5px;
}

.pos-products .marketplace-card .stock-badge {
  top: 7px;
  right: 7px;
  padding: 4px 7px;
  border: 1px solid rgba(23, 160, 117, .18);
  border-radius: 999px;
  color: #087b5e;
  background: rgba(247, 255, 251, .94);
  box-shadow: 0 2px 8px rgba(21, 83, 65, .08);
  font-size: 8px;
  font-weight: 800;
}

.pos-products .marketplace-card .stock-badge.low {
  color: #c14e35;
  border-color: rgba(238, 77, 45, .18);
  background: rgba(255, 247, 244, .96);
}

.marketplace-content {
  padding: 10px 11px 11px;
}

.pos-products .marketplace-card .product-brand-row {
  min-width: 0;
  margin-bottom: 6px;
}

.pos-products .marketplace-card .product-brand {
  padding: 3px 6px;
  border-radius: 4px;
  color: #6658d9;
  background: #f3f1ff;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .2px;
}

.pos-products .marketplace-card .spec-btn {
  flex: 0 0 auto;
  padding: 2px 3px;
  color: #9098a7;
  background: transparent;
  font-size: 8px;
}

.pos-products .marketplace-card .spec-btn:hover {
  color: #625bf6;
  background: #f5f3ff;
}

.pos-products .marketplace-card h4 {
  min-height: 39px;
  margin: 0 0 9px;
  color: #293244;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.55;
  -webkit-line-clamp: 2;
}

.marketplace-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pos-products .marketplace-card .product-price {
  min-width: 0;
  color: #625bf6;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: -.35px;
  white-space: nowrap;
}

.pos-products .marketplace-card .product-price small {
  color: #939aaa;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0;
}

.pos-products .marketplace-card .marketplace-add {
  width: 30px;
  height: 30px;
  min-height: 30px;
  flex: 0 0 30px;
  padding: 7px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(145deg, #716df2, #7f55ec);
  box-shadow: 0 7px 16px rgba(99, 87, 224, .25);
}

.pos-products .marketplace-card .marketplace-add:hover {
  color: #fff;
  background: linear-gradient(145deg, #625bf0, #7146df);
  transform: translateY(-1px);
}

.pos-products .marketplace-card .product-meta {
  align-items: center;
  margin-top: 8px;
  color: #8d95a5;
  font-size: 8px;
  line-height: 1.4;
}

.pos-products .marketplace-card .wholesale {
  max-width: 70%;
  overflow: hidden;
  padding: 3px 5px;
  border: 1px solid #ddd8ff;
  border-radius: 4px;
  color: #6758d0;
  background: #f8f6ff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-products .marketplace-card.out-of-stock {
  cursor: not-allowed;
  filter: saturate(.55);
  opacity: .7;
}

.pos-products .marketplace-card.out-of-stock .marketplace-add {
  color: #a3a8b2;
  background: #eceef2;
  box-shadow: none;
}

@media (hover: hover) and (pointer: fine) {
  .pos-products .marketplace-card:not(.out-of-stock):hover {
    z-index: 2;
    border-color: rgba(99, 102, 241, .34);
    box-shadow: 0 13px 28px rgba(84, 72, 176, .15);
    transform: translateY(-4px);
  }

  .pos-products .marketplace-card:not(.out-of-stock):hover .product-image {
    transform: scale(1.035);
  }
}

.pos-products .product-grid.list-view .marketplace-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 0;
  min-height: 82px;
}

.pos-products .product-grid.list-view .marketplace-media {
  width: 82px;
  height: 82px;
  aspect-ratio: auto;
}

.pos-products .product-grid.list-view .marketplace-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  align-items: center;
  padding: 9px 11px;
}

.pos-products .product-grid.list-view .product-brand-row,
.pos-products .product-grid.list-view h4 {
  grid-column: 1;
}

.pos-products .product-grid.list-view h4 {
  min-height: 0;
  margin: 3px 0;
}

.pos-products .product-grid.list-view .marketplace-price-row {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.pos-products .product-grid.list-view .product-meta {
  grid-column: 1 / -1;
  display: flex;
  margin-top: 4px;
}

@media (max-width: 760px) {
  .pos-products .product-grid:not(.list-view) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .marketplace-content { padding: 9px; }
  .pos-products .marketplace-card h4 { font-size: 10px; }
  .pos-products .marketplace-card .product-price { font-size: 13px; }
}

@media (min-width: 761px) and (max-width: 1190px) {
  .pos-products .product-grid:not(.list-view) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .marketplace-content { padding: 9px; }
  .pos-products .marketplace-card h4 { font-size: 10px; }
  .pos-products .marketplace-card .product-price { font-size: 12px; }
}

@media (max-width: 390px) {
  .pos-products .marketplace-card .marketplace-add {
    width: 28px;
    height: 28px;
    min-height: 28px;
    flex-basis: 28px;
  }

  .pos-products .marketplace-card .wholesale { max-width: 64%; }
}

@media (prefers-reduced-motion: reduce) {
  .pos-products .marketplace-card,
  .pos-products .marketplace-media .product-image,
  .pos-products .marketplace-media .product-placeholder {
    transition: none;
  }
}
