/* ============================================================
   CampusSphere Demo Form Block
   ============================================================ */

/* ---------- Wrap / layout variants ---------- */
.campussphere-demo-form-wrap {
	width: 100%;
}

/* Card: elevated white box */
.campussphere-demo-form-wrap--card {
	background: #ffffff;
	border-radius: 16px;
	padding: 40px;
	box-shadow:
		0 4px 6px -1px rgba( 0, 0, 0, 0.07 ),
		0 10px 30px -5px rgba( 0, 0, 0, 0.1 );
	max-width: 720px;
	margin-inline: auto;
}

/* Inline: no card chrome, full-width */
.campussphere-demo-form-wrap--inline {
	padding: 0;
	max-width: none;
}

/* Minimal: just a little breathing room */
.campussphere-demo-form-wrap--minimal {
	padding: 24px 0;
	max-width: 600px;
	margin-inline: auto;
}

/* ---------- Header ---------- */
.campussphere-demo-form__header {
	margin-bottom: 28px;
}

.campussphere-demo-form__title {
	font-size: clamp( 1.375rem, 2.5vw, 1.75rem );
	font-weight: 800;
	color: #0f1c3f;
	margin: 0 0 8px;
	line-height: 1.25;
}

.campussphere-demo-form__subtitle {
	font-size: 0.9375rem;
	color: #64748b;
	line-height: 1.6;
	margin: 0;
}

/* ---------- Field layout ---------- */
.campussphere-demo-form__fields {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.campussphere-demo-form__row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

/* ---------- Individual field ---------- */
.campussphere-demo-form__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.campussphere-demo-form__field label {
	font-size: 0.8125rem;
	font-weight: 600;
	color: #374151;
	letter-spacing: 0.01em;
}

/* Required asterisk */
.campussphere-demo-form__field--required label::after {
	content: " *";
	color: #ef4444;
}

/* Inputs, selects & textareas */
.campussphere-demo-form__field input,
.campussphere-demo-form__field select,
.campussphere-demo-form__field textarea,
.campussphere-demo-form .campussphere-demo-form__field input,
.campussphere-demo-form .campussphere-demo-form__field select,
.campussphere-demo-form .campussphere-demo-form__field textarea {
	height: 48px;
	padding: 0 14px;
	border: 1.5px solid #e2e8f0;
	border-radius: 8px;
	font-size: 0.9375rem;
	color: #0f1c3f;
	background: #ffffff;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	appearance: none;
	-webkit-appearance: none;
	width: 100%;
	box-sizing: border-box;
	font-family: inherit;
}

.campussphere-demo-form__field textarea {
	height: auto;
	min-height: 110px;
	padding: 12px 14px;
	resize: vertical;
	line-height: 1.5;
}

.campussphere-demo-form__field select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 36px;
	cursor: pointer;
}

.campussphere-demo-form__field input:focus,
.campussphere-demo-form__field select:focus,
.campussphere-demo-form__field textarea:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba( 37, 99, 235, 0.14 );
}

.campussphere-demo-form__field input::placeholder {
	color: #94a3b8;
}

/* Invalid state */
.campussphere-demo-form__field input:invalid:not( :placeholder-shown ),
.campussphere-demo-form__field.has-error input,
.campussphere-demo-form__field.has-error select {
	border-color: #ef4444;
}

/* Field error message */
.campussphere-demo-form__error {
	font-size: 0.75rem;
	color: #ef4444;
	min-height: 1em;
	line-height: 1.4;
}

/* ---------- Submit button ---------- */
.campussphere-demo-form__submit {
	width: 100%;
	height: 52px;
	margin-top: 24px;
	font-size: 1rem;
	font-weight: 700;
	border: none;
	border-radius: 10px;
	cursor: pointer;
	background: #2563eb;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
	box-shadow: 0 4px 14px rgba( 37, 99, 235, 0.28 );
	position: relative;
	overflow: hidden;
}

.campussphere-demo-form__submit:hover:not( :disabled ) {
	background: #1d4ed8;
	transform: translateY( -1px );
	box-shadow: 0 6px 20px rgba( 37, 99, 235, 0.36 );
}

.campussphere-demo-form__submit:active:not( :disabled ) {
	transform: translateY( 0 );
}

.campussphere-demo-form__privacy {
	margin: 12px 0 0;
	font-size: 0.8125rem;
	color: #94a3b8;
	text-align: center;
	line-height: 1.5;
}

/* Normal state: show label, hide loading */
.campussphere-demo-form__submit-label {
	display: inline;
}

.campussphere-demo-form__submit-loading {
	display: none;
}

/* Loading state */
.campussphere-demo-form--loading .campussphere-demo-form__submit {
	opacity: 0.75;
	cursor: not-allowed;
	pointer-events: none;
}

.campussphere-demo-form--loading .campussphere-demo-form__submit-label {
	display: none;
}

