/* KARAMeD Registration forms.
 * Brand colour: KARAMeD purple. Override any token in
 * Elementor → Site Settings → Custom CSS, e.g. .km-reg, .km-book, .km-dialog { --km-primary: #6A49F2; }
 */
.km-reg {
	--km-primary: #6A49F2;
	--km-primary-text: #fff;
	--km-text: #1f2933;
	--km-muted: #5f6b7a;
	--km-border: #d5dbe3;
	--km-bg: #fff;
	--km-field-bg: #f8fafc;
	--km-error: #c62828;
	--km-error-bg: #fdecea;
	--km-success: #1b873f;
	--km-info-bg: #eef5fb;
	--km-radius: 10px;
	--km-gap: 18px;

	box-sizing: border-box;
	max-width: 760px;
	margin: 0 auto;
	padding: clamp(20px, 4vw, 40px);
	background: var(--km-bg);
	color: var(--km-text);
	border: 1px solid var(--km-border);
	border-radius: 16px;
	box-shadow: 0 10px 30px rgba(16, 42, 67, 0.06);
	font-family: inherit;
	font-size: 16px;
	line-height: 1.5;
	text-align: left;
}

.km-reg *,
.km-reg *::before,
.km-reg *::after { box-sizing: inherit; }

.km-reg--patient { max-width: 560px; }
.km-reg--notice { padding: 20px; }

.km-section {
	border: 0;
	margin: 0 0 28px;
	padding: 0;
	min-width: 0;
}

.km-section__title {
	display: block;
	width: 100%;
	margin: 0 0 14px;
	padding: 0 0 10px;
	border-bottom: 1px solid var(--km-border);
	font-size: 1.05rem;
	font-weight: 600;
	color: var(--km-text);
}

.km-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--km-gap);
}

.km-field--full { grid-column: 1 / -1; }

@media (max-width: 600px) {
	.km-grid { grid-template-columns: 1fr; }
}

.km-field label {
	display: block;
	margin-bottom: 6px;
	font-size: 0.92rem;
	font-weight: 600;
	color: var(--km-text);
}

.km-req { color: var(--km-error); margin-left: 2px; }
.km-opt { color: var(--km-muted); font-weight: 400; font-size: 0.85em; margin-left: 4px; }

:is(.km-reg, .km-dialog, .km-acct) input[type="text"],
:is(.km-reg, .km-dialog, .km-acct) input[type="email"],
:is(.km-reg, .km-dialog, .km-acct) input[type="tel"],
:is(.km-reg, .km-dialog, .km-acct) input[type="url"],
:is(.km-reg, .km-dialog, .km-acct) input[type="number"],
:is(.km-reg, .km-dialog, .km-acct) input[type="password"],
:is(.km-reg, .km-dialog, .km-acct) select,
:is(.km-reg, .km-dialog, .km-acct) textarea {
	display: block;
	width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 11px 14px;
	font: inherit;
	font-size: 16px; /* prevents iOS zoom */
	color: var(--km-text);
	background: var(--km-field-bg);
	border: 1px solid var(--km-border);
	border-radius: var(--km-radius);
	box-shadow: none;
	transition: border-color .15s, box-shadow .15s, background-color .15s;
	appearance: none;
	-webkit-appearance: none;
}

:is(.km-reg, .km-dialog, .km-acct) select {
	padding-right: 40px;
	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='none' stroke='%235f6b7a' stroke-width='1.6' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
}

:is(.km-reg, .km-dialog, .km-acct) textarea { min-height: 110px; resize: vertical; }

:is(.km-reg, .km-dialog, .km-acct) input:focus,
:is(.km-reg, .km-dialog, .km-acct) select:focus,
:is(.km-reg, .km-dialog, .km-acct) textarea:focus {
	outline: none;
	background-color: #fff;
	border-color: var(--km-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--km-primary) 20%, transparent);
}

:is(.km-reg, .km-dialog, .km-acct) input[type="file"] {
	display: block;
	width: 100%;
	padding: 14px;
	font: inherit;
	font-size: 0.95rem;
	background: var(--km-field-bg);
	border: 1.5px dashed var(--km-border);
	border-radius: var(--km-radius);
	cursor: pointer;
}

:is(.km-reg, .km-dialog, .km-acct) input[type="file"]::file-selector-button {
	margin-right: 12px;
	padding: 8px 14px;
	font: inherit;
	font-weight: 600;
	color: var(--km-primary);
	background: #fff;
	border: 1px solid var(--km-primary);
	border-radius: 8px;
	cursor: pointer;
}

.km-password { position: relative; }
.km-password input { padding-right: 72px; }

