/* AI Search results shown inside "Featured Deals Near you" (index.html).
   Scoped to #aiFeaturedResults so the normal featured cards are untouched.
   Goals: every card same height, every image fully INSIDE its card (never cropped, stretched or overflowing). */
#aiFeaturedResults { display: flex; flex-wrap: wrap; margin-left: -15px; margin-right: -15px; }
#aiFeaturedResults::before, #aiFeaturedResults::after { display: none; } /* bootstrap clearfix would become a flex item */
#aiFeaturedResults > [class*="col-"] { display: flex; margin-bottom: 30px; min-width: 0; }
#aiFeaturedResults .jd-ai-link { display: flex; width: 100%; color: inherit; text-decoration: none; }
#aiFeaturedResults .jd-ai-link:hover, #aiFeaturedResults .jd-ai-link:focus { color: inherit; text-decoration: none; }

#aiFeaturedResults .product-thumb {
  display: flex; flex-direction: column; width: 100%; min-width: 0;
  background: #fff; border-radius: 10px; overflow: hidden;          /* nothing can poke out of the card */
  box-shadow: 0 2px 10px rgba(60, 20, 120, .10);
  transition: transform .2s ease, box-shadow .2s ease;
}
#aiFeaturedResults .jd-ai-link:hover .product-thumb,
#aiFeaturedResults .jd-ai-link:focus-visible .product-thumb { transform: translateY(-4px); box-shadow: 0 8px 22px rgba(60, 20, 120, .20); }
#aiFeaturedResults .jd-ai-link:focus-visible { outline: 3px solid #7b2ff7; outline-offset: 2px; border-radius: 10px; }

/* fixed-height image well; the image is scaled to fit inside it, keeping its aspect ratio */
#aiFeaturedResults .product-header {
  position: relative; flex: 0 0 auto; height: 240px; padding: 14px; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border-bottom: 1px solid #f0edf7; overflow: hidden;
}
#aiFeaturedResults .product-header > img,
#aiFeaturedResults .product-header img {
  display: block; width: auto; height: auto; max-width: 100%; max-height: 100%;
  object-fit: contain; margin: 0 auto; border-radius: 0;
}
#aiFeaturedResults .jd-ai-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: #28a745; color: #fff; font-size: 12px; font-weight: 700; line-height: 1;
  padding: 6px 9px; border-radius: 4px;
}

#aiFeaturedResults .product-inner {
  flex: 1 1 auto; display: flex; flex-direction: column; text-align: left;
  padding: 16px 18px 18px; background: #fff; border-radius: 0;
}
#aiFeaturedResults .jd-ai-store {
  margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #7b2ff7;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#aiFeaturedResults .jd-ai-title {
  margin: 0 0 8px; font-size: 15px; font-weight: 600; line-height: 1.35; color: #2b2340;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.7em; overflow-wrap: anywhere;
}
#aiFeaturedResults .jd-ai-desc {
  margin: 0 0 8px; font-size: 13px; line-height: 1.4; color: #6b6580;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
#aiFeaturedResults .jd-ai-bottom { margin-top: auto; padding-top: 6px; }
#aiFeaturedResults .jd-ai-prices { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 8px; }
#aiFeaturedResults .jd-ai-price { font-size: 22px; font-weight: 800; color: #1f1a33; line-height: 1.1; }
#aiFeaturedResults .jd-ai-was { font-size: 14px; color: #9a94ad; text-decoration: line-through; }
#aiFeaturedResults .jd-ai-host { margin: 0 0 12px; font-size: 12px; color: #8a849c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#aiFeaturedResults .jd-ai-cta {
  display: block; text-align: center; padding: 9px 12px; border-radius: 6px; font-weight: 600; font-size: 14px;
  color: #fff; background: linear-gradient(135deg, #7b2ff7, #a24bf5);
}
#aiFeaturedResults .jd-ai-link:hover .jd-ai-cta { filter: brightness(1.08); }

