/* ═══════════════════════════════════════════════════════════════
   Search Autocomplete Dropdown
   ═══════════════════════════════════════════════════════════════ */

/* Wrapper that gives the dropdown its positioning anchor */
.search-ac-wrap {
  position: relative;
  width: 100%;
}

/* ── Dropdown container ────────────────────────────────────────── */
.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 340px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .16), 0 2px 8px rgba(0, 0, 0, .08);
  z-index: 99999;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, .07);
  animation: sd-fadein .15s ease;
}

.search-dropdown.open {
  display: block;
}

@keyframes sd-fadein {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Product list ──────────────────────────────────────────────── */
.sd-list {
  list-style: none;
  margin: 0;
  padding: 6px 0 0;
  max-height: 440px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}

.sd-list::-webkit-scrollbar        { width: 4px; }
.sd-list::-webkit-scrollbar-track  { background: transparent; }
.sd-list::-webkit-scrollbar-thumb  { background: #ddd; border-radius: 4px; }

/* ── Single item ───────────────────────────────────────────────── */
.sd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background .13s;
  text-decoration: none;
  color: inherit;
}

.sd-item:hover,
.sd-item.active {
  background: #f7f7f7;
}

/* ── Thumbnail ─────────────────────────────────────────────────── */
.sd-thumb {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #eee;
  background: #f3f3f3;
}

.sd-thumb-placeholder {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  background: #f3f3f3;
  border: 1px solid #eee;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-size: 22px;
}

/* ── Text info ─────────────────────────────────────────────────── */
.sd-info {
  flex: 1;
  min-width: 0;
}

.sd-name {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
  line-height: 1.35;
}

.sd-name mark {
  background: #fff3cd;
  color: #1a1a1a;
  padding: 0 1px;
  border-radius: 2px;
}

.sd-price {
  font-size: 13px;
  color: #e02020;
  font-weight: 700;
}

.sd-original {
  font-size: 11px;
  color: #aaa;
  text-decoration: line-through;
  margin-left: 6px;
  font-weight: 400;
}

/* ── Arrow icon on each item ───────────────────────────────────── */
.sd-arrow {
  color: #ccc;
  font-size: 11px;
  flex-shrink: 0;
  transition: color .13s;
}

.sd-item:hover .sd-arrow,
.sd-item.active .sd-arrow {
  color: #888;
}

/* ── Divider ───────────────────────────────────────────────────── */
.sd-divider {
  height: 1px;
  background: #f0f0f0;
  margin: 4px 0 0;
}

/* ── Footer / See all ──────────────────────────────────────────── */
.sd-footer {
  padding: 10px 16px 12px;
  background: #fafafa;
  border-top: 1px solid #f0f0f0;
}

.sd-see-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 0;
  border-radius: 6px;
  background: #222;
  color: #fff !important;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .03em;
  transition: background .2s;
}

.sd-see-all:hover {
  background: #444;
}

/* ── Empty / loading states ────────────────────────────────────── */
.sd-empty,
.sd-loading {
  padding: 22px 16px;
  text-align: center;
  font-size: 13px;
  color: #999;
}

.sd-loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #ddd;
  border-top-color: #555;
  border-radius: 50%;
  animation: sd-spin .6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes sd-spin {
  to { transform: rotate(360deg); }
}

/* ── Mobile override (full-width, flush to form) ───────────────── */
.mobile_search .search-dropdown {
  min-width: unset;
  border-radius: 0 0 10px 10px;
  top: 100%;
}
