/* ════════════════════════════════════════════════════════
 * page-ai-recommend-bem.css — Turn B
 * BEM 元件層 for ai_recommend.html
 * scope: .ai-recommend-page
 * ════════════════════════════════════════════════════════ */

/* ── Hero header ────────────────────────────────────── */
.ai-recommend-page .ar-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--momo-space-2, 12px);
  padding: var(--momo-space-4, 20px);
  border: 1px solid var(--momo-border-strong);
  border-radius: var(--momo-radius-md, 8px);
  background: var(--momo-surface-raised);
  box-shadow: var(--momo-shadow-soft);
}
.ai-recommend-page .ar-hero__title { display: flex; flex-direction: column; gap: 4px; }
.ai-recommend-page .ar-hero__sub   { color: var(--momo-text-tertiary); }
.ai-recommend-page .ar-hero__actions {
  display: flex; align-items: center; gap: var(--momo-space-1, 8px);
}

/* ── Decision strip ────────────────────────────────── */
.ai-recommend-page .ar-command-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin: var(--momo-space-3, 16px) 0;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--momo-border-subtle);
  border-radius: var(--momo-radius-md, 8px);
  background: color-mix(in srgb, var(--momo-page-accent) 7%, var(--momo-surface));
}
.ai-recommend-page .ar-command-strip__label {
  color: var(--momo-text-tertiary);
  font-size: 0.76rem;
  font-weight: 800;
}
.ai-recommend-page .ar-command-strip strong {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  min-height: 2rem;
  padding: 0.34rem 0.58rem;
  border: 1px solid color-mix(in srgb, var(--momo-page-accent) 22%, var(--momo-border-subtle));
  border-radius: 999px;
  background: var(--momo-surface);
  color: var(--momo-text-strong);
  font-size: 0.82rem;
  font-weight: 800;
}
.ai-recommend-page .ar-command-strip strong i { color: var(--momo-page-accent); }
.ai-recommend-page .ar-command-strip__link {
  margin-left: auto;
  color: var(--momo-page-accent);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}
.ai-recommend-page .ar-command-strip__link:hover { text-decoration: underline; }

