/*
 * Peppermint Christian College — shared visual theme.
 * Loaded on both Desk (app_include_css) and the website/portal (web_include_css),
 * so the same look applies everywhere a user sees this platform — Desk admin
 * screens, the public website, the login page, and the Student/Parent portals.
 *
 * Palette sampled directly from the school's own logo (see
 * docs/reference/peppermint-christian-college/brand-guide.md) — not invented:
 *   Primary Purple #650F80, Peach/Tan #FACDAA, White.
 *
 * Font: Poppins (Google Fonts), 3 weights, Latin subset only — a few tens of
 * KB total, still well within the brief's low-data intent. The original
 * choice here was a system-font stack (zero network cost) on the reasoning
 * that it "reads as distinct from Frappe's default Inter at zero cost" —
 * that held up in computed-style terms (confirmed: it was genuinely
 * applying) but not visually: system-UI fonts (San Francisco/Segoe UI) are
 * close enough to Inter that nobody could actually see the difference,
 * which is the opposite of the brief's "100% different look and feel" goal
 * for this session. Poppins is geometric/rounded and reads as clearly
 * different at a glance, which is the actual point.
 */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap");

:root,
[data-theme="light"] {
	--ppc-purple: #650f80;
	--ppc-purple-dark: #4a0b5e;
	--ppc-purple-light: #8a3aa8;
	--ppc-peach: #facdaa;
	--ppc-peach-dark: #f0a868;
	--ppc-ink: #2b1733;
	--ppc-surface: #ffffff;
	--ppc-surface-tint: #fdf8fb;
	--ppc-radius: 14px;
	--ppc-shadow: 0 2px 10px rgba(101, 15, 128, 0.08), 0 1px 2px rgba(101, 15, 128, 0.06);
	--ppc-shadow-lg: 0 8px 28px rgba(101, 15, 128, 0.14);

	/* Re-point Frappe's own tokens at the brand palette rather than
	   rewriting every component that consumes them. */
	--primary: var(--ppc-purple);
	--primary-color: var(--ppc-purple);
	--font-stack: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
		Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;

	--radius: 10px;
	--radius-sm: 6px;
	--radius-md: 12px;
	--radius-lg: 16px;
	--radius-xl: 20px;
}

/* !important: Desk's own CSS sets font-family at (at least) the same
   specificity on body, and LMS's Tailwind bundle sets it on html/body too
   (its own @font-face'd InterVar) — without !important this rule was losing
   the cascade in both places despite loading last, which is why the font
   swap wasn't visually showing up anywhere even though it was technically
   "applying" per getComputedStyle in isolated testing. */
html,
body {
	font-family: var(--font-stack) !important;
}

/* Website/portal navbar (templates/includes/navbar/navbar.html - used by
   /login, /student-portal, /parent-portal, and any other Jinja website
   page). This is NOT the same shell as modern Desk below - verified
   live via Playwright, 2026-11-29, after the first version of this file
   shipped with only this rule and visibly had no effect on /app at all. */
.navbar.navbar-light {
	background: linear-gradient(135deg, var(--ppc-purple) 0%, var(--ppc-purple-dark) 100%) !important;
	border-bottom: none !important;
}
.navbar.navbar-light .navbar-brand,
.navbar.navbar-light a,
.navbar.navbar-light .text-muted {
	color: #f5e9f8 !important;
}
.navbar.navbar-light a:hover {
	color: #ffffff !important;
}

/* Desk's actual shell (confirmed live via Playwright DOM inspection,
   2026-11-29 - this version of Frappe uses a left icon rail
   (.body-sidebar) plus a separate top "dock" bar, not the
   .navbar-light template above). */
