/*
 * Visual-only reskin of the Pre Admission web form (/pre-admission/*),
 * matching login_theme.css's RCHS brand (same palette, fonts, card/button
 * language) but adapted to this page's very different shape: a long,
 * multi-step (Page Break) wizard with its own extensive functional CSS/JS
 * already inline in preadmission.js (civil-registry validation, phone/
 * email checks, its own navbar-based language switcher, RTL toggling).
 *
 * Same split brand-panel / form-panel layout as the login redesign, plus
 * a small companion preadmission_theme.js that hides the navbar and
 * injects a decorative brand panel + an independent language pill (real
 * switching via the exact cookie+reload mechanism preadmission.js's own
 * applyLanguage() already uses) - since the navbar this hides is where
 * preadmission.js's own language switcher lives (buildFriendlyLanguageSwitcher()
 * appends into .navbar .navbar-nav), that control would otherwise become
 * unreachable. The rest - .web-form-container card shell, typography,
 * inputs, buttons, step-progress dots - are all classes owned by Frappe
 * core's web_form.scss / web_form.js, never anything preadmission.js
 * builds itself, so restyling them here can't fight that file.
 *
 * Field validation is untouched: every invalid-field highlight in
 * preadmission.js is applied as an inline style (`.css({"border-color":
 * ...})`, markFieldInvalid()), which always wins over this file's
 * class-level rules regardless of load order.
 *
 * Scoped via body[data-path^="pre-admission"] - covers /pre-admission,
 * /pre-admission/new and /pre-admission/<name>(/edit), and (like
 * login_theme.css) applies from first paint since data-path is stamped
 * server-side in base.html, not added by any script.
 */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
	--rchs-blue: #0769B2;
	--rchs-blue-dark: #054C82;
	--rchs-blue-deepest: #062741;
	--rchs-navy-ink: #0A2036;
	--rchs-teal: #13AFA3;
	--rchs-teal-soft: #DFF5F2;
	--rchs-bg-soft: #F3F8FC;
	--rchs-surface: #FFFFFF;
	--rchs-line: #E1EAF2;
	--rchs-muted: #5C7488;
	--rchs-radius-md: 14px;
	--rchs-radius-sm: 10px;
	--rchs-ease: cubic-bezier(.4, 0, .2, 1);
}

body[data-path^="pre-admission"] {
	font-family: 'Inter', sans-serif;
	background: var(--rchs-bg-soft);
	color: var(--rchs-navy-ink);
	-webkit-font-smoothing: antialiased;
}

/* preadmission.js sets html.dir/body.style.direction directly (not a
   class), so keying off those - same convention it already uses - rather
   than duplicating its language detection here. */
html[dir="rtl"] body[data-path^="pre-admission"],
html[lang^="ar"] body[data-path^="pre-admission"] {
	font-family: 'IBM Plex Sans Arabic', 'Inter', sans-serif;
}

/* The stock navbar's job (logo, language switcher, login link) is fully
   absorbed into the brand panel + language pill below (both injected by
   preadmission_theme.js) - same call as login_theme.css. The navbar's own
   language <select id="language-switcher"> and the nav-item button
   preadmission.js builds around it (buildFriendlyLanguageSwitcher) are
   left completely alone in the DOM, just visually hidden along with the
   rest of the navbar - preadmission_theme.js's own pill is an independent
   control using the exact same cookie+reload mechanism (see
   applyLanguage() in preadmission.js), not a rewire of that hidden one. */
body[data-path^="pre-admission"] .navbar {
	display: none !important;
}

body[data-path^="pre-admission"] .web-footer {
	display: none !important;
}

/* !important throughout this rule: web_form.scss's own
   "[data-doctype='Web Form'] .page-content-wrapper .container .page_content"
   selector chains four class-level selectors (specificity 0,4,0) against
   this file's two (0,2,1), so its "max-width: 800px; margin: auto" was
   silently winning and leaving .page_content un-shifted (margin:auto on
   an unconstrained-width block resolves to 0, not centered) - the brand
   panel doesn't lay content aside by simply being fixed and positioned;
   the panel and the page's own document flow are two independent layout
   contexts, so nothing pushes .page_content over unless it's told to. */
