/**
 * ANB Shop Archive – product grid cards for shop / category / brand pages.
 *
 * @package ANB_Shop_Archive
 */

/* ── Grid: override Electro Bootstrap row-cols ── */
.anb-sa-active .woocommerce ul.products,
.anb-sa-active .woocommerce ul.products.row,
.anb-sa-active .woocommerce ul.products[class*="row-cols"] {
	display: grid !important;
	grid-template-columns: repeat(var(--anb-sa-cols, 4), minmax(0, 1fr));
	gap: 8px !important;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
	--bs-gutter-x: 0;
	--bs-gutter-y: 0;
	flex-wrap: unset !important;
}

.anb-sa-active .woocommerce ul.products::before,
.anb-sa-active .woocommerce ul.products::after {
	display: none !important;
	content: none !important;
}

.anb-sa-active .woocommerce ul.products > li.product {
	width: 100% !important;
	max-width: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	float: none !important;
	flex: none !important;
	flex-basis: auto !important;
	display: flex !important;
	flex-direction: column !important;
	align-self: stretch !important;
}

/* Kill Electro/Bootstrap row-cols width rules */
.anb-sa-active .woocommerce ul.products.row > li.product[class*="col"],
.anb-sa-active .woocommerce ul.products > li.product {
	--bs-columns: unset;
}

.anb-sa-active .woocommerce ul.products li.product .product-outer,
.anb-sa-active .woocommerce ul.products li.product .product-inner,
.anb-sa-active .woocommerce ul.products li.product .product-loop-header,
.anb-sa-active .woocommerce ul.products li.product .product-loop-body,
.anb-sa-active .woocommerce ul.products li.product .product-loop-footer {
	display: contents;
}

/* ── Card ── */
.anb-sa-active .anb-sa-card {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	width: 100%;
	height: 100%;
	min-height: 100%;
	background: #ffffff;
	border: 1px solid #e8e8e8;
	border-radius: 10px;
	padding: 12px;
	box-shadow: none;
	transition: box-shadow 0.2s ease;
}

.anb-sa-active .anb-sa-card:hover {
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
	transform: none;
}

/* Fixed-ratio image area – keeps row alignment */
.anb-sa-active .anb-sa-card__image-wrap {
	flex: 0 0 auto;
	margin-bottom: 10px;
}

.anb-sa-active .anb-sa-card__image-link {
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border-radius: 6px;
	background: #f7f7f7;
	aspect-ratio: 1 / 1;
	width: 100%;
}

.anb-sa-active .anb-sa-card__image-wrap img {
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	display: block;
	object-fit: contain;
	object-position: center;
}

/* Body grows; title clamped so footers align */
.anb-sa-active .anb-sa-card__body {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	margin-bottom: 10px;
	min-height: 4.5em;
}

.anb-sa-active .anb-sa-card__title {
	margin: 0 0 6px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
}

.anb-sa-active .anb-sa-card__title a {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
	color: #1a1a1a;
	text-decoration: none;
	word-break: break-word;
}

.anb-sa-active .anb-sa-card__title a:hover {
	color: #333333;
}

.anb-sa-active .anb-sa-card__sku {
	margin: auto 0 0;
	font-size: 12px;
	line-height: 1.3;
	color: #888888;
}

/* Footer pinned to bottom of every card */
.anb-sa-active .anb-sa-card__footer {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: auto;
	padding-top: 4px;
}

.anb-sa-active .anb-sa-card__price {
	font-size: 13px;
	font-weight: 600;
	color: #1a1a1a;
	min-height: 1.2em;
	line-height: 1.3;
}

.anb-sa-active .anb-sa-card__price .login-to-view-price {
	font-weight: 500;
	font-size: 12px;
	color: #555555;
	text-decoration: none;
}

.anb-sa-active .anb-sa-card__price .login-to-view-price:hover {
	text-decoration: underline;
}

.anb-sa-active .anb-sa-card__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 10px 16px;
	background: var(--anb-sa-accent, #1a1a1a);
	color: #ffffff !important;
	border: none;
	border-radius: 30px;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	text-decoration: none !important;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.anb-sa-active .anb-sa-card__btn:hover,
.anb-sa-active .anb-sa-card__btn:focus {
	opacity: 0.88;
	color: #ffffff !important;
}

/* Archive toolbar */
.anb-sa-active .shop-control-bar,
.anb-sa-active .woocommerce-result-count,
.anb-sa-active .woocommerce-ordering {
	margin-bottom: 0.75rem;
}

/* ── Responsive columns ──
 *  992px+        → 4 columns (admin --anb-sa-cols)
 *  576–991px     → 3 columns (tablet)
 *  360–575px     → 2 columns (mobile)
 *  below 360px   → 1 column
 */

/* Desktop & laptop: 4 columns */
@media (min-width: 992px) {
	.anb-sa-active .woocommerce ul.products,
	.anb-sa-active .woocommerce ul.products.row,
	.anb-sa-active .woocommerce ul.products[class*="row-cols"] {
		grid-template-columns: repeat(var(--anb-sa-cols, 4), minmax(0, 1fr)) !important;
		gap: 8px !important;
	}
}

/* Tablet: 3 columns */
@media (min-width: 576px) and (max-width: 991px) {
	.anb-sa-active .woocommerce ul.products,
	.anb-sa-active .woocommerce ul.products.row,
	.anb-sa-active .woocommerce ul.products[class*="row-cols"] {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
		gap: 8px !important;
	}

	.anb-sa-active .anb-sa-card {
		padding: 10px;
	}

	.anb-sa-active .anb-sa-card__title {
		font-size: 13px;
	}

	.anb-sa-active .anb-sa-card__body {
		min-height: 4em;
	}
}

/* Mobile: 2 columns */
@media (min-width: 360px) and (max-width: 575px) {
	.anb-sa-active .woocommerce ul.products,
	.anb-sa-active .woocommerce ul.products.row,
	.anb-sa-active .woocommerce ul.products[class*="row-cols"] {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 6px !important;
	}

	.anb-sa-active .anb-sa-card {
		padding: 8px;
		border-radius: 8px;
	}

	.anb-sa-active .anb-sa-card__image-wrap {
		margin-bottom: 8px;
	}

	.anb-sa-active .anb-sa-card__title {
		font-size: 12px;
	}

	.anb-sa-active .anb-sa-card__title a {
		-webkit-line-clamp: 2;
	}

	.anb-sa-active .anb-sa-card__body {
		min-height: 3.2em;
		margin-bottom: 8px;
	}

	.anb-sa-active .anb-sa-card__sku {
		font-size: 11px;
	}

	.anb-sa-active .anb-sa-card__btn {
		padding: 8px 10px;
		font-size: 11px;
		border-radius: 20px;
	}

	.anb-sa-active .anb-sa-card__price {
		font-size: 11px;
	}
}

/* Very small phones: 1 column */
@media (max-width: 359px) {
	.anb-sa-active .woocommerce ul.products,
	.anb-sa-active .woocommerce ul.products.row,
	.anb-sa-active .woocommerce ul.products[class*="row-cols"] {
		grid-template-columns: 1fr !important;
		gap: 8px !important;
	}
}
