/**
 * Shared form-in-popup shell (CF7 and similar). Used by book-a-session, contact-us, and future popups.
 * CF7 layout rules are scoped under .ph-form-popup-modal__cf7
 */

body.ph-form-popup-modal-open {
	overflow: hidden;
}

.ph-form-popup-modal[hidden],
.ph-form-popup-modal--closed {
	display: none !important;
}

.ph-form-popup-modal {
	position: fixed;
	inset: 0;
	z-index: 100002;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
	box-sizing: border-box;
}

.ph-form-popup-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(51, 51, 51, 0.45);
	backdrop-filter: blur(4px);
}

.ph-form-popup-modal__panel {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 560px;
	max-height: 80vh;
	background: var(--ph-white);
	border-radius: 24px;
	box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
	overflow: auto;
	padding: 28px 24px 24px;
	box-sizing: border-box;
}

.ph-form-popup-modal__close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 2;
	width: 40px;
	height: 40px;
	border: 1px solid var(--ph-black);
	border-radius: 50%;
	background: var(--ph-white);
	color: var(--ph-gray-dark);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--ph-shadow-sm);
	transition: color var(--ph-transition), background var(--ph-transition);
}

.ph-form-popup-modal__close:hover {
	color: var(--ph-black);
	background: var(--ph-gray-bg);
}

.ph-form-popup-modal__close:focus-visible {
	outline: 2px solid var(--ph-green);
	outline-offset: 2px;
}

.ph-form-popup-modal__title {
	margin: 0 40px 16px 0;
	font-size: 1.35rem;
	font-weight: 700;
	color: var(--ph-black);
	line-height: 1.25;
}

