.wa-lead-modal { position: fixed; inset: 0; z-index: 100000; font-family: var(--wa-font); }
.wa-lead-modal[hidden] { display: none; }

.wa-lead-modal__backdrop {
	position: absolute; inset: 0;
	background: rgba(15, 23, 42, 0.55);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity var(--wa-duration-base) var(--wa-ease);
}
.wa-lead-modal.is-open .wa-lead-modal__backdrop { opacity: 1; }

.wa-lead-modal__panel {
	position: relative;
	max-width: 420px;
	margin: 8vh auto 0;
	background: var(--wa-surface);
	color: var(--wa-ink);
	border-radius: var(--wa-radius-lg);
	padding: 28px;
	box-shadow: var(--wa-shadow-lg);
	max-height: 84vh;
	overflow-y: auto;
	opacity: 0;
	transform: translateY(16px) scale(0.98);
	transition: opacity var(--wa-duration-base) var(--wa-ease), transform var(--wa-duration-base) var(--wa-ease);
}
.wa-lead-modal.is-open .wa-lead-modal__panel { opacity: 1; transform: translateY(0) scale(1); }

.wa-lead-modal__close {
	position: absolute; top: 14px; right: 16px;
	width: 32px; height: 32px; border-radius: 50%;
	background: var(--wa-surface-alt); border: none; font-size: 20px; line-height: 1;
	cursor: pointer; color: var(--wa-ink-soft);
	transition: background var(--wa-duration-fast) var(--wa-ease), transform var(--wa-duration-fast) var(--wa-ease);
}
.wa-lead-modal__close:hover { background: var(--wa-border); transform: rotate(90deg); }

.wa-lead-modal__title { margin: 0 0 4px; font-size: 1.2em; font-weight: 700; letter-spacing: -0.01em; }
.wa-lead-modal__product {
	margin: 0 0 20px; color: var(--wa-ink-soft); font-size: 0.9em;
	padding: 10px 12px; background: var(--wa-surface-alt); border-radius: var(--wa-radius-md);
}

/* Floating-label inputs — the detail that separates "form" from "product" */
.wa-lead-form__field { position: relative; margin-bottom: 18px; }
.wa-lead-form__field label {
	position: absolute; left: 14px; top: 13px;
	font-size: 0.95em; color: var(--wa-ink-soft);
	pointer-events: none;
	transition: transform var(--wa-duration-fast) var(--wa-ease), font-size var(--wa-duration-fast) var(--wa-ease), color var(--wa-duration-fast) var(--wa-ease);
	background: var(--wa-surface);
	padding: 0 4px;
}
.wa-lead-form__field input,
.wa-lead-form__field textarea {
	width: 100%; box-sizing: border-box; padding: 13px 14px;
	border: 1.5px solid var(--wa-border); border-radius: var(--wa-radius-md);
	font-size: 1em; color: var(--wa-ink); background: var(--wa-surface);
	transition: border-color var(--wa-duration-fast) var(--wa-ease), box-shadow var(--wa-duration-fast) var(--wa-ease);
}
.wa-lead-form__field input:focus,
.wa-lead-form__field textarea:focus {
	outline: none; border-color: var(--wa-green);
	box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.14);
}
.wa-lead-form__field input:focus + label,
.wa-lead-form__field input:not(:placeholder-shown) + label,
.wa-lead-form__field textarea:focus + label,
.wa-lead-form__field textarea:not(:placeholder-shown) + label {
	transform: translateY(-22px) scale(0.82);
	color: var(--wa-green-dark);
}

