/**
 * @file
 * Product autocomplete dropdown. Logical properties keep LTR/RTL correct.
 */

.product-ac {
  position: relative;
}

.product-ac__panel {
  position: absolute;
  inset-inline-start: 0;
  inset-inline-end: 0;
  top: 100%;
  z-index: 1050;
  max-height: 420px;
  overflow-y: auto;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  -webkit-overflow-scrolling: touch;
}

.product-ac__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f2f2f2;
}

.product-ac__item:last-child {
  border-bottom: 0;
}

.product-ac__item.is-active,
.product-ac__item:hover {
  background: #f5f7fa;
}

/* Fixed box prevents layout shift while the image loads. */
.product-ac__thumb {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-ac__thumb img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  display: block;
}

.product-ac__thumb--placeholder {
  background: #e8ebee url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23aeb6bf' stroke-width='2'><rect x='3' y='3' width='18' height='18' rx='2'/><circle cx='8.5' cy='8.5' r='1.5'/><path d='M21 15l-5-5L5 21'/></svg>") center / 20px no-repeat;
}

.product-ac__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  text-align: start;
}

.product-ac__title {
  font-size: 0.9rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-ac__meta {
  display: flex;
  gap: 8px;
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 2px;
}

/* Hide price/SKU meta on small screens. */
@media (max-width: 575.98px) {
  .product-ac__meta {
    display: none;
  }
}

.product-ac__price {
  color: #16794c;
  font-weight: 600;
}

.product-ac__empty,
.product-ac__loading {
  padding: 12px;
  font-size: 0.85rem;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-ac__spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #cfd4da;
  border-top-color: #16794c;
  border-radius: 50%;
  animation: product-ac-spin 0.7s linear infinite;
}

@keyframes product-ac-spin {
  to { transform: rotate(360deg); }
}

/* Explicit RTL mirroring for shadow direction. */
[dir="rtl"] .product-ac__panel {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}
