/**
 * TTools Product Grids
 * Shared styles for related products, up-sells, and cross-sells.
 * Replaces Woodmart's slider with a reliable responsive CSS Grid.
 */

/* Section wrapper */
.ttools-product-grid-section {
	margin-top: 2em;
	padding: 0;
}

.ttools-product-grid-section h2 {
	font-size: 1.3em;
	margin-bottom: 1em;
	font-weight: 600;
	color: #095880;
}

/* Grid container — desktop default: 4 columns */
.ttools-product-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 20px;
}

/* Modifier: 6-column variant for related products on wider screens */
.ttools-product-grid--six {
	grid-template-columns: repeat(6, 1fr);
	gap: 15px;
}

/* Card */
.ttools-product-card {
	position: relative;
	border: 1px solid #e8e8e8;
	border-radius: 5px;
	overflow: hidden;
	background: #fff;
	transition: box-shadow 0.2s ease;
	display: flex;
	flex-direction: column;
}

.ttools-product-card:hover {
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

/* Sale badge */
.ttools-product-card__badge {
	position: absolute;
	top: 8px;
	left: 8px;
	background: #095880;
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	padding: 3px 10px;
	border-radius: 3px;
	z-index: 2;
}

/* Card link wrapper */
.ttools-product-card__link {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	text-decoration: none;
	color: inherit;
}

/* Image container */
.ttools-product-card__image {
	width: 100%;
	overflow: hidden;
	background: #f9f9f9;
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ttools-product-card__image img {
	width: 100% !important;
	height: auto !important;
	max-width: 100% !important;
	display: block;
	object-fit: contain;
}

/* Info area */
.ttools-product-card__info {
	padding: 12px;
	text-align: center;
	flex-grow: 1;
}

.ttools-product-card__title {
	font-size: 14px;
	font-weight: 500;
	line-height: 1.3;
	margin: 0 0 6px 0;
	color: #333;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ttools-product-card__rating {
	margin-bottom: 6px;
}

.ttools-product-card__rating .star-rating {
	font-size: 12px;
}

.ttools-product-card__price {
	font-size: 15px;
	font-weight: 600;
	color: #095880;
}

.ttools-product-card__price del {
	color: #ccc;
	font-weight: 400;
	font-size: 13px;
}

.ttools-product-card__price ins {
	text-decoration: none;
	color: #095880;
}

/* Add to cart button — high specificity to override Woodmart defaults */
.ttools-product-card a.ttools-product-card__cart-btn,
.ttools-product-card a.button.ttools-product-card__cart-btn,
.ttools-product-grid .ttools-product-card a.ttools-product-card__cart-btn {
	display: block;
	width: calc(100% - 24px);
	margin: 0 12px 12px;
	padding: 8px 12px;
	text-align: center;
	background-color: #095880;
	color: #fff;
	border: none;
	border-radius: 5px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	cursor: pointer;
	transition: background-color 0.2s ease;
	text-decoration: none;
	opacity: 1;
	text-transform: none;
	letter-spacing: 0;
	box-shadow: none;
	min-height: 0;
}

.ttools-product-card a.ttools-product-card__cart-btn:hover,
.ttools-product-card a.button.ttools-product-card__cart-btn:hover,
.ttools-product-grid .ttools-product-card a.ttools-product-card__cart-btn:hover {
	background-color: #90ae2c;
	color: #fff;
	opacity: 1;
}

.ttools-product-card a.ttools-product-card__cart-btn:focus,
.ttools-product-card a.ttools-product-card__cart-btn:active {
	background-color: #074c6e;
	color: #fff;
	outline: none;
}

/* "Loading" / "Added" state during ajax add-to-cart */
.ttools-product-card a.ttools-product-card__cart-btn.loading,
.ttools-product-card a.ttools-product-card__cart-btn.added {
	opacity: 0.85;
}

.ttools-product-card .added_to_cart {
	display: block;
	text-align: center;
	font-size: 12px;
	color: #90ae2c;
	margin: 0 12px 8px;
	text-decoration: none;
}

/* === Responsive breakpoints === */

/* Tablet/laptop: 6-col grids step down to 4, 4-col grids step down to 3 */
@media (max-width: 1200px) {
	.ttools-product-grid--six {
		grid-template-columns: repeat(4, 1fr);
		gap: 18px;
	}
}

@media (max-width: 1024px) {
	.ttools-product-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 15px;
	}
	.ttools-product-grid--six {
		grid-template-columns: repeat(3, 1fr);
		gap: 15px;
	}
}

/* Mobile: 2 columns for everything */
@media (max-width: 767px) {
	.ttools-product-grid,
	.ttools-product-grid--six {
		grid-template-columns: repeat(2, 1fr);
		gap: 10px;
	}
	.ttools-product-card__info {
		padding: 8px;
	}
	.ttools-product-card__title {
		font-size: 13px;
	}
	.ttools-product-card__price {
		font-size: 14px;
	}
	.ttools-product-card__cart-btn {
		font-size: 12px;
		padding: 7px 8px;
		margin: 0 8px 8px;
		width: calc(100% - 16px);
	}
}

/* Small mobile */
@media (max-width: 380px) {
	.ttools-product-grid,
	.ttools-product-grid--six {
		gap: 8px;
	}
	.ttools-product-card__title {
		font-size: 12px;
	}
	.ttools-product-card__price {
		font-size: 13px;
	}
}
