/* AffShelf: đổi màu theo brand bằng cách đặt các biến này ở :root của theme. */
:root {
  --affshelf-accent: #0f766e;
  --affshelf-accent-text: #fff;
  --affshelf-pro: #15803d;
  --affshelf-con: #b91c1c;
  --affshelf-radius: 10px;
  --affshelf-line: color-mix(in srgb, currentColor 14%, transparent);
  --affshelf-soft: color-mix(in srgb, currentColor 4%, transparent);
  --affshelf-muted: color-mix(in srgb, currentColor 62%, transparent);
}

.affshelf-list { margin: 1.5em 0; container-type: inline-size; }
.affshelf-list img { max-width: 100%; height: auto; }

/* bảng so sánh */
.affshelf-compare { overflow-x: auto; margin: 0 0 1.5em; border: 1px solid var(--affshelf-line); border-radius: var(--affshelf-radius); }
.affshelf-compare table { width: 100%; border-collapse: collapse; margin: 0; font-size: .95em; }
.affshelf-compare th, .affshelf-compare td { padding: .6em .75em; border: 0; border-bottom: 1px solid var(--affshelf-line); text-align: left; vertical-align: middle; }
.affshelf-compare tr:last-child td { border-bottom: 0; }
.affshelf-compare th { font-size: .8em; text-transform: uppercase; letter-spacing: .04em; color: var(--affshelf-muted); background: var(--affshelf-soft); }
.affshelf-compare__n { font-weight: 700; width: 2em; }
.affshelf-compare__prod { display: flex; align-items: center; gap: .65em; color: inherit; text-decoration: none; font-weight: 600; }
.affshelf-compare__prod img { width: 48px; height: 48px; object-fit: contain; flex: none; background: #fff; border-radius: 6px; }
.affshelf-compare__prod:hover span { text-decoration: underline; }
.affshelf-compare__buy { display: inline-block; white-space: nowrap; padding: .4em .9em; border-radius: 999px; background: var(--affshelf-accent); color: var(--affshelf-accent-text) !important; text-decoration: none !important; font-weight: 600; font-size: .9em; }

/* thẻ sản phẩm */
.affshelf-card { position: relative; border: 1px solid var(--affshelf-line); border-radius: var(--affshelf-radius); padding: 1.25em; margin: 0 0 1.25em; scroll-margin-top: 90px; }
.affshelf-card__top { display: grid; grid-template-columns: 140px 1fr 180px; gap: 1.25em; align-items: center; }
.affshelf-card__mid { min-width: 0; position: relative; }
.affshelf-card__n { position: absolute; top: -.7em; left: 1em; min-width: 1.8em; height: 1.8em; line-height: 1.8em; padding: 0 .4em; text-align: center; border-radius: 999px; background: var(--affshelf-accent); color: var(--affshelf-accent-text); font-weight: 700; font-size: .85em; }
.affshelf-card__img { display: block; background: #fff; border-radius: 8px; padding: 6px; }
.affshelf-card__img img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }
.affshelf-card__title { margin: 0 0 .3em !important; font-size: 1.2em; line-height: 1.3; }
.affshelf-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .2em .8em; font-size: .9em; color: var(--affshelf-muted); margin-bottom: .45em; }
.affshelf-card__meta b { color: var(--affshelf-accent); font-size: 1.15em; }
.affshelf-dot { display: none; } /* chấm treo cuối dòng khi điểm rớt xuống; dùng khoảng cách thay chấm */
.affshelf-card__desc { margin: 0; }
.affshelf-card__buy { display: flex; flex-direction: column; align-items: stretch; gap: .4em; text-align: center; }
.affshelf-btn { display: block; padding: .75em 1.1em; border-radius: 8px; background: var(--affshelf-accent); color: var(--affshelf-accent-text) !important; font-weight: 700; text-decoration: none !important; line-height: 1.2; transition: filter .15s; }
.affshelf-btn:hover, .affshelf-compare__buy:hover { filter: brightness(1.1); }
.affshelf-price { font-weight: 700; font-size: 1.15em; }
.affshelf-price__when { display: block; font-size: .72em; color: var(--affshelf-muted); }
.affshelf-stock { font-size: .8em; color: var(--affshelf-con); }

