/**
 * MEBAC Smart Blocks — Styles
 *
 * BEM methodology with .msb- prefix.
 * Compatible with Woodmart theme (rounded corners, soft shadows, clean typography).
 */

/* ==========================================================================
   Shared Card Styles
   ========================================================================== */

.msb-card {
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	overflow: hidden;
	transition: box-shadow 0.25s ease, transform 0.25s ease;
	display: flex;
	flex-direction: column;
}

.msb-card:hover {
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
	transform: translateY(-2px);
}

.msb-card--out-of-stock {
	opacity: 0.6;
}

.msb-card__image-link {
	display: block;
	position: relative;
	overflow: hidden;
	aspect-ratio: 1 / 1;
}

.msb-card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.msb-card:hover .msb-card__image {
	transform: scale(1.04);
}

.msb-card__body {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
}

.msb-card__name {
	font-size: 14px;
	font-weight: 600;
	color: #333;
	text-decoration: none;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.msb-card__name:hover {
	color: #1a1a1a;
}

.msb-card__price {
	font-size: 16px;
	font-weight: 700;
	color: #222;
}

.msb-card__price del {
	color: #999;
	font-weight: 400;
	font-size: 13px;
}

.msb-card__price ins {
	text-decoration: none;
	color: #e04f4f;
}

.msb-card__badge {
	display: inline-block;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	padding: 4px 10px;
	border-radius: 4px;
}

.msb-card__badge--out {
	background: #f5f5f5;
	color: #999;
}

/* Badge on image (kit card) */
.msb-card__image-link .msb-card__badge {
	position: absolute;
	top: 10px;
	left: 10px;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
}

/* ==========================================================================
   Shared Button Styles
   ========================================================================== */

.msb-card__btn,
.msb-kit__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 18px;
	border: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s ease, opacity 0.2s ease;
	min-height: 42px;
}

.msb-card__btn {
	background: #333;
	color: #fff;
	width: 100%;
	margin-top: auto;
}

.msb-card__btn:hover {
	background: #111;
}

.msb-kit__btn {
	background: #333;
	color: #fff;
	padding: 14px 32px;
	font-size: 15px;
	border-radius: 10px;
}

.msb-kit__btn:hover {
	background: #111;
}

/* Button states */
.msb-card__btn--loading,
.msb-kit__btn--loading {
	opacity: 0.7;
	pointer-events: none;
}

.msb-card__btn--added,
.msb-kit__btn--added {
	background: #4caf50 !important;
	pointer-events: none;
}

.msb-card__btn--error,
.msb-kit__btn--error {
	background: #e04f4f !important;
}

/* ==========================================================================
   Repeat Purchase — Product Card Carousel
   ========================================================================== */

.msb-reorder-wrap {
	display: flex;
	gap: 16px;
	margin: 24px 0;
	align-items: flex-start;
}

.msb-reorder-wrap .msb-reorder {
	flex: 1;
	min-width: 0;
}

.msb-reorder {
	margin: 24px 0;
	background: #fff;
	border-radius: 10px;
	border: 1px solid #e5e5e5;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
	overflow: hidden;
	transition: box-shadow 0.3s ease;
}