.km-toggle {
	position: absolute;
	top: 50%;
	right: 8px;
	transform: translateY(-50%);
	min-height: 34px;
	padding: 4px 10px;
	font: inherit;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--km-primary);
	background: transparent;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
}

.km-toggle:hover,
.km-toggle:focus-visible { background: var(--km-info-bg); outline: none; }

.km-help {
	margin: 6px 0 0;
	font-size: 0.84rem;
	color: var(--km-muted);
}

.km-help--center { text-align: center; margin-top: 12px; }

.km-error {
	margin: 6px 0 0;
	font-size: 0.85rem;
	font-weight: 500;
	color: var(--km-error);
}

.km-error:empty { display: none; }

.km-field--invalid input,
.km-field--invalid select,
.km-field--invalid textarea {
	border-color: var(--km-error);
	background-color: #fff;
}

.km-field--consent { margin-bottom: 22px; }

.km-check {
	display: flex !important;
	gap: 10px;
	align-items: flex-start;
	font-weight: 400 !important;
	cursor: pointer;
}

.km-check input {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	margin: 2px 0 0;
	accent-color: var(--km-primary);
}

.km-check a { color: var(--km-primary); text-decoration: underline; }

.km-turnstile { margin: 0; max-width: 100%; }
.km-turnstile.is-visible { margin: 6px 0 18px; }

.km-submit {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 54px;
	padding: 14px 24px;
	font: inherit;
	font-size: 1.02rem;
	font-weight: 600;
	color: var(--km-primary-text);
	background: var(--km-primary);
	border: 0;
	border-radius: var(--km-radius);
	cursor: pointer;
	transition: filter .15s, transform .05s;
}

.km-submit:hover:not(:disabled) { filter: brightness(1.08); }
.km-submit:active:not(:disabled) { transform: translateY(1px); }
.km-submit:focus-visible { outline: 3px solid color-mix(in srgb, var(--km-primary) 40%, transparent); outline-offset: 2px; }
.km-submit:disabled { cursor: not-allowed; opacity: .65; }

.km-spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2.5px solid rgba(255, 255, 255, .45);
	border-top-color: #fff;
	border-radius: 50%;
	animation: km-spin .7s linear infinite;
}

.km-submit.is-busy .km-spinner { display: inline-block; }

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

.km-alert {
	margin: 0 0 22px;
	padding: 12px 16px;
	font-size: 0.93rem;
	border-radius: var(--km-radius);
	border-left: 4px solid currentColor;
}

.km-alert--error { color: var(--km-error); background: var(--km-error-bg); }
.km-alert--info { color: var(--km-primary); background: var(--km-info-bg); }
.km-alert[hidden] { display: none; }

/* Honeypot — off-screen, not display:none (some bots skip hidden fields). */
.km-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Success */
.km-success { text-align: center; padding: 12px 0; outline: none; }
.km-success[hidden] { display: none; }

.km-success__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	margin-bottom: 14px;
	color: #fff;
	background: var(--km-success);
	border-radius: 50%;
}

.km-success__title { margin: 0 0 10px; font-size: 1.4rem; color: var(--km-text); }
.km-success p { max-width: 520px; margin: 0 auto 12px; color: var(--km-muted); }

.km-stores-label {
	margin: 22px 0 10px !important;
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--km-muted, #5f6b7a);
	text-align: center;
}

/* App-store badges: black, rounded, logo + two-line label (official badge layout). */
.km-stores {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
}

.km-store {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	box-sizing: border-box;
	/* Same size for both badges (Google Play is the wider label). */
	width: 200px;
	flex: 0 0 200px;
	height: 56px;
	padding: 6px 18px 6px 14px;
	color: #fff !important;
	background: #000;
	border: 1px solid #a6a6a6;
	border-radius: 10px;
	text-decoration: none !important;
	text-align: left;
	line-height: 1.1;
	transition: transform .15s, box-shadow .15s;
}

.km-store:hover,
.km-store:focus-visible {
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
	outline: none;
}

.km-store i {
	flex: 0 0 28px;
	font-size: 28px;
	line-height: 1;
	text-align: center;
	color: #fff;
}

