/* ============================================================
 * Mtech — Catalogue / Product Listing (PLP) redesign
 * Loaded only on shop + product taxonomy archives.
 * Brand: primary #135289, accent green #009245.
 * ============================================================ */

:root {
	--mtech-blue: #135289;
	--mtech-blue-dark: #0e3f6b;
	--mtech-green: #009245;
	--mtech-ink: #111827;
	--mtech-muted: #6b7280;
	--mtech-line: #e5e7eb;
	--mtech-bg: #f7f8fa;
	--mtech-radius: 10px;
}

/* ---------- Page heading + intro ---------- */
.woocommerce .page-header .woocommerce-products-header__title,
.woocommerce-page .page-header .woocommerce-products-header__title {
	font-weight: 700;
	color: var(--mtech-ink);
}

.term-description,
.woocommerce-product-loop-description,
.woocommerce-archive-description {
	color: #4b5563;
	font-size: 15px;
	line-height: 1.6;
}

/* "Read more" clamp for long category intros */
.mtech-clamp {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.mtech-readmore {
	background: none;
	border: 0;
	color: var(--mtech-blue);
	font-weight: 600;
	cursor: pointer;
	padding: 0 0 0 4px;
	font-size: 14px;
}

/* ---------- Results toolbar ---------- */
.woocommerce .woocommerce-result-count {
	color: var(--mtech-muted);
	font-size: 14px;
	margin-bottom: 0;
}

.woocommerce .woocommerce-ordering select,
.mtech-per-page select {
	border: 1px solid var(--mtech-line);
	border-radius: 8px;
	padding: 8px 30px 8px 12px;
	background-color: #fff;
	color: var(--mtech-ink);
	font-size: 14px;
	cursor: pointer;
}

/* Grid / list toggle */
.mtech-view-toggle {
	display: inline-flex;
	gap: 4px;
	margin-left: 10px;
	vertical-align: middle;
	float: right;
}

.mtech-view-btn {
	width: 38px;
	height: 38px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--mtech-line);
	background: #fff;
	border-radius: 8px;
	color: var(--mtech-muted);
	cursor: pointer;
	padding: 0;
	transition: all .15s ease;
}

.mtech-view-btn svg { width: 18px; height: 18px; }

.mtech-view-btn.is-active {
	background: var(--mtech-blue);
	border-color: var(--mtech-blue);
	color: #fff;
}

/* ---------- Product grid ---------- */
.woocommerce ul.products,
.woocommerce-page ul.products {
	display: grid !important;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
	margin: 0 0 24px;
}

