/**
 * WooCommerce tweaks for Tin Nông TNTECH storefront (paired with Tailwind theme).
 */

/* ── Single product gallery (WooCommerce Flexslider) ─────────────────────── */

.tntech-wc-gallery-wrap {
	width: 100%;
}

.tntech-wc-gallery-main {
	width: 100%;
	--tntech-gallery-stage-h: clamp(17.5rem, 58vw, 22rem);
}

@media (min-width: 768px) {
	.tntech-wc-gallery-main {
		--tntech-gallery-stage-h: 24rem;
	}
}

@media (min-width: 1024px) {
	.tntech-wc-gallery-main {
		--tntech-gallery-stage-h: 26rem;
	}
}

/* Grid column: gallery full width (override WC 48% float). */
.woocommerce #content div.product div.images,
.woocommerce div.product div.images,
.woocommerce-page #content div.product div.images,
.woocommerce-page div.product div.images {
	width: 100% !important;
	max-width: 100%;
	min-width: 0;
	float: none !important;
	box-sizing: border-box;
	margin: 0;
}

.tntech-wc-gallery-wrap .woocommerce-product-gallery,
.tntech-wc-single .woocommerce-product-gallery {
	width: 100% !important;
	max-width: 100%;
	margin-bottom: 0;
	position: relative;
	float: none;
}

/* Pre-flexslider: show first image only in the stage box. */
.woocommerce div.product div.images .woocommerce-product-gallery:not(.flexslider) .woocommerce-product-gallery__wrapper:not(.slides) {
	display: block;
	position: relative;
	min-height: var(--tntech-gallery-stage-h);
	padding: 1rem 1.25rem;
	box-sizing: border-box;
	overflow: hidden;
	background: #fff;
	border-radius: 1rem;
	border: 1px solid #f3f4f6;
	box-shadow:
		0 10px 15px -3px rgb(0 0 0 / 0.08),
		0 4px 6px -4px rgb(0 0 0 / 0.06);
}

.woocommerce div.product div.images .woocommerce-product-gallery:not(.flexslider) .woocommerce-product-gallery__wrapper:not(.slides) .woocommerce-product-gallery__image:first-child {
	display: block !important;
	width: 100% !important;
}

.woocommerce div.product div.images .woocommerce-product-gallery:not(.flexslider) .woocommerce-product-gallery__wrapper:not(.slides) .woocommerce-product-gallery__image:nth-child(n + 2) {
	display: none !important;
}

/* Flexslider viewport — main stage (horizontal slides). */
.woocommerce div.product div.images .flex-viewport {
	width: 100% !important;
	max-width: 100% !important;
	margin: 0 0 1rem !important;
	overflow: hidden !important;
	background: #fff;
	border-radius: 1rem;
	border: 1px solid #f3f4f6;
	box-shadow:
		0 10px 15px -3px rgb(0 0 0 / 0.08),
		0 4px 6px -4px rgb(0 0 0 / 0.06);
}

.woocommerce div.product div.images .flex-viewport .woocommerce-product-gallery__wrapper {
	margin: 0;
	padding: 1rem 1.25rem;
	box-sizing: border-box;
}

@media (min-width: 768px) {
	.woocommerce div.product div.images .flex-viewport .woocommerce-product-gallery__wrapper {
		padding: 1.25rem 1.75rem;
	}
}

/* Horizontal slide track — widths set by Flexslider inline styles; do not force 100%. */
.woocommerce div.product div.images .flex-viewport .woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image {
	display: block !important;
	float: left !important;
	margin: 0 !important;
	box-sizing: border-box;
}

.woocommerce div.product div.images .flex-viewport .woocommerce-product-gallery__image a {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	width: 100%;
}

.woocommerce div.product div.images .flex-viewport .woocommerce-product-gallery__image img,
.woocommerce div.product div.images .flex-viewport .woocommerce-product-gallery__image picture img {
	display: block;
	width: auto !important;
	max-width: 100%;
	height: auto !important;
	max-height: calc(var(--tntech-gallery-stage-h) - 2.5rem);
	object-fit: contain;
	object-position: center;
	margin-inline: auto;
}

.tntech-wc-gallery-main .woocommerce-product-gallery__trigger {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	z-index: 5;
}