/* Google Play colours on the play glyph. */
.km-store--google i {
	background: linear-gradient(135deg, #00d7fe 0%, #00f076 35%, #ffd500 62%, #ff3a44 100%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	font-size: 25px;
}

.km-store__text { display: flex; flex-direction: column; }
.km-store__small { font-size: 10.5px; font-weight: 500; letter-spacing: .02em; opacity: .95; }
.km-store--google .km-store__small { text-transform: uppercase; letter-spacing: .06em; }
.km-store__big { font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin-top: 2px; }

.km-receipt-row { margin: 18px 0 4px; text-align: center; }

@media (max-width: 400px) {
	.km-stores { flex-direction: column; align-items: center; }
	.km-store { flex-basis: auto; width: 100%; max-width: 240px; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
	.km-reg * { transition: none !important; animation-duration: 1.5s !important; }
}

.km-reg .km-btn--primary {
	display: inline-flex;
	align-items: center;
	min-height: 48px;
	padding: 12px 22px;
	font-weight: 600;
	color: #fff !important;
	background: var(--km-primary);
	border-radius: var(--km-radius);
	text-decoration: none !important;
}

/* =====================================================================
 * Theme isolation
 * The Apper theme styles every button[type=submit] (12px uppercase pill),
 * adds letter-spacing to p/li/a/button and removes focus outlines.
 * These rules use higher specificity so the KARAMeD UI looks the same
 * on every page and theme update.
 * ===================================================================== */
:is(.km-reg, .km-book, .km-dialog, .km-acct) :is(p, li, a, button, label, span, legend, dt, dd, input, select, textarea, h3, h4) {
	letter-spacing: normal;
}

:is(.km-reg, .km-book, .km-dialog, .km-acct) button {
	text-transform: none;
	box-shadow: none;
	font-family: inherit;
}

:is(.km-reg, .km-book, .km-dialog, .km-acct) button.km-submit[type="submit"],
:is(.km-reg, .km-book, .km-dialog, .km-acct) button.km-submit {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 54px;
	margin: 24px 0 0;
	padding: 14px 28px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: normal;
	text-transform: none;
	color: #fff;
	background: var(--km-primary, #6A49F2);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 8px 20px rgba(106, 73, 242, .25);
	cursor: pointer;
	transition: filter .15s, transform .05s, box-shadow .15s;
}

:is(.km-reg, .km-book, .km-dialog, .km-acct) button.km-submit:hover:not(:disabled) {
	filter: brightness(1.07);
	box-shadow: 0 10px 24px rgba(106, 73, 242, .32);
}

:is(.km-reg, .km-book, .km-dialog, .km-acct) button.km-submit:disabled {
	opacity: .6;
	box-shadow: none;
	cursor: not-allowed;
}

/* Inside the consent/actions wrapper the spacing comes from the wrapper. */
.km-reg .km-actions button.km-submit { margin-top: 0; }
.km-dialog .km-step__actions button.km-submit { margin-top: 0; width: auto; flex: 1; }

:is(.km-reg, .km-dialog, .km-acct) button.km-toggle {
	font-size: 13px;
	font-weight: 600;
	text-transform: none;
	letter-spacing: normal;
}

/* Keyboard focus must stay visible (the theme removes it). */
:is(.km-reg, .km-book, .km-dialog, .km-acct) :is(button, a, input, select, textarea):focus-visible {
	outline: 3px solid rgba(106, 73, 242, .45) !important;
	outline-offset: 2px;
}

:is(.km-reg, .km-book, .km-dialog, .km-acct) a:not(.km-btn):not(.km-store) {
	color: var(--km-primary, #6A49F2);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Field rhythm: consistent space between rows of fields. */
.km-reg .km-grid,
.km-dialog .km-grid { row-gap: 20px; }

.km-reg .km-help { line-height: 1.45; }

.km-reg :is(.km-success, .km-confirm__body) p { line-height: 1.6; }

@media (max-width: 520px) {
	.km-dialog .km-step__actions button.km-submit { width: 100%; flex: none; }
}

/* Generic buttons (search, book, ghost) — same pill shape as the site. */
:is(.km-reg, .km-book, .km-dialog, .km-acct) :is(button, a).km-btn,
:is(.km-reg, .km-book, .km-dialog, .km-acct) button.km-btn[type="submit"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 10px 22px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	border-radius: 999px;
	box-shadow: none;
}
:is(.km-reg, .km-book, .km-dialog, .km-acct) :is(button, a).km-btn--sm { min-height: 36px; padding: 6px 14px; font-size: 13.5px; }

/* Safety net if the theme's .btn class is present before the script repairs it. */
:is(.km-reg, .km-book, .km-dialog, .km-acct) :is(button, a).btn::before,
:is(.km-reg, .km-book, .km-dialog, .km-acct) :is(button, a).btn::after { content: none !important; display: none !important; }
:is(.km-reg, .km-book, .km-dialog, .km-acct) button > span:not([class]) { letter-spacing: inherit; text-transform: inherit; position: static !important; color: inherit; }
:is(.km-reg, .km-dialog, .km-acct) button.km-toggle {
	border: 0;
	background: transparent;
	color: var(--km-primary, #6A49F2);
	overflow: visible;
	border-radius: 6px;
	min-height: 34px;
	padding: 4px 10px;
}
:is(.km-reg, .km-book, .km-dialog, .km-acct) button.km-submit:hover { color: #fff; }