.ph-form-popup-modal__subtitle {
	margin: -8px 0 16px;
	font-size: 0.9375rem;
	line-height: 1.5;
	color: var(--ph-gray-dark, #4b5563);
}

.ph-cf7-popup-success .ph-form-popup-modal__title {
	display: none;
}

.ph-cf7-popup-success .ph-form-popup-modal__subtitle {
	display: none;
}

.ph-cf7-popup-success .ph-form-popup-modal__meta {
	display: none !important;
}

/* Optional block above the form (e.g. selected Painhunter on book-a-session). CF7 painhunter-context may stay in DOM for mail. */
.ph-form-popup-modal__meta {
	margin: 0 0 20px;
}

.ph-form-popup-modal__meta[hidden] {
	display: none !important;
}

.ph-form-popup-modal__meta-eyebrow {
	margin: 0 0 8px;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ph-gray-dark, #4b5563);
}

.ph-form-popup-modal__meta-card {
	padding: 14px 16px;
	border-radius: 14px;
	background: linear-gradient(135deg, rgba(70, 159, 16, 0.08) 0%, rgba(70, 159, 16, 0.02) 100%);
	border: 1px solid rgba(70, 159, 16, 0.22);
	box-sizing: border-box;
}

.ph-form-popup-modal__meta-name {
	margin: 0;
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.35;
	color: var(--ph-black);
}

.ph-form-popup-modal__meta-row {
	margin: 10px 0 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 10px;
	font-size: 0.8125rem;
	line-height: 1.4;
	color: var(--ph-gray-dark, #4b5563);
}

.ph-form-popup-modal__meta-id-label {
	font-weight: 600;
	color: var(--ph-black);
}

.ph-form-popup-modal__meta-id {
	display: inline-flex;
	align-items: center;
	padding: 2px 10px;
	border-radius: 999px;
	background: var(--ph-white);
	border: 1px solid rgba(70, 159, 16, 0.35);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--ph-green, #469f10);
	letter-spacing: 0.02em;
}

.ph-cf7-popup-success .ph-form-popup-modal__cf7 .wpcf7-response-output {
	margin-top: 0;
	text-align: center;
	padding: 20px 16px;
}

/* ---- CF7 output lives inside this wrapper ---- */

.ph-form-popup-modal__cf7 {
	margin-top: 4px;
}

.ph-form-popup-modal__cf7 .wpcf7-form {
	display: flex;
	flex-direction: column;
	gap: 20px;
	margin: 0;
}

.ph-form-popup-modal__cf7 .wpcf7-form > .ph-cf7-form-fields {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.ph-form-popup-modal__cf7 label br {
	display: none;
}

.ph-form-popup-modal__cf7 .wpcf7-form > p,
.ph-form-popup-modal__cf7 .wpcf7-form > .ph-cf7-form-fields > p {
	margin: 0;
}

.ph-form-popup-modal__cf7 .wpcf7-form-control-wrap {
	display: block;
	width: 100%;
	margin-top: 5px;
}

.ph-form-popup-modal__cf7 .wpcf7-form-control-wrap:has(.ph-country-phone-field) {
	margin-top: 0;
}

.ph-form-popup-modal__cf7 label:has(.ph-country-phone-field) br,
.ph-form-popup-modal__cf7 label:has(.ph-country-phone-field) ~ br {
	display: none;
}

/* CF7 autop empty <p> / <p><br></p> — each gets flex gap: 20px if left in DOM. */
.ph-form-popup-modal__cf7 .wpcf7-form > p:empty,
.ph-form-popup-modal__cf7 .ph-cf7-form-fields > p:empty,
.ph-form-popup-modal__cf7 .ph-cf7-form-fields > p:has(> br:only-child),
.ph-form-popup-modal__cf7 .ph-cf7-form-fields > p:not(:has(label,input,textarea,select,button,.wpcf7-form-control-wrap,.ph-country-phone-field)) {
	display: none !important;
	margin: 0 !important;
	padding: 0 !important;
	height: 0 !important;
	min-height: 0 !important;
	overflow: hidden !important;
	border: 0 !important;
}

.ph-form-popup-modal__cf7 label {
	display: block;
	margin-bottom: 0;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ph-black);
}

/* painhunter-context: keep value for CF7 / email; hide from sighted users (summary in __meta). */
.ph-form-popup-modal__cf7 label:has(input[name='painhunter-context']),
.ph-form-popup-modal__cf7 label:has(textarea[name='painhunter-context']),
.ph-form-popup-modal__cf7 p:has(input[name='painhunter-context']),
.ph-form-popup-modal__cf7 p:has(textarea[name='painhunter-context']) {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip-path: inset(50%) !important;
	border: 0 !important;
	white-space: nowrap !important;
}

.ph-form-popup-modal__cf7 .ph-country-phone-field .ph-login-modal__label {
	display: none !important;
}

.ph-form-popup-modal__cf7 .wpcf7-text,
.ph-form-popup-modal__cf7 .wpcf7-email,
.ph-form-popup-modal__cf7 .wpcf7-textarea,
.ph-form-popup-modal__cf7 input[type='text'],
.ph-form-popup-modal__cf7 input[type='email'],
.ph-form-popup-modal__cf7 textarea {
	width: 100%;
	box-sizing: border-box;
	border-radius: 12px;
	border: 1px solid var(--ph-gray-border, #e5e7eb);
	padding: 10px 14px;
	font-size: 0.9375rem;
	color: var(--ph-black);
	background: var(--ph-white);
	line-height: 1.45;
	transition: border-color var(--ph-transition), box-shadow var(--ph-transition);
}

.ph-form-popup-modal__cf7 .wpcf7-text::placeholder,
.ph-form-popup-modal__cf7 .wpcf7-email::placeholder,
.ph-form-popup-modal__cf7 .wpcf7-textarea::placeholder {
	color: var(--ph-gray-mid);
	opacity: 1;
}

.ph-form-popup-modal__cf7 .wpcf7-text:focus,
.ph-form-popup-modal__cf7 .wpcf7-email:focus,
.ph-form-popup-modal__cf7 .wpcf7-textarea:focus,
.ph-form-popup-modal__cf7 input:focus,
.ph-form-popup-modal__cf7 textarea:focus {
	outline: none;
	border-color: var(--ph-green);
	box-shadow: 0 0 0 3px rgba(70, 159, 16, 0.12);
}

.ph-form-popup-modal__cf7 .wpcf7-textarea {
	min-height: 120px;
	resize: vertical;
}

.ph-form-popup-modal__cf7 .wpcf7-submit,
.ph-form-popup-modal__cf7 input[type='submit'] {
	width: 100%;
	margin-top: 4px;
	padding: 14px 22px;
	border: none;
	border-radius: 9999px;
	background: var(--ph-green);
	color: var(--ph-white);
	font-size: 1rem;
	font-weight: 800;
	cursor: pointer;
	transition: background var(--ph-transition);
	line-height: 1.25;
}

.ph-form-popup-modal__cf7 .wpcf7-submit:hover,
.ph-form-popup-modal__cf7 input[type='submit']:hover {
	background: var(--ph-green-dark, #3f920f);
}

.ph-form-popup-modal__cf7 .wpcf7-not-valid-tip {
	font-size: var(--ph-text-xs, 0.8125rem);
	margin-top: 6px;
	color: #b91c1c;
}

.ph-form-popup-modal__cf7 .wpcf7-response-output {
	display: block;
	margin: 12px 0 0;
	padding: 12px 14px;
	border-radius: 12px;
	clear: both;
	font-size: var(--ph-text-sm, 0.9375rem);
	line-height: 1.45;
}

.ph-form-popup-modal__cf7 .wpcf7-response-output[hidden] {
	display: none;
}

.ph-form-popup-modal__cf7 .wpcf7-mail-sent-ok {
	border: 1px solid rgba(34, 197, 94, 0.35);
	background: rgba(34, 197, 94, 0.08);
	color: var(--ph-black);
}

.ph-form-popup-modal__cf7 .wpcf7-validation-errors {
	border: 1px solid rgba(220, 38, 38, 0.35);
	background: rgba(220, 38, 38, 0.06);
}