.wa-lead-form__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Quantity stepper — premium pill treatment matching the button system */
.wa-lead-form__field--qty label { position: static; display: block; margin-bottom: 8px; font-size: 0.9em; font-weight: 600; background: none; padding: 0; }
.wa-qty-stepper {
	display: flex; align-items: stretch; max-width: 150px;
	border: 1.5px solid var(--wa-border); border-radius: var(--wa-radius-pill); overflow: hidden;
}
.wa-qty-stepper__btn {
	flex: 0 0 42px; border: none; background: var(--wa-surface-alt); font-size: 1.2em; cursor: pointer;
	min-height: 44px; color: var(--wa-ink); transition: background var(--wa-duration-fast) var(--wa-ease);
}
.wa-qty-stepper__btn:hover { background: var(--wa-border); }
.wa-qty-stepper__btn:active { transform: scale(0.92); }
.wa-qty-stepper input[type="number"] {
	flex: 1; text-align: center; border: none; font-weight: 700;
	-moz-appearance: textfield; background: var(--wa-surface); color: var(--wa-ink);
}
.wa-qty-stepper input[type="number"]::-webkit-outer-spin-button,
.wa-qty-stepper input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.wa-lead-form__error {
	color: var(--wa-danger); background: var(--wa-danger-bg); padding: 10px 12px;
	border-radius: var(--wa-radius-md); font-size: 0.9em; margin-bottom: 14px;
	animation: wa-shake 0.3s var(--wa-ease);
}
@keyframes wa-shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

.wa-lead-form__actions { display: flex; gap: 10px; margin-top: 4px; }
.wa-lead-form__submit {
	flex: 1; background: var(--wa-green); color: #fff; border: none; border-radius: var(--wa-radius-pill);
	padding: 13px; font-weight: 700; cursor: pointer; min-height: 46px;
	box-shadow: var(--wa-shadow-sm);
	transition: background var(--wa-duration-fast) var(--wa-ease), transform var(--wa-duration-fast) var(--wa-ease), box-shadow var(--wa-duration-fast) var(--wa-ease);
}
.wa-lead-form__submit:hover:not(:disabled) { background: var(--wa-green-dark); transform: translateY(-1px); box-shadow: var(--wa-shadow-md); }
.wa-lead-form__submit:disabled { opacity: 0.7; cursor: default; }
.wa-lead-form__cancel {
	background: transparent; border: 1.5px solid var(--wa-border); border-radius: var(--wa-radius-pill);
	padding: 13px 18px; cursor: pointer; min-height: 46px; color: var(--wa-ink-soft);
	transition: background var(--wa-duration-fast) var(--wa-ease);
}
.wa-lead-form__cancel:hover { background: var(--wa-surface-alt); }
.wa-lead-form__privacy { font-size: 0.75em; color: var(--wa-ink-soft); margin: 12px 0 0; text-align: center; }

body.wa-lead-modal-open { overflow: hidden; }

/* Success state — shown for ~700ms after a valid submit, before WhatsApp opens, so the
   action feels confirmed rather than the modal just vanishing abruptly. */
.wa-lead-modal__success {
	display: none; flex-direction: column; align-items: center; text-align: center; padding: 20px 0 8px;
}
.wa-lead-modal.is-success .wa-lead-modal__success { display: flex; }
.wa-lead-modal.is-success #wa-lead-form { display: none; }
.wa-lead-modal__success-icon {
	width: 56px; height: 56px; border-radius: 50%; background: var(--wa-green);
	display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
	animation: wa-pop var(--wa-duration-slow) var(--wa-ease);
}
.wa-lead-modal__success-icon svg { width: 28px; height: 28px; stroke: #fff; }
@keyframes wa-pop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.wa-lead-modal__success-text { font-weight: 600; color: var(--wa-ink); }

@media (max-width: 480px) {
	.wa-lead-modal__panel {
		margin: 0;
		max-width: 100%;
		height: 100vh;      /* Fallback for older browsers */
		height: 100dvh;     /* Modern standard */
		max-height: 100dvh;
		border-radius: 0;
		display: flex;
		flex-direction: column;
	}
	#wa-lead-form {
		display: flex;
		flex-direction: column;
		flex: 1;
	}
	.wa-lead-form__actions {
		margin-top: auto; /* Pushes buttons to the bottom of the screen */
		padding-bottom: 24px;
	}
}
