/* หน้าสินค้า (templates/single-product.html, inc/product.php, assets/js/product.js)
 * ขนาดจอเหมือน theme.css: Tablet P ≤1023 · Mobile L ≤767 · Mobile S ≤424
 */
.avesta-product { background: var(--wp--preset--color--base); }
.avesta-product__top { padding-block: 1.25rem var(--av-section); }
.avesta-product__top > * { margin-block: 0; }

/* เส้นทาง: แบบเดียวกับหน้าหมวด (ไอคอนบ้าน + ›) แต่บนพื้นขาว */
.avesta-product__crumbs { margin-bottom: 1.25rem !important; }
.avesta-product__crumbs .woocommerce-breadcrumb { margin: 0; font-size: .875rem; color: var(--wp--preset--color--muted); }
.avesta-product__crumbs a { color: var(--av-blue); text-decoration: none; }
.avesta-product__crumbs a:hover { text-decoration: underline; }
.avesta-product__crumbs a:first-child::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: .35rem; vertical-align: -2px; background: currentColor; -webkit-mask: var(--avesta-i-home) center/contain no-repeat; mask: var(--avesta-i-home) center/contain no-repeat; }

.avesta-product__cols { margin-block: 0 !important; align-items: flex-start !important; }
.avesta-product__gallery .woocommerce-product-gallery { margin: 0 !important; }
.avesta-product__gallery .woocommerce-product-gallery__image img { border-radius: var(--av-radius); background: var(--wp--preset--color--surface); }
.avesta-product__gallery .flex-control-thumbs { display: flex; gap: .5rem; margin-top: .5rem !important; }
.avesta-product__gallery .flex-control-thumbs li { width: 72px !important; }
.avesta-product__gallery .flex-control-thumbs img { border-radius: 10px; border: 1px solid var(--av-line); }

.avesta-product__buy > * { margin-block: 0; }
.avesta-product__title { font-size: clamp(1.45rem, 1.05rem + 1.3vw, 2.05rem) !important; line-height: 1.3; color: var(--av-navy); text-wrap: balance; margin: 0 0 .6rem !important; }
.avesta-product__price, .avesta-product__price .price { font-size: 1.5rem !important; font-weight: 800; color: var(--av-navy); margin: 0 0 .9rem !important; }
.avesta-product__price .avesta-vat-note { font-size: .875rem; }

.avesta-product-short { color: var(--wp--preset--color--muted); font-size: .9375rem; line-height: 1.7; padding: .9rem 1rem; background: var(--wp--preset--color--surface); border-radius: 10px; margin-bottom: 1.25rem; }
.avesta-product-short p { margin: 0 0 .5rem; }
.avesta-product-short p:last-child { margin-bottom: 0; }
.avesta-product-short a { color: var(--av-blue); }

/* ---------- เลือกรุ่น ---------- */
.avesta-product__form form.cart { margin: 0 !important; }
.avesta-pick-title { font-weight: 700; color: var(--av-navy); margin: 0 0 .5rem; font-size: 1rem; }
.avesta-product__form table.variations { margin: 0 0 .5rem !important; border: 0; width: 100%; }
.avesta-product__form table.variations th.label { display: none !important; }
.avesta-product__form table.variations td { display: block; padding: 0 !important; border: 0; }
.avesta-product__form .cfvsw-swatches-container { display: grid !important; grid-template-columns: 1fr; gap: .5rem; }
.avesta-product__form .cfvsw-swatches-option {
	display: flex !important; align-items: center; justify-content: stretch; margin: 0 !important; min-height: 54px !important; min-width: 0 !important;
	padding: .55rem .9rem !important; background: var(--wp--preset--color--base) !important; border: 1.5px solid var(--av-line) !important; border-radius: 10px !important; cursor: pointer;
	transition: border-color .15s, background-color .15s; box-shadow: none !important;
}
.avesta-product__form .cfvsw-swatches-option:hover { border-color: var(--av-blue) !important; }
.avesta-product__form .cfvsw-swatches-option.cfvsw-selected-swatch { border-color: var(--av-blue) !important; background: var(--wp--preset--color--blue-soft) !important; box-shadow: inset 0 0 0 1px var(--av-blue) !important; }
.avesta-product__form .cfvsw-swatch-inner { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 1rem; text-align: left; font-size: .9375rem; font-weight: 600; color: var(--wp--preset--color--ink); white-space: normal; }
.avesta-swatch-price { flex: none; font-weight: 800; color: var(--av-navy); font-size: .9375rem; }
.avesta-product__form .reset_variations { font-size: .875rem; color: var(--av-blue); }

