/*
 * Same split brand-panel / form-panel redesign as preadmission_theme.css,
 * applied to the Student Applicant web form (/student-applicant/*) - see
 * that file for the full rationale (RCHS palette/fonts, why this is
 * CSS-only for form styling, why field validation is untouched).
 *
 * One deliberate difference from preadmission_theme.css: THIS form is
 * normally reached by a signed-in applicant (once their account exists
 * post pre-admission activation) - login_required is set on this web form,
 * and the navbar's account dropdown (templates/includes/navbar/navbar_login.html,
 * #website-post-login) is their only way back to their profile/logout
 * from this page. The navbar is still fully hidden here (same as
 * login_theme.css/preadmission_theme.css - it read as cluttered sitting
 * above the brand panel), but student_applicant_theme.js relocates that
 * exact #website-post-login element (avatar + "My Account"/"Log out"
 * dropdown, untouched - not rebuilt) into a themed pill inside the page
 * itself (.sa-account-widget, next to the language pill), so the account
 * menu is never actually lost, just moved. Core's own render_user()
 * (frappe-web bundle) populates/toggles that element purely by class
 * (".logged-in", ".user-image-wrapper") wherever it lives in the DOM, so
 * relocating it doesn't break that.
 */

@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^="student-applicant"] {
	font-family: 'Inter', sans-serif;
	background: var(--rchs-bg-soft);
	color: var(--rchs-navy-ink);
	-webkit-font-smoothing: antialiased;
}

html[dir="rtl"] body[data-path^="student-applicant"],
html[lang^="ar"] body[data-path^="student-applicant"] {
	font-family: 'IBM Plex Sans Arabic', 'Inter', sans-serif;
}

body[data-path^="student-applicant"] .navbar {
	display: none !important;
}

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

/* !important: web_form.scss's own
   "[data-doctype='Web Form'] .page-content-wrapper .container .page_content"
   chains four class-level selectors (0,4,0) against this file's two
   (0,2,1) - without !important its "max-width: 800px; margin: auto" wins
   and .page_content never actually shifts into the space the brand panel
   reserves (margin:auto on an unconstrained-width block resolves to 0,
   not centered), leaving form fields rendered underneath the fixed panel. */
body[data-path^="student-applicant"] .page_content {
	max-width: none !important;
	margin-inline-start: 38% !important;
	min-height: 100vh;
}

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

/* ============ BRAND PANEL (decorative, injected by student_applicant_theme.js) ============ */
body[data-path^="student-applicant"] .sa-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^="student-applicant"] .sa-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^="student-applicant"] .sa-brand-top {
	display: flex;
	align-items: center;
	gap: 14px;
	position: relative;
	z-index: 2;
}

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

body[data-path^="student-applicant"] .sa-brand-wordmark {
	display: flex;
	flex-direction: column;
	line-height: 1.15;
}

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

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

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

body[data-path^="student-applicant"] .sa-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^="student-applicant"] .sa-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^="student-applicant"] .sa-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^="student-applicant"] .sa-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^="student-applicant"] .sa-brand-checklist {
	margin-top: 30px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

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

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

body[data-path^="student-applicant"] .sa-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;
}

/* 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: student_applicant_theme.js also inserts a
   separate, plain .sa-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^="student-applicant"] .sa-brand-panel {
		display: none;
	}

	body[data-path^="student-applicant"] .page_content {
		margin-inline-start: 0 !important;
	}
}

/* Desktop/tablet already gets the logo from the sidebar .sa-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^="student-applicant"] .sa-mobile-logo {
	display: none;
}

/* ============ FORM PANEL ============ */
/* padding-top cleared to sit below .sa-topbar (position:absolute, so it
   doesn't push flow content down on its own) - the account widget/lang
   pill sit at top:28px with ~38px of their own height, so whichever
   banner (payment notice / acceptance-status notice / role-redirect) or
   the form itself renders first in flow needs enough top padding to
   clear that, or its own top portion renders hidden underneath it. */
body[data-path^="student-applicant"] .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^="student-applicant"] .page_content {
		padding-top: 76px;
	}
}

body[data-path^="student-applicant"] .web-form-container {
	width: 100% !important;
	max-width: 960px !important;
	flex: 0 0 auto;
	align-self: center !important;
	margin: 0 auto !important;
}

/* Notice banners - #sa-admission-payment-notice (get_admission_payment_notice),
   #sa-acceptance-status-notice ("Application Under Review" etc.,
   showAcceptanceStatusNotice) and #sa-role-redirect are all plain
   Bootstrap .alert divs student_applicant.js inserts as flex siblings of
   .web-form-container inside .page_content, with no width of their own -
   in a flex column with align-items:center they only ever shrink-wrap
   their text, so their edges never lined up with the card's below them.
   !important on padding/border-radius/box-shadow: student_applicant.js
   sets inline style.padding/.margin directly on these (e.g. "12px 14px"),
   which otherwise wins over any plain class rule here regardless of
   selector specificity. */
body[data-path^="student-applicant"] #sa-admission-payment-notice,
body[data-path^="student-applicant"] #sa-acceptance-status-notice,
body[data-path^="student-applicant"] #sa-role-redirect {
	width: 100% !important;
	max-width: 960px !important;
	flex: 0 0 auto;
	align-self: center !important;
	box-sizing: border-box;
	font-family: 'Inter', sans-serif;
	border-radius: var(--rchs-radius-sm) !important;
	padding: 16px 20px !important;
	margin: 32px auto 20px !important;
	box-shadow: 0 4px 14px rgba(10, 32, 54, .05) !important;
}

