/**
 * MazzX Catalog & WhatsApp — Frontend Styles
 */

/* CSS Variables (defaults, overridden by inline style from PHP) */
:root {
	--mazzx-buy-now-color: #ff9800;
	--mazzx-whatsapp-color: #25D366;
	--mazzx-customize-color: #2196F3;
	--mazzx-icon-size: 1em;
	--mazzx-icon-gap: 6px;
	--mazzx-single-buttons-gap: 8px;
	--mazzx-loop-buttons-gap: 5px;
}

/* Button wrapper */
.mazzx-buttons-wrapper {
	display: flex;
	flex-wrap: wrap;
	gap: var(--mazzx-single-buttons-gap, 8px);
	margin: var(--mazzx-single-wrapper-margin, 10px 0 0 0);
	padding: var(--mazzx-single-wrapper-padding, 0);
	align-items: center;
}

/* Base button style (branded only) */
.mazzx-style-branded .mazzx-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 20px;
	border: 1px solid transparent;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
	cursor: pointer;
	transition: opacity 0.2s ease, transform 0.1s ease;
	text-align: center;
	white-space: nowrap;
}

.mazzx-style-branded .mazzx-btn:hover {
	opacity: 0.9;
	text-decoration: none;
}

.mazzx-style-branded .mazzx-btn:active {
	transform: scale(0.98);
}

/* Branded mode colors */
.mazzx-style-branded .mazzx-buy-now-btn {
	background-color: var(--mazzx-buy-now-color);
	color: #fff;
}

.mazzx-style-branded .mazzx-buy-now-btn:hover,
.mazzx-style-branded .mazzx-buy-now-btn:focus {
	color: #fff;
}

.mazzx-style-branded .mazzx-whatsapp-btn {
	background-color: var(--mazzx-whatsapp-color);
	color: #fff;
}

.mazzx-style-branded .mazzx-whatsapp-btn:hover,
.mazzx-style-branded .mazzx-whatsapp-btn:focus {
	color: #fff;
}

.mazzx-style-branded .mazzx-customize-btn {
	background-color: var(--mazzx-customize-color);
	color: #fff;
}

.mazzx-style-branded .mazzx-customize-btn:hover,
.mazzx-style-branded .mazzx-customize-btn:focus {
	color: #fff;
}

.mazzx-style-branded .mazzx-quote-btn {
	background-color: var(--mazzx-quote-color);
	color: #fff;
}

.mazzx-style-branded .mazzx-quote-btn:hover,
.mazzx-style-branded .mazzx-quote-btn:focus {
	color: #fff;
}

/* Inherit/hybrid mode: rely on active theme button styling */
.mazzx-style-inherit .mazzx-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	column-gap: var(--mazzx-icon-gap, 6px);
	text-decoration: none;
}

.mazzx-style-hybrid .mazzx-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	column-gap: var(--mazzx-icon-gap, 6px);
	text-decoration: none;
}

.mazzx-btn {
	display: inline-flex;
	align-items: center;
	column-gap: var(--mazzx-icon-gap, 6px);
}

.mazzx-btn .mazzx-btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	font-size: var(--mazzx-icon-size, 1em);
	flex: 0 0 auto;
}

.mazzx-btn .mazzx-icon-dashicon.dashicons {
	font-size: var(--mazzx-icon-size, 1em);
	width: var(--mazzx-icon-size, 1em);
	height: var(--mazzx-icon-size, 1em);
	line-height: 1;
}

.mazzx-manual-price-range {
	display: inline-block;
	font-weight: 600;
}

@supports not (gap: 1px) {
	.mazzx-btn .mazzx-btn-icon {
		margin-right: var(--mazzx-icon-gap, 6px);
	}

	.mazzx-btn .mazzx-btn-label + .mazzx-btn-icon {
		margin-right: 0;
		margin-left: var(--mazzx-icon-gap, 6px);
	}
}

