/**
 * Mama Herbals WooCommerce Enhancer — Frontend Styles
 */

:root {
	--mhe-primary: #2e7d32;
	--mhe-primary-dark: #1b5e20;
	--mhe-accent: #25d366;
	--mhe-text: #222;
	--mhe-muted: #777;
	--mhe-border: #e2e2e2;
	--mhe-bg: #fff;
	--mhe-radius: 6px;
	--mhe-danger: #c0392b;
}

/* ----------------------------------------------------------------
 * Card wrapper
 * ---------------------------------------------------------------- */
.mhe-card {
	position: relative;
}

/* ----------------------------------------------------------------
 * Badges
 * ---------------------------------------------------------------- */
.mhe-badges {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 5;
	display: flex;
	flex-direction: column;
	gap: 4px;
	max-width: calc(100% - 56px);
}

.mhe-badge {
	display: inline-block;
	padding: 3px 8px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.4;
	border-radius: 3px;
	color: #fff;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.mhe-badge-sale {
	background: var(--mhe-danger);
}

.mhe-badge-outofstock {
	background: #555;
}

.mhe-badge-backorder {
	background: #b8860b;
}

.mhe-badge-lowstock {
	background: #e67e22;
}

/* ----------------------------------------------------------------
 * Hover image swap + zoom
 * ---------------------------------------------------------------- */
.mhe-card .woocommerce-loop-product__link,
.mhe-card a.woocommerce-LoopProduct-link {
	position: relative;
	display: block;
	overflow: hidden;
}

.mhe-hover-image {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transition: opacity 0.35s ease;
	pointer-events: none;
}

.mhe-card:hover .mhe-hover-image {
	opacity: 1;
}

.mhe-zoomable {
	overflow: hidden;
}

.mhe-zoomable img {
	transition: transform 0.4s ease;
	will-change: transform;
}

.mhe-zoomable:hover img.mhe-zoom-active {
	transform: scale(1.15);
}

/* ----------------------------------------------------------------
 * Quantity selector
 * ---------------------------------------------------------------- */
.mhe-qty-wrapper {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--mhe-border);
	border-radius: var(--mhe-radius);
	overflow: hidden;
	vertical-align: middle;
}

.mhe-qty-btn {
	background: #f5f5f5;
	border: none;
	width: 30px;
	height: 34px;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	color: var(--mhe-text);
}

.mhe-qty-btn:hover {
	background: #ebebeb;
}

.mhe-qty-input {
	width: 44px;
	height: 34px;
	border: none;
	border-left: 1px solid var(--mhe-border);
	border-right: 1px solid var(--mhe-border);
	text-align: center;
	font-size: 14px;
	-moz-appearance: textfield;
}

.mhe-qty-input::-webkit-outer-spin-button,
.mhe-qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* ----------------------------------------------------------------
 * Loop action row (quantity + add to cart + buy now, inline & responsive)
 * ---------------------------------------------------------------- */
.mhe-actions-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 8px;
}

.mhe-actions-row .mhe-qty-wrapper {
	flex: 0 0 auto;
}

.mhe-actions-row .button,
.mhe-actions-row .mhe-add-to-cart,
.mhe-actions-row .mhe-buy-now {
	flex: 1 1 auto;
	margin: 0 !important;
	white-space: nowrap;
	text-align: center;
}

@media (max-width: 480px) {
	.mhe-actions-row {
		flex-direction: column;
		align-items: stretch;
	}

	.mhe-actions-row .mhe-qty-wrapper {
		align-self: center;
	}

	.mhe-actions-row .button,
	.mhe-actions-row .mhe-add-to-cart,
	.mhe-actions-row .mhe-buy-now {
		width: 100%;
	}
}

/* ----------------------------------------------------------------
 * Buttons (Buy Now, Quick View, Add to Cart state)
 * ---------------------------------------------------------------- */
.mhe-buy-now {
	display: inline-block;
	margin-top: 6px;
	margin-left: 6px;
	background: var(--mhe-primary-dark);
	color: #fff;
	border: none;
	border-radius: var(--mhe-radius);
	padding: 8px 16px;
	font-size: 13px;
	cursor: pointer;
	transition: background 0.2s ease;
}

.mhe-buy-now:hover {
	background: #123d16;
	color: #fff;
}

.mhe-add-to-cart.is-loading,
.mhe-buy-now.is-loading {
	opacity: 0.7;
	pointer-events: none;
}

.mhe-quick-view-btn {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 6;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: rgba(255, 255, 255, 0.95);
	border: 1px solid var(--mhe-border);
	border-radius: 50%;
	padding: 0;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
	transition: background 0.2s ease, transform 0.2s ease;
}

.mhe-quick-view-btn:hover,
.mhe-quick-view-btn:focus {
	background: var(--mhe-primary);
	transform: scale(1.06);
}

.mhe-quick-view-btn:hover .mhe-eye-icon,
.mhe-quick-view-btn:focus .mhe-eye-icon {
	fill: #fff;
}

.mhe-eye-icon {
	width: 18px;
	height: 18px;
	fill: var(--mhe-text);
	pointer-events: none;
}