body[data-path^="pre-admission"] .page_content {
	max-width: none !important;
	margin-inline-start: 38% !important;
	min-height: 100vh;
}

body[data-path^="pre-admission"] main.container {
	max-width: none !important;
	width: 100%;
	padding: 0 !important;
	margin: 0 !important;
}

/* ============ BRAND PANEL (decorative, injected by preadmission_theme.js) ============ */
body[data-path^="pre-admission"] .pa-brand-panel {
	position: fixed;
	inset-block: 0;
	inset-inline-start: 0;
	width: 38%;
	min-width: 340px;
	background:
		radial-gradient(120% 140% at 15% 0%, rgba(255, 255, 255, .10) 0%, rgba(255, 255, 255, 0) 45%),
		linear-gradient(160deg, var(--rchs-blue) 0%, var(--rchs-blue-dark) 58%, var(--rchs-blue-deepest) 100%);
	color: #fff;
	padding: 52px 44px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	overflow: hidden;
	z-index: 1;
}

body[data-path^="pre-admission"] .pa-brand-watermark {
	position: absolute;
	inset: 0;
	opacity: .10;
	pointer-events: none;
	display: flex;
	align-items: center;
	justify-content: center;
	transform: scale(1.7) translateY(6%);
}

body[data-path^="pre-admission"] .pa-brand-top {
	display: flex;
	align-items: center;
	gap: 14px;
	position: relative;
	z-index: 2;
}

body[data-path^="pre-admission"] .pa-brand-top img {
	width: 48px;
	height: 48px;
	border-radius: 12px;
	background: #fff;
	padding: 6px;
	object-fit: contain;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
	cursor: pointer;
}

body[data-path^="pre-admission"] .pa-brand-wordmark {
	display: flex;
	flex-direction: column;
	line-height: 1.15;
}

body[data-path^="pre-admission"] .pa-brand-wordmark .en {
	font-family: 'Space Grotesk', sans-serif;
	font-weight: 700;
	font-size: 26px;
	letter-spacing: .05em;
}

body[data-path^="pre-admission"] .pa-brand-wordmark .sub {
	font-size: 14px;
	font-weight: 600;
	color: rgba(255, 255, 255, .72);
	letter-spacing: .02em;
	margin-top: 2px;
}

body[data-path^="pre-admission"] .pa-brand-mid {
	position: relative;
	z-index: 2;
	max-width: 420px;
	margin-top: auto;
	margin-bottom: auto;
	padding: 56px 0;
}

body[data-path^="pre-admission"] .pa-brand-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: 'Space Grotesk', sans-serif;
	font-size: 13px;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--rchs-teal-soft);
	margin-bottom: 20px;
}

body[data-path^="pre-admission"] .pa-brand-eyebrow .dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--rchs-teal-soft);
	box-shadow: 0 0 0 4px rgba(255, 255, 255, .15);
}

body[data-path^="pre-admission"] .pa-brand-mid h1 {
	font-family: 'Space Grotesk', sans-serif;
	font-weight: 800;
	font-size: clamp(28px, 2.6vw, 42px);
	line-height: 1.22;
	letter-spacing: -.01em;
	color: #fff;
}

body[data-path^="pre-admission"] .pa-brand-mid p {
	margin-top: 16px;
	font-size: 16px;
	line-height: 1.65;
	color: rgba(255, 255, 255, .78);
	max-width: 400px;
}

