/* Woo Product Enquiry — Frontend Styles */

.ccpe-enquiry-wrap {
	margin-top: 1.5em;
	clear: both;
}

.ccpe-toggle-btn {
	width: 100%;
	text-align: center;
}

/* ── Modal ── */
dialog.ccpe-modal {
	border: none;
	border-radius: 6px;
	background: #fff;
	color: #1f1f1f;
	padding: 0;
	width: min(520px, 90vw);
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
}

dialog.ccpe-modal,
dialog.ccpe-modal * {
	box-sizing: border-box;
}

dialog.ccpe-modal::backdrop {
	background: rgba(0, 0, 0, 0.55);
}

dialog.ccpe-modal[open] {
	animation: ccpe-modal-in 0.2s ease-out;
}

@keyframes ccpe-modal-in {
	from {
		opacity: 0;
		transform: translateY(-16px) scale(0.97);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.ccpe-modal-inner {
	padding: 1.5em 2em 2em;
	background: #fff;
	color: #1f1f1f;
	text-align: left;
}

.ccpe-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75em;
	margin-bottom: 1.2em;
	padding-bottom: 0.8em;
	border-bottom: 1px solid #e0e0e0;
}

.ccpe-modal-title {
	display: block;
	flex: 1 1 auto;
	margin: 0;
	font-size: 1.2em;
	font-weight: 700;
	line-height: 1.25;
	color: #1f1f1f;
	text-align: left;
	text-transform: none;
	letter-spacing: normal;
	visibility: visible;
	opacity: 1;
}

.ccpe-modal-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	min-width: 28px;
	min-height: 28px;
	margin: 0;
	background: none;
	border: none;
	font-size: 1.5em;
	line-height: 1;
	cursor: pointer;
	padding: 0.2em 0.4em;
	color: #777;
	transition: color 0.15s;
	text-transform: none;
	visibility: visible;
	opacity: 1;
}

.ccpe-modal-close:hover {
	color: #333;
}

body.ccpe-modal-open {
	overflow: hidden;
}

/* Fallback for environments where native dialog modal behavior is unavailable. */
dialog.ccpe-modal.ccpe-modal--fallback-open {
	position: fixed;
	inset: 0;
	width: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	background: rgba(0, 0, 0, 0.55);
	box-shadow: none;
	z-index: 999999;
	overflow: auto;
}

dialog.ccpe-modal.ccpe-modal--fallback-open .ccpe-modal-inner {
	width: min(520px, 90vw);
	max-height: 90vh;
	overflow-y: auto;
	background: #fff;
	border-radius: 6px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
	margin: 5vh auto;
}

.ccpe-intro {
	margin-bottom: 1em;
	color: #555;
	text-align: left;
}

/* Form rows — mirrors WooCommerce's woocommerce-form-row patterns */
.ccpe-form-row {
	margin-bottom: 1em;
}

.ccpe-form-row label {
	display: block;
	margin-bottom: .3em;
	font-weight: 600;
	font-size: .9em;
	color: #1f1f1f;
	text-align: left;
	text-transform: none;
	letter-spacing: normal;
}

.ccpe-form-row .required {
	color: #e2401c;
}

.ccpe-form-row .input-text,
.ccpe-form-row select,
.ccpe-form-row textarea {
	width: 100%;
	box-sizing: border-box;
	max-width: 100%;
}

.ccpe-modal .ccpe-enquiry-form {
	margin: 0;
}

/* Protect modal internals from aggressive builder text alignment/typography inheritance. */
.ccpe-modal-inner,
.ccpe-modal-inner * {
	text-align: left;
}

/* Two-column rows */
@media (min-width: 768px) {
	.ccpe-enquiry-form {
		display: grid;
		grid-template-columns: 1fr 1fr;
		column-gap: 1.5em;
	}

	.ccpe-row--wide,
	.ccpe-row--actions {
		grid-column: 1 / -1;
	}

	.ccpe-row--first {
		grid-column: 1;
	}

	.ccpe-row--last {
		grid-column: 2;
	}
}

/* Submit row */
.ccpe-row--actions {
	display: flex;
	align-items: center;
	gap: 1em;
	margin-top: .5em;
}

/* Loading spinner */
.ccpe-spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2px solid rgba(0,0,0,0.15);
	border-top-color: #555;
	border-radius: 50%;
	animation: ccpe-spin .7s linear infinite;
}

.ccpe-is-loading .ccpe-spinner {
	display: inline-block;
}

.ccpe-is-loading .ccpe-submit-btn {
	opacity: .6;
	pointer-events: none;
}

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

/* Response message */
.ccpe-form-response {
	margin-top: .8em;
	padding: .75em 1em;
	border-radius: 3px;
	display: none;
}

.ccpe-form-response.ccpe-response--success {
	display: block;
	background: #d4edda;
	color: #155724;
	border: 1px solid #c3e6cb;
}

.ccpe-form-response.ccpe-response--error {
	display: block;
	background: #f8d7da;
	color: #721c24;
	border: 1px solid #f5c6cb;
}