@media (max-width: 480px) {
	.mhe-quick-view-btn {
		width: 32px;
		height: 32px;
	}

	.mhe-eye-icon {
		width: 16px;
		height: 16px;
	}
}

/* ----------------------------------------------------------------
 * Quick View Modal
 * ---------------------------------------------------------------- */
.mhe-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
}

.mhe-modal.is-open {
	display: block;
}

.mhe-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	animation: mhe-fade-in 0.2s ease forwards;
}

.mhe-modal-dialog {
	position: relative;
	max-width: 900px;
	width: calc(100% - 32px);
	max-height: calc(100vh - 64px);
	margin: 32px auto;
	background: var(--mhe-bg);
	border-radius: var(--mhe-radius);
	overflow-y: auto;
	animation: mhe-pop-in 0.25s ease forwards;
}

@keyframes mhe-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes mhe-pop-in {
	from { opacity: 0; transform: translateY(16px) scale(0.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.mhe-modal-close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	background: #fff;
	border: 1px solid var(--mhe-border);
	border-radius: 50%;
	width: 32px;
	height: 32px;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.mhe-modal-spinner {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 240px;
}

.mhe-modal.is-loaded .mhe-modal-spinner {
	display: none;
}

.mhe-spinner {
	width: 40px;
	height: 40px;
	border: 4px solid var(--mhe-border);
	border-top-color: var(--mhe-primary);
	border-radius: 50%;
	animation: mhe-spin 0.8s linear infinite;
}

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

.mhe-modal-body {
	padding: 32px;
}

/* Quick view inner layout */
.mhe-qv {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 32px;
}

@media (max-width: 680px) {
	.mhe-qv {
		grid-template-columns: 1fr;
	}

	.mhe-modal-body {
		padding: 20px;
	}
}

.mhe-qv-slider {
	position: relative;
}

.mhe-qv-slide {
	display: none;
}

.mhe-qv-slide.is-active {
	display: block;
}

.mhe-qv-slide img {
	width: 100%;
	height: auto;
	border-radius: var(--mhe-radius);
}

.mhe-qv-slide-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, 0.9);
	border: 1px solid var(--mhe-border);
	border-radius: 50%;
	width: 32px;
	height: 32px;
	cursor: pointer;
	font-size: 18px;
}

.mhe-qv-prev { left: 8px; }
.mhe-qv-next { right: 8px; }

.mhe-qv-dots {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-top: 10px;
}

.mhe-qv-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--mhe-border);
	cursor: pointer;
}

.mhe-qv-dot.is-active {
	background: var(--mhe-primary);
}

.mhe-qv-title {
	margin: 0 0 8px;
	font-size: 22px;
}

.mhe-qv-title a {
	color: inherit;
	text-decoration: none;
}

.mhe-qv-rating {
	margin-bottom: 8px;
}

.mhe-qv-price {
	font-size: 20px;
	margin-bottom: 14px;
}

.mhe-qv-excerpt {
	color: var(--mhe-muted);
	margin-bottom: 14px;
}

.mhe-qv-meta {
	width: 100%;
	margin-bottom: 16px;
	font-size: 13px;
}

.mhe-qv-meta th {
	text-align: left;
	color: var(--mhe-muted);
	padding-right: 12px;
	vertical-align: top;
}

.mhe-qv-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-bottom: 16px;
}

.mhe-qv-actions .mhe-add-to-cart,
.mhe-qv-actions .mhe-buy-now {
	margin: 0;
}

.mhe-qv-secondary-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	border-top: 1px solid var(--mhe-border);
	padding-top: 14px;
}

.mhe-whatsapp-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--mhe-accent);
	color: #fff;
	text-decoration: none;
	padding: 8px 16px;
	border-radius: var(--mhe-radius);
	font-size: 13px;
}

.mhe-whatsapp-btn:hover {
	background: #1ebc59;
	color: #fff;
}

.mhe-share {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
}

.mhe-share-label {
	color: var(--mhe-muted);
}

.mhe-share-btn {
	background: #f0f0f0;
	color: var(--mhe-text);
	text-decoration: none;
	padding: 6px 12px;
	border-radius: var(--mhe-radius);
	font-size: 12px;
}

.mhe-share-btn:hover {
	background: #e2e2e2;
	color: var(--mhe-text);
}

/* ----------------------------------------------------------------
 * Single product page
 * ---------------------------------------------------------------- */
.mhe-buy-now-single {
	margin-left: 10px !important;
}

.mhe-single-secondary-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-top: 18px;
	padding-top: 16px;
	border-top: 1px solid var(--mhe-border);
}

@media (max-width: 480px) {
	.mhe-buy-now-single {
		margin-left: 0 !important;
		margin-top: 8px !important;
		display: block;
		width: 100%;
	}

	.mhe-single-secondary-actions {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* ----------------------------------------------------------------
 * Toast / mini notice
 * ---------------------------------------------------------------- */
.mhe-toast {
	position: fixed;
	bottom: 20px;
	right: 20px;
	background: var(--mhe-text);
	color: #fff;
	padding: 10px 18px;
	border-radius: var(--mhe-radius);
	font-size: 13px;
	z-index: 100001;
	opacity: 0;
	transform: translateY(10px);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.mhe-toast.is-visible {
	opacity: 1;
	transform: translateY(0);
}
