/*
 * Popups on the public booking forms (kiosk and /register/), Oct 2026:
 *   - the mobile OTP dialog (#otpDialog, markup in each page), which replaced the inline
 *     panel at the bottom of the visitor step;
 *   - the "Welcome back" dialog built by assets/returning-visitor.js.
 * Native <dialog>.showModal(), like assets/terms-dialog.js -- never alert()/confirm(), which
 * on the kiosk tablet block every later WebUSB call until somebody taps OK.
 * Sized for touch: every control is at least 48px tall.
 */

.vd-dialog {
	/* /register/ declares a dark colour scheme for its header; the dialogs are white cards, so
	   native checkboxes and radios must render in their light form. */
	color-scheme: light;
	width: min(560px, calc(100% - 32px));
	max-width: 560px;
	max-height: min(90vh, 760px);
	max-height: min(90dvh, 760px);
	margin: auto;
	padding: 0;
	overflow: hidden;
	color: var(--adani-black, #231f20);
	background: #fff;
	border: 0;
	border-radius: 12px;
	box-shadow: 0 24px 80px rgba(0, 0, 0, .34);
}

.vd-dialog::backdrop {
	background: rgba(20, 17, 18, .72);
	backdrop-filter: blur(2px);
}

.vd-dialog[open] {
	display: block;
}

.vd-dialog__shell {
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
	max-height: min(90vh, 760px);
	max-height: min(90dvh, 760px);
}

.vd-dialog__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 22px 14px;
	border-bottom: 1px solid #e3e3e3;
}