.campussphere-demo-form--loading .campussphere-demo-form__submit-loading {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.campussphere-demo-form--loading .campussphere-demo-form__submit-loading::before {
	content: "";
	width: 18px;
	height: 18px;
	border: 2px solid rgba( 255, 255, 255, 0.4 );
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: campussphere-spin 0.7s linear infinite;
	flex-shrink: 0;
}

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

/* ---------- Success state ---------- */
.campussphere-demo-form__success {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin-top: 24px;
	padding: 20px 24px;
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-radius: 10px;
	font-size: 0.9375rem;
	color: #166534;
	line-height: 1.6;
}

.campussphere-demo-form__success[hidden] {
	display: none;
}

.campussphere-demo-form__success-icon {
	width: 24px;
	height: 24px;
	background: #22c55e;
	color: #ffffff;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.875rem;
	font-weight: 700;
	flex-shrink: 0;
	margin-top: 1px;
}

/* Hide form fields on success */
.campussphere-demo-form--success .campussphere-demo-form__fields,
.campussphere-demo-form--success .campussphere-demo-form__submit,
.campussphere-demo-form--success .campussphere-demo-form__privacy {
	display: none;
}

/* ---------- General error ---------- */
.campussphere-demo-form__error-general {
	margin-top: 16px;
	padding: 14px 18px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
	font-size: 0.875rem;
	color: #991b1b;
	line-height: 1.5;
}

.campussphere-demo-form__error-general[hidden] {
	display: none;
}

/* ---------- Responsive ---------- */
@media ( max-width: 639px ) {
	.campussphere-demo-form-wrap--card {
		padding: 28px 20px;
		border-radius: 12px;
	}

	.campussphere-demo-form__row {
		grid-template-columns: 1fr;
	}
}

/* ---------- Editor overrides ---------- */
.wp-block-campussphere-demo-form .campussphere-demo-form__field input,
.wp-block-campussphere-demo-form .campussphere-demo-form__field select {
	pointer-events: none;
}

/* ============================================================
   Demo booking modal
   ============================================================ */

.campussphere-demo-modal {
	position: fixed;
	inset: 0;
	z-index: 10050;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
}

.campussphere-demo-modal[hidden] {
	display: none !important;
}

.campussphere-demo-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 15, 23, 42, 0.62 );
	backdrop-filter: blur( 6px );
}

.campussphere-demo-modal__dialog {
	position: relative;
	z-index: 1;
	width: min( 100%, 640px );
	max-height: min( 92dvh, 860px );
	overflow: auto;
	padding: clamp( 1.5rem, 4vw, 2.25rem );
	border: 1px solid rgba( 226, 232, 240, 0.9 );
	border-radius: 1.25rem;
	background:
		radial-gradient( circle at 100% 0%, rgba( 219, 234, 254, 0.55 ), transparent 42% ),
		#fff;
	box-shadow:
		0 2rem 4rem rgba( 15, 23, 42, 0.28 ),
		inset 0 1px 0 rgba( 255, 255, 255, 0.9 );
	animation: campussphereDemoModalIn 0.28s cubic-bezier( 0.22, 1, 0.36, 1 ) both;
}

@keyframes campussphereDemoModalIn {
	from {
		opacity: 0;
		transform: translateY( 0.75rem ) scale( 0.98 );
	}
	to {
		opacity: 1;
		transform: translateY( 0 ) scale( 1 );
	}
}

.campussphere-demo-modal__close {
	position: absolute;
	top: 0.85rem;
	right: 0.85rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	border: 1px solid #e2e8f0;
	border-radius: 999px;
	background: #fff;
	color: #475569;
	font-size: 1.35rem;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.campussphere-demo-modal__close:hover {
	border-color: #cbd5e1;
	background: #f8fafc;
	color: #0f172a;
}

.campussphere-demo-modal__close:focus-visible {
	outline: 3px solid rgba( 37, 99, 235, 0.35 );
	outline-offset: 2px;
}

.campussphere-demo-modal__overline {
	margin: 0 0 0.5rem;
	color: #2563eb;
	font-size: 0.6875rem;
	font-weight: 800;
	letter-spacing: 0.12em;
	line-height: 1.4;
	text-transform: uppercase;
}

.campussphere-demo-form--modal .campussphere-demo-form__header {
	padding-right: 2rem;
	margin-bottom: 1.5rem;
}

.campussphere-demo-form--modal .campussphere-demo-form__title {
	font-size: clamp( 1.5rem, 3vw, 1.875rem );
}

.campussphere-demo-form--modal .campussphere-demo-form__submit {
	width: 100%;
	margin-top: 0.25rem;
}

html.campussphere-demo-modal-open,
html.campussphere-demo-modal-open body {
	overflow: hidden;
}

@media ( max-width: 639px ) {
	.campussphere-demo-modal {
		padding: 0.75rem;
		align-items: flex-end;
	}

	.campussphere-demo-modal__dialog {
		width: 100%;
		max-height: 92dvh;
		border-radius: 1.25rem 1.25rem 0.75rem 0.75rem;
		padding: 1.35rem 1.15rem 1.5rem;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.campussphere-demo-modal__dialog {
		animation: none;
	}
}
