/* ==========================================================================
   PWD WooCommerce Product Enquiry — Frontend Styles
   Version: 1.2.0

   COLOUR STRATEGY (mirrors PWD Custom WCFM Registration):
   This means:
     Inherit mode: PHP outputs nothing, theme colours cascade naturally.
     Custom mode: PHP outputs scoped !important rules, overrides the vars.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Enquiry Button
   -------------------------------------------------------------------------- */
/* Higher specificity than .woocommerce button or .button — needed because
   our button sits inside WooCommerce template wrappers and theme rules would
   otherwise override the var() colour declarations. */
html body .pwd-enquiry-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 24px;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.22s ease, color 0.22s ease, border-color 0.22s ease, transform 0.15s ease, box-shadow 0.22s ease;
	white-space: nowrap;
	position: relative;
	overflow: hidden;
	margin-top: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	border: 1px solid transparent;
	font-family: inherit;
	letter-spacing: 0.01em;
}

html body .pwd-enquiry-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
	text-decoration: none;
}

html body .pwd-enquiry-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

html body .pwd-enquiry-btn:focus-visible {
	outline-offset: 3px;
}

html body .pwd-enquiry-btn.pwd-enquiry-btn--full,
html body .pwd-enquiry-btn--full {
	display: flex !important;
	width: 100% !important;
	max-width: 100% !important;
	justify-content: center !important;
	box-sizing: border-box !important;
}
.pwd-enquiry-btn__icon { flex-shrink: 0; pointer-events: none; }
.pwd-enquiry-btn__label { pointer-events: none; }

.pwd-enquiry-btn--archive {
	width: 100%;
	justify-content: center;
	font-size: 13px;
	padding: 9px 16px;
	margin-top: 6px;
}

.pwd-enquiry-btn--icon-only {
	width: 38px; height: 38px;
	padding: 0;
	border-radius: 50%;
	justify-content: center;
	margin-top: 6px;
}

.pwd-enquiry-btn--icon-only .pwd-enquiry-btn__label { display: none; }

/* --------------------------------------------------------------------------
   Overlay
   -------------------------------------------------------------------------- */
.pwd-enquiry-overlay {
	position: fixed;
	inset: 0;
	z-index: 999990;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
}

.pwd-enquiry-overlay.is-open,
.pwd-enquiry-overlay[aria-hidden="false"] {
	opacity: 1;
	pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
html body .pwd-enquiry-modal {
	background: #ffffff;
	border-radius: 12px;
	width: 100%;
	max-width: 540px;
	max-height: 92vh;
	overflow-y: auto;
	overflow-x: hidden;
	position: relative;
	box-shadow: 0 20px 60px rgba(0,0,0,0.2), 0 6px 20px rgba(0,0,0,0.1);
	transform: scale(0.92) translateY(16px);
	transition: transform 0.28s cubic-bezier(0.34, 1.3, 0.64, 1), opacity 0.25s ease;
	opacity: 0;
	scroll-behavior: smooth;
}

.pwd-enquiry-overlay.is-open .pwd-enquiry-modal {
	transform: scale(1) translateY(0);
	opacity: 1;
}

.pwd-enquiry-modal::-webkit-scrollbar { width: 4px; }
.pwd-enquiry-modal::-webkit-scrollbar-track { background: transparent; }
.pwd-enquiry-modal::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }

/* --------------------------------------------------------------------------
   Close button — neutral chrome
   -------------------------------------------------------------------------- */
.pwd-enquiry-modal__close {
	position: absolute;
	top: 14px; right: 14px;
	z-index: 2;
	width: 32px; height: 32px;
	border-radius: 50%;
	border: none;
	background: rgba(0, 0, 0, 0.06);
	color: #555;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.18s ease, color 0.18s ease;
	padding: 0;
	flex-shrink: 0;
}