@media (min-width: 600px)  { .woocommerce ul.products { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 992px)  { .woocommerce ul.products { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .woocommerce ul.products { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1440px) { .woocommerce ul.products { grid-template-columns: repeat(6, 1fr); } }

/* ---------- Product card ---------- */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
	position: relative;
	display: flex;
	flex-direction: column;
	width: auto !important;
	margin: 0 !important;
	padding: 12px;
	background: #fff;
	border: 1px solid var(--mtech-line);
	border-radius: var(--mtech-radius);
}

/* Image */
.woocommerce ul.products li.product .woocommerce-image__wrapper {
	position: relative;
	margin-bottom: 10px;
}

.woocommerce ul.products li.product img {
	aspect-ratio: 1 / 1;
	object-fit: contain;
	width: 100%;
	height: auto;
	background: #fff;
}

/* Sale bubble -> small pill top-left */
.woocommerce ul.products li.product .sale-item,
.woocommerce span.onsale {
	position: absolute;
	top: 8px;
	left: 8px;
	margin: 0;
	min-height: 0;
	min-width: 0;
	width: auto;
	height: auto;
	line-height: 1;
	padding: 5px 8px;
	font-size: 11px;
	font-weight: 700;
	border-radius: 6px;
	background: var(--mtech-green);
	color: #fff;
	z-index: 3;
}

/* Card body */
.woocommerce ul.products li.product .woocommerce-card__header {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
}

/* Eyebrow (category) */
.woocommerce ul.products li.product .product__categories {
	margin: 0 0 4px;
	font-size: 11px;
	letter-spacing: .04em;
	text-transform: uppercase;
	line-height: 1.3;
}

.woocommerce ul.products li.product .product__categories a {
	color: var(--mtech-muted);
	text-decoration: none;
}

/* Title */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
	margin: 0 0 8px;
	min-height: 38px;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title a {
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--mtech-ink);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-decoration: none;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title a:hover { color: var(--mtech-blue); }

/* Price */
.woocommerce ul.products li.product .price {
	margin: 0 0 6px;
	color: var(--mtech-ink);
	font-size: 16px;
	font-weight: 700;
	display: block;
}

.woocommerce ul.products li.product .price del {
	color: #9ca3af;
	font-weight: 400;
	font-size: 13px;
	opacity: 1;
	margin-right: 6px;
}

.woocommerce ul.products li.product .price ins { text-decoration: none; }

.woocommerce ul.products li.product .price .woocommerce-price-suffix {
	display: inline-block;
	color: var(--mtech-muted);
	font-size: 11px;
	font-weight: 400;
}

/* In-stock indicator */
.mtech-stock {
	display: flex;
	align-items: center;
	gap: 5px;
	margin: 0 0 10px;
	font-size: 12.5px;
	font-weight: 500;
}

.mtech-stock svg { width: 15px; height: 15px; }
.mtech-stock.is-in { color: var(--mtech-green); }
.mtech-stock.is-out { color: #dc2626; }

/* Add to cart button */
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .added_to_cart {
	/* Always in flow + visible (override Shoptimizer's absolute/opacity-0 hover reveal) */
	position: relative !important;
	opacity: 1 !important;
	visibility: visible !important;
	bottom: auto !important;
	margin-top: auto;
	width: 100% !important;
	height: auto !important;
	line-height: 1.4 !important;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 9px 12px;
	font-size: 13.5px;
	font-weight: 600;
	border-radius: 8px;
	border: 1px solid var(--mtech-blue);
	background: #fff !important;
	color: var(--mtech-blue) !important;
	text-align: center;
}

.woocommerce ul.products li.product .button::before {
	content: "";
	width: 16px;
	height: 16px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='21' r='1'/><circle cx='20' cy='21' r='1'/><path d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/></svg>") center/contain no-repeat;
	mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='21' r='1'/><circle cx='20' cy='21' r='1'/><path d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/></svg>") center/contain no-repeat;
	flex: 0 0 auto;
}

.woocommerce ul.products li.product .button:hover {
	background: var(--mtech-blue) !important;
	color: #fff !important;
}

.woocommerce ul.products li.product .added_to_cart::before { content: none; }

.woocommerce ul.products li.product .button.loading { color: var(--mtech-blue) !important; }

/* ---------- List view ---------- */
.woocommerce ul.products.mtech-list {
	grid-template-columns: 1fr !important;
	gap: 12px;
}

.woocommerce ul.products.mtech-list li.product {
	flex-direction: row;
	align-items: center;
	gap: 18px;
	padding: 14px 16px;
}

.woocommerce ul.products.mtech-list li.product .woocommerce-image__wrapper {
	flex: 0 0 130px;
	width: 130px;
	margin-bottom: 0;
}

.woocommerce ul.products.mtech-list li.product .woocommerce-card__header {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 24px;
}

.woocommerce ul.products.mtech-list li.product .woocommerce-loop-product__title {
	flex: 1 1 320px;
	min-height: 0;
}

.woocommerce ul.products.mtech-list li.product .woocommerce-loop-product__title a { -webkit-line-clamp: 2; }
.woocommerce ul.products.mtech-list li.product .product__categories { flex: 1 1 100%; }
.woocommerce ul.products.mtech-list li.product .price { margin: 0; }
.woocommerce ul.products.mtech-list li.product .mtech-stock { margin: 0; }

.woocommerce ul.products.mtech-list li.product .button {
	width: auto;
	margin: 0;
	padding: 10px 22px;
}

@media (max-width: 600px) {
	.woocommerce ul.products.mtech-list li.product { flex-direction: column; align-items: stretch; }
	.woocommerce ul.products.mtech-list li.product .woocommerce-image__wrapper { width: 100%; flex-basis: auto; }
	.woocommerce ul.products.mtech-list li.product .button { width: 100%; }
}

/* ---------- Sidebar widgets ---------- */
#secondary .widget {
	background: #fff;
	border: 1px solid var(--mtech-line);
	border-radius: var(--mtech-radius);
	padding: 18px;
	margin-bottom: 18px;
}

#secondary .widget .widget-title,
#secondary .widget h2,
#secondary .widget h3 {
	font-size: 15px;
	font-weight: 700;
	color: var(--mtech-ink);
	margin: 0 0 14px;
}

/* Price filter */
#secondary .widget_price_filter .price_slider_wrapper .ui-widget-content {
	background: #e5e7eb;
	border: 0;
	border-radius: 999px;
	height: 4px;
}