.avesta-edition-help { margin: .25rem 0 1rem; font-size: .9375rem; }
.avesta-edition-help summary { cursor: pointer; color: var(--av-blue); font-weight: 600; width: fit-content; }
.avesta-edition-help dl { margin: .6rem 0 0; display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; padding: .8rem 1rem; border: 1px solid var(--av-line); border-radius: 10px; }
.avesta-edition-help dt { font-weight: 700; color: var(--av-navy); }
.avesta-edition-help dd { margin: 0; color: var(--wp--preset--color--muted); }

.avesta-product__form .woocommerce-variation-price .price { font-size: 1.375rem; font-weight: 800; color: var(--av-navy); }
.avesta-product__form .woocommerce-variation-description p { margin: .25rem 0; font-size: .9375rem; color: var(--wp--preset--color--muted); }

/* ข้อความบอกให้เลือกรุ่นก่อน: แสดงเฉพาะตอนปุ่มใส่ตะกร้ายังกดไม่ได้ */
.avesta-pick-hint { display: none; margin: 0 0 .6rem; font-size: .875rem; color: var(--wp--preset--color--gold-ink); background: var(--wp--preset--color--gold-soft); border-radius: 10px; padding: .45rem .75rem; flex-basis: 100%; }
.variations_form:has(.single_add_to_cart_button.disabled) .avesta-pick-hint { display: block; }

/* ปุ่มใส่ตะกร้า + ขอใบเสนอราคา หนักเท่ากัน */
.avesta-product__form .woocommerce-variation-add-to-cart, .avesta-product__form form.cart:not(.variations_form) { display: flex; flex-wrap: wrap; gap: .6rem; align-items: stretch; }
.avesta-product__form .quantity { flex: 0 0 74px; margin: 0 !important; }
.avesta-product__form .quantity .qty { width: 100%; height: 100%; min-height: 48px; text-align: center; font: inherit; }
.avesta-product__form .single_add_to_cart_button { flex: 1 1 160px; min-height: 48px; margin: 0 !important; font-size: 1rem !important; }
.avesta-product__form .single_add_to_cart_button.disabled { opacity: 1 !important; background: var(--wp--preset--color--surface) !important; color: var(--wp--preset--color--muted) !important; cursor: not-allowed; }
.avesta-quote-btn { flex: 1 1 160px; display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 1.2rem; border: 1.5px solid var(--av-navy); border-radius: 10px; color: var(--av-navy); background: var(--wp--preset--color--base); font-weight: 700; text-decoration: none; box-sizing: border-box; }
.avesta-quote-btn:hover { background: var(--wp--preset--color--blue-soft); color: var(--av-navy); }

/* ---------- ข้อมูลก่อนซื้อ ---------- */
.avesta-assurance { list-style: none; margin: 1.5rem 0 0 !important; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--av-line); border-radius: 10px; overflow: hidden; }
.avesta-assurance li { display: grid; grid-template-columns: auto 1fr; column-gap: .7rem; align-items: center; padding: .8rem 1rem; border-top: 1px solid var(--av-line); }
.avesta-assurance li:nth-child(-n+2) { border-top: 0; }
.avesta-assurance li:nth-child(even) { border-left: 1px solid var(--av-line); }
.avesta-assurance li::before { grid-row: span 2; width: 26px; height: 26px; background: var(--av-blue); }
.avesta-assurance strong { color: var(--av-navy); font-size: .9375rem; line-height: 1.35; }
.avesta-assurance span { color: var(--wp--preset--color--muted); font-size: .8125rem; }

