/* =====================================================================
   Trợ lý chọn đồ 1.6.0 — templates/parts/assistant.php + assets/js/assistant.js
   Dùng trong popup trang chủ (.tdwh-am) và ở đầu trang danh mục (.tdwh-shopas).
   ===================================================================== */

.tdwh-as { clear: both; }
.tdwh-as__head { padding-right: 40px; }
.tdwh-home .tdwh-as__title { font-size: clamp(1.25rem, 4.4vw, 1.7rem); font-weight: 800; line-height: 1.25; }
.tdwh-home .tdwh-as__steps { display: flex; gap: 6px; margin: 16px 0 18px; overflow-x: auto; scrollbar-width: none; counter-reset: s; }
.tdwh-as__steps::-webkit-scrollbar { display: none; }
.tdwh-as__steps li { counter-increment: s; flex: 1 0 auto; padding: 8px 10px 0; border-top: 3px solid var(--hp-line); font-size: .76rem; font-weight: 600; color: var(--hp-muted); white-space: nowrap; }
.tdwh-as__steps li::before { content: counter(s) ". "; }
.tdwh-as__steps li.is-cur { color: var(--hp-navy); border-color: var(--hp-accent); }
.tdwh-as__steps li.is-done { color: var(--hp-blue); border-color: var(--hp-blue); cursor: pointer; }

.tdwh-as__step { border: 0; margin: 0; padding: 0; min-width: 0; }
.tdwh-as__step[hidden], .tdwh-as__form[hidden], .tdwh-as__result[hidden], .tdwh-as__err[hidden], .tdwh-as__row[hidden] { display: none; }
.tdwh-home .tdwh-as__q { padding: 0; margin: 0 0 14px; font-size: 1.1rem; font-weight: 700; color: var(--hp-navy); }
.tdwh-as__row { margin-bottom: 16px; }
.tdwh-home .tdwh-as__label { display: block; margin-bottom: 8px; font-size: .86rem; font-weight: 600; color: var(--hp-muted); }
.tdwh-as__label small { font-weight: 400; }
.tdwh-home .tdwh-as__hintp { margin: -4px 0 8px; font-size: .8rem; color: var(--hp-muted); }
.tdwh-as__label--gap { margin-top: 14px; }
.tdwh-home .tdwh-as__muted { color: var(--hp-muted); font-size: .9rem; }