body[data-path^="pre-admission"] .pa-brand-checklist {
	margin-top: 30px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

body[data-path^="pre-admission"] .pa-brand-checklist .item {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14.5px;
	color: rgba(255, 255, 255, .88);
}

body[data-path^="pre-admission"] .pa-brand-checklist .item svg {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	color: var(--rchs-teal-soft);
}

body[data-path^="pre-admission"] .pa-brand-bottom {
	position: relative;
	z-index: 2;
	font-size: 13.5px;
	color: rgba(255, 255, 255, .62);
	border-top: 1px solid rgba(255, 255, 255, .16);
	padding-top: 18px;
	line-height: 1.6;
}

/* "Need help?" support note (built by preadmission_theme.js's buildSupportNote), shown right after the
   form, below the "Already have an account?" prompt. */
body[data-path^="pre-admission"] .pa-support {
	display: block;
	line-height: 1.65;
}

body[data-path^="pre-admission"] .pa-support .pa-support-title {
	display: block;
	margin-bottom: 4px;
	font-weight: 600;
}

body[data-path^="pre-admission"] .pa-support .pa-support-phone {
	font-weight: 600;
	text-decoration: underline;
	white-space: nowrap;
	unicode-bidi: isolate;
}

body[data-path^="pre-admission"] .pa-support--page {
	display: block;
	width: 100%;
	max-width: 960px;
	margin: 0 auto 8px;
	padding: 16px 18px;
	border: 1px solid #e4e8eb;
	border-radius: 12px;
	background: #f8fafb;
	font-size: 13.5px;
	color: #5c6a76;
}

body[data-path^="pre-admission"] .pa-support--page .pa-support-title {
	color: #1b2b3a;
}

body[data-path^="pre-admission"] .pa-support--page .pa-support-phone {
	color: #0769b2;
}

/* Below 880px the full side brand panel has no room - hidden entirely,
   same as before this page had any mobile branding at all. The logo
   itself is NOT lost though: preadmission_theme.js also inserts a
   separate, plain .pa-mobile-logo node as the first child of
   .page_content specifically (not a sibling bar above/outside it, the
   way this sidebar panel is) - see its dedicated rule further down, right
   after .page_content's own mobile rule. */
@media (max-width: 880px) {
	body[data-path^="pre-admission"] .pa-brand-panel {
		display: none;
	}
}

/* Desktop/tablet already gets the logo from the sidebar .pa-brand-panel -
   this inline one only ever renders below 880px (its own rule further
   down), so keep it out of the box model up here too. */
body[data-path^="pre-admission"] .pa-mobile-logo {
	display: none;
}

/* ============ FORM PANEL (real content, shifted + restyled) ============ */
body[data-path^="pre-admission"] .page_content {
	background: var(--rchs-surface);
	display: flex;
	flex-direction: column;
	align-items: center;
	padding-block: 40px 56px;
	padding-inline: 28px 40px;
	position: relative;
}

@media (max-width: 880px) {
	body[data-path^="pre-admission"] .page_content {
		margin-inline-start: 0 !important;
		padding-top: 76px;
	}
}

body[data-path^="pre-admission"] .web-form-container {
	width: 100%;
	max-width: 960px;
}

/* preadmission.js's blockFormAccess() injects this alert with
   $(".web-form-container").before(...) and no spacing of its own, so it
   lands as the first flow child right at .page_content's padding-top
   (40px) - inside the vertical band .pa-topbar's language pill occupies
   (position:absolute, top:28px, ~36px tall, so roughly y:28-64). The
   alert's text naturally spans the full available width (no max-width of
   its own, unlike .web-form-container above), so the pill sits visually
   on top of its first line instead of just missing it horizontally.
   Clearing it below the pill's band (with a little extra room) fixes
   that regardless of how wide the alert ends up being. */
body[data-path^="pre-admission"] .registration-blocked {
	margin-top: 40px;
}

/* Top-right row - holds the language pill and (for signed-in visitors -
   see preadmission.js's get_user_role_info banner) the relocated account
   widget side by side. Same structure as student_applicant_theme.css's
   .sa-topbar. */
body[data-path^="pre-admission"] .pa-topbar {
	position: absolute;
	top: 28px;
	inset-inline-end: 32px;
	display: flex;
	align-items: center;
	gap: 10px;
	z-index: 3;
}

/* Fixed (not absolute) here specifically so it renders pinned to the
   viewport's very top-right regardless of where it sits in the DOM/normal
   flow relative to .pa-mobile-logo right below it - the desired stacking
   order is language switch first, then the logo, then the page heading,
   and this is what makes that order hold even though .pa-mobile-logo is
   inserted as .page_content's first child (i.e. structurally *before*
   this topbar, which is appended as a later child) - position:fixed takes
   it out of flow entirely so DOM order between the two doesn't matter. */
@media (max-width: 880px) {
	body[data-path^="pre-admission"] .pa-topbar {
		position: fixed;
		top: 14px;
		inset-inline-end: 16px;
		z-index: 20;
	}
}

/* The logo now lives INSIDE .page_content (preadmission_theme.js inserts
   it as that element's first child) rather than in a separate bar
   outside/above it - .page_content is already display:flex/flex-direction:
   column/align-items:center (see its own rule above), so this just needs
   to size the image and clear the fixed language pill sitting on top of
   it. display:none by default (the earlier rule right after
   .pa-brand-panel's own mobile rule) is overridden back to flex only
   below 880px, since desktop/tablet already has the logo via the sidebar
   panel. */
@media (max-width: 880px) {
	body[data-path^="pre-admission"] .pa-mobile-logo {
		display: flex;
		justify-content: center;
		width: 100%;
		margin-top: 20px;
		margin-bottom: 8px;
	}

	body[data-path^="pre-admission"] .pa-mobile-logo img {
		width: 88px;
		height: 88px;
		object-fit: contain;
		cursor: pointer;
	}
}

/* Language pill - injected by preadmission_theme.js, real switching via
   the same cookie+reload mechanism preadmission.js's own hidden switcher
   already uses. */
body[data-path^="pre-admission"] .pa-lang-toggle {
	display: flex;
	align-items: center;
	gap: 2px;
	background: var(--rchs-bg-soft);
	border-radius: 999px;
	padding: 4px;
	border: 1px solid var(--rchs-line);
}

body[data-path^="pre-admission"] .pa-lang-toggle button {
	border: none;
	background: transparent;
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 600;
	padding: 6px 14px;
	border-radius: 999px;
	color: var(--rchs-muted);
	cursor: pointer;
	transition: background .2s var(--rchs-ease), color .2s var(--rchs-ease);
}

body[data-path^="pre-admission"] .pa-lang-toggle button.active {
	background: var(--rchs-surface);
	color: var(--rchs-blue);
	box-shadow: 0 1px 3px rgba(10, 32, 54, .12);
}

/* Account widget - the real #website-post-login <li> (avatar + Log out),
   relocated here as-is by preadmission_theme.js. Same treatment as
   student_applicant_theme.css's .sa-account-widget. */
body[data-path^="pre-admission"] .pa-account-widget#website-post-login {
	display: flex !important;
	align-items: center;
	list-style: none;
}