.body-sidebar {
	background: linear-gradient(180deg, var(--ppc-purple) 0%, var(--ppc-purple-dark) 100%) !important;
	color: #f5e9f8 !important;
}
.body-sidebar .item-anchor,
.body-sidebar .sidebar-header,
.body-sidebar .drop-icon svg {
	color: #f5e9f8 !important;
	stroke: #f5e9f8 !important;
}
.body-sidebar .item-anchor:hover {
	background: rgba(255, 255, 255, 0.14) !important;
	color: #ffffff !important;
}
/* The active/selected state (confirmed live via DOM inspection: it's
   .standard-sidebar-item.active-sidebar on the LIST ITEM, not .selected on
   .item-anchor itself — that selector above never matched anything) is
   Frappe's own near-white pill, confirmed computed as a solid light
   background. Our light-pink text color from the base .item-anchor rule
   above was still winning on top of it, which is nearly unreadable — pale
   pink text on a near-white pill. Give the active item its own solid,
   high-contrast treatment instead of trying to keep it on the purple
   scheme: peach fill with dark purple text, readable regardless of
   whatever background shade Frappe itself puts under it. */
.body-sidebar .standard-sidebar-item.active-sidebar .item-anchor {
	background: var(--ppc-peach) !important;
	color: var(--ppc-purple-dark) !important;
}
.body-sidebar .standard-sidebar-item.active-sidebar .item-anchor svg {
	stroke: var(--ppc-purple-dark) !important;
}
.body-sidebar .sidebar-item-icon svg {
	stroke: #f5e9f8 !important;
}

#desk-dock {
	background: var(--ppc-purple) !important;
	color: #f5e9f8 !important;
}
#desk-dock .dock-item,
#desk-dock a {
	color: #f5e9f8 !important;
}

/* App/module logos: the "/desk" app-switcher tiles (.app-icon, confirmed via
   DOM inspection) and the ERPNext home workspace's shortcut icons (plain
   <img> tags pointing at each app's own colored logo file, e.g.
   erpnext-logo.svg for "Accounts" — also confirmed live) are each app's own
   branding, not Desk chrome, so app_include_css never touched them. A CSS
   filter is the only lever that doesn't mean hand-replacing dozens of
   per-workspace icon references: desaturate then re-tint toward the brand
   purple so they read as one consistent palette instead of each app's
   separate stock colors. */
.app-icon,
img[src*="-logo.svg"],
img[src*="learning.svg"] {
	filter: grayscale(1) sepia(1) saturate(6) hue-rotate(245deg) brightness(0.85);
}

/* "Framework" is literally the frappe app itself, shown as a selectable
   tile alongside ERPNext/Education/Learning on the app-switcher screen —
   a developer/internal concept with no meaning to a parent, student, or
   teacher, and a dead giveaway "this is Frappe" to anyone technical.
   Hiding the one tile is reversible, cosmetic-only CSS; nothing about
   Frappe itself is removed or disabled. */
.desktop-icon:has(img[alt="Framework"]) {
	display: none !important;
}

/* LMS's SPA (/lms/*) is a separately-built Vue+Tailwind bundle with no
   app_include_css hook loop at all (confirmed: lms/www/_lms.html has no
   include-css/js loop, unlike every other Frappe page) — this stylesheet
   only reaches it because school_custom/website.py's website_path_resolver
   intercepts the /lms route and renders our own copy of the shell with this
   file's <link> injected. Reskinning the compiled Tailwind classes
   themselves isn't possible without rebuilding lms's frontend from source,
   which isn't attempted here. What IS real and confirmed by reading the
   actual served bundle (not guessed): Tailwind v4's utilities compile to
   `background-color: var(--surface-gray-1, oklch(...))`-style rules, i.e.
   every surface/ink/outline color in the whole SPA is a CSS custom property
   with a literal fallback — so re-declaring those same :root variables here,
   after the bundle's own stylesheet in <head>, wins the cascade (same
   specificity, later rule) and actually retints the live app, not just the
   shell chrome around it. This does NOT reach button/accent colors — lms's
   design system ties those to the gray scale directly (a monochrome design,
   confirmed: no single --primary-style token exists in its CSS to redirect),
   so "purple everywhere" isn't achievable without a source rebuild, but the
   neutral surfaces that make up most of the chrome (sidebar, panels, page
   background) now read as warm/branded instead of Frappe's stock gray. */