/* "Pay Now" CTA inside #sa-admission-payment-notice - plain Bootstrap
   .btn-primary by default (Bootstrap's own blue, not the RCHS brand
   blue), restyled to match the submit/next buttons elsewhere in this
   theme. !important: Bootstrap's .btn-primary sets background/border
   directly on the same single class, same specificity as this rule -
   without !important, source order (Bootstrap's stylesheet loads before
   this file's own <link>, so this should already win, but load order
   between web_include_css entries and bundled core CSS isn't guaranteed)
   isn't something to depend on here. */
body[data-path^="student-applicant"] .sa-pay-now-btn {
	background: linear-gradient(135deg, var(--rchs-blue) 0%, var(--rchs-blue-dark) 100%) !important;
	border-color: var(--rchs-blue-dark) !important;
	font-weight: 600;
	box-shadow: 0 4px 12px rgba(7, 105, 178, .28);
	transition: filter .15s var(--rchs-ease), box-shadow .15s var(--rchs-ease);
}

body[data-path^="student-applicant"] .sa-pay-now-btn:hover {
	filter: brightness(1.05);
	box-shadow: 0 6px 16px rgba(7, 105, 178, .36);
}

/* Top-right row - holds the language pill and (for signed-in applicants)
   the relocated account widget side by side. */
body[data-path^="student-applicant"] .sa-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 .sa-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 .sa-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^="student-applicant"] .sa-topbar {
		position: fixed;
		top: 14px;
		inset-inline-end: 16px;
		z-index: 20;
	}
}

/* The logo now lives INSIDE .page_content (student_applicant_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
   .sa-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^="student-applicant"] .sa-mobile-logo {
		display: flex;
		justify-content: center;
		width: 100%;
		margin-top: 20px;
		margin-bottom: 8px;
	}

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

/* Language pill - real switching via the exact cookie+reload mechanism
   student_applicant.js's own handleLanguageSelection() already uses (see
   student_applicant.js ~line 2072). */
body[data-path^="student-applicant"] .sa-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^="student-applicant"] .sa-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^="student-applicant"] .sa-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 + "My
   Account"/"Log out" dropdown), relocated here as-is by
   student_applicant_theme.js. Overrides its navbar-nav styling (which
   assumed a Bootstrap navbar parent it no longer has) with a matching
   pill of its own; the dropdown-menu itself is left to Bootstrap's own
   positioning/toggle logic, only restyled to fit the theme. */
body[data-path^="student-applicant"] .sa-account-widget#website-post-login {
	display: flex !important;
	align-items: center;
	list-style: none;
}

body[data-path^="student-applicant"] .sa-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^="student-applicant"] .sa-account-widget .nav-link.nav-avatar:hover {
	border-color: var(--rchs-blue);
}

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

body[data-path^="student-applicant"] .sa-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^="student-applicant"] .sa-account-widget .dropdown-item {
	border-radius: 8px;
	font-size: 13.5px;
	padding: 8px 12px;
	color: var(--rchs-navy-ink);
}

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

/* Bootstrap/Popper's RTL dropdown placement right-aligns the menu to its
   toggle (so it opens leftward from there) - the normal, correct behavior
   in a full-width RTL navbar with room to spare on the left. This widget
   was relocated out of that navbar into .sa-topbar (relocateAccountWidget(),
   student_applicant_theme.js) and sits close to the left edge of this
   narrow panel instead, so that same leftward placement pushes most of the
   menu off-screen (computed to a large negative `left`, e.g. -122px, with
   only a sliver of its ~160px width actually visible - "half hidden on the
   left"). Pinning it to a fixed left-anchored position (like default LTR
   placement) instead of Popper's dynamic RTL offset keeps it fully
   on-screen, opening rightward from the toggle where this narrow layout
   actually has room. text-align: right still keeps the Arabic item text
   itself correctly aligned. */
html[dir="rtl"] body[data-path^="student-applicant"] .sa-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;
}

/* ============ CARD SHELL ============ */
body[data-path^="student-applicant"] .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^="student-applicant"] .web-form-head {
	border-bottom: 1px solid var(--rchs-line);
}

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

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

body[data-path^="student-applicant"] .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^="student-applicant"] .form-section .section-head {
	font-family: 'Space Grotesk', sans-serif;
	font-weight: 600;
	color: var(--rchs-blue-dark);
}

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

/* ============ INPUTS ============ */
/* Baseline only - never !important, so student_applicant.js's own inline
   invalid/valid border-color styles still win, same as preadmission_theme.css. */
body[data-path^="student-applicant"] .form-control,
body[data-path^="student-applicant"] .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^="student-applicant"] .form-control::placeholder {
	color: #9AACBB;
}

body[data-path^="student-applicant"] .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^="student-applicant"] .web-form-footer .submit-btn,
body[data-path^="student-applicant"] .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^="student-applicant"] .web-form-footer .submit-btn:hover,
body[data-path^="student-applicant"] .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^="student-applicant"] .web-form-footer .discard-btn,
body[data-path^="student-applicant"] .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^="student-applicant"] .web-form-footer .discard-btn:hover,
body[data-path^="student-applicant"] .web-form-footer .btn-previous:hover {
	border-color: var(--rchs-blue);
	color: var(--rchs-blue);
}

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

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

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

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

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

/* ============ SUCCESS PAGE ============ */
body[data-path^="student-applicant"] .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^="student-applicant"] .success-title {
	font-family: 'Space Grotesk', sans-serif;
	color: var(--rchs-navy-ink);
}

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

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

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

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

/* Spinner shown inside the Submit button while its accept() request is
   in-flight (see setupSubmitSpinner() in student_applicant.js) - plain
   CSS border-spin, no extra markup/library needed. */
body[data-path^="student-applicant"] .sa-submit-spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, .4);
	border-top-color: #fff;
	border-radius: 50%;
	vertical-align: -2px;
	margin-inline-end: 6px;
	animation: sa-submit-spin .7s linear infinite;
}

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