#secondary .widget_price_filter .ui-slider .ui-slider-range { background: var(--mtech-blue); }

#secondary .widget_price_filter .ui-slider .ui-slider-handle {
	background: var(--mtech-blue);
	border: 2px solid #fff;
	box-shadow: 0 1px 4px rgba(0,0,0,.25);
	border-radius: 50%;
	width: 14px;
	height: 14px;
	top: -5px;
}

#secondary .widget_price_filter .price_label { color: var(--mtech-muted); font-size: 13px; }

#secondary .widget_price_filter .button {
	width: 100%;
	background: var(--mtech-blue) !important;
	color: #fff !important;
	border-radius: 8px;
	padding: 9px;
	font-weight: 600;
	float: none;
	margin-top: 12px;
}

#secondary .widget_price_filter .button:hover { background: var(--mtech-blue-dark) !important; }

/* Filter / category lists */
#secondary .widget ul { margin: 0; list-style: none; }

#secondary .widget_layered_nav ul li,
#secondary .widget_product_categories ul li,
#secondary .widget_categories ul li {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 0;
	border: 0;
	font-size: 14px;
	color: #374151;
}

#secondary .widget_layered_nav ul li a,
#secondary .widget_product_categories ul li a,
#secondary .widget_categories ul li a {
	color: #374151;
	text-decoration: none;
	flex: 1 1 auto;
}

#secondary .widget_layered_nav ul li a:hover,
#secondary .widget_product_categories ul li a:hover,
#secondary .widget_categories ul li a:hover { color: var(--mtech-blue); }

#secondary .widget_layered_nav ul li .count,
#secondary .widget_categories ul li .count {
	color: var(--mtech-muted);
	font-size: 13px;
}

/* Help card */
.mtech-help-card {
	background: #eef4fb;
	border: 1px solid #d6e3f2;
	border-radius: var(--mtech-radius);
	padding: 20px 18px;
	text-align: center;
	margin-bottom: 18px;
}

.mtech-help-icon {
	width: 44px;
	height: 44px;
	margin: 0 auto 10px;
	border-radius: 50%;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--mtech-blue);
}

.mtech-help-icon svg { width: 24px; height: 24px; }
.mtech-help-title { font-weight: 700; color: var(--mtech-ink); margin: 0 0 2px; font-size: 15px; }
.mtech-help-text { color: var(--mtech-muted); font-size: 13px; margin: 0 0 14px; }

.mtech-help-btn {
	display: block;
	background: #fff;
	border: 1px solid var(--mtech-blue);
	color: var(--mtech-blue);
	font-weight: 600;
	border-radius: 8px;
	padding: 9px 14px;
	text-decoration: none;
	transition: all .15s ease;
}

.mtech-help-btn:hover { background: var(--mtech-blue); color: #fff; }

/* ---------- Per-page selector ---------- */
.mtech-per-page {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	float: right;
	color: var(--mtech-muted);
	font-size: 14px;
}

/* ---------- Pagination ---------- */
.woocommerce nav.woocommerce-pagination ul {
	border: 0;
	display: flex;
	gap: 6px;
	justify-content: center;
}

.woocommerce nav.woocommerce-pagination ul li {
	border: 0;
	margin: 0;
}

.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
	border: 1px solid var(--mtech-line);
	border-radius: 8px;
	min-width: 38px;
	height: 38px;
	line-height: 38px;
	padding: 0 8px;
	color: var(--mtech-ink);
	background: #fff;
}

.woocommerce nav.woocommerce-pagination ul li span.current {
	background: var(--mtech-blue);
	border-color: var(--mtech-blue);
	color: #fff;
}

.woocommerce nav.woocommerce-pagination ul li a:hover {
	background: var(--mtech-bg);
	border-color: #cdd6e0;
}