.affshelf-badge { display: inline-block; margin-left: .5em; padding: .1em .55em; border-radius: 4px; background: var(--affshelf-accent); color: var(--affshelf-accent-text); font-style: normal; font-size: .72em; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; vertical-align: middle; }
.affshelf-badge--card { position: absolute; top: -.75em; right: 1em; margin: 0; }

/* giải thích điểm */
.affshelf-tip { display: inline-block; }
.affshelf-tip > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 1.15em; height: 1.15em; border-radius: 50%; border: 1px solid currentColor; font-size: .8em; font-weight: 700; font-style: italic; font-family: Georgia, serif; }
.affshelf-tip > summary::-webkit-details-marker { display: none; }
.affshelf-tip__body { position: absolute; z-index: 20; left: 0; right: 0; max-width: 340px; margin-top: .4em; padding: .75em .9em; border-radius: 8px; background: #111; color: #f5f5f5; font-size: .85em; line-height: 1.45; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.affshelf-tip__body a { color: #fff; text-decoration: underline; }

/* pros / cons */
.affshelf-pc { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; margin-top: 1.1em; }
.affshelf-pc > div { padding: .8em 1em; border-radius: 8px; background: var(--affshelf-soft); }
.affshelf-pc__h { margin: 0 0 .35em !important; font-weight: 700; font-size: .85em; text-transform: uppercase; letter-spacing: .04em; }
.affshelf-pc__pros .affshelf-pc__h { color: var(--affshelf-pro); }
.affshelf-pc__cons .affshelf-pc__h { color: var(--affshelf-con); }
.affshelf-pc ul { margin: 0 !important; padding: 0 !important; list-style: none !important; }
.affshelf-pc li { position: relative; padding-left: 1.3em; margin: .25em 0; font-size: .95em; }
.affshelf-pc__pros li::before { content: "+"; color: var(--affshelf-pro); }
.affshelf-pc__cons li::before { content: "\2212"; color: var(--affshelf-con); }
.affshelf-pc li::before { position: absolute; left: 0; font-weight: 700; }

/* đoạn review chi tiết */
.affshelf-tab { margin-top: .9em; border-top: 1px solid var(--affshelf-line); padding-top: .6em; }
.affshelf-tab > summary { cursor: pointer; font-weight: 600; }
.affshelf-tab__body { padding-top: .5em; }
.affshelf-tab__body > :last-child { margin-bottom: 0; }

.affshelf-note, .affshelf-disclosure { font-size: .85em; color: var(--affshelf-muted); }
.affshelf-disclosure { padding: .6em .9em; border-left: 3px solid var(--affshelf-accent); background: var(--affshelf-soft); border-radius: 0 6px 6px 0; }
.affshelf-link { font-weight: 600; }

/* theo bề rộng khối danh sách, không theo màn hình: cột nội dung của theme thường hẹp */
@container (max-width: 760px) {
  .affshelf-card__top { grid-template-columns: 120px 1fr; }
  .affshelf-card__buy { grid-column: 1 / -1; }
  .affshelf-card__buy .affshelf-btn { max-width: 340px; width: 100%; margin: 0 auto; }
}
@container (max-width: 520px) {
  .affshelf-card { padding: 1em; }
  .affshelf-card__top { grid-template-columns: 88px 1fr; gap: .9em; }
  .affshelf-card__title { font-size: 1.05em; }
  .affshelf-pc { grid-template-columns: 1fr; }
  .affshelf-compare__prod img { width: 40px; height: 40px; }
  .affshelf-compare th, .affshelf-compare td { padding: .5em; }
}