/* Thumbnail strip — centered below main stage. */
.tntech-wc-single .flex-control-thumbs {
	display: flex !important;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0.75rem;
	float: none !important;
	width: 100%;
	margin: 0 auto !important;
	padding: 0;
	list-style: none;
	box-sizing: border-box;
}

.tntech-wc-single .flex-control-thumbs::before,
.tntech-wc-single .flex-control-thumbs::after {
	display: none;
	content: none;
}

.tntech-wc-single .flex-control-thumbs li {
	float: none !important;
	width: auto !important;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none;
	flex: 0 0 auto;
}

.tntech-wc-single .flex-control-thumbs li img {
	display: block;
	width: 4.75rem !important;
	height: 4.75rem !important;
	object-fit: cover;
	border-radius: 0.75rem;
	border: 2px solid #e5e7eb;
	opacity: 0.88;
	cursor: pointer;
	transition:
		border-color 0.2s ease,
		opacity 0.2s ease,
		box-shadow 0.2s ease;
}

@media (min-width: 768px) {
	.tntech-wc-single .flex-control-thumbs {
		gap: 0.875rem;
	}

	.tntech-wc-single .flex-control-thumbs li img {
		width: 5.5rem !important;
		height: 5.5rem !important;
	}
}

.tntech-wc-single .flex-control-thumbs li img:hover,
.tntech-wc-single .flex-control-thumbs li.flex-active img {
	opacity: 1;
	border-color: #d68133;
}

.tntech-wc-single .flex-control-thumbs li.flex-active img {
	box-shadow: 0 0 0 3px rgb(214 129 51 / 0.22);
}

@media (max-width: 767px) {
	.tntech-wc-single .flex-control-thumbs {
		flex-wrap: nowrap;
		justify-content: center;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 0.35rem;
	}
}

.tntech-wc-single-summary {
	padding-top: 0.25rem;
}

.tntech-wc-single-summary .product_title {
	margin-bottom: 0.5rem;
	line-height: 1.25;
}

.tntech-wc-product-slogan {
	margin-top: 0;
	color: #d78131;
}

.tntech-wc-single-summary .tntech-wc-summary-section {
	margin-bottom: 1.5rem;
}

.tntech-wc-single-summary .tntech-wc-cta-row {
	margin-top: 1.75rem;
	margin-bottom: 2rem;
	gap: 1rem;
}

@media (min-width: 768px) {
	.tntech-wc-single-summary {
		padding-top: 0.5rem;
		padding-left: 0.75rem;
	}
}

/* Override storefront % widths so summary fills its grid column. */
.woocommerce #content div.product div.summary,
.woocommerce div.product div.summary,
.woocommerce-page #content div.product div.summary,
.woocommerce-page div.product div.summary {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	float: none;
	box-sizing: border-box;
}

.tntech-wc-single .summary .price {
	color: #782e01;
	font-size: 1.5rem;
	font-weight: 700;
	margin-bottom: 0.75rem;
}

.tntech-wc-single .summary form.cart .button,
.tntech-wc-single .summary .single_add_to_cart_button {
	background: linear-gradient(90deg, #782e01, #d78131);
	color: #fff;
	border-radius: 999px;
	padding: 0.75rem 2rem;
	font-weight: 700;
	border: none;
	box-shadow: 0 10px 15px -3px rgb(0 0 0 / 10%);
}

.tntech-wc-single .summary form.cart .button:hover,
.tntech-wc-single .summary .single_add_to_cart_button:hover {
	filter: brightness(1.05);
}

/* Long description & extra sections: readable typography */
.tntech-wc-long-desc-inner img,
.tntech-wc-extra-section-inner img {
	max-width: 100%;
	height: auto;
}

/* Single product — reviews sidebar (“Đánh Giá Nông Dân” UI). */
.tntech-wc-reviews-sidebar #reviews > h2,
.tntech-wc-reviews-sidebar .woocommerce-Reviews-title {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.tntech-wc-reviews-sidebar .woocommerce-Reviews-title + p {
	margin-top: 0;
}

.tntech-wc-reviews-sidebar__card {
	box-shadow: 0 4px 22px rgb(15 23 42 / 0.06), 0 2px 6px rgb(15 23 42 / 0.035);
}

.tntech-wc-reviews-sidebar__title {
	color: #5d2d06;
	line-height: 1.35;
}

.tntech-wc-reviews-sidebar__count-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 9999px;
	background-color: #d68133;
	color: #fff;
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1;
	flex-shrink: 0;
	box-shadow: 0 2px 4px rgb(0 0 0 / 0.14);
}

.tntech-wc-reviews-sidebar__body #reviews .woocommerce-Reviews-inner,
.tntech-wc-reviews-sidebar__body #reviews #comments {
	margin-top: 0;
}