@media (max-width: 991px) { #aiFeaturedResults .product-header { height: 210px; } }
@media (max-width: 575px)  { #aiFeaturedResults .product-header { height: 190px; } #aiFeaturedResults .jd-ai-price { font-size: 20px; } }
@media (prefers-reduced-motion: reduce) { #aiFeaturedResults .product-thumb { transition: none; } }

/* placeholder shown when a retailer image is missing / broken / a 1x1 lazy-load spacer */
#aiFeaturedResults .product-header.jd-ai-noimg-wrap { background: linear-gradient(135deg, #f6f0ff, #e8dcff); }
#aiFeaturedResults .product-header.jd-ai-noimg-wrap::after {
  content: "\f290"; font-family: FontAwesome; font-size: 64px; line-height: 1; color: #b99cf2;
}

/* ───────── AI Search v2: chips, status, new-deals banner, background search box, pager, notification ───────── */
.jd-ai-panel { margin: 0 0 18px; text-align: left; }
.jd-ai-chips { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.jd-ai-chips:empty { display: none; }
.jd-ai-chips-label { font-size: 13px; color: #6a6a7a; margin-right: 2px; }
.jd-ai-chip {
  border: 1px solid #cdb8ee; background: #f4edff; color: #4a2782; border-radius: 999px;
  padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; line-height: 1.2;
}
.jd-ai-chip:hover, .jd-ai-chip:focus-visible { background: #6b3ba7; color: #fff; border-color: #6b3ba7; outline: none; }
.jd-ai-note { font-size: 12px; color: #77778a; }
.jd-ai-meta { font-size: 13px; color: #6a6a7a; margin-bottom: 10px; }
.jd-ai-link-btn { background: none; border: 0; padding: 0; color: #6b3ba7; font-weight: 600; text-decoration: underline; cursor: pointer; }
.jd-ai-banner {
  background: #e8f7ee; border: 1px solid #9fd8b3; color: #1d5b34; border-radius: 8px;
  padding: 12px 14px; margin: 0 0 12px;
}
.jd-ai-deeper {
  background: #fbf8ff; border: 1px solid #e0d2f5; color: #3b2a58; border-radius: 8px;
  padding: 14px 16px; margin: 0 0 12px; line-height: 1.5;
}
.jd-ai-btn {
  display: inline-block; background: #6b3ba7; color: #fff !important; border: 0; border-radius: 6px;
  padding: 8px 16px; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; margin-left: 6px;
}
.jd-ai-btn:hover, .jd-ai-btn:focus-visible { background: #4a2782; outline: none; text-decoration: none; }
.jd-ai-emailform { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.jd-ai-emailform input[type=email] { flex: 1 1 220px; min-width: 0; padding: 8px 12px; border: 1px solid #cbb9e8; border-radius: 6px; }
.jd-ai-emailform .jd-ai-btn { margin-left: 0; }
.jd-ai-spin {
  display: inline-block; width: 14px; height: 14px; border: 2px solid #cdb8ee; border-top-color: #6b3ba7;
  border-radius: 50%; vertical-align: -2px; animation: jd-ai-spin 0.9s linear infinite;
}
@keyframes jd-ai-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .jd-ai-spin { animation: none; } }

.jd-ai-pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 4px 0 28px; }
.jd-ai-pager:empty { display: none; }
.jd-ai-pager-info { width: 100%; text-align: center; font-size: 13px; color: #6a6a7a; margin-bottom: 4px; }
.jd-ai-pg {
  min-width: 38px; height: 38px; padding: 0 10px; border: 1px solid #d9cdf0; background: #fff; color: #4a2782;
  border-radius: 6px; font-weight: 600; cursor: pointer;
}
.jd-ai-pg:hover:not([disabled]), .jd-ai-pg:focus-visible { background: #f4edff; outline: 2px solid #6b3ba7; }
.jd-ai-pg.active { background: #6b3ba7; color: #fff; border-color: #6b3ba7; }
.jd-ai-pg[disabled] { opacity: .4; cursor: not-allowed; }
.jd-ai-gap { color: #9a9ab0; padding: 0 2px; }
.jd-ai-more { margin-left: 10px; padding: 9px 18px; border: 2px solid #6b3ba7; background: #fff; color: #6b3ba7; border-radius: 6px; font-weight: 700; cursor: pointer; }
.jd-ai-more:hover:not([disabled]) { background: #6b3ba7; color: #fff; }

.jd-ai-toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 99999; width: 320px; max-width: calc(100vw - 36px);
  background: #fff; border-left: 5px solid #6b3ba7; border-radius: 8px; padding: 14px 38px 14px 16px;
  box-shadow: 0 8px 28px rgba(40, 10, 90, .28); color: #2d2340; display: none;
}
.jd-ai-toast p { margin: 4px 0 10px; font-size: 14px; }
.jd-ai-toast .jd-ai-btn { margin-left: 0; }
.jd-ai-toast-x { position: absolute; top: 6px; right: 8px; background: none; border: 0; font-size: 22px; line-height: 1; color: #888; cursor: pointer; }
@media (max-width: 480px) { .jd-ai-toast { left: 12px; right: 12px; width: auto; bottom: 12px; } .jd-ai-pg { min-width: 34px; height: 34px; } }