.tdwh-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tdwh-chips label { position: relative; margin: 0; cursor: pointer; }
.tdwh-chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tdwh-chips span { display: inline-flex; align-items: center; min-height: 42px; padding: 8px 16px; border: 1.5px solid var(--hp-line); border-radius: 999px; background: #fff; font-size: .92rem; font-weight: 500; color: var(--hp-ink); transition: all .15s; }
.tdwh-chips label:hover span { border-color: var(--hp-blue); }
.tdwh-chips input:checked + span { background: var(--hp-grad); border-color: transparent; color: #fff; }
.tdwh-chips input:focus-visible + span, .tdwh-opt input:focus-visible + span { outline: 3px solid var(--hp-accent); outline-offset: 2px; }

.tdwh-as__nums { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tdwh-as__nums--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tdwh-as__num { margin: 0; display: grid; gap: 6px; font-size: .86rem; font-weight: 600; color: var(--hp-muted); }
.tdwh-as__in { position: relative; display: block; }
.tdwh-home .tdwh-as__in input { width: 100%; height: 48px; margin: 0; padding: 0 36px 0 12px; font: inherit; font-size: 1.05rem; color: var(--hp-ink); border: 1.5px solid var(--hp-line); border-radius: 12px; background: #fff; box-shadow: none; -moz-appearance: textfield; }
.tdwh-as__in input::-webkit-outer-spin-button, .tdwh-as__in input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tdwh-home .tdwh-as__in input:focus { border-color: var(--hp-blue); outline: none; box-shadow: 0 0 0 3px var(--hp-tint); }
.tdwh-as__in em { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; font-weight: 400; font-size: .84rem; color: var(--hp-muted); pointer-events: none; }
.tdwh-as__howto { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--hp-surface); }
.tdwh-as__howto summary { cursor: pointer; font-weight: 600; color: var(--hp-blue); font-size: .9rem; }
.tdwh-home .tdwh-as__howto ul { margin-top: 8px; display: grid; gap: 4px; font-size: .86rem; color: var(--hp-ink); }
.tdwh-home .tdwh-as__err { margin-top: 10px; color: #b42318; font-size: .88rem; }
.tdwh-as__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px 18px; margin-top: 20px; }
.tdwh-as__actions .tdwh-link-btn:first-child { margin-right: auto; }

.tdwh-as__pref { margin-bottom: 16px; }
.tdwh-opts { display: flex; flex-wrap: wrap; gap: 10px; }
.tdwh-opt { position: relative; margin: 0; cursor: pointer; }
.tdwh-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tdwh-opt span { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px; border: 1.5px solid var(--hp-line); border-radius: 12px; background: #fff; }
.tdwh-opt b { font-weight: 600; font-size: .84rem; color: var(--hp-ink); padding: 0 6px 2px; text-align: center; }
.tdwh-opts--img .tdwh-opt img { width: 80px; height: 100px; object-fit: cover; border-radius: 8px; }
.tdwh-opts--swatch .tdwh-opt span { flex-direction: row; padding: 6px 12px 6px 6px; border-radius: 999px; }
.tdwh-opt--none span { justify-content: center; min-height: 42px; border-style: dashed; }
.tdwh-opts--img .tdwh-opt--none span { min-height: 136px; }
.tdwh-opt:hover span { border-color: var(--hp-blue); }
.tdwh-opt input:checked + span { border-color: var(--hp-accent); box-shadow: 0 0 0 1.5px var(--hp-accent); }

/* Kết quả */
.tdwh-as__result:focus { outline: none; }
.tdwh-as__sum { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding-bottom: 12px; border-bottom: 1px solid var(--hp-line); font-size: .86rem; color: var(--hp-muted); }
.tdwh-as__sum .tdwh-link-btn { font-size: .86rem; margin-left: 10px; }
.tdwh-home .tdwh-as__note, .tdwh-as__none { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--hp-accent-soft); font-size: .9rem; color: var(--hp-ink); display: grid; gap: 10px; justify-items: start; }
.tdwh-rc { display: grid; grid-template-columns: 36% 1fr; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--hp-line); }
.tdwh-rc__img { display: block; border-radius: 14px; overflow: hidden; aspect-ratio: 3 / 4; background: var(--hp-surface-2); align-self: start; }
.tdwh-home .tdwh-rc__img img { width: 100%; height: 100%; object-fit: cover; margin: 0; }
.tdwh-rc__body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tdwh-home .tdwh-rc__rank { font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hp-accent); }
.tdwh-home .tdwh-rc__name { font-size: 1rem; font-weight: 700; line-height: 1.35; color: var(--hp-navy); }
.tdwh-home .tdwh-rc__price { font-size: .95rem; font-weight: 700; color: var(--hp-accent); line-height: 1.6; }
.tdwh-rc__price span { font-weight: 500; color: var(--hp-muted); font-size: .84rem; margin-right: 4px; }
.tdwh-home .tdwh-rc__size { align-self: flex-start; padding: 5px 12px; border-radius: 12px; background: var(--hp-tint); font-size: .86rem; line-height: 1.4; }
.tdwh-rc__size span { color: var(--hp-muted); }
.tdwh-rc__size b { color: var(--hp-navy); }
.tdwh-rc__size small { display: block; font-size: .74rem; color: var(--hp-blue); }
.tdwh-rc__size.is-ask { background: var(--hp-surface); }
.tdwh-home .tdwh-rc__why { display: grid; gap: 3px; }
.tdwh-rc__why li { position: relative; padding-left: 14px; font-size: .84rem; color: var(--hp-muted); line-height: 1.45; }
.tdwh-rc__why li::before { content: ''; position: absolute; left: 1px; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--hp-accent); }
.tdwh-rc__cta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.tdwh-rc__cta .tdwh-btn { min-height: 42px; padding: 8px 16px; font-size: .9rem; }
.tdwh-as__alt { margin-top: 22px; }
.tdwh-home .tdwh-as__alt h3 { font-size: 1.02rem; font-weight: 800; margin-bottom: 10px; color: var(--hp-navy); }
.tdwh-home .tdwh-as__altnote { margin: -4px 0 10px; font-size: .84rem; color: var(--hp-muted); }
.tdwh-as__alt i { font-style: normal; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--hp-accent); }
.tdwh-home .tdwh-as__alt ul { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.tdwh-as__alt li { flex: 0 0 min(78%, 300px); scroll-snap-align: start; }
.tdwh-as__alt a { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 10px; border-radius: 14px; background: var(--hp-surface); height: 100%; }
.tdwh-home .tdwh-as__alt img { width: 64px; height: 84px; object-fit: cover; border-radius: 8px; }
.tdwh-as__alt span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tdwh-as__alt b { font-size: .88rem; color: var(--hp-navy); line-height: 1.35; }
.tdwh-as__alt em { font-style: normal; font-weight: 700; color: var(--hp-accent); font-size: .86rem; }
.tdwh-as__alt small { font-size: .78rem; color: var(--hp-muted); }
.tdwh-home .tdwh-as__foot { margin-top: 14px; font-size: .78rem; color: var(--hp-muted); }

/* Trang danh mục: thanh mở/thu gọn phía trên danh sách sản phẩm */
.tdwh-shopas { margin: 0 0 28px; border-radius: 20px; overflow: hidden; box-shadow: var(--hp-shadow); background: #fff; }
.tdwh-shopas__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 18px 20px; background: var(--hp-grad); }
.tdwh-shopas__bar .tdwh-eyebrow { color: #ffc2ea; margin-bottom: 4px; }
.tdwh-home .tdwh-shopas__t { color: #fff; font-weight: 700; font-size: 1.05rem; }
.tdwh-collapse__btn .is-open, .tdwh-shopas.is-open .tdwh-collapse__btn .is-closed { display: none; }
.tdwh-shopas.is-open .tdwh-collapse__btn .is-open { display: inline; }
.tdwh-collapse__body { padding: 20px 16px; }
.tdwh-collapse__body[hidden] { display: none; }
.tdwh-shopas .tdwh-as__head { display: none; }

/* Popup trợ lý trên trang chủ */
.tdwh-am__box { max-width: 860px; }

@media (min-width: 760px) {
	.tdwh-rc { grid-template-columns: 170px 1fr; gap: 20px; }
	.tdwh-as__nums { grid-template-columns: repeat(2, minmax(0, 200px)); }
	.tdwh-as__nums--3 { grid-template-columns: repeat(3, minmax(0, 160px)); }
	.tdwh-collapse__body { padding: 24px 28px; }
	.tdwh-as__alt li { flex-basis: 260px; }
}