/* Disabled state (variable products without variation selected) */
.mazzx-btn[disabled],
.mazzx-btn.mazzx-disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: auto; /* Keep pointer events to show alert on click */
}

/* Loading state */
.mazzx-btn.mazzx-loading {
	opacity: 0.7;
	cursor: wait;
	position: relative;
}

.mazzx-btn.mazzx-loading::after {
	content: '';
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-left: 8px;
	border: 2px solid transparent;
	border-top-color: currentColor;
	border-radius: 50%;
	animation: mazzx-spin 0.6s linear infinite;
}

@keyframes mazzx-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Shop loop buttons */
.mazzx-loop-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: var(--mazzx-loop-buttons-gap, 5px);
	margin: var(--mazzx-loop-wrapper-margin, 8px 0 0 0);
	padding: var(--mazzx-loop-wrapper-padding, 0);
}

.mazzx-loop-btn {
	padding: 6px 12px;
	font-size: 12px;
	border-radius: 3px;
}

/* Responsive */
@media (max-width: 600px) {
	.mazzx-buttons-wrapper {
		flex-direction: column;
	}

	.mazzx-btn {
		width: 100%;
	}

	.mazzx-loop-buttons {
		flex-direction: column;
	}

	.mazzx-loop-btn {
		width: 100%;
	}
}

/* Quote form */
.mazzx-quote-form-wrapper {
	max-width: 920px;
	margin: 0 auto;
}

.mazzx-quote-product-card {
	display: grid;
	grid-template-columns: minmax(160px, 240px) 1fr;
	gap: 20px;
	padding: 20px;
	margin: 0 0 18px;
	border: 1px solid #e7ebe7;
	border-radius: 12px;
	background: #fff;
}

.mazzx-quote-product-image {
	width: 100%;
	height: auto;
	border-radius: 8px;
	object-fit: cover;
}

.mazzx-quote-product-content h3 {
	margin: 0 0 8px;
	font-size: 15px;
	color: #56705f;
	font-weight: 600;
}

.mazzx-quote-product-content h4 {
	margin: 0 0 8px;
	font-size: 22px;
	line-height: 1.25;
}

.mazzx-quote-product-price {
	margin-bottom: 8px;
	font-size: 18px;
	font-weight: 600;
}

.mazzx-quote-product-sku {
	font-size: 13px;
	color: #6d7a71;
	margin-bottom: 8px;
}

.mazzx-quote-product-desc p {
	margin: 0;
	color: #4b5c50;
	font-size: 14px;
}

.mazzx-quote-form {
	display: grid;
	gap: 16px;
}

.mazzx-quote-section {
	background: #fff;
	border: 1px solid #e7ebe7;
	border-radius: 12px;
	padding: 16px;
}

.mazzx-quote-section h4 {
	margin: 0 0 12px;
	font-size: 16px;
	font-weight: 600;
}

.mazzx-quote-form p {
	margin: 0 0 12px;
}

.mazzx-quote-form label {
	display: inline-block;
	font-weight: 600;
	margin-bottom: 5px;
}

.mazzx-quote-form input[type='text'],
.mazzx-quote-form input[type='email'],
.mazzx-quote-form select,
.mazzx-quote-form textarea {
	width: 100%;
	max-width: 100%;
	padding: 10px 12px;
	border: 1px solid #d8dfd8;
	border-radius: 8px;
	background: #fff;
	box-sizing: border-box;
}

.mazzx-quote-form small {
	display: block;
	margin-top: 5px;
	color: #6d7a71;
	font-size: 12px;
}

.mazzx-quote-form button[type='submit'] {
	min-width: 220px;
	border-radius: 999px;
	padding: 11px 22px;
}

@media (max-width: 768px) {
	.mazzx-quote-product-card {
		grid-template-columns: 1fr;
	}

	.mazzx-quote-form button[type='submit'] {
		width: 100%;
	}
}