.tntech-wc-reviews-sidebar__body #reviews #comments .tntech-wc-commentlist-scroll {
	max-height: 400px;
	overflow-y: auto;
}

.tntech-wc-reviews-sidebar__body #reviews #comments ol.commentlist {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: none;
	overflow: visible;
}

/* WooCommerce đệm trái cho avatar mặc định — layout TNTECH không dùng avatar */
.woocommerce #reviews #comments ol.commentlist li .comment-text {
	margin-left: 0 !important;
}

/* Review cards (template overrides — không avatar) */
.tntech-wc-reviews-sidebar__body #reviews ol.commentlist > li.review {
	list-style: none;
	margin: 0 0 0.75rem !important;
	padding: 0 !important;
	border: none;
	background: transparent;
}

.tntech-wc-reviews-sidebar__body li.review .comment_container img.avatar {
	display: none !important;
}

.tntech-wc-reviews-sidebar__body li.review .comment_container .tntech-wc-review-card .star-rating {
	font-size: 0.9375rem;
	color: #e6aa14 !important;
}

.tntech-wc-reviews-sidebar__body .tntech-wc-review-quote p,
.tntech-wc-reviews-sidebar__body .tntech-wc-review-quote .description p {
	font-size: 0.875rem;
	line-height: 1.55;
	font-style: italic;
	color: #4b5563;
	margin: 0;
}

.tntech-wc-reviews-sidebar #review_form .comment-form-tntech-region label {
	display: block;
	font-size: 0.875rem;
	font-weight: 700;
	color: #374151;
	margin-bottom: 0.35rem;
}

.tntech-wc-reviews-sidebar #review_form .comment-form-tntech-region input.input-text {
	width: 100%;
	box-sizing: border-box;
	padding: 0.45rem 0.65rem;
	border-radius: 0.5rem;
	border: 1px solid #e5e7eb;
	font-size: 0.875rem;
}

.tntech-wc-reviews-sidebar #review_form_wrapper {
	padding-top: 1.25rem;
	margin-top: 1.125rem;
	border-top: 1px solid #e5e7eb;
}

.tntech-wc-reviews-sidebar #reply-title,
.tntech-wc-reviews-sidebar .comment-reply-title {
	display: block;
	font-size: 1rem;
	font-weight: 700;
	color: #374151;
	margin: 0 0 1rem;
	border: none;
	padding: 0;
}

.tntech-wc-reviews-sidebar #review_form select#rating,
.tntech-wc-reviews-sidebar #review_form #rating {
	display: block;
	width: 100%;
	max-width: 100%;
	margin-top: 0.35rem;
	padding: 0.45rem 0.65rem;
	font-size: 0.875rem;
	border-radius: 0.5rem;
	border: 1px solid #e5e7eb;
	background-color: #fff;
	box-sizing: border-box;
}

.tntech-wc-reviews-sidebar .comment-form-rating label,
.tntech-wc-reviews-sidebar .comment-form-comment label {
	display: block;
	font-size: 0.875rem;
	font-weight: 700;
	color: #374151;
	margin-bottom: 0.35rem;
}

.tntech-wc-reviews-sidebar .comment-form-rating .required,
.tntech-wc-reviews-sidebar .comment-form-comment .required {
	color: #b45309;
}

.tntech-wc-reviews-sidebar #commentform .comment-form-rating {
	margin-bottom: 1rem;
}

.tntech-wc-reviews-sidebar #commentform .comment-form-comment {
	margin-bottom: 0;
}

.tntech-wc-reviews-sidebar #commentform textarea {
	width: 100%;
	box-sizing: border-box;
	min-height: 8rem;
	border-radius: 0.5rem;
	border: 1px solid #e5e7eb;
	padding: 0.65rem 0.85rem;
	font-size: 0.875rem;
	line-height: 1.55;
	resize: vertical;
}

