/* Operqon website + login layer (REDESIGN-SPEC §5: "Login page — token
 * surface, tenant logo, action button").
 *
 * Loaded through web_include_css, so it reaches the website pages the
 * tenant surface actually exposes — above all /login. Every rule is
 * scoped to the login page's own wrapper (#page-login) so no other
 * website page changes. The logo itself is NOT set here: the branding
 * installer points Website Settings app_logo at the Operqon lockup,
 * which is the source frappe/www/login.py reads first (the app's
 * app_logo_url hook is the fallback).
 *
 * The website bundle compiles its palette at build time, so the login
 * card and its action button take the token values through the direct
 * rules below (values only — no markup is patched). Each var() carries
 * the literal token value as its fallback, resolved from the same
 * tokens.source.json the Desk file is generated from, because the
 * generated token file itself is a Desk-side (app_include_css) asset.
 *
 * v3 alignment (operqon-v3-dreams-erp, 2026-11-12): the literal
 * fallbacks below now carry the Dreams ERP package values
 * (#0F766E / #0C6760, bg #F8F9FA, border #E8E9EC, radius 6px) so the
 * login page matches the v3 SPA shell; the --opq-* vars still win
 * wherever the Desk token file is loaded.
 */
#page-login {
	background: var(--opq-bg, #f8f9fa);
}

#page-login .page-card {
	border: 1px solid var(--opq-border, #e8e9ec);
	border-radius: var(--opq-radius-lg, 6px);
	box-shadow: var(--opq-shadow, 0 8px 28px rgba(20, 39, 47, 0.08));
}

/* The v16 login submit is an Espresso button, not a bootstrap one
 * (F3, fixed 2026-11-08): frappe/www/login.html renders
 * <button class="es-button w-full" data-variant="solid" type="submit">
 * — no .btn-login / .btn-primary class exists in the current markup,
 * which is why the old rules below never reached it. The espresso
 * button.css paints the solid variant from --surface-gray-10 (hover
 * -9, active -8) with --ink-base text, so the login scope re-points
 * exactly those steps at the action tokens (the generated token file
 * is Desk-side only, hence the literal fallbacks the header notes).
 * The bootstrap-class rules are kept for the website pages that still
 * render .btn-primary inside the login wrapper (message/CTA pages). */
