/* Overrides for compact, modern product grid inside chat panel */
.ai-search-embed {
  /* Smaller thumbnail to suit non-fullscreen chat */
  --ai-thumb-height: 80px;
  /* Motion tokens */
  --ai-ease-standard: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ai-motion-fast: 180ms;
  --ai-motion-medium: 220ms;
}

/* 4-column grid with responsive fallback */
.ai-search-embed .ai-search-embed__products {
  grid-template-columns: repeat(4, 1fr) !important;
}

@media (max-width: 900px) {
  .ai-search-embed .ai-search-embed__products {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Compact thumbnails */
.ai-search-embed .ai-search-embed__product-media {
  aspect-ratio: auto !important;
  height: var(--ai-thumb-height) !important;
  overflow: hidden;
}

/* Hide description for cleaner, tighter cards */
.ai-search-embed .ai-search-embed__product-desc {
  display: none !important;
}

/* Slightly tighter body spacing when desc is hidden */
.ai-search-embed .ai-search-embed__product-body {
  gap: 6px !important;
}

/* Align product cards with chatbox theme */
.ai-search-embed .ai-search-embed__product-card {
  background: var(--ai-color-surface) !important;
  border-color: rgba(0, 0, 0, 0.06) !important;
  transition: transform var(--ai-motion-fast) var(--ai-ease-standard),
              box-shadow var(--ai-motion-fast) var(--ai-ease-standard),
              border-color var(--ai-motion-fast) var(--ai-ease-standard),
              background-color var(--ai-motion-fast) var(--ai-ease-standard);
  will-change: transform;
}

/* Simplify card footer; hide explicit action */
.ai-search-embed .ai-search-embed__product-meta {
  justify-content: flex-start !important;
}

.ai-search-embed .ai-search-embed__link {
  display: none !important;
}

/* Accent the price to match chatbox primary color */
.ai-search-embed .ai-search-embed__price {
  color: var(--ai-color-accent) !important;
}

/* Hover/focus elevation and border accent */
.ai-search-embed .ai-search-embed__product-card:hover,
.ai-search-embed .ai-search-embed__product-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  border-color: var(--ai-color-accent) !important;
  outline: none;
}

/* Focus ring for keyboard navigation */
.ai-search-embed .ai-search-embed__product-card:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--ai-color-accent) 55%, transparent),
              0 4px 14px rgba(0, 0, 0, 0.14);
}

/* Active press feedback */
.ai-search-embed .ai-search-embed__product-card:active {
  transform: translateY(0) scale(0.985);
}

/* Subtle image zoom on hover/focus */
.ai-search-embed .ai-search-embed__product-img {
  transition: transform var(--ai-motion-medium) var(--ai-ease-standard);
  transform-origin: center center;
}
.ai-search-embed .ai-search-embed__product-card:hover .ai-search-embed__product-img,
.ai-search-embed .ai-search-embed__product-card:focus-visible .ai-search-embed__product-img {
  transform: scale(1.03);
}

/* Entrance animation with gentle fade/slide and slight stagger */
@keyframes ai-fade-slide-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ai-search-embed .ai-search-embed__product-card {
  animation: ai-fade-slide-up var(--ai-motion-medium) var(--ai-ease-standard) 1 both;
}
.ai-search-embed .ai-search-embed__product-card:nth-child(1) { animation-delay: 0ms; }
.ai-search-embed .ai-search-embed__product-card:nth-child(2) { animation-delay: 30ms; }
.ai-search-embed .ai-search-embed__product-card:nth-child(3) { animation-delay: 60ms; }
.ai-search-embed .ai-search-embed__product-card:nth-child(4) { animation-delay: 90ms; }
.ai-search-embed .ai-search-embed__product-card:nth-child(5) { animation-delay: 120ms; }
.ai-search-embed .ai-search-embed__product-card:nth-child(6) { animation-delay: 150ms; }

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .ai-search-embed * { animation: none !important; transition: none !important; }
  .ai-search-embed .ai-search-embed__product-card,
  .ai-search-embed .ai-search-embed__product-img { transform: none !important; }
}