.pwd-enquiry-modal__close:hover { background: rgba(0,0,0,0.12); color: #111; }

.pwd-enquiry-modal__close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Modal header / product info
   -------------------------------------------------------------------------- */
.pwd-enquiry-modal__header { padding: 28px 28px 0; }

.pwd-enquiry-modal__product-info {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 16px;
	background: rgba(0, 0, 0, 0.03);
	border-radius: 8px;
	margin-bottom: 4px;
}

.pwd-enquiry-modal__product-img {
	width: 56px; height: 56px;
	object-fit: cover;
	border-radius: 6px;
	flex-shrink: 0;
	border: 1px solid rgba(0,0,0,0.08);
}

.pwd-enquiry-modal__label {
	display: block;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #999;
	margin-bottom: 3px;
}

.pwd-enquiry-modal .pwd-enquiry-modal__product-name {
	font-size: 15px;
	font-weight: 700;
	color: #1a1a2e;
	margin: 0;
	line-height: 1.3;
}

.pwd-enquiry-modal__title-fallback .pwd-enquiry-modal__product-name {
	font-size: 20px;
	margin: 0 0 4px;
}

/* --------------------------------------------------------------------------
   Modal body / form
   -------------------------------------------------------------------------- */
.pwd-enquiry-modal__body { padding: 20px 28px 28px; }

.pwd-enquiry-form { display: flex; flex-direction: column; gap: 0; }
.pwd-enquiry-form__row { margin-bottom: 16px; }
.pwd-enquiry-form__row--2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pwd-enquiry-form__field { display: flex; flex-direction: column; }

.pwd-enquiry-modal .pwd-enquiry-form__label {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	font-weight: 600;
	color: #333333;
	margin-bottom: 6px;
	line-height: 1.4;
}

/* Required star — chrome */
.pwd-enquiry-form__required { color: #e53e3e; font-size: 12px; line-height: 1; }
.pwd-enquiry-form__optional { font-size: 11px; font-weight: 400; color: #aaa; margin-left: 2px; }

.pwd-enquiry-modal .pwd-enquiry-form__input {
	width: 100%;
	padding: 10px 14px;
	border: 1.5px solid #e0e0e0;
	border-radius: 6px;
	color: #333333;
	background: #ffffff;
	font-size: 14px;
	transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
	outline: none;
	line-height: 1.5;
	font-family: inherit;
	appearance: none;
	-webkit-appearance: none;
	box-sizing: border-box;
}

.pwd-enquiry-modal .pwd-enquiry-form__input::placeholder { color: #bbb; }

.pwd-enquiry-modal .pwd-enquiry-form__input:focus {
	border-color: #1a1a2e;
	background: #ffffff;
	box-shadow: 0 0 0 3px rgba(26,26,46,0.08);
}

/* Error — chrome */
.pwd-enquiry-modal .pwd-enquiry-form__input.has-error {
	border-color: #e53e3e !important;
	box-shadow: 0 0 0 3px rgba(229,62,62,0.1) !important;
}

.pwd-enquiry-modal .pwd-enquiry-form__textarea { resize: vertical; min-height: 110px; }

/* --------------------------------------------------------------------------
   Submit button
   -------------------------------------------------------------------------- */
.pwd-enquiry-form__row--submit { margin-bottom: 0; margin-top: 6px; }

html body .pwd-enquiry-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 13px 24px;
	border: none;
	border-radius: 6px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
	letter-spacing: 0.02em;
	font-family: inherit;
	position: relative;
	overflow: hidden;
}

html body .pwd-enquiry-submit:hover:not(:disabled) {
	transform: translateY(-1px);
	box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.pwd-enquiry-submit:active:not(:disabled) { transform: translateY(0); box-shadow: none; }

.pwd-enquiry-submit:disabled,
.pwd-enquiry-submit.is-loading { opacity: 0.7; cursor: not-allowed; transform: none; }

.pwd-enquiry-submit:focus-visible {
	outline-offset: 3px;
}

.pwd-enquiry-submit__spinner { display: none; animation: pwd-spin 0.75s linear infinite; }
.pwd-enquiry-submit.is-loading .pwd-enquiry-submit__label { display: none; }
.pwd-enquiry-submit.is-loading .pwd-enquiry-submit__spinner { display: inline-flex; }

@keyframes pwd-spin {
	from { transform: rotate(0deg); }
	to   { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Success — chrome
   -------------------------------------------------------------------------- */
.pwd-enquiry-success {
	display: flex; flex-direction: column; align-items: center; text-align: center; padding: 20px 0 10px;
}
.pwd-enquiry-success__icon {
	width: 72px; height: 72px; border-radius: 50%;
	background: #f0fdf4; display: flex; align-items: center; justify-content: center;
	margin-bottom: 16px; color: #22c55e;
	animation: pwd-success-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes pwd-success-pop {
	from { transform: scale(0.5); opacity: 0; }
	to   { transform: scale(1); opacity: 1; }
}
.pwd-enquiry-success__message { font-size: 15px; color: #444; line-height: 1.6; margin: 0; max-width: 340px; }

/* --------------------------------------------------------------------------
   Error notice — chrome
   -------------------------------------------------------------------------- */
.pwd-enquiry-error {
	display: flex; align-items: flex-start; gap: 10px;
	padding: 12px 14px; background: #fff5f5; border: 1px solid #fed7d7;
	border-radius: 6px; color: #c53030; font-size: 13px; line-height: 1.5; margin-bottom: 16px;
}
.pwd-enquiry-error svg { flex-shrink: 0; margin-top: 1px; }

/* --------------------------------------------------------------------------
   Privacy
   -------------------------------------------------------------------------- */
.pwd-enquiry-privacy { font-size: 12px; color: #999; margin: 0; line-height: 1.5; }
.pwd-enquiry-modal .pwd-enquiry-privacy a {
	text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Honeypot
   -------------------------------------------------------------------------- */
.pwd-enquiry-hp {
	position: absolute !important; left: -9999px !important;
	opacity: 0 !important; height: 0 !important;
	overflow: hidden !important; pointer-events: none !important;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
	.pwd-enquiry-modal { max-height: 96vh; border-radius: 12px 12px 0 0; }
	.pwd-enquiry-overlay { align-items: flex-end; padding: 0; }
	.pwd-enquiry-overlay.is-open .pwd-enquiry-modal { transform: translateY(0); }
	.pwd-enquiry-overlay .pwd-enquiry-modal { transform: translateY(100%); max-width: 100%; }
	.pwd-enquiry-modal__header, .pwd-enquiry-modal__body { padding-left: 20px; padding-right: 20px; }
	.pwd-enquiry-form__row--2col { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
	.pwd-enquiry-overlay, .pwd-enquiry-modal, .pwd-enquiry-btn, .pwd-enquiry-submit {
		transition: none !important; animation: none !important;
	}
}

/* --------------------------------------------------------------------------
   Request Quotation Button — v1.3.0
   The quotation button reuses all .pwd-enquiry-btn base styles but gets a
   distinct visual treatment so users can tell the two buttons apart.
   When btn_mode is 'custom' the admin colour settings override these defaults
   for the enquiry button; the quote button inherits the same base but shows
   a secondary/outline treatment unless the admin overrides it too.
   -------------------------------------------------------------------------- */
.pwd-enquiry-btn--quote {
	background: transparent;
	color: currentColor;
	border: 2px solid currentColor;
	opacity: .85;
}

.pwd-enquiry-btn--quote:hover,
.pwd-enquiry-btn--quote:focus {
	opacity: 1;
	background: rgba(0,0,0,.06);
}

/* When the modal is opened by a quotation button, tint the modal label */
.pwd-enquiry-overlay--quotation .pwd-enquiry-modal__label {
	color: #854d0e;
}

/* --------------------------------------------------------------------------
   Elementor fallback containers — v1.5.0
   Wraps buttons rendered by Layer 2 (woocommerce_after_single_product) or
   Layer 3 (JavaScript DOM injection) when Elementor replaces the standard
   WooCommerce single product template and bypasses the normal summary hooks.
   -------------------------------------------------------------------------- */
.pwd-enquiry-elementor-fallback,
.pwd-enquiry-js-injected {
	display: block;
	margin-top: 16px;
	clear: both;
}

.pwd-enquiry-elementor-fallback .pwd-enquiry-btn,
.pwd-enquiry-js-injected .pwd-enquiry-btn {
	margin-top: 0;
}