/* ── Status pills ──────────────────────────────────── */
.ai-recommend-page .ar-status {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  background: var(--momo-surface-2);
  color: var(--momo-text-tertiary);
  border: 1px solid var(--momo-border-subtle);
}
.ai-recommend-page .ar-status--ok   { background: var(--momo-warm-olive, #6f7a4a); color: var(--momo-on-accent, #fff8ef); border-color: transparent; }
.ai-recommend-page .ar-status--info { background: var(--momo-warm-caramel, #c96442); color: var(--momo-on-accent, #fff8ef); border-color: transparent; }
.ai-recommend-page .ar-status--off  { opacity: 0.7; }

/* ── Card head 變體（取代彩色 bg-* 漸層） ──────────── */
.ai-recommend-page .ar-card__head {
  padding: 0.5rem 1rem !important;
  font-weight: 800;
}
.ai-recommend-page .ar-card__head--accent {
  background: var(--momo-page-accent) !important;
  color: var(--momo-on-accent, #fff8ef) !important;
  border-bottom: none !important;
}
.ai-recommend-page .ar-card__head--accent h6 { color: var(--momo-on-accent, #fff8ef) !important; }
.ai-recommend-page .ar-card__head--success {
  background: var(--momo-warm-olive, #6f7a4a) !important;
  color: var(--momo-on-accent, #fff8ef) !important;
  border-bottom: none !important;
}
.ai-recommend-page .ar-card__head--success span { color: var(--momo-on-accent, #fff8ef); }
.ai-recommend-page .ar-card__head--soft {
  background: var(--momo-surface-raised) !important;
  color: var(--momo-text-strong) !important;
  border-bottom: 1px solid var(--momo-border-subtle) !important;
}
.ai-recommend-page .ar-card__head--soft h6,
.ai-recommend-page .ar-card__head--soft span {
  color: var(--momo-text-strong) !important;
}
.ai-recommend-page .ar-card__head--accent-soft {
  background: var(--momo-warm-honey-soft, rgba(242, 178, 90, 0.15)) !important;
}
.ai-recommend-page .ar-card__head--warn-soft {
  background: var(--momo-warm-caramel-soft, rgba(201, 100, 66, 0.12)) !important;
}
.ai-recommend-page .ar-card__step { opacity: 0.85; }

.ai-recommend-page .ar-engine-settings {
  display: none !important;
}

/* ── Card variant accent borders ──────────────────── */
.ai-recommend-page .ar-card--gen      { border-color: var(--momo-text-strong) !important; }
.ai-recommend-page .ar-card--result   { border-color: var(--momo-warm-olive, #6f7a4a) !important; }
.ai-recommend-page .ar-card--search   { border-color: var(--momo-warm-honey, #c89043) !important; }
.ai-recommend-page .ar-card--insights { border-color: var(--momo-warm-caramel, #c96442) !important; }
.ai-recommend-page .ar-card--trends   { border-color: var(--momo-warm-olive, #6f7a4a) !important; }

/* ── Product identity cards ────────────────────────── */
.ai-recommend-page .ar-product-card {
  display: grid;
  grid-template-columns: 1.6rem 4.5rem minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  min-height: 5.25rem;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--momo-border-subtle);
  cursor: pointer;
}
.ai-recommend-page .ar-product-card:hover {
  background: color-mix(in srgb, var(--momo-page-accent) 5%, var(--momo-surface));
}
.ai-recommend-page .ar-product-card__rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: var(--momo-text-strong);
  color: var(--momo-on-accent, #fff8ef);
  font-size: 0.75rem;
  font-weight: 800;
}
.ai-recommend-page .ar-product-card__media {
  width: 4.5rem;
  height: 4.5rem;
}
.ai-recommend-page .ar-product-card__img,
.ai-recommend-page .ar-product-card__missing-img {
  width: 100%;
  height: 100%;
  border: 1px solid var(--momo-border-subtle);
  border-radius: var(--momo-radius-sm, 6px);
  background: var(--momo-surface-2);
}
.ai-recommend-page .ar-product-card__img {
  display: block;
  object-fit: contain;
}
.ai-recommend-page .ar-product-card__missing-img {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: var(--momo-text-tertiary);
  font-size: 0.68rem;
  font-weight: 800;
}
.ai-recommend-page .ar-product-card__body {
  min-width: 0;
}
.ai-recommend-page .ar-product-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}
.ai-recommend-page .ar-product-card__id {
  color: var(--momo-text-tertiary);
  font-size: 0.72rem;
  font-weight: 800;
}
.ai-recommend-page .ar-product-card__name {
  overflow: hidden;
  color: var(--momo-text-strong);
  font-size: 0.86rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-recommend-page .ar-product-card__price {
  margin-top: 0.2rem;
  color: var(--momo-warm-rose, #a84428);
  font-size: 0.86rem;
  font-weight: 900;
}
.ai-recommend-page .ar-product-card__actions {
  display: flex;
  justify-content: flex-end;
  min-width: 5.25rem;
}
.ai-recommend-page .ar-product-card__link {
  white-space: nowrap;
}
.ai-recommend-page .ar-product-card__pending {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .ai-recommend-page .ar-product-card {
    grid-template-columns: 1.6rem 3.8rem minmax(0, 1fr);
  }
  .ai-recommend-page .ar-product-card__media {
    width: 3.8rem;
    height: 3.8rem;
  }
  .ai-recommend-page .ar-product-card__actions {
    grid-column: 2 / -1;
    justify-content: flex-start;
  }
}

/* ── Dropdown / quick tags / keywords ──────────────── */
.ai-recommend-page .ar-dropdown { max-height: 300px; overflow-y: auto; }
.ai-recommend-page .ar-quick-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-recommend-page .ar-quick-tag,
.ai-recommend-page .ar-keyword {
  cursor: pointer;
  font-size: 0.72rem;
  transition: background-color 120ms;
}
.ai-recommend-page .ar-keywords {
  padding: var(--momo-space-1, 8px);
  background: var(--momo-surface-2);
  border-radius: var(--momo-radius-sm, 6px);
  max-height: 80px;
  overflow-y: auto;
}
.ai-recommend-page .ar-keyword-badge {
  background: var(--momo-surface-2) !important;
  color: var(--momo-text-strong) !important;
  border-color: var(--momo-border-subtle) !important;
}
.ai-recommend-page .ar-keyword-badge.is-selected {
  background: var(--momo-warm-caramel, #c96442) !important;
  color: var(--momo-on-accent, #fff8ef) !important;
  border-color: transparent !important;
}
.ai-recommend-page .ar-selected-count {
  background: var(--momo-surface-2) !important;
  color: var(--momo-text-tertiary) !important;
  border: 1px solid var(--momo-border-subtle);
}
.ai-recommend-page .ar-selected-count.is-active {
  background: var(--momo-page-accent) !important;
  color: var(--momo-on-accent, #fff8ef) !important;
  border-color: transparent;
}
.ai-recommend-page .ar-step-badge,
.ai-recommend-page .ar-semantic-badge,
.ai-recommend-page .ar-copy-badge,
.ai-recommend-page .ar-source-badge {
  color: var(--momo-on-accent, #fff8ef) !important;
  border-color: transparent !important;
}
.ai-recommend-page .ar-step-badge,
.ai-recommend-page .ar-semantic-badge--primary,
.ai-recommend-page .ar-copy-badge--primary,
.ai-recommend-page .ar-source-badge--ptt {
  background: var(--momo-page-accent) !important;
}
.ai-recommend-page .ar-semantic-badge--ok,
.ai-recommend-page .ar-copy-badge--ok,
.ai-recommend-page .ar-source-badge--dcard {
  background: var(--momo-warm-olive, #6f7a4a) !important;
}
.ai-recommend-page .ar-copy-badge--warn,
.ai-recommend-page .ar-source-badge--youtube {
  background: var(--momo-warm-honey, #c89043) !important;
  color: var(--momo-text-strong) !important;
}
.ai-recommend-page .ar-copy-badge--danger,
.ai-recommend-page .ar-source-badge--google-news {
  background: var(--momo-warm-rose, #a84428) !important;
}
.ai-recommend-page .ar-copy-badge--info,
.ai-recommend-page .ar-source-badge--ai {
  background: var(--momo-warm-terra, #a85d3d) !important;
}

/* ── Result body ───────────────────────────────────── */
.ai-recommend-page .ar-result__body { max-height: 400px; overflow-y: auto; }
.ai-recommend-page .ar-result__text {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 0.9rem;
  color: var(--momo-text-strong);
}

/* ── Disabled label state ──────────────────────────── */
.ai-recommend-page .ar-disabled { opacity: 0.5; }

/* ── Scroll utilities ──────────────────────────────── */
.ai-recommend-page .ar-scroll-280 { max-height: 280px; overflow-y: auto; }
.ai-recommend-page .ar-scroll-300 { max-height: 300px; overflow-y: auto; }
.ai-recommend-page .ar-scroll-350 { max-height: 350px; overflow-y: auto; }

/* ── Loading overlay ───────────────────────────────── */
.ar-loading-overlay {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(42, 37, 32, 0.72);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.ar-loading-overlay__inner {
  text-align: center;
  color: var(--momo-on-accent, #fff8ef);
}
.ar-loading-overlay .spinner-border-lg {
  width: 3rem; height: 3rem; border-width: 0.3em;
}

@media (max-width: 767.98px) {
  .ai-recommend-page .ar-hero__actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .ai-recommend-page .ar-command-strip__link {
    width: 100%;
    margin-left: 0;
  }
}
