/*
 * Ofertas Repuestos — frontend styles.
 * Index card grid + per-category product listing + empty state + pagination.
 */

.ofrt-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
	grid-auto-rows: 1fr;
	align-items: stretch;
	gap: 0.75rem;
	list-style: none;
	padding: 0;
	margin: 0;
}

.ofrt-grid__item {
	display: flex;
	height: 100%;
}

.ofrt-card {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	text-decoration: none;
	color: inherit;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 4.5px;
	overflow: hidden;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.ofrt-card:hover,
.ofrt-card:focus {
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	transform: translateY(-1px);
}

.ofrt-card__media {
	display: block;
	aspect-ratio: 1 / 1;
	background: #f4f4f4;
	overflow: hidden;
}

.ofrt-card__media--placeholder {
	background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
}

.ofrt-card__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ofrt-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.1875rem;
	padding: 0.5625rem 0.75rem 0.75rem;
	flex: 1 0 auto;
}

.ofrt-card__name {
	font-weight: 600;
	font-size: 0.9375rem;
	line-height: 1.3;
	/* Reserve 3 lines so CTAs align across cards in the same row. */
	min-height: 3.65625rem;
	max-height: calc(0.9375rem * 1.3 * 3);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}

.ofrt-card__cta {
	font-size: 0.796875rem;
	color: #0073aa;
}

/* --- Per-category product listing --- */

