/* NIIB Admissions — form, popup, floating WhatsApp, mobile bar, consent banner.
   Colours inherit from the niib-lucknow theme variables when present. */
:root {
	--niib-primary: var(--c-burgundy, #471535);
	--niib-secondary: var(--c-wine, #651F48);
	--niib-gold: var(--c-gold, #C3A16C);
	--niib-ink: var(--c-ink, #29232A);
	--niib-ivory: var(--c-ivory, #FFF8F5);
	--niib-blush: var(--c-blush, #F3DEDF);
	--niib-error: #B3261E;
	--niib-success: #1F6B3A;
	--niib-radius: 10px;
	--niib-mbar-h: 64px;
}

/* ---------- Form ---------- */
.niib-form { display: grid; gap: 14px; font: inherit; color: var(--niib-ink); text-align: left; }
.niib-form__head { margin-bottom: 4px; }
.niib-form__title { font-family: var(--f-head, Georgia, serif); font-size: 1.5rem; line-height: 1.2; margin: 0 0 6px; color: var(--niib-primary); }
.niib-form__text { margin: 0; font-size: .92rem; color: #5d5560; }
.niib-field { display: grid; gap: 6px; }
.niib-field > label { font-size: .82rem; font-weight: 600; letter-spacing: .01em; }
.niib-req { color: var(--niib-secondary); }
.niib-opt { font-weight: 400; color: #7a7079; }
.niib-form input[type=text], .niib-form input[type=tel], .niib-form input[type=email], .niib-form select {
	width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid #d9cdd3; border-radius: 8px;
	background: #fff; color: var(--niib-ink); font: inherit; font-size: 16px; box-sizing: border-box;
	transition: border-color .2s, box-shadow .2s; -webkit-appearance: none; appearance: none;
}
.niib-form select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23651F48' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
.niib-form input:focus, .niib-form select:focus { outline: none; border-color: var(--niib-secondary); box-shadow: 0 0 0 3px rgba(101, 31, 72, .18); }
.niib-form [aria-invalid=true] { border-color: var(--niib-error) !important; }
.niib-phone { display: flex; align-items: stretch; }
.niib-phone__cc { display: flex; align-items: center; padding: 0 12px; border: 1px solid #d9cdd3; border-right: 0; border-radius: 8px 0 0 8px; background: var(--niib-ivory); font-weight: 600; font-size: .95rem; }
.niib-phone input { border-radius: 0 8px 8px 0 !important; }
.niib-field--check { grid-template-columns: 20px 1fr; align-items: start; column-gap: 10px; }
.niib-field--check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--niib-secondary); }
.niib-field--check label { font-size: .8rem; font-weight: 400; line-height: 1.5; color: #5d5560; }
.niib-field--check label a { color: var(--niib-secondary); text-decoration: underline; }
.niib-field--check .niib-error { grid-column: 1 / -1; }
.niib-error { margin: 0; font-size: .8rem; color: var(--niib-error); }
.niib-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.niib-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 24px;
	border: 1px solid var(--niib-primary); border-radius: 999px; background: var(--niib-primary); color: #fff;
	font: inherit; font-weight: 600; font-size: .95rem; letter-spacing: .02em; cursor: pointer; text-decoration: none;
	transition: background .2s, transform .2s, box-shadow .2s;
}
.niib-btn:hover { background: var(--niib-secondary); border-color: var(--niib-secondary); color: #fff; }
.niib-btn:focus-visible { outline: 3px solid var(--niib-gold); outline-offset: 2px; }
.niib-btn[disabled] { opacity: .7; cursor: progress; }
.niib-btn--ghost { background: transparent; color: var(--niib-primary); }
.niib-btn--ghost:hover { color: #fff; }
.niib-btn--wa { background: #1f7a4d; border-color: #1f7a4d; }
.niib-btn--wa:hover { background: #18623e; border-color: #18623e; }
.niib-btn svg { width: 20px; height: 20px; }
.niib-btn--submit { width: 100%; }
.niib-form__status:empty { display: none; }
.niib-form__status { padding: 12px 14px; border-radius: 8px; font-size: .9rem; line-height: 1.5; }
.niib-form__status.is-success { background: #e8f4ec; color: var(--niib-success); border: 1px solid #b9dcc5; }
.niib-form__status.is-error { background: #fbeceb; color: var(--niib-error); border: 1px solid #f0c3c0; }
.niib-form.is-sent .niib-field, .niib-form.is-sent .niib-btn--submit { display: none; }

/* ---------- Modal ---------- */
.niib-modal { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.niib-modal[hidden] { display: none; }
.niib-modal__backdrop { position: absolute; inset: 0; background: rgba(31, 10, 24, .62); opacity: 0; transition: opacity .2s; }
.niib-modal__dialog {
	position: relative; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto;
	background: #fff; border-radius: 16px; border-top: 4px solid var(--niib-gold); padding: 32px 28px 24px;
	box-shadow: 0 24px 60px rgba(31, 10, 24, .35); transform: translateY(16px); opacity: 0; transition: transform .25s, opacity .25s; outline: none;
}
.niib-modal.is-open .niib-modal__backdrop { opacity: 1; }
.niib-modal .niib-modal__dialog:focus, .niib-modal .niib-modal__dialog:focus-visible { outline: none; }
.niib-modal.is-open .niib-modal__dialog { transform: none; opacity: 1; }
.niib-modal__close {
	position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; display: grid; place-items: center;
	border: 0; border-radius: 50%; background: var(--niib-ivory); color: var(--niib-primary); cursor: pointer;
}
.niib-modal__close svg { width: 20px; height: 20px; }
.niib-modal__close:hover { background: var(--niib-blush); }
.niib-modal__close:focus-visible { outline: 3px solid var(--niib-gold); }
.niib-modal .niib-form__title { padding-right: 40px; }
.niib-modal__alt { margin: 14px 0 0; text-align: center; font-size: .85rem; color: #5d5560; }
.niib-modal__alt a { color: var(--niib-secondary); font-weight: 600; }
html.niib-modal-open { overflow: hidden; }
@media (max-width: 480px) {
	.niib-modal { padding: 0; align-items: flex-end; }
	.niib-modal__dialog { max-width: none; border-radius: 16px 16px 0 0; padding: 28px 20px calc(20px + env(safe-area-inset-bottom)); max-height: 92vh; max-height: 92dvh; }
}

/* ---------- Floating WhatsApp ---------- */
.niib-wa-float {
	position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 9990; display: flex; align-items: center; gap: 10px;
	height: 56px; padding: 0 16px; border-radius: 999px; background: #1f7a4d; color: #fff; text-decoration: none;
	box-shadow: 0 10px 28px rgba(0, 0, 0, .22); transition: transform .2s, bottom .25s;
}
.niib-wa-float--right { right: 24px; }
.niib-wa-float--left { left: 24px; }
.niib-wa-float svg { width: 28px; height: 28px; flex: none; }
.niib-wa-float__label { font-weight: 600; font-size: .9rem; white-space: nowrap; }
.niib-wa-float:hover { transform: translateY(-2px); color: #fff; }
.niib-wa-float:focus-visible { outline: 3px solid var(--niib-gold); outline-offset: 3px; }
@media (max-width: 1024px) { .niib-wa-float__label { display: none; } .niib-wa-float { width: 56px; padding: 0; justify-content: center; } }

/* ---------- Mobile sticky bar ---------- */
.niib-mbar { display: none; }
@media (max-width: 768px) {
	body.niib-has-mbar { padding-bottom: calc(var(--niib-mbar-h) + env(safe-area-inset-bottom)); }
	body.niib-has-mbar .niib-wa-float { display: none; }
	.niib-mbar {
		position: fixed; left: 0; right: 0; bottom: 0; z-index: 9995; display: grid; grid-template-columns: repeat(3, 1fr);
		height: calc(var(--niib-mbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
		background: #fff; border-top: 1px solid #eadde3; box-shadow: 0 -6px 20px rgba(31, 10, 24, .12); transition: transform .2s;
	}
	body.niib-typing .niib-mbar { transform: translateY(110%); }
	.niib-mbar__item {
		display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 48px;
		border: 0; background: none; color: var(--niib-primary); font: inherit; font-size: .78rem; font-weight: 600; text-decoration: none; cursor: pointer;
	}
	.niib-mbar__item + .niib-mbar__item { border-left: 1px solid #f0e5ea; }
	.niib-mbar__item svg { width: 22px; height: 22px; }
	.niib-mbar__item--wa { color: #1f7a4d; }
	.niib-mbar__item--cta { background: var(--niib-primary); color: #fff; }
	.niib-mbar__item:focus-visible { outline: 3px solid var(--niib-gold); outline-offset: -3px; }
}

/* ---------- Consent banner (slim bottom bar) ---------- */
.niib-consent {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 9996; display: flex; align-items: center; justify-content: center; gap: 12px 28px; flex-wrap: wrap;
	padding: 14px 24px calc(14px + env(safe-area-inset-bottom)); background: #fff; color: var(--niib-ink); border-top: 1px solid #eadde3;
	box-shadow: 0 -10px 30px rgba(31, 10, 24, .12); font-size: .84rem; line-height: 1.5;
}
.niib-consent[hidden] { display: none; }
.niib-consent p { margin: 0; max-width: 760px; }
.niib-consent a { color: var(--niib-secondary); }
.niib-consent__actions { display: flex; gap: 10px; flex: none; }
.niib-consent .niib-btn { min-height: 42px; padding: 8px 20px; }
body.niib-consent-open .niib-wa-float { bottom: calc(96px + env(safe-area-inset-bottom)); }
@media (max-width: 768px) {
	.niib-consent { padding: 12px 16px; gap: 10px; justify-content: stretch; }
	.niib-consent__actions { width: 100%; }
	.niib-consent__actions .niib-btn { flex: 1; }
	body.niib-has-mbar .niib-consent { bottom: calc(var(--niib-mbar-h) + env(safe-area-inset-bottom)); }
}

/* Hide the floating button while an enquiry form is on screen (never covers a form). */
.niib-wa-float { transition: transform .25s, bottom .25s, opacity .25s; }
body.niib-form-in-view .niib-wa-float { opacity: 0; transform: translateY(16px); pointer-events: none; visibility: hidden; }

/* ---------- Contact details & map shortcodes ---------- */
.niib-contact-details { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.niib-contact-details h3 { margin: 0 0 6px; font-size: 1rem; }
.niib-contact-details address { font-style: normal; margin-bottom: 6px; }
.niib-map { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--niib-blush); }
.niib-map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

@media (prefers-reduced-motion: reduce) {
	.niib-modal__dialog, .niib-modal__backdrop, .niib-wa-float, .niib-mbar, .niib-btn { transition: none; }
}