body[data-path^="pre-admission"] .pa-account-widget .nav-link.nav-avatar {
	display: flex;
	align-items: center;
	padding: 4px;
	border-radius: 999px;
	background: var(--rchs-bg-soft);
	border: 1px solid var(--rchs-line);
	transition: border-color .18s var(--rchs-ease);
}

body[data-path^="pre-admission"] .pa-account-widget .nav-link.nav-avatar:hover {
	border-color: var(--rchs-blue);
}

body[data-path^="pre-admission"] .pa-account-widget .user-image-wrapper,
body[data-path^="pre-admission"] .pa-account-widget .avatar,
body[data-path^="pre-admission"] .pa-account-widget .avatar-frame {
	width: 28px !important;
	height: 28px !important;
}

body[data-path^="pre-admission"] .pa-account-widget .dropdown-menu {
	font-family: 'Inter', sans-serif;
	border: 1px solid var(--rchs-line);
	border-radius: var(--rchs-radius-sm);
	box-shadow: 0 12px 28px rgba(10, 32, 54, .12);
	padding: 6px;
	margin-top: 8px;
}

body[data-path^="pre-admission"] .pa-account-widget .dropdown-item {
	border-radius: 8px;
	font-size: 13.5px;
	padding: 8px 12px;
	color: var(--rchs-navy-ink);
}

body[data-path^="pre-admission"] .pa-account-widget .dropdown-item:hover {
	background: var(--rchs-bg-soft);
	color: var(--rchs-blue);
}