.msb-reorder:hover {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* --- Header --- */

.msb-reorder__header {
	padding: 16px 20px 0;
	display: flex;
	align-items: center;
	gap: 10px;
}

.msb-reorder__badge {
	display: inline-block;
	font-size: 9px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 1.2px;
	color: #16a34a;
	background: rgba(22, 163, 74, 0.08);
	border-radius: 4px;
	padding: 2px 7px;
}

.msb-reorder__title {
	font-size: 15px;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0;
}

/* --- Carousel --- */

/* Carousel — shared */
.msb-reorder__carousel {
	padding: 8px 12px;
	border-bottom: 1px solid #f0f0f0;
}

/* Desktop: show Woodmart carousel, hide mobile */
.msb-reorder__carousel--mobile {
	display: none !important;
}

/* Mobile: grid layout instead of carousel */
@media (max-width: 767px) {
	.msb-reorder__carousel--desktop {
		display: none !important;
	}

	.msb-reorder__carousel--mobile {
		display: grid !important;
		grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
		gap: 10px;
		padding: 12px 16px;
		border-bottom: 1px solid #f0f0f0;
	}
}

/* --- Product Card --- */

.msb-reorder-card {
	width: 100%;
	box-sizing: border-box;
	background: #fff !important;
	border-radius: 10px;
	border: 1px solid #eee;
	overflow: hidden;
	transition: all 0.25s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.msb-reorder-card:hover {
	border-color: #d0d0d0;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.06);
	transform: translateY(-3px);
}

.msb-reorder-card__img-link {
	display: block;
	position: relative;
	aspect-ratio: 1;
	background: #fff !important;
	padding: 8px;
}

.msb-reorder-card__img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.msb-reorder-card__qty {
	position: absolute;
	top: 6px;
	left: 6px;
	font-size: 9px;
	font-weight: 700;
	background: #16a34a;
	color: #fff;
	padding: 1px 6px;
	border-radius: 999px;
	box-shadow: 0 1px 3px rgba(22, 163, 74, 0.3);
	z-index: 2;
}

.msb-reorder-card__body {
	padding: 8px 10px 10px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	border-top: 1px solid #f5f5f5;
}

.msb-reorder-card__name {
	font-size: 11px;
	font-weight: 600;
	color: #333;
	text-decoration: none;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.6em;
}

.msb-reorder-card__name:hover {
	color: #1c61e7;
}

.msb-reorder-card__price {
	font-size: 13px;
	font-weight: 700;
	color: #1a1a1a;
}

.msb-reorder-card__price del {
	color: #999;
	font-weight: 400;
	font-size: 11px;
}

.msb-reorder-card__price ins {
	text-decoration: none;
}

.msb-reorder-card__add {
	display: inline-block;
	padding: 8px 20px;
	margin-top: 6px;
	background: #1c61e7 !important;
	color: #fff !important;
	border: none !important;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.25s ease;
	text-align: center;
	box-shadow: 0 2px 6px rgba(28, 97, 231, 0.2);
	-webkit-appearance: none !important;
	appearance: none !important;
}

.msb-reorder-card__add:hover {
	background: #1550c4 !important;
	box-shadow: 0 4px 12px rgba(28, 97, 231, 0.3);
	transform: translateY(-1px);
}

/* Add button states */
.msb-reorder-card__add.msb-card__btn--added {
	background: #16a34a !important;
}

.msb-reorder-card__add.msb-card__btn--error {
	background: #dc2626 !important;
}

.msb-reorder-card__add.msb-card__btn--loading {
	opacity: 0.7;
	pointer-events: none;
}

/* --- Footer: total + reorder button --- */

.msb-reorder__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 20px;
	gap: 12px;
}

.msb-reorder__total-price {
	font-size: 18px;
	font-weight: 800;
	color: #1a1a1a;
	letter-spacing: -0.02em;
}

.msb-reorder__btn.msb-kit__btn {
	background: #16a34a !important;
	color: #fff !important;
	padding: 10px 20px;
	font-size: 13px;
	font-weight: 600;
	border-radius: 8px;
	white-space: nowrap;
	box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}

.msb-reorder__btn.msb-kit__btn:hover {
	background: #15803d !important;
	color: #fff !important;
	box-shadow: 0 4px 16px rgba(22, 163, 74, 0.35);
	transform: translateY(-1px);
}

.msb-reorder__btn.msb-kit__btn--added {
	background: #22c55e !important;
	color: #fff !important;
}

/* Success animation */
.msb-reorder--added {
	border-color: #16a34a;
	box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15), 0 2px 12px rgba(22, 163, 74, 0.1);
	transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ==========================================================================
   Product Kit — Compact Inline Card
   ========================================================================== */

.msb-product-kit {
	margin: 0;
	background: #fff;
	border-radius: 10px;
	border: 1px solid #e5e5e5;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
	overflow: hidden;
	transition: box-shadow 0.3s ease;
}

.msb-product-kit:hover {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(28, 97, 231, 0.06);
}

/* --- Inner: vertical centered layout --- */

.msb-product-kit__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 24px 20px;
	gap: 16px;
	text-align: center;
}

/* --- Top: badge + title + subtitle --- */

.msb-product-kit__info {
	max-width: 400px;
}

.msb-product-kit__badge {
	display: inline-block;
	font-size: 9px;
	box-shadow: 0 1px 4px rgba(28, 97, 231, 0.15);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 1.2px;
	color: #1c61e7;
	background: rgba(28, 97, 231, 0.08);
	border-radius: 4px;
	padding: 2px 7px;
	margin-bottom: 4px;
}

.msb-product-kit__title {
	font-size: 14px;
	font-weight: 700;
	color: #1a1a1a;
	line-height: 1.3;
	margin: 0 0 2px;
}

.msb-product-kit__subtitle {
	font-size: 11px;
	font-weight: 400;
	color: #999;
	line-height: 1.3;
	margin: 0;
}

/* --- Center: product thumbnails with + --- */