[data-theme="light"] {
	--surface-sidebar: #f6edf8;
	--surface-gray-1: #faf4fb;
	--surface-gray-2: #f3e6f0;
	--surface-elevation-1: #ffffff;
	--surface-elevation-2: #fffaf7;
	--ink-gray-9: var(--ppc-ink);
	--ink-gray-6: #7a5a82;
	--ink-gray-5: #8a6a92;
	--ink-gray-4: #9c7ea3;
	--outline-gray-1: #f0dcec;
	--outline-gray-2: #e9d4e6;
	--outline-gray-3: #ddc2da;
}

/* lms/www/_lms.html's own inline bootstrap script resolves the user's OS
   dark-mode preference *before* any stylesheet paints (to avoid a
   flash-of-wrong-theme) and sets <html data-theme="dark"> accordingly — so
   any PPC viewing this on a device with system dark mode on gets this block,
   never the [data-theme="light"] one above. Missing this the first time
   around is exactly why a dark-mode screenshot showed zero branding despite
   every other check passing. */
[data-theme="dark"] {
	--surface-sidebar: #241029;
	--surface-gray-1: #2a1330;
	--surface-gray-2: #33173b;
	--surface-elevation-1: #2e1535;
	--surface-elevation-2: #35183d;
	--ink-gray-9: #f5e9f8;
	--ink-gray-6: #d9bfdf;
	--ink-gray-5: #c7a4cf;
	--ink-gray-4: #b58fbe;
	--outline-gray-1: #3a1a43;
	--outline-gray-2: #4a2454;
	--outline-gray-3: #5c2d68;
}

/* Buttons: brand purple primary, soft rounding, no harsh default shadow. */
.btn-primary,
.btn.btn-primary {
	background-color: var(--ppc-purple);
	border-color: var(--ppc-purple);
}
.btn-primary:hover,
.btn.btn-primary:hover {
	background-color: var(--ppc-purple-dark);
	border-color: var(--ppc-purple-dark);
}

/* Login page redesign. The template itself (frappe/www/login.html) can't be
   overridden the way LMS's shell was — it lives at "www/login.html" inside
   the frappe app, which loads first of every installed app, so the same
   ChoiceLoader precedence that blocked a report-card-style override on
   education's template blocks one here too (confirmed by the same
   reasoning verified live elsewhere in this project, not re-tested here
   since the underlying mechanism is identical). So copy strings baked into
   the template ("Sign In", "Welcome! Please sign in to continue.") can't be
   changed without that override; everything else — layout, color, shape,
   the logo's presentation, and the motto line (added via ::after
   generated content, since it isn't in the template at all) — is real CSS,
   verified live via screenshot after each change. */
body[data-path="login"] {
	background:
		radial-gradient(circle at 15% 20%, rgba(250, 205, 170, 0.55) 0%, transparent 45%),
		radial-gradient(circle at 85% 85%, rgba(101, 15, 128, 0.18) 0%, transparent 50%),
		linear-gradient(160deg, var(--ppc-surface-tint) 0%, #f3e6f0 100%);
	min-height: 100vh;
}
body[data-path="login"] .page-content-wrapper {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: 24px 16px;
}
body[data-path="login"] .page-content-wrapper main.container {
	max-width: 440px;
	width: 100%;
	margin: 0;
}
body[data-path="login"] .page-header-wrapper,
body[data-path="login"] .page-breadcrumbs {
	display: none;
}

body[data-path="login"] .page-card {
	border-radius: 20px;
	box-shadow: var(--ppc-shadow-lg);
	border-top: 6px solid var(--ppc-purple);
	overflow: hidden;
	padding: 40px 36px !important;
	background: #ffffff;
}

/* The logo JPEG has a plain white background (no transparent export exists
   yet, flagged since Phase 3) — giving it its own white rounded chip with
   padding makes that a deliberate frame instead of a stray square, and
   centers/enlarges it instead of the template's small left-aligned default. */
body[data-path="login"] .page-card-head {
	align-items: center !important;
	text-align: center !important;
}
body[data-path="login"] .app-logo {
	width: 88px;
	height: 88px;
	object-fit: contain;
	border-radius: 18px;
	background: #ffffff;
	padding: 8px;
	box-shadow: var(--ppc-shadow);
	margin: 0 auto 4px;
}
body[data-path="login"] .page-card-head-text {
	align-items: center !important;
	text-align: center !important;
}
body[data-path="login"] .page-card-head h4 {
	color: var(--ppc-purple-dark) !important;
	font-weight: 700 !important;
}
body[data-path="login"] .page-card-subtitle {
	color: #8a6a92 !important;
}
/* The motto isn't in the template at all - generated content is the only
   way to add it without a controller override. */
body[data-path="login"] .page-card-head-text::after {
	content: "Inspire, Educate, Empower";
	display: block;
	margin-top: 2px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ppc-peach-dark);
}

