/* ==========================================================================
   Niwa AI – Products (card rail, pricing, suggestions)
   ---------------------------------------------------------------------------
   Product cards displayed in the .niwa-morph__body scrollable container.
   New design: dark card with full image background, gradient overlay,
   logo + glass pill banner, overlaid content, and bot-bubble footer.
   All selectors use .niwa-* prefix. No za-* references.
   ========================================================================== */

/* ── Wrap Container ───────────────────────────────────────────────────── */
.niwa-morph__body .niwa-message-products,
.niwa-center__body .niwa-message-products,
.niwa-shortcode .niwa-message-products {
  width: 100%;
  padding: 0;
}

/* ── Product Rail ─────────────────────────────────────────────────────── */
.niwa-morph__body .niwa-products,
.niwa-center__body .niwa-products,
.niwa-shortcode .niwa-products {
  --card-w: 249px;
  --card-img-h: 300px;
  --card-radius: 12px;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* 16px body margin + 28px avatar + 8px gap = 52px to align under bubble */
  padding-left: 52px;
  padding-right: 16px;
  padding-top: 4px;
  padding-bottom: 8px;
  cursor: grab;
}

.niwa-morph__body .niwa-products::-webkit-scrollbar,
.niwa-center__body .niwa-products::-webkit-scrollbar,
.niwa-shortcode .niwa-products::-webkit-scrollbar {
  display: none;
}

.niwa-morph__body .niwa-products.dragging,
.niwa-center__body .niwa-products.dragging,
.niwa-shortcode .niwa-products.dragging {
  cursor: grabbing;
  scroll-behavior: auto;
  user-select: none;
}

/* ── Card ─────────────────────────────────────────────────────────────── */
.niwa-morph__body .niwa-card,
.niwa-center__body .niwa-card,
.niwa-shortcode .niwa-card {
  flex: 0 0 var(--card-w);
  background: var(--niwa-color-surface-raised);
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 1px solid var(--niwa-color-border-subtle);
  display: flex;
  flex-direction: column;
  margin-bottom: 2px;
  transition: box-shadow 0.2s, transform 0.2s;
}

.niwa-morph__body .niwa-card:hover,
.niwa-center__body .niwa-card:hover,
.niwa-shortcode .niwa-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.niwa-widget[data-niwa-theme="light"] .niwa-card {
  background: #1a1a1a;
  border-color: rgba(255, 255, 255, 0.08);
}

.niwa-widget[data-niwa-theme="light"] .niwa-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  border-color: rgba(255, 255, 255, 0.12);
}

/* ── Dark theme card ──────────────────────────────────────────────────── */
[data-niwa-theme="dark"] .niwa-card {
  background: #1a1a1a;
  border-color: rgba(255, 255, 255, 0.08);
}

[data-niwa-theme="dark"] .niwa-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.12);
}

/* ── Card Visual (image area) ─────────────────────────────────────────── */
.niwa-morph__body .niwa-card-visual,
.niwa-center__body .niwa-card-visual,
.niwa-shortcode .niwa-card-visual {
  position: relative;
  height: var(--card-img-h);
  overflow: hidden;
  cursor: pointer;
}

/* ── Card Image ───────────────────────────────────────────────────────── */
.niwa-morph__body .niwa-card-img,
.niwa-center__body .niwa-card-img,
.niwa-shortcode .niwa-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Gradient Overlay ─────────────────────────────────────────────────── */
.niwa-morph__body .niwa-card-overlay,
.niwa-center__body .niwa-card-overlay,
.niwa-shortcode .niwa-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.15), transparent);
  pointer-events: none;
}

/* ── Top Area (logo + banner) ─────────────────────────────────────────── */
.niwa-morph__body .niwa-card-top,
.niwa-center__body .niwa-card-top,
.niwa-shortcode .niwa-card-top {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 2;
}