.tntech-wc-reviews-sidebar #commentform input#submit {
	width: 100%;
	background-color: #782e01;
	color: #fff;
	font-weight: 700;
	font-size: 0.875rem;
	padding: 0.65rem 1rem;
	border: none;
	border-radius: 0.5rem;
	cursor: pointer;
	margin-top: 0.875rem;
	box-shadow: 0 8px 12px rgb(120 46 1 / 0.15);
	transition: filter 150ms ease, background-color 150ms ease;
}

.tntech-wc-reviews-sidebar #commentform input#submit:hover {
	background-color: #5d2301;
	filter: brightness(1.06);
}

.tntech-wc-reviews-sidebar #review_form .logged-in-as,
.tntech-wc-reviews-sidebar #review_form .must-log-in {
	font-size: 0.8125rem;
	color: #6b7280;
	margin-bottom: 0.75rem;
}

.tntech-wc-single .woocommerce .star-rating {
	color: #facc15;
}

/* ── Main shop hero ──────────────────────────────────────────────────────── */

.tntech-wc-shop-hero {
	display: flex;
	min-height: clamp(16rem, 31.25vw, 37.5rem);
	align-items: center;
	background-image: url('../images/shop/shop-hero.webp');
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
}

.tntech-wc-shop-hero::before {
	position: absolute;
	inset: 0;
	z-index: 0;
	background: linear-gradient(90deg, rgb(46 39 20 / 36%), rgb(46 39 20 / 10%) 34%, transparent 62%);
	content: '';
	pointer-events: none;
}

.tntech-wc-shop-hero h1 {
	text-shadow: 0 2px 12px rgb(0 0 0 / 55%);
}

@media (max-width: 767px) {
	.tntech-wc-shop-hero {
		min-height: 18rem;
		background-position: center;
	}

	.tntech-wc-shop-hero::before {
		background: linear-gradient(90deg, rgb(46 39 20 / 28%), transparent 85%);
	}
}

.tntech-wc-archive .woocommerce-result-count,
.tntech-wc-archive .woocommerce-ordering {
	display: none !important;
}

/**
 * Breadcrumb trail: gray links + "/" + brown bold uppercase current (shop archive + single).
 */