#page-login {
	--surface-gray-10: var(--opq-action, #0f766e);
	--surface-gray-9: var(--opq-action-dark, #0c6760);
	--surface-gray-8: var(--opq-action-dark, #0c6760);
	--ink-base: #ffffff;
}

#page-login .btn-login,
#page-login .btn-primary {
	background-color: var(--opq-action, #0f766e);
	border-color: var(--opq-action, #0f766e);
	color: #ffffff;
	border-radius: var(--opq-radius-sm, 6px);
}

#page-login .btn-login:hover,
#page-login .btn-login:focus,
#page-login .btn-primary:hover,
#page-login .btn-primary:focus {
	background-color: var(--opq-action-dark, #0c6760);
	border-color: var(--opq-action-dark, #0c6760);
	color: #ffffff;
}

#page-login a:not(.btn) {
	color: var(--opq-action, #0f766e);
}

#page-login .social-login .btn,
#page-login .login-with-email-link .btn {
	border-radius: var(--opq-radius-sm, 6px);
}

/* ————————————————————————————————————————————————————————————————
 * E1 (2026-11-18): the login page takes the Dreams Core sign-in
 * anatomy — the same split the customer portal sign-in uses
 * (operqon.cloud/customer): form panel on the left, dark brand
 * panel on the right. CSS only, per this file's contract: every
 * rule is scoped to #page-login, no markup is patched, and the
 * form's ids, buttons and flows (password, email link, forgot,
 * Operqon SSO) are exactly the ones login.js already drives.
 * The brand panel is a pseudo-element on .page_content, so it
 * persists across the login / email-login / forgot / signup
 * sections, which all render inside the same wrapper.
 * ———————————————————————————————————————————————————————————————— */

/* Page frame: full-viewport split. The website bundle centres its
 * container; the login scope takes the full width and reserves the
 * right-hand band for the brand panel. */
#page-login .container {
	max-width: none;
	padding-left: 0;
	padding-right: 0;
}

#page-login .page_content {
	position: relative;
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 44vw 40px 24px;
}

/* Brand panel (right band): deep-navy gradient, the reversed Operqon
 * lockup as a background image, then the portal panel's own line and
 * three product points as pre-line text. */
#page-login .page_content::after {
	content: "Your business.\A Working together.\A\A Sales, stock and accounts in one place\A Plans, billing and team access built in\A One secure sign-in for your whole business";
	white-space: pre-line;
	box-sizing: border-box;
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: 42vw;
	padding: 120px 56px 56px;
	background-color: var(--opq-deep, #0b1e25);
	background-image: url("/assets/operqon_core/images/operqon-reversed-horizontal.svg"),
		linear-gradient(160deg, var(--opq-deep, #0b1e25) 0%, var(--opq-ink, #14272f) 100%);
	background-repeat: no-repeat, no-repeat;
	background-position: 56px 48px, center;
	background-size: 168px auto, cover;
	color: #ffffff;
	font-family: var(--opq-font-sans, Inter, ui-sans-serif, system-ui, sans-serif);
	font-size: 15px;
	line-height: 1.9;
	z-index: 1;
}

/* The sections are the flex items of .page_content; pin their width
 * so the form panel is deterministic instead of content-sized. */
#page-login .page_content > section {
	width: 100%;
	max-width: 430px;
}

/* The card becomes the form panel: white surface, template radius
 * and padding, one soft shadow — the portal sign-in card's posture. */
#page-login .login-content.page-card {
	background: var(--opq-white, #ffffff);
	border: 1px solid var(--opq-border, #e8e9ec);
	border-radius: var(--opq-radius-lg, 16px);
	box-shadow: var(--opq-shadow, 0 8px 28px rgba(20, 39, 47, 0.08));
	max-width: 430px;
	width: 100%;
	margin: 0 auto;
	padding: 36px 36px 30px;
	position: relative;
	z-index: 2;
}

#page-login .app-logo {
	height: 34px;
	width: auto;
}

#page-login .page-card-head h4 {
	font-family: var(--opq-font-sans, Inter, ui-sans-serif, system-ui, sans-serif);
	color: var(--opq-ink, #14272f);
	letter-spacing: -0.01em;
}

#page-login .page-card-subtitle {
	color: var(--opq-slate, #5b7075);
}

/* Fields: template input posture — 44px tall, token border, action
 * focus ring (the same ring the Desk token file declares). */
#page-login .form-group label {
	font-size: 13px;
	font-weight: 600;
	color: var(--opq-ink, #14272f);
}

#page-login .form-control {
	height: 44px;
	border: 1px solid var(--opq-border, #dce8e5);
	border-radius: var(--opq-radius-sm, 8px);
	background: var(--opq-white, #ffffff);
	color: var(--opq-ink, #14272f);
	font-size: 14px;
	padding: 0 12px;
}

#page-login .form-control:focus {
	border-color: var(--opq-action, #00786f);
	box-shadow: var(--opq-focus, 0 0 0 3px rgba(0, 141, 131, 0.28));
	outline: none;
}

#page-login .password-field .toggle-password {
	color: var(--opq-slate, #5b7075);
}

/* Actions: full-width template buttons at 44px. The solid Continue
 * button's fill already resolves to the action token through the
 * surface-step re-point above; here it gains the template's radius
 * and weight. */
#page-login .page-card-actions .es-button {
	min-height: 44px;
	border-radius: var(--opq-radius-sm, 8px);
	font-weight: 600;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Email-link option: ghost button on the white panel. */
#page-login .btn-login-with-email-link {
	background: var(--opq-white, #ffffff);
	border: 1px solid var(--opq-border, #dce8e5);
	color: var(--opq-ink, #14272f);
}

#page-login .btn-login-with-email-link:hover {
	border-color: var(--opq-action, #00786f);
	color: var(--opq-action, #00786f);
}

/* SSO: divided from the password flow and promoted to the brand
 * button — deep navy, white text. The anchor and its authorize
 * href are untouched; only the paint changes. */
#page-login .social-logins {
	border-top: 1px solid var(--opq-border, #dce8e5);
	padding-top: 18px;
	margin-top: 2px;
}

#page-login .btn-operqon {
	background: var(--opq-deep, #0b1e25);
	border: 1px solid var(--opq-deep, #0b1e25);
	color: #ffffff;
}

#page-login .btn-operqon:hover {
	background: var(--opq-ink, #14272f);
	border-color: var(--opq-ink, #14272f);
	color: #ffffff;
}

/* The error banner keeps its mechanics; it gains the template
 * radius so a failed sign-in reads as part of the same panel. */
#page-login .login-error-banner {
	border-radius: var(--opq-radius-sm, 8px);
}

/* Mobile / narrow: single column. The brand panel collapses to a
 * top band carrying the lockup and the one-line promise; the
 * bullet lines retire (the form is the whole job on a phone). */
@media (max-width: 991px) {
	#page-login .page_content {
		flex-direction: column;
		justify-content: flex-start;
		padding: 0 16px 32px;
		min-height: 0;
	}

	#page-login .page_content::after {
		content: "Your business. Working together.";
		order: -1;
		position: relative;
		width: calc(100% + 32px);
		margin: 0 -16px 24px;
		padding: 76px 24px 22px;
		background-position: 24px 22px, center;
		background-size: 140px auto, cover;
		font-size: 17px;
		font-weight: 600;
		line-height: 1.4;
	}

	#page-login .login-content.page-card {
		padding: 28px 22px 24px;
	}
}