.msb-product-kit__products {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex-wrap: wrap;
}

/* --- Thumbnail item --- */

.msb-kit-item {
	display: block;
	width: 64px;
	height: 64px;
	background: #fff !important;
	border-radius: 10px;
	border: 1.5px solid #eee;
	padding: 6px;
	position: relative;
	text-decoration: none;
	transition: all 0.25s ease;
	flex-shrink: 0;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.msb-kit-item:hover {
	border-color: #1c61e7;
	box-shadow: 0 2px 8px rgba(28, 97, 231, 0.12);
	transform: translateY(-1px);
}

.msb-kit-item--out {
	opacity: 0.4;
}

.msb-kit-item__img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.msb-kit-item__qty {
	position: absolute;
	top: -5px;
	left: -5px;
	font-size: 9px;
	font-weight: 700;
	background: #1c61e7;
	color: #fff;
	padding: 1px 5px;
	border-radius: 999px;
	line-height: 1.4;
	min-width: 16px;
	text-align: center;
	box-shadow: 0 1px 3px rgba(28, 97, 231, 0.3);
	z-index: 2;
}

.msb-kit-item__label {
	position: absolute;
	bottom: -5px;
	left: 50%;
	transform: translateX(-50%);
	font-size: 8px;
	font-weight: 700;
	background: #1c61e7;
	color: #fff;
	padding: 1px 6px;
	border-radius: 4px;
	white-space: nowrap;
	box-shadow: 0 1px 3px rgba(28, 97, 231, 0.3);
	z-index: 2;
}

.msb-kit-item__out {
	position: absolute;
	bottom: -6px;
	left: 50%;
	transform: translateX(-50%);
	font-size: 7px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	background: #ef4444;
	color: #fff;
	padding: 1px 5px;
	border-radius: 3px;
	white-space: nowrap;
}

/* --- "+" between items --- */

.msb-kit-item + .msb-kit-item::before {
	content: '+';
	position: absolute;
	left: -13px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 13px;
	font-weight: 600;
	color: #1c61e7;
	opacity: 0.4;
	pointer-events: none;
	line-height: 1;
}

/* --- Right: CTA button --- */

.msb-product-kit__action {
	width: 100%;
	max-width: 280px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
}

.msb-product-kit__total-price {
	font-size: 18px;
	font-weight: 800;
	color: #1a1a1a;
	letter-spacing: -0.02em;
}

.msb-product-kit .msb-kit__btn {
	background: #1c61e7;
	color: #fff !important;
	padding: 10px 20px;
	font-size: 13px;
	font-weight: 600;
	border-radius: 8px;
	border: none;
	cursor: pointer;
	transition: all 0.25s ease;
	white-space: nowrap;
	box-shadow: 0 2px 8px rgba(28, 97, 231, 0.25);
}

.msb-product-kit .msb-kit__btn:hover {
	background: #1550c4;
	color: #fff !important;
	box-shadow: 0 4px 16px rgba(28, 97, 231, 0.35);
	transform: translateY(-1px);
}

.msb-product-kit .msb-kit__btn:active {
	transform: scale(0.97);
}

.msb-product-kit .msb-kit__btn--added {
	background: #16a34a !important;
}

.msb-product-kit .msb-kit__btn--error {
	background: #dc2626 !important;
}

/* --- Kit success animation --- */

.msb-product-kit--added {
	border-color: #16a34a;
	box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2), 0 2px 12px rgba(22, 163, 74, 0.1);
	transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.msb-kit-item--added {
	border-color: #16a34a !important;
	box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15) !important;
	transform: scale(1.08);
	transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.msb-product-kit .msb-kit__btn--loading::after {
	content: '';
	display: inline-block;
	width: 12px;
	height: 12px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: msb-spin 0.7s linear infinite;
	margin-left: 6px;
}

@keyframes msb-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	.msb-product-kit .msb-kit__btn:active {
		transform: none;
	}
}

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

/* Mobile */
@media (max-width: 767px) {
	.msb-reorder {
		overflow: visible;
	}

	.msb-reorder-wrap {
		flex-direction: column;
	}

	.msb-product-kit__inner {
		padding: 16px;
	}

	.msb-kit-item {
		width: 52px;
		height: 52px;
	}

	.msb-reorder__footer {
		flex-direction: column;
		text-align: center;
	}

	.msb-reorder__btn.msb-kit__btn {
		width: 100%;
	}
}

/* Tablet */
@media (max-width: 1023px) {
	.msb-reorder-wrap {
		flex-direction: column;
	}
}