.tntech-wc-breadcrumb-trail,
.tntech-wc-breadcrumb-trail .woocommerce-breadcrumb {
	font-size: 0.875rem;
	line-height: 1.6;
	color: #6b4310;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.tntech-wc-breadcrumb-trail a,
.tntech-wc-breadcrumb-trail .woocommerce-breadcrumb a {
	font-weight: 400;
	text-transform: none;
	color: #666666;
	text-decoration: none;
}

.tntech-wc-breadcrumb-trail a:hover,
.tntech-wc-breadcrumb-trail .woocommerce-breadcrumb a:hover {
	color: #782e01;
	text-decoration: underline;
}

.tntech-wc-breadcrumb-trail .breadcrumb-sep {
	display: inline-block;
	margin: 0 0.4rem;
	color: #666666;
	font-weight: 400;
	text-transform: none;
}

/* Same trail rules on shop hero (earth): recessed links vs bright current — mirrors light-page contrast. */
.tntech-wc-breadcrumb-trail--earth .woocommerce-breadcrumb {
	color: #fff;
}

.tntech-wc-breadcrumb-trail--earth a,
.tntech-wc-breadcrumb-trail--earth .woocommerce-breadcrumb a {
	color: rgba(255, 235, 214, 0.72);
}

.tntech-wc-breadcrumb-trail--earth a:hover,
.tntech-wc-breadcrumb-trail--earth .woocommerce-breadcrumb a:hover {
	color: #fff;
	text-decoration: underline;
}

.tntech-wc-breadcrumb-trail--earth .breadcrumb-sep {
	color: rgba(255, 255, 255, 0.42);
}

.tntech-wc-archive .onsale-badge {
	z-index: 2;
}

.tntech-wc-archive ul.products {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tntech-wc-archive ul.products::before,
.tntech-wc-archive ul.products::after {
	display: none;
}

.tntech-wc-loop-card {
	width: 100%;
	float: none !important;
	margin: 0 !important;
}

/* Override WC column % widths so CSS grid children fill the column. */
.woocommerce ul.products.columns-3 li.product,
.woocommerce-page ul.products.columns-3 li.product {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
	float: none !important;
}

/* Loop column grid (Woo adds .columns-3 + inline widths on some releases). */
.tntech-wc-archive ul.products.columns-3 {
	display: grid;
	grid-template-columns: repeat(1, minmax(0, 1fr));
	gap: 1.5rem;
}

@media (min-width: 640px) {
	.tntech-wc-archive ul.products.columns-3 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.tntech-wc-archive ul.products.columns-3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.tntech-wc-archive ul.products.columns-3 {
	gap: 2rem;
}

.tntech-wc-archive .woocommerce-pagination {
	margin-top: 2.5rem;
}

.tntech-wc-archive .woocommerce-pagination ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
	justify-content: center;
	list-style: none;
	margin: 0;
	padding: 0;
	border: 0 !important;
}

.tntech-wc-archive .woocommerce-pagination ul li {
	margin: 0;
	border: 0 !important;
}

.tntech-wc-archive .woocommerce-pagination ul li a,
.tntech-wc-archive .woocommerce-pagination ul li span {
	display: inline-flex;
	min-width: 2.25rem;
	align-items: center;
	justify-content: center;
	padding: 0.35rem 0.65rem;
	border-radius: 0.5rem;
	border: 1px solid #e5e7eb;
	background: #fff;
	color: #374151;
	text-decoration: none;
	font-size: 0.875rem;
	font-weight: 600;
}

.tntech-wc-archive .woocommerce-pagination ul li a:hover {
	border-color: #d78131;
	color: #782e01;
}

.tntech-wc-archive .woocommerce-pagination ul li span.current {
	background: #782e01;
	border-color: #782e01;
	color: #fff;
}

.tntech-wc-loop-card .tntech-wc-loop-card__media {
	min-height: 15rem;
	height: 16rem;
	padding: 1rem 1.25rem;
	overflow: hidden;
	background-color: #f9fafb;
}

.tntech-wc-loop-card .tntech-wc-loop-card__img,
.tntech-wc-loop-card .attachment-woocommerce_thumbnail,
.tntech-wc-loop-card img.woocommerce-placeholder {
	width: auto !important;
	height: auto !important;
	max-width: 100%;
	max-height: 13rem;
	object-fit: contain;
	object-position: center;
	display: block;
	margin-inline: auto;
	transition: transform 0.3s ease;
}

.tntech-wc-loop-card .tntech-wc-loop-card__media:hover .tntech-wc-loop-card__img,
.tntech-wc-loop-card .tntech-wc-loop-card__media:hover .attachment-woocommerce_thumbnail {
	transform: scale(1.03);
}

/* Featured / related grids reuse loop card markup */
.tntech-wc-featured-product__media {
	min-height: 13rem;
	height: 13rem;
	padding: 1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #f9fafb;
}

.tntech-wc-featured-product__media img {
	width: auto !important;
	height: auto !important;
	max-width: 100%;
	max-height: 11rem;
	object-fit: contain;
	object-position: center;
	margin-inline: auto;
}

/* ── Related products (single) — không nằm trong .tntech-wc-archive nên cần lưới riêng. */
.tntech-wc-single section.related.products,
.tntech-wc-single .related.products {
	clear: both;
	margin-top: 2.75rem;
	padding-top: 2rem;
	border-top: 1px solid #e5e7eb;
	max-width: 100%;
	box-sizing: border-box;
}

.tntech-wc-single .related.products > h2 {
	font-size: 1.375rem;
	line-height: 1.35;
	font-weight: 700;
	color: #782e01;
	margin: 0 0 1.5rem;
	text-align: left;
	letter-spacing: -0.01em;
}

.tntech-wc-single .related.products ul.products {
	margin: 0;
	padding: 0;
	list-style: none;
	float: none;
	width: 100%;
	display: grid;
	grid-template-columns: repeat(1, minmax(0, 1fr));
	gap: 2rem;
}

.tntech-wc-single .related.products ul.products::before,
.tntech-wc-single .related.products ul.products::after {
	display: none;
}

@media (min-width: 640px) {
	.tntech-wc-single .related.products ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.tntech-wc-single .related.products ul.products {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.tntech-wc-single .related.products ul.products li.product {
	width: 100% !important;
	max-width: 100%;
	min-width: 0;
	float: none !important;
	margin: 0 !important;
	clear: none !important;
}
