/* ==========================================================================
   MG Home Carousel — MeLi-style product carousels
   ========================================================================== */

/* ── Section card ── */
.mg-carousel-section {
	background: #fff;
	border-radius: 8px;
	padding: 20px 24px 24px;
	margin-bottom: 16px;
}

/* ── Header ── */
.mg-carousel-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 16px;
	gap: 16px;
}

.mg-carousel-title {
	font-size: 20px;
	font-weight: 600;
	color: #1a1a2e;
	margin: 0;
	line-height: 1.3;
}

.mg-carousel-link {
	font-size: 14px;
	font-weight: 500;
	color: #490D78;
	text-decoration: none;
	white-space: nowrap;
	flex-shrink: 0;
}

.mg-carousel-link:hover {
	color: #3d0360;
}

/* ── Track wrapper (arrows + track) ── */
.mg-carousel-wrapper {
	position: relative;
}

/* ── Track ── */
.mg-carousel-track {
	display: flex;
	gap: 16px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
	padding: 4px 0;
}

.mg-carousel-track::-webkit-scrollbar {
	display: none;
}

.mg-carousel-track.is-dragging {
	scroll-snap-type: none;
	scroll-behavior: auto;
	cursor: grabbing;
	user-select: none;
}

/* ── Navigation arrows ── */
.mg-carousel-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 3;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.1);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: #333;
	transition: box-shadow 0.2s, opacity 0.2s;
	padding: 0;
}

.mg-carousel-arrow:hover {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.mg-carousel-arrow:disabled,
.mg-carousel-arrow[disabled] {
	opacity: 0;
	pointer-events: none;
}

.mg-carousel-prev {
	left: -16px;
}

.mg-carousel-next {
	right: -16px;
}

/* ── Product card ── */
.mg-carousel-card {
	flex: 0 0 calc((100% - 80px) / 6);
	scroll-snap-align: start;
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.mg-carousel-card__link {
	text-decoration: none;
	color: inherit;
	display: flex;
	flex-direction: column;
	flex: 1;
}

.mg-carousel-card__link:hover {
	color: inherit;
}

/* ── Image ── */
.mg-carousel-card__img {
	position: relative;
	aspect-ratio: 1;
	background: #fff;
	border: 1px solid #eee;
	border-radius: 6px;
	overflow: hidden;
	margin-bottom: 12px;
}

.mg-carousel-card__img img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	padding: 10px;
	transition: transform 0.25s ease;
}

.mg-carousel-card:hover .mg-carousel-card__img img {
	transform: scale(1.04);
}

/* ── Badge ── */
.mg-carousel-card__badge {
	position: absolute;
	top: 8px;
	left: 8px;
	background: #c62828;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 3px;
	text-transform: uppercase;
	letter-spacing: 0.3px;
	line-height: 1;
}

/* ── Info ── */
.mg-carousel-card__info {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1;
}

.mg-carousel-card__title {
	font-size: 14px;
	font-weight: 400;
	line-height: 1.3;
	color: #333;
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ── Pricing ── */
.mg-carousel-card__pricing {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin-top: 4px;
}

.mg-carousel-card__original,
.mg-carousel-card__original .woocommerce-Price-amount,
.mg-carousel-card__original .woocommerce-Price-currencySymbol {
	font-size: 12px;
	color: #667085 !important;
	text-decoration: line-through;
	line-height: 1;
	opacity: 1 !important;
}

.mg-carousel-card__price-row {
	display: flex;
	align-items: baseline;
	gap: 6px;
}

.mg-carousel-card__price {
	font-size: 22px;
	font-weight: 400;
	color: #333;
	line-height: 1.2;
}

.mg-carousel-card__discount {
	font-size: 14px;
	font-weight: 500;
	color: #0f7a45;
}

/* ── Shipping ── */
.mg-carousel-card__shipping {
	font-size: 12px;
	color: #0f7a45;
	font-weight: 500;
	margin-top: 4px;
}

/* ── Add-to-cart button ── */
.mg-carousel-card__cart {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	padding: 8px 12px;
	margin-top: 8px;
	background: #490D78;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s, opacity 0.2s, transform 0.15s;
	opacity: 0;
	transform: translateY(4px);
}

.mg-carousel-card:hover .mg-carousel-card__cart,
.mg-carousel-card__cart:focus {
	opacity: 1;
	transform: translateY(0);
}

.mg-carousel-card__cart:hover {
	background: #3d0360;
}

.mg-carousel-card__cart:active {
	transform: scale(0.97);
}

.mg-carousel-card__cart.is-loading {
	pointer-events: none;
	opacity: 0.7;
}

.mg-carousel-card__cart.is-added {
	background: #00a650;
	pointer-events: none;
}

/* ── Home carousels container ── */
.mg-home-carousels {
	max-width: 1200px;
	margin: 0 auto;
	padding: 16px 16px 0;
}

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

/* Tablet */
@media (max-width: 1024px) {
	.mg-carousel-card {
		flex: 0 0 calc((100% - 48px) / 4);
	}

	.mg-carousel-prev { left: -8px; }
	.mg-carousel-next { right: -8px; }
}

/* Mobile */
@media (max-width: 767px) {
	.mg-carousel-section {
		border-radius: 0;
		padding: 16px;
		margin-bottom: 8px;
	}

	.mg-carousel-card {
		flex: 0 0 42%;
	}

	.mg-carousel-arrow {
		display: none;
	}

	.mg-carousel-card__price {
		font-size: 18px;
	}

	.mg-carousel-card__cart {
		opacity: 1;
		transform: translateY(0);
		padding: 10px 12px;
	}

	.mg-carousel-title {
		font-size: 17px;
	}

	.mg-home-carousels {
		padding: 8px 0 0;
	}
}

/* Small mobile */
@media (max-width: 400px) {
	.mg-carousel-card {
		flex: 0 0 45%;
	}
}