.vd-dialog__title {
	margin: 0;
	color: var(--adani-purple, #8e278f);
	font-size: clamp(19px, 4vw, 24px);
	font-weight: 700;
	line-height: 1.25;
}

.vd-dialog__close {
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	min-height: 44px;
	margin: -6px -8px 0 0;
	padding: 0;
	color: #555;
	background: transparent;
	border: 0;
	border-radius: 50%;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}

.vd-dialog__close:hover,
.vd-dialog__close:focus-visible {
	color: var(--adani-purple, #8e278f);
	background: rgba(142, 39, 143, .08);
}

.vd-dialog__body {
	padding: 16px 22px 18px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.vd-dialog__intro {
	margin: 0 0 14px;
	color: var(--adani-grey, #555);
	font-size: 14px;
	line-height: 1.5;
}

.vd-dialog__footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 10px;
	padding: 14px 22px 18px;
	border-top: 1px solid #e3e3e3;
}

.vd-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0 20px;
	color: var(--adani-purple, #8e278f);
	background: #fff;
	border: 1.5px solid var(--adani-purple, #8e278f);
	border-radius: 8px;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.vd-btn--primary {
	color: #fff;
	background: var(--adani-purple, #8e278f);
}

.vd-btn:focus-visible {
	outline: 3px solid rgba(142, 39, 143, .32);
	outline-offset: 2px;
}

body.vd-dialog-open {
	overflow: hidden;
}

/* ---- OTP dialog --------------------------------------------------------- */

.otp-dialog .otp-panel__hint {
	margin: 0 0 14px;
	color: var(--adani-grey, #555);
	font-size: 15px;
	line-height: 1.45;
}

.otp-dialog .otp-panel__code {
	margin: 0 0 4px;
}

.otp-dialog .otp-panel__code[hidden] {
	display: none;
}

.otp-dialog .otp-panel__code input {
	width: 100%;
	min-height: 56px;
	font-size: 26px;
	letter-spacing: .4em;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

.otp-dialog .otp-panel__status {
	min-height: 20px;
	margin: 10px 0 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
}

.otp-dialog .otp-panel__status.is-error { color: var(--danger, #c0392b); }
.otp-dialog .otp-panel__status.is-success { color: var(--success, #1e7b4f); }
.otp-dialog .otp-panel__status.is-info { color: var(--adani-grey, #555); }

.otp-dialog .otp-panel__row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 16px;
}

/* Verify first, Resend second, whatever each page's button classes do to their width. */
.otp-dialog .otp-panel__row > * {
	flex: 1 1 180px;
	width: auto;
	min-width: 0;
	min-height: 48px;
	margin: 0;
}

.otp-dialog .otp-panel__row > [hidden] {
	display: none;
}

.otp-dialog #otpVerifyBtn { order: 1; }
.otp-dialog #otpSendBtn { order: 2; }

.otp-dialog__change {
	display: inline-block;
	width: auto;
	min-height: 44px;
	margin: 12px 0 0;
	padding: 0;
	color: var(--adani-purple, #8e278f);
	background: transparent;
	border: 0;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

/* ---- Mobile field with its verification state (step 1) ------------------ */

.mobile-verify {
	display: flex;
	align-items: stretch;
	gap: 10px;
}

.mobile-verify > input {
	flex: 1 1 auto;
	min-width: 0;
}

.mobile-verify__badge,
.mobile-verify__btn {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	min-width: 0;
	min-height: 44px;
	margin: 0;
	padding: 0 16px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
}

.mobile-verify__badge {
	color: var(--success, #1e7b4f);
	background: var(--success-soft, #e7f4ec);
	border: 1px solid var(--success, #1e7b4f);
}

.mobile-verify__btn {
	color: #fff;
	background: var(--adani-purple, #8e278f);
	border: 0;
	cursor: pointer;
}

.mobile-verify__badge[hidden],
.mobile-verify__btn[hidden] {
	display: none;
}

.mobile-view {
	display: flex;
	align-items: stretch;
	gap: 10px;
}

.mobile-view > input {
	flex: 1 1 auto;
	min-width: 0;
	color: #555;
	background: #eceef3;
	cursor: default;
}

.mobile-view__change {
	flex: 0 0 auto;
	width: auto;
	min-width: 0;
	min-height: 44px;
	margin: 0;
	padding: 0 16px;
	color: var(--adani-purple, #8e278f);
	background: #fff;
	border: 1.5px solid var(--adani-purple, #8e278f);
	border-radius: 8px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

/* ---- Resident Master gate: find your record by Survey No (step 1) -------
   Shared by the kiosk (light card) and /register/ (dark card), so colours are tints that read on
   both and text inherits the card's own colour. */

.resident-find,
.resident-matched {
	margin: 16px 0;
	padding: 16px;
	border: 1px solid rgba(142, 39, 143, .45);
	border-radius: 10px;
	background: rgba(142, 39, 143, .07);
}

.resident-find[hidden],
.resident-matched[hidden],
.resident-name-hint[hidden] {
	display: none !important;
}

.resident-find__title {
	margin: 0 0 6px;
	color: inherit;
	font-size: 17px;
	font-weight: 700;
}

.resident-find .field { margin-top: 12px; }

.resident-find__row {
	display: flex;
	align-items: stretch;
	gap: 10px;
}

.resident-find__row > input {
	flex: 1 1 auto;
	min-width: 0;
	letter-spacing: .02em;
}

.resident-find__slash,
.resident-find__btn {
	flex: 0 0 auto;
	width: auto;
	min-width: 48px;
	min-height: 48px;
	margin: 0;
	padding: 0 16px;
	border-radius: 8px;
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	white-space: nowrap;
	cursor: pointer;
}

.resident-find__slash {
	color: var(--adani-purple, #8e278f);
	background: #fff;
	border: 1.5px solid var(--adani-purple, #8e278f);
	font-size: 22px;
	line-height: 1;
}

.resident-find__btn {
	color: #fff;
	background: var(--adani-purple, #8e278f);
	border: 0;
}

.resident-find__btn:disabled {
	opacity: .55;
	cursor: not-allowed;
}

.resident-find__status {
	min-height: 1.4em;
	margin: 10px 0 0;
	font-size: 14px;
	font-weight: 600;
}

.resident-find__status.is-error { color: #e0483e; }
.resident-find__status.is-success { color: #2e9e63; }
.resident-find__status.is-info { opacity: .8; }

.resident-matched__line {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
	margin: 0;
	font-size: 15px;
}

.resident-matched__line strong { overflow-wrap: anywhere; }

.resident-matched__change {
	margin: 0 0 0 auto;
	padding: 6px 0;
	color: inherit;
	background: transparent;
	border: 0;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

@media (max-width: 480px) {
	.resident-find__row { flex-wrap: wrap; }
	.resident-find__row > input { flex-basis: calc(100% - 58px); }
	.resident-find__btn { flex: 1 1 100%; }
}

:lang(hi) .resident-find__row > input, :lang(mr) .resident-find__row > input { letter-spacing: 0; }

.resident-find__unmatched {
	display: block;
	width: 100%;
	min-height: 44px;
	margin: 10px 0 0;
	padding: 8px 14px;
	color: inherit;
	background: transparent;
	border: 1.5px dashed rgba(142, 39, 143, .6);
	border-radius: 8px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	cursor: pointer;
}

.resident-find__unmatched[hidden],
.decl-step[hidden],
.decl-unmatched[hidden] {
	display: none !important;
}

/* ---- The Survey No popup (#surveyDialog, both pages) -------------------------------------
   The find-your-record controls in a vd-dialog. Labels go back into normal flow: the kiosk floats
   every .field label on its input's border. */
.survey-dialog__field { margin: 16px 0 0; }

.survey-dialog__field > label {
	position: static !important;
	display: block;
	margin: 0 0 6px !important;
	padding: 0 !important;
	color: var(--adani-black, #231f20) !important;
	background: transparent !important;
	font-size: 13px !important;
	font-weight: 600;
}

.survey-dialog .resident-find__row > input {
	min-height: 48px;
	margin: 0;
	color: var(--adani-black, #231f20);
	background: #fff;
	border: 1px solid #c9c4cc;
	border-radius: 8px;
	padding: 0 12px;
	font-size: 16px;
}

.survey-dialog .resident-find__status.is-error { color: var(--danger, #c0392b); }
.survey-dialog .resident-find__status.is-success { color: var(--success, #1e7b4f); }
.survey-dialog .resident-find__status.is-info { color: var(--adani-grey, #555); opacity: 1; }

.survey-dialog .resident-find__unmatched {
	color: var(--adani-purple, #8e278f);
	border-color: var(--adani-purple, #8e278f);
}

/* ---- Mandatory Declaration & Documents to Carry (assets/resident-declaration.js) ---------- */

.decl-dialog { max-width: 640px; width: min(640px, calc(100% - 32px)); }

.decl-unmatched {
	margin: 0 0 12px;
	padding: 10px 12px;
	color: #7a2e00;
	background: #fff4e5;
	border-left: 4px solid #e08a00;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
}

.decl-quote {
	margin: 0 0 14px;
	padding: 12px 14px;
	color: #3b2a00;
	background: #fff8e6;
	border: 1px solid #f0c66b;
	border-radius: 8px;
	font-size: 14px;
	font-style: italic;
	line-height: 1.55;
}

.decl-table {
	width: 100%;
	margin: 0 0 14px;
	border-collapse: collapse;
	font-size: 14px;
}

.decl-table th,
.decl-table td {
	padding: 8px 10px;
	text-align: left;
	vertical-align: top;
	border: 1px solid #d9d4dc;
}

.decl-table thead th {
	color: #fff;
	background: #1f2a44;
	font-weight: 700;
}

.decl-table tbody th { width: 40%; font-weight: 700; }

.decl-agree {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
}

.decl-agree input { width: 22px; height: 22px; margin: 0; flex: none; }

/* The kiosk styles every input as a full-height field; a tick box must stay a tick box. */
.decl-agree input[type="checkbox"],
.decl-step__agree input[type="checkbox"] {
	width: 22px !important;
	height: 22px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	flex: none;
	accent-color: var(--adani-purple, #8e278f);
}


.decl-dialog .vd-btn[disabled] { opacity: .5; cursor: not-allowed; }

/* The step-4 tick box that mirrors the popup (Submit stays disabled until it is ticked). */
.decl-step {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
	margin: 14px 0 0;
	padding: 12px 14px;
	border: 1px solid rgba(224, 138, 0, .7);
	border-radius: 8px;
	background: rgba(224, 138, 0, .08);
}

.decl-step__agree {
	display: flex;
	flex: 1 1 260px;
	align-items: flex-start;
	gap: 10px;
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.decl-step__agree input { width: 22px; height: 22px; margin: 0; flex: none; }

.decl-step__review {
	flex: 0 0 auto;
	width: auto;
	min-height: 40px;
	margin: 0;
	padding: 0 4px;
	color: inherit;
	background: transparent;
	border: 0;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

@media (max-width: 520px) {
	/* The documents table stacks: each row becomes a small card. */
	.decl-table thead { display: none; }
	.decl-table, .decl-table tbody, .decl-table tr, .decl-table th, .decl-table td { display: block; width: 100%; }
	.decl-table tr { margin-bottom: 8px; border: 1px solid #d9d4dc; border-radius: 6px; overflow: hidden; }
	.decl-table th, .decl-table td { border: 0; }
	.decl-table tbody th { width: 100%; color: #fff; background: #1f2a44; }
}

:lang(hi) .decl-quote, :lang(mr) .decl-quote { font-style: normal; }

/* ---- Welcome back dialog ------------------------------------------------ */

.rv-section-title {
	margin: 4px 0 8px;
	color: var(--adani-black, #231f20);
	font-size: 15px;
	font-weight: 700;
}

.rv-section-hint {
	margin: -4px 0 10px;
	color: var(--adani-grey, #555);
	font-size: 13px;
}

.rv-list {
	display: grid;
	gap: 8px;
	margin: 0 0 16px;
	padding: 0;
	list-style: none;
}

.rv-option {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	min-height: 56px;
	margin: 0;
	padding: 12px 14px;
	background: #fafafa;
	border: 1.5px solid #ddd;
	border-radius: 10px;
	cursor: pointer;
}

.rv-option:has(input:checked) {
	background: rgba(142, 39, 143, .06);
	border-color: var(--adani-purple, #8e278f);
}

.rv-option input {
	flex: 0 0 22px;
	width: 22px;
	height: 22px;
	min-height: 22px;
	margin: 2px 0 0;
	padding: 0;
	accent-color: var(--adani-purple, #8e278f);
	box-shadow: none;
}

.rv-option__text {
	display: grid;
	gap: 2px;
	min-width: 0;
}

.rv-option__name {
	font-size: 16px;
	font-weight: 700;
	overflow-wrap: anywhere;
}

.rv-option__meta {
	color: var(--adani-grey, #555);
	font-size: 13px;
	overflow-wrap: anywhere;
}

@media (max-width: 480px) {
	.vd-dialog { width: calc(100% - 20px); }
	.vd-dialog__header { padding: 16px 16px 12px; }
	.vd-dialog__body { padding: 14px 16px; }
	.vd-dialog__footer { padding: 12px 16px 16px; }
	.vd-dialog__footer .vd-btn { flex: 1 1 100%; }
	.mobile-verify__badge, .mobile-verify__btn, .mobile-view__change { padding: 0 12px; }
}

:lang(hi) .vd-dialog *, :lang(mr) .vd-dialog * { letter-spacing: 0; }
:lang(hi) .otp-dialog .otp-panel__code input, :lang(mr) .otp-dialog .otp-panel__code input { letter-spacing: .4em; }