.niwa-morph__body .niwa-card-logo,
.niwa-center__body .niwa-card-logo,
.niwa-shortcode .niwa-card-logo {
  width: 21px;
  height: 21px;
  border-radius: var(--niwa-radius-full);
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
  object-fit: cover;
}

.niwa-morph__body .niwa-card-banner,
.niwa-center__body .niwa-card-banner,
.niwa-shortcode .niwa-card-banner {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: var(--niwa-font-weight-medium);
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 3px 10px;
  border-radius: var(--niwa-radius-full);
  white-space: nowrap;
}

/* ── Content (over image, bottom) ─────────────────────────────────────── */
.niwa-morph__body .niwa-card-content,
.niwa-center__body .niwa-card-content,
.niwa-shortcode .niwa-card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px;
  z-index: 2;
}

.niwa-morph__body .niwa-card-title,
.niwa-center__body .niwa-card-title,
.niwa-shortcode .niwa-card-title {
  font-size: 15px;
  color: #fff;
  font-weight: var(--niwa-font-weight-semibold);
  line-height: 1.3;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.niwa-morph__body .niwa-card-desc,
.niwa-center__body .niwa-card-desc,
.niwa-shortcode .niwa-card-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 12px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── CTA row (price + Shop Now) ───────────────────────────────────────── */
.niwa-morph__body .niwa-card-cta,
.niwa-center__body .niwa-card-cta,
.niwa-shortcode .niwa-card-cta {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.niwa-morph__body .niwa-card-price,
.niwa-center__body .niwa-card-price,
.niwa-shortcode .niwa-card-price {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.niwa-morph__body .niwa-price-old,
.niwa-center__body .niwa-price-old,
.niwa-shortcode .niwa-price-old {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  text-decoration: line-through;
  white-space: nowrap;
  order: -1;
}

.niwa-morph__body .niwa-price-old,
.niwa-morph__body .niwa-price-old *,
.niwa-center__body .niwa-price-old,
.niwa-center__body .niwa-price-old *,
.niwa-shortcode .niwa-price-old,
.niwa-shortcode .niwa-price-old * {
  color: rgba(255, 255, 255, 0.45) !important;
}

.niwa-morph__body .niwa-price-current,
.niwa-center__body .niwa-price-current,
.niwa-shortcode .niwa-price-current {
  font-size: 16px;
  font-weight: var(--niwa-font-weight-bold);
  color: #fff;
  white-space: nowrap;
}

.niwa-morph__body .niwa-price-current,
.niwa-morph__body .niwa-price-current *,
.niwa-center__body .niwa-price-current,
.niwa-center__body .niwa-price-current *,
.niwa-shortcode .niwa-price-current,
.niwa-shortcode .niwa-price-current * {
  color: #fff !important;
}

/* ── Shop Now / Buy Now pill button (over image) ──────────────────────── */
.niwa-morph__body .niwa-btn-pill,
.niwa-center__body .niwa-btn-pill,
.niwa-shortcode .niwa-btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 85px !important;
  min-height: 24px !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 6px 12px !important;
  border: none !important;
  border-radius: 100px !important;
  cursor: pointer;
  font-size: 10px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  font-family: inherit !important;
  text-decoration: none;
  text-transform: none;
  white-space: nowrap !important;
  transition: opacity 0.15s, transform 0.1s;
  flex-shrink: 0;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.niwa-morph__body .niwa-btn-pill:hover,
.niwa-center__body .niwa-btn-pill:hover,
.niwa-shortcode .niwa-btn-pill:hover {
  opacity: 0.85;
}

.niwa-morph__body .niwa-btn-pill:active,
.niwa-center__body .niwa-btn-pill:active,
.niwa-shortcode .niwa-btn-pill:active {
  transform: scale(0.97);
}

.niwa-morph__body .niwa-btn-pill:disabled,
.niwa-center__body .niwa-btn-pill:disabled,
.niwa-shortcode .niwa-btn-pill:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ── Add to Cart button (footer) ──────────────────────────────────────── */
.niwa-morph__body .niwa-btn-cart,
.niwa-center__body .niwa-btn-cart,
.niwa-shortcode .niwa-btn-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 85px !important;
  min-height: 24px !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 6px 12px !important;
  border: none !important;
  border-radius: 100px !important;
  cursor: pointer;
  font-size: 10px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  font-family: inherit !important;
  text-decoration: none;
  text-transform: none;
  white-space: nowrap !important;
  transition: opacity 0.15s, transform 0.1s;
  flex-shrink: 0;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.niwa-morph__body .niwa-btn-cart:hover,
.niwa-center__body .niwa-btn-cart:hover,
.niwa-shortcode .niwa-btn-cart:hover {
  opacity: 0.85;
}

.niwa-morph__body .niwa-btn-cart:active,
.niwa-center__body .niwa-btn-cart:active,
.niwa-shortcode .niwa-btn-cart:active {
  transform: scale(0.97);
}

.niwa-morph__body .niwa-btn-cart:disabled,
.niwa-center__body .niwa-btn-cart:disabled,
.niwa-shortcode .niwa-btn-cart:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ── Footer ───────────────────────────────────────────────────────────── */
.niwa-morph__body .niwa-card-footer,
.niwa-center__body .niwa-card-footer,
.niwa-shortcode .niwa-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--niwa-color-bubble-bot);
  border-radius: 0 0 var(--card-radius) var(--card-radius);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 0;
}

.niwa-widget[data-niwa-theme="light"] .niwa-card-footer {
  background: #1a1a1a;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

/* ── Dark theme footer ────────────────────────────────────────────────── */
[data-niwa-theme="dark"] .niwa-card-footer {
  background: #1a1a1a;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.niwa-morph__body .niwa-card-footer-meta,
.niwa-center__body .niwa-card-footer-meta,
.niwa-shortcode .niwa-card-footer-meta {
  display: flex;
  align-items: center;
  min-width: 0;
}

.niwa-morph__body .niwa-card-footer--off,
.niwa-center__body .niwa-card-footer--off,
.niwa-shortcode .niwa-card-footer--off {
  justify-content: flex-end;
}

/* ── Delivery text ────────────────────────────────────────────────────── */
.niwa-morph__body .niwa-card-delivery,
.niwa-center__body .niwa-card-delivery,
.niwa-shortcode .niwa-card-delivery {
  font-size: 10px;
  color: var(--niwa-color-bubble-bot-text);
  opacity: 0.72;
  font-weight: var(--niwa-font-weight-medium);
  line-height: 1.2;
}

.niwa-morph__body .niwa-card-delivery-val,
.niwa-center__body .niwa-card-delivery-val,
.niwa-shortcode .niwa-card-delivery-val {
  opacity: 1;
  font-weight: var(--niwa-font-weight-semibold);
}

.niwa-widget[data-niwa-theme="light"] .niwa-card-delivery {
  color: rgba(255, 255, 255, 0.5);
  opacity: 1;
}

.niwa-widget[data-niwa-theme="light"] .niwa-card-delivery-val {
  color: rgba(255, 255, 255, 0.9);
}

/* ── Dark theme delivery text ─────────────────────────────────────────── */
[data-niwa-theme="dark"] .niwa-card-delivery {
  color: rgba(255, 255, 255, 0.5);
  opacity: 1;
}

[data-niwa-theme="dark"] .niwa-card-delivery-val {
  color: rgba(255, 255, 255, 0.9);
}

/* ── Dark theme Add to Cart button ────────────────────────────────────── */
[data-niwa-theme="dark"] .niwa-btn-cart {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}

.niwa-widget[data-niwa-theme="light"] .niwa-btn-cart {
  background: rgba(255, 255, 255, 0.1) !important;
  color: rgba(255, 255, 255, 0.4) !important;
}

/* ── Star rating ──────────────────────────────────────────────────────── */
.niwa-morph__body .niwa-card-rating,
.niwa-center__body .niwa-card-rating,
.niwa-shortcode .niwa-card-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--niwa-color-bubble-bot-text);
  line-height: 1;
  min-width: 0;
}

.niwa-widget[data-niwa-theme="light"] .niwa-card-rating,
.niwa-widget[data-niwa-theme="light"] .niwa-card-rating .niwa-rating-count {
  color: rgba(255, 255, 255, 0.9);
}

.niwa-morph__body .niwa-card-rating .niwa-rating-value,
.niwa-center__body .niwa-card-rating .niwa-rating-value,
.niwa-shortcode .niwa-card-rating .niwa-rating-value {
  font-size: 11px;
  font-weight: var(--niwa-font-weight-semibold);
  color: var(--niwa-color-bubble-bot-text);
}

.niwa-morph__body .niwa-card-rating .niwa-stars,
.niwa-center__body .niwa-card-rating .niwa-stars,
.niwa-shortcode .niwa-card-rating .niwa-stars {
  display: inline-flex;
  gap: 0;
  color: #facc15;
  font-size: 11px;
  letter-spacing: -1px;
}

.niwa-morph__body .niwa-card-rating .niwa-rating-count,
.niwa-center__body .niwa-card-rating .niwa-rating-count,
.niwa-shortcode .niwa-card-rating .niwa-rating-count {
  font-size: 10px;
  color: var(--niwa-color-bubble-bot-text);
  opacity: 0.7;
}

.niwa-widget[data-niwa-theme="light"] .niwa-card-rating .niwa-rating-value {
  color: rgba(255, 255, 255, 0.9);
}

.niwa-widget[data-niwa-theme="light"] .niwa-card-rating .niwa-rating-count {
  color: rgba(255, 255, 255, 0.9);
  opacity: 0.7;
}

/* ── Suggestion Chips ─────────────────────────────────────────────────── */
.niwa-morph__body .niwa-suggests,
.niwa-center__body .niwa-suggests,
.niwa-shortcode .niwa-suggests {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  margin-top: 8px;
  padding-top: 4px;
}

.niwa-morph__body .niwa-chip,
.niwa-center__body .niwa-chip,
.niwa-shortcode .niwa-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 16px;
  border: 1.5px solid var(--niwa-color-border-subtle);
  border-radius: var(--niwa-radius-full);
  cursor: pointer;
  background: transparent;
  color: var(--niwa-color-primary);
  font-size: var(--niwa-font-size-sm);
  font-weight: var(--niwa-font-weight-medium);
  line-height: var(--niwa-line-height-tight);
  white-space: nowrap;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  transition:
    background var(--niwa-transition-fast),
    color var(--niwa-transition-fast),
    transform var(--niwa-transition-fast),
    border-color var(--niwa-transition-fast),
    box-shadow var(--niwa-transition-fast);
}

.niwa-morph__body .niwa-chip:hover,
.niwa-center__body .niwa-chip:hover,
.niwa-shortcode .niwa-chip:hover {
  background: var(--niwa-color-primary);
  color: #fff;
  border-color: var(--niwa-color-primary);
  transform: translateY(-1px);
}

.niwa-morph__body .niwa-chip:active,
.niwa-center__body .niwa-chip:active,
.niwa-shortcode .niwa-chip:active {
  transform: translateY(0) scale(0.97);
}

/* Dark theme chips */
[data-niwa-theme="dark"] .niwa-chip {
  border-color: rgba(232, 230, 225, 0.34);
  color: var(--niwa-color-text-primary);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

[data-niwa-theme="dark"] .niwa-chip:hover {
  background: var(--niwa-color-text-primary);
  color: var(--niwa-color-surface-base);
  border-color: var(--niwa-color-text-primary);
}