.ofrt-listing {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.ofrt-listing__header {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.ofrt-listing__back {
	align-self: flex-start;
	font-size: 0.9rem;
	color: #0073aa;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
}

.ofrt-listing__back:hover,
.ofrt-listing__back:focus {
	text-decoration: underline;
}

.ofrt-listing__title {
	font-size: 1.5rem;
	font-weight: 600;
	margin: 0;
	line-height: 1.25;
}

.ofrt-listing__count {
	margin: 0;
	color: #666;
	font-size: 0.9rem;
}

.ofrt-products {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
	grid-auto-rows: 1fr;
	align-items: stretch;
	gap: 0.75rem;
	list-style: none;
	padding: 0;
	margin: 0;
}

.ofrt-products__item {
	display: flex;
	height: 100%;
}

.ofrt-product-card {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 4.5px;
	overflow: hidden;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.ofrt-product-card:hover,
.ofrt-product-card:focus-within {
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	transform: translateY(-1px);
}

.ofrt-product-card__link {
	display: flex;
	flex-direction: column;
	width: 100%;
	text-decoration: none;
	color: inherit;
}

.ofrt-product-card__media {
	display: block;
	position: relative;
	aspect-ratio: 1 / 1;
	background: #f4f4f4;
	overflow: hidden;
}

.ofrt-product-card__badge {
	position: absolute;
	top: 0.45rem;
	left: 0.45rem;
	z-index: 1;
	padding: 0.22rem 0.45rem;
	font-size: 0.65rem;
	font-weight: 700;
	line-height: 1.2;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #fff;
	background: #c0392b;
	border-radius: 3px;
	pointer-events: none;
}

.ofrt-product-card__media--placeholder {
	background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
}

.ofrt-product-card__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ofrt-product-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.2625rem;
	padding: 0.5625rem 0.75rem 0.75rem;
	flex: 1 0 auto;
}

.ofrt-product-card__name {
	font-weight: 600;
	font-size: 0.890625rem;
	line-height: 1.3;
	/* Reserve 4 lines so cards in the same row have equal body height
	   regardless of title length. min-height/max-height are universal
	   fallbacks; line-clamp adds ellipsis where supported. */
	min-height: 4.6875rem;
	max-height: calc(0.890625rem * 1.3 * 4);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4;
	line-clamp: 4;
	overflow: hidden;
}

.ofrt-product-card__sku {
	font-size: 0.75rem;
	line-height: 1.3;
	color: #666;
}

.ofrt-product-card__sku-label {
	font-weight: 500;
}

.ofrt-product-card__price {
	display: block;
	font-size: 0.84375rem;
	color: #222;
}

.ofrt-product-card__price del {
	color: #888;
	margin-right: 0.1875rem;
}

.ofrt-product-card__price ins {
	color: #c0392b;
	text-decoration: none;
	font-weight: 600;
}

.ofrt-product-card__footer {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
	padding: 0.5625rem 0.75rem 0.75rem;
	border-top: 1px solid rgba(0, 0, 0, 0.05);
	background: #fafafa;
}

.ofrt-product-card__login {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.3rem;
	width: 100%;
	padding: 0.4125rem 0.5625rem;
	font-size: 0.796875rem;
	font-weight: 500;
	color: #1b365c;
	background: #fff;
	border: 1px dashed rgba(27, 54, 92, 0.4);
	border-radius: 3px;
	cursor: pointer;
	text-decoration: none;
	box-sizing: border-box;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ofrt-product-card__login:hover,
.ofrt-product-card__login:focus {
	background: #eef3f9;
	border-color: #1b365c;
	color: #dd9323;
}

.ofrt-product-card__login-icon {
	font-size: 0.890625rem;
	line-height: 1;
}

/* --- Empty state --- */

.ofrt-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	padding: 2.5rem 1rem;
	text-align: center;
	color: #555;
	border: 1px dashed rgba(0, 0, 0, 0.12);
	border-radius: 6px;
	background: #fafafa;
}

.ofrt-empty__message {
	margin: 0;
	font-size: 1rem;
}

.ofrt-empty__back {
	color: #0073aa;
	text-decoration: none;
	font-size: 0.95rem;
}

.ofrt-empty__back:hover,
.ofrt-empty__back:focus {
	text-decoration: underline;
}

/* --- Pagination --- */

.ofrt-listing__pagination {
	display: flex;
	justify-content: center;
}

.ofrt-listing__pagination .page-numbers {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	list-style: none;
	padding: 0;
	margin: 0;
}

.ofrt-listing__pagination .page-numbers li {
	margin: 0;
}

.ofrt-listing__pagination .page-numbers a,
.ofrt-listing__pagination .page-numbers span {
	display: inline-block;
	padding: 0.5rem 0.75rem;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 4px;
	text-decoration: none;
	color: #0073aa;
	background: #fff;
	line-height: 1.2;
}

.ofrt-listing__pagination .page-numbers a:hover,
.ofrt-listing__pagination .page-numbers a:focus {
	border-color: #0073aa;
}

.ofrt-listing__pagination .page-numbers .current {
	background: #0073aa;
	color: #fff;
	border-color: #0073aa;
}

/* --- Card action slot (buy button / options link / login link / OOS) --- */

.ofrt-product-card__action-slot {
	display: flex;
	width: 100%;
	margin-top: 0;
}

.ofrt-product-card__action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 0.45rem 0.75rem;
	font-size: 0.796875rem;
	line-height: 1.3;
	text-decoration: none;
	border: 1px solid currentColor;
	border-radius: 3px;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
	width: 100%;
}

.ofrt-product-card__action--login,
.ofrt-product-card__action--choose-options,
.ofrt-product-card__action--view,
.ofrt-product-card__action--add-to-cart {
	color: #0073aa;
}

.ofrt-product-card__action--login:hover,
.ofrt-product-card__action--login:focus,
.ofrt-product-card__action--choose-options:hover,
.ofrt-product-card__action--choose-options:focus,
.ofrt-product-card__action--view:hover,
.ofrt-product-card__action--view:focus {
	background: #0073aa;
	color: #fff;
	border-color: #0073aa;
}

/* Add-to-cart is a solid CTA: white text on blue, both at rest and on
   hover. Slight darken on hover/focus for visual feedback. */
.ofrt-product-card__action--add-to-cart {
	color: #fff;
	background: #0073aa;
	border-color: #0073aa;
	text-align: center;
	margin: 0;
	min-height: unset;
	height: auto;
}

.ofrt-product-card__action--add-to-cart:hover,
.ofrt-product-card__action--add-to-cart:focus {
	background: #005177;
	color: #fff;
	border-color: #005177;
}

/* Neutralize theme/WooCommerce button sizing inside card footers. */
.ofrt-product-card__action-pair .ofrt-product-card__action--add-to-cart.add_to_cart_button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	margin: 0;
	padding: 0.45rem 0.75rem;
	line-height: 1.3;
	min-height: 0;
	height: auto;
}

.ofrt-product-card__action--out-of-stock {
	color: #999;
	border-color: #ccc;
	cursor: not-allowed;
}

.ofrt-product-card__action-pair {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0.35rem;
	width: 100%;
}

.ofrt-product-card__quantity {
	flex: none;
	width: 100%;
	max-width: 4.5rem;
	box-sizing: border-box;
	padding: 0.4125rem 0.375rem;
	font-size: 0.84375rem;
	line-height: 1.3;
	text-align: center;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 3px;
	background: #fff;
}

.ofrt-product-card__quantity:focus {
	outline: 2px solid #0073aa;
	outline-offset: 1px;
	border-color: #0073aa;
}

.ofrt-product-card__quantity::-webkit-outer-spin-button,
.ofrt-product-card__quantity::-webkit-inner-spin-button {
	opacity: 1;
}