/* Same fix as .sa-account-widget's own RTL rule in student_applicant_theme.css -
   see that comment for the full explanation. Bootstrap/Popper's RTL
   placement right-aligns this relocated dropdown to its toggle, opening
   leftward - but the toggle sits close to the left edge of .pa-topbar, so
   the menu gets pushed mostly off-screen (large negative computed `left`).
   Pinning it to a fixed left-anchored position keeps it fully on-screen. */
html[dir="rtl"] body[data-path^="pre-admission"] .pa-account-widget .dropdown-menu {
	text-align: right;
	position: absolute !important;
	inset: auto !important;
	top: 100% !important;
	left: 0 !important;
	right: auto !important;
	transform: none !important;
}

/* "Already submitted" notice (preadmission.js, get_user_role_info callback) -
   inserted right before .web-form-header, in normal document flow, while
   .pa-topbar sits at top:28px as position:absolute (so it doesn't
   push flow content down on its own) - without its own top margin this
   banner's first ~40px render underneath the pill. !important on
   padding/border-radius/box-shadow: the inline style="..." this banner's
   own JS sets (direction/text-align/pointer-events) doesn't touch these,
   but Bootstrap's own .alert rules are equal specificity to a plain #id
   selector here and load after this file, so without it those still win. */
body[data-path^="pre-admission"] #pa-already-submitted-notice {
	width: 100%;
	max-width: 960px;
	box-sizing: border-box;
	margin-block: 72px 20px !important;
	padding: 18px 22px !important;
	border-radius: var(--rchs-radius-sm) !important;
	border: 1px solid #BFE8E2;
	background: var(--rchs-teal-soft);
	color: #0E6F66;
	box-shadow: 0 4px 14px rgba(10, 32, 54, .05) !important;
	font-family: 'Inter', sans-serif;
}

body[data-path^="pre-admission"] #pa-already-submitted-notice strong {
	font-family: 'Space Grotesk', sans-serif;
	font-size: 16px;
	color: var(--rchs-navy-ink);
}

body[data-path^="pre-admission"] #pa-already-submitted-notice a {
	color: #0E6F66;
	font-weight: 600;
	text-decoration: underline;
}

@media (max-width: 880px) {
	body[data-path^="pre-admission"] #pa-already-submitted-notice {
		margin-block: 56px 16px !important;
	}
}

/* ============ CARD SHELL ============ */
body[data-path^="pre-admission"] .web-form-header {
	background: var(--rchs-surface);
	border: 1px solid var(--rchs-line);
	border-bottom: none;
	border-top-left-radius: var(--rchs-radius-md);
	border-top-right-radius: var(--rchs-radius-md);
	padding: 2.25rem 2.25rem 0;
	box-shadow: 0 1px 0 rgba(10, 32, 54, .02);
}

body[data-path^="pre-admission"] .web-form-head {
	border-bottom: 1px solid var(--rchs-line);
}

body[data-path^="pre-admission"] .web-form-title h1 {
	font-family: 'Space Grotesk', sans-serif;
	font-weight: 700;
	letter-spacing: -.01em;
	color: var(--rchs-navy-ink);
}

body[data-path^="pre-admission"] .web-form-introduction {
	color: var(--rchs-muted);
	line-height: 1.6;
}

body[data-path^="pre-admission"] .web-form {
	background: var(--rchs-surface);
	border: 1px solid var(--rchs-line);
	border-top: none;
	border-bottom-left-radius: var(--rchs-radius-md);
	border-bottom-right-radius: var(--rchs-radius-md);
	box-shadow: 0 20px 44px rgba(10, 32, 54, .06);
}

/* ============ SECTION / FIELD TYPOGRAPHY ============ */
body[data-path^="pre-admission"] .form-section .section-head {
	font-family: 'Space Grotesk', sans-serif;
	font-weight: 600;
	color: var(--rchs-blue-dark);
}

body[data-path^="pre-admission"] .control-label {
	color: var(--rchs-navy-ink);
	font-weight: 600;
	font-size: 13.5px;
}

/* ============ INPUTS ============ */
/* Baseline only - never !important, so preadmission.js's own inline
   invalid/valid border-color styles (markFieldInvalid, civil-registry
   validation) still win as they already do over core's default styling. */