/* ---------- รายละเอียดและสินค้าที่เกี่ยวข้อง ---------- */
.avesta-product__details { padding-block: 0 var(--av-section); margin: 0 !important; }
.avesta-product__details .woocommerce-tabs { margin: 0; }
.avesta-product__details .woocommerce-Tabs-panel { max-width: 70ch; }
.avesta-product__details .woocommerce-Tabs-panel img { height: auto; }
.avesta-product__details .woocommerce-Tabs-panel > h2:first-child { display: none; }
.avesta-product__related { padding-block: var(--av-section); background: var(--wp--preset--color--surface); margin: 0 !important; }
.avesta-product__related .avesta-underline { margin-bottom: 1.5rem !important; }

/* =================== Tablet P 768–1023 =================== */
@media (max-width: 1023px) {
	.avesta-product__cols { flex-wrap: wrap !important; }
	.avesta-product__cols > .wp-block-column { flex-basis: 100% !important; }
	.avesta-product__gallery { max-width: 520px; }
}
/* =================== Mobile L 425–767 =================== */
@media (max-width: 767px) {
	.avesta-assurance { grid-template-columns: 1fr; }
	.avesta-assurance li:nth-child(2) { border-top: 1px solid var(--av-line); }
	.avesta-assurance li:nth-child(even) { border-left: 0; }
}
/* =================== Mobile S ≤424 =================== */
@media (max-width: 424px) {
	.avesta-quote-btn, .avesta-product__form .single_add_to_cart_button { flex-basis: 100%; }
	.avesta-edition-help dl { grid-template-columns: 1fr; }
}

/* แกลเลอรีของ WooCommerce ตั้งกว้าง 48% ลอยซ้ายไว้สำหรับธีมแบบเก่า ให้เต็มคอลัมน์ */
.avesta-product__gallery .woocommerce-product-gallery { width: 100% !important; float: none !important; margin: 0 !important; }
.avesta-product__gallery .woocommerce-product-gallery__wrapper { margin: 0 !important; }
.avesta-product__form table.variations, .avesta-product__form table.variations tbody, .avesta-product__form table.variations tr, .avesta-product__form table.variations td, .avesta-product__form .cfvsw-swatches-container { display: block; width: 100% !important; }
.avesta-product__form .cfvsw-swatches-container { display: grid !important; }
.avesta-product__form .reset_variations { display: inline-block; margin-top: .4rem; }

/* ข้อความเมื่อเพิ่มลงตะกร้าไม่สำเร็จ (assets/js/product.js) */
.avesta-cart-msg { flex-basis: 100%; margin: .2rem 0 0; padding: .55rem .8rem; border-radius: 10px; background: var(--wp--preset--color--danger-soft); border: 1px solid var(--wp--preset--color--danger-line); color: var(--wp--preset--color--danger); font-size: .9375rem; }
.avesta-product__form .single_add_to_cart_button.is-busy { opacity: .75; cursor: progress; }

/* ---------- สินค้าขอใบเสนอราคา (ไม่มีราคา) ---------- */
.avesta-quote-only__note { margin: 0 0 .8rem; font-size: .9375rem; color: var(--wp--preset--color--muted); }
.avesta-quote-only__actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.avesta-quote-btn--primary { background: var(--av-gold); border-color: var(--av-gold); color: var(--av-navy); }
.avesta-quote-btn--primary:hover { background: var(--wp--preset--color--gold-hover); color: var(--av-navy); }
@media (max-width: 767px) { .avesta-quote-only__actions .avesta-quote-btn { flex-basis: 100%; } }