body[data-path="login"] .form-control {
	border-radius: 10px !important;
	border: 1.5px solid #e9d4e6 !important;
	padding: 10px 14px !important;
}
body[data-path="login"] .form-control:focus {
	border-color: var(--ppc-purple) !important;
	box-shadow: 0 0 0 3px rgba(101, 15, 128, 0.12) !important;
}

body[data-path="login"] .es-button[data-variant="solid"] {
	background: var(--ppc-purple) !important;
	border-color: var(--ppc-purple) !important;
	border-radius: 10px !important;
	font-weight: 600 !important;
}
body[data-path="login"] .es-button[data-variant="solid"]:hover {
	background: var(--ppc-purple-dark) !important;
	border-color: var(--ppc-purple-dark) !important;
}
body[data-path="login"] .btn-login-option {
	border-radius: 10px !important;
	border: 1.5px solid var(--ppc-peach-dark) !important;
	color: var(--ppc-purple-dark) !important;
	background: #fff7f0 !important;
	font-weight: 600 !important;
}
body[data-path="login"] .btn-login-option:hover {
	background: var(--ppc-peach) !important;
}
body[data-path="login"] a[href="#forgot"] {
	color: var(--ppc-purple) !important;
	font-weight: 600 !important;
}

/* ---- Shared component classes for our own custom pages and portals ---- */

.ppc-card {
	background: var(--ppc-surface);
	border-radius: var(--ppc-radius);
	box-shadow: var(--ppc-shadow);
	padding: 20px 22px;
}

.ppc-card + .ppc-card {
	margin-top: 16px;
}

.ppc-card-title {
	color: var(--ppc-purple);
	font-weight: 700;
	font-size: 15px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: 14px;
}

.ppc-stat-row {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
}

.ppc-stat {
	flex: 1 1 160px;
	background: var(--ppc-surface-tint);
	border: 1px solid #f0dcec;
	border-radius: var(--ppc-radius);
	padding: 14px 16px;
}

.ppc-stat-label {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #8a6a92;
	margin-bottom: 4px;
}

.ppc-stat-value {
	font-size: 22px;
	font-weight: 700;
	color: var(--ppc-ink);
}

.ppc-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	background: var(--ppc-peach);
	color: var(--ppc-purple-dark);
}

.ppc-empty-state {
	color: #9c7ea3;
	text-align: center;
	padding: 24px 0;
}

.ppc-list-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 0;
	border-bottom: 1px solid #f3e6f0;
}
.ppc-list-row:last-child {
	border-bottom: none;
}

.ppc-page-header {
	background: linear-gradient(135deg, var(--ppc-purple) 0%, var(--ppc-purple-dark) 100%);
	color: #ffffff;
	border-radius: var(--ppc-radius);
	padding: 24px 26px;
	margin-bottom: 20px;
}
.ppc-page-header h1,
.ppc-page-header h2 {
	color: #ffffff;
	margin: 0;
}
.ppc-page-header p {
	color: #f0dcec;
	margin: 4px 0 0;
}

.ppc-child-switcher {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 18px;
}
.ppc-child-chip {
	padding: 8px 16px;
	border-radius: 999px;
	border: 2px solid var(--ppc-peach);
	background: #ffffff;
	color: var(--ppc-purple);
	font-weight: 600;
	text-decoration: none;
	font-size: 14px;
}
.ppc-child-chip.active,
.ppc-child-chip:hover {
	background: var(--ppc-purple);
	border-color: var(--ppc-purple);
	color: #ffffff;
}