body[data-path^="pre-admission"] .form-control,
body[data-path^="pre-admission"] .web-form-wrapper select.form-control {
	font-family: inherit;
	background: var(--rchs-bg-soft);
	border: 1.5px solid var(--rchs-line);
	border-radius: var(--rchs-radius-sm);
	color: var(--rchs-navy-ink);
	transition: border-color .18s var(--rchs-ease), background .18s var(--rchs-ease), box-shadow .18s var(--rchs-ease);
}

body[data-path^="pre-admission"] .form-control::placeholder {
	color: #9AACBB;
}

body[data-path^="pre-admission"] .form-control:focus {
	background: var(--rchs-surface);
	border-color: var(--rchs-blue);
	box-shadow: 0 0 0 4px rgba(7, 105, 178, .12);
}

/* ============ BUTTONS ============ */
body[data-path^="pre-admission"] .web-form-footer .submit-btn,
body[data-path^="pre-admission"] .web-form-footer .btn-next {
	font-family: 'Space Grotesk', sans-serif;
	font-weight: 600;
	letter-spacing: .01em;
	color: #fff;
	background: linear-gradient(135deg, var(--rchs-blue) 0%, var(--rchs-blue-dark) 100%);
	border: none;
	border-radius: var(--rchs-radius-sm);
	box-shadow: 0 8px 20px rgba(7, 105, 178, .24);
	transition: transform .15s var(--rchs-ease), box-shadow .15s var(--rchs-ease), filter .15s var(--rchs-ease);
}

body[data-path^="pre-admission"] .web-form-footer .submit-btn:hover,
body[data-path^="pre-admission"] .web-form-footer .btn-next:hover {
	filter: brightness(1.05);
	box-shadow: 0 10px 24px rgba(7, 105, 178, .32);
	transform: translateY(-1px);
}

body[data-path^="pre-admission"] .web-form-footer .discard-btn,
body[data-path^="pre-admission"] .web-form-footer .btn-previous {
	font-weight: 600;
	color: var(--rchs-muted);
	background: var(--rchs-surface);
	border: 1.5px solid var(--rchs-line);
	border-radius: var(--rchs-radius-sm);
}

body[data-path^="pre-admission"] .web-form-footer .discard-btn:hover,
body[data-path^="pre-admission"] .web-form-footer .btn-previous:hover {
	border-color: var(--rchs-blue);
	color: var(--rchs-blue);
}

/* ============ STEP PROGRESS DOTS ============ */
body[data-path^="pre-admission"] .slides-progress .slide-step {
	border-color: var(--rchs-line);
	background: var(--rchs-surface);
}

body[data-path^="pre-admission"] .slides-progress .slide-step .slide-step-indicator {
	background: var(--rchs-line);
}

body[data-path^="pre-admission"] .slides-progress .slide-step.active {
	border-color: var(--rchs-blue);
}

body[data-path^="pre-admission"] .slides-progress .slide-step.active .slide-step-indicator {
	background: var(--rchs-blue);
}

body[data-path^="pre-admission"] .slides-progress .slide-step.step-success:not(.active) {
	background: var(--rchs-teal);
	border-color: var(--rchs-teal);
}

/* ============ SUCCESS PAGE ============ */
body[data-path^="pre-admission"] .success-page {
	background: var(--rchs-surface);
	border: 1px solid var(--rchs-line);
	border-radius: var(--rchs-radius-md);
	box-shadow: 0 20px 44px rgba(10, 32, 54, .06);
}

body[data-path^="pre-admission"] .success-title {
	font-family: 'Space Grotesk', sans-serif;
	color: var(--rchs-navy-ink);
}

body[data-path^="pre-admission"] .success-icon {
	color: var(--rchs-teal);
}

body[data-path^="pre-admission"] a {
	color: var(--rchs-blue);
}

body[data-path^="pre-admission"] a:hover {
	color: var(--rchs-blue-dark);
}

@media (max-width: 880px) {
	body[data-path^="pre-admission"] .web-form-header,
	body[data-path^="pre-admission"] .web-form {
		border-radius: 0;
		border-left: none;
		border-right: none;
	}
}
