/* ==========================================================================
   FEDCO Theme — website, login and portal
   --------------------------------------------------------------------------
   IMPORTANT — Frappe's login DOM nests like this:

       .page_content
         └ .container.page-card-container
             └ .page-card                 <- THE CARD. Style this one.
                 ├ .page-card-head
                 └ form.form-signin
                     └ .page-card-body
                         ├ .for-login     <- inner sections, NOT cards
                         ├ .for-forgot
                         └ .for-email-login

   Styling .for-login as a card produces a card nested inside a card and
   squeezes the form into a narrow column. Those inner sections are therefore
   explicitly neutralised below. Only .page-card carries card styling.
   ========================================================================== */

:root {
	--fedco-500: #984A35;
	--fedco-600: #863F2C;
	--fedco-700: #6B3222;
	--fedco-800: #52261A;
	--fedco-gold: #F8C525;
	--fedco-green: #1D9644;
	--fedco-ink: #2A1A14;
	--fedco-50: #FDF6F3;
	--fedco-100: #F7E4DD;
	--fedco-200: #EFC7BA;
	--fedco-300: #DDA08B;
}

/* ==========================================================================
   Login page
   ========================================================================== */
body[data-path="login"] {
	background-color: #FFFFFF;
	min-height: 100vh;
}

/* The page becomes a flex row: the brand panel occupies the left, the card is
   pushed right. Flex rather than percentage margins, so the card cannot drift
   or overlap the panel at intermediate widths. */
body[data-path="login"] .page_content {
	position: relative;
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	padding: 40px 4vw;
}

body[data-path="login"] .page_content > .section,
body[data-path="login"] .page_content > section {
	width: 100%;
	display: flex;
	justify-content: flex-end;
}

/* Brand panel. Fixed so it never scrolls with the form; negative z-index so it
   can never intercept a click on the form. */
body[data-path="login"]::before {
	content: "";
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	width: 46%;
	background:
		radial-gradient(circle at 22% 26%, rgba(248, 197, 37, 0.20) 0%, transparent 45%),
		radial-gradient(circle at 78% 82%, rgba(29, 150, 68, 0.22) 0%, transparent 50%),
		linear-gradient(150deg, var(--fedco-600) 0%, var(--fedco-800) 100%);
	border-radius: 0 46% 46% 0 / 0 50% 50% 0;
	z-index: -1;
	pointer-events: none;
}

body[data-path="login"]::after {
	content: "Field to Ledger. One System.";
	position: fixed;
	left: 4%;
	bottom: 14%;
	width: 32%;
	max-width: 460px;
	color: #FBEDE8;
	font-size: clamp(1.3rem, 2.1vw, 2.1rem);
	font-weight: 600;
	line-height: 1.28;
	letter-spacing: -0.01em;
	z-index: -1;
	pointer-events: none;
}

/* ---- the card ----------------------------------------------------------- */
body[data-path="login"] .page-card-container {
	width: 100%;
	max-width: 430px;
	margin: 0;
	padding: 0;
	display: flex;
	justify-content: flex-end;
}

body[data-path="login"] .page-card {
	width: 100%;
	max-width: 430px;
	margin: 0;
	padding: 38px 34px;
	background: #FFFFFF;
	border: 1px solid #EADFDA;
	border-radius: 16px;
	box-shadow: 0 18px 48px rgba(58, 27, 18, 0.13);
}

/* ---- inner sections must never look like cards -------------------------- */
body[data-path="login"] .page-card-body,
body[data-path="login"] .form-signin,
body[data-path="login"] .for-login,
body[data-path="login"] .for-forgot,
body[data-path="login"] .for-signup,
body[data-path="login"] .for-email-login,
body[data-path="login"] .for-login-with-email-link {
	max-width: none;
	width: auto;
	margin: 0;
	padding: 0;
	background: none;
	border: none;
	border-radius: 0;
	box-shadow: none;
}

/* Frappe toggles these sections with .hide; nothing above may defeat it. */
body[data-path="login"] .hide {
	display: none !important;
}

/* ---- brand lockup ------------------------------------------------------- */
body[data-path="login"] .page-card-head {
	text-align: left;
	border: none;
	padding: 0 0 4px;
	margin-bottom: 22px;
}

body[data-path="login"] .page-card-head .app-logo,
body[data-path="login"] .page-card-head img {
	height: 52px;
	width: auto;
	max-width: 100%;
	margin-bottom: 14px;
	display: block;
}

body[data-path="login"] .page-card-head h4 {
	color: var(--fedco-ink);
	font-weight: 700;
	font-size: 1.4rem;
	letter-spacing: -0.01em;
	margin: 0;
}

/* tricolour rule — all three brand colours, carrying no text */
body[data-path="login"] .page-card-head::after {
	content: "";
	display: block;
	width: 56px;
	height: 3px;
	margin-top: 12px;
	border-radius: 3px;
	background: linear-gradient(90deg, var(--fedco-500) 0%, var(--fedco-gold) 55%, var(--fedco-green) 100%);
}

/* ---- form controls ------------------------------------------------------ */
body[data-path="login"] .form-control {
	height: 46px;
	width: 100%;
	border-radius: 9px;
	border: 1px solid #E2D5D0;
	background: #FFFFFF;
	font-size: 15px;
	padding: 6px 14px;
	color: var(--fedco-ink);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body[data-path="login"] .form-control:focus {
	border-color: var(--fedco-300);
	box-shadow: 0 0 0 3px rgba(152, 74, 53, 0.24);
	outline: none;
}

body[data-path="login"] label,
body[data-path="login"] .control-label {
	color: #6B5A54;
	font-size: 0.82rem;
	font-weight: 500;
}

body[data-path="login"] .password-field {
	position: relative;
}

body[data-path="login"] .toggle-password {
	position: absolute;
	right: 12px;
	bottom: 12px;
	color: var(--fedco-600);
	font-size: 0.78rem;
	cursor: pointer;
	background: transparent;
	border: none;
	z-index: 2;
}

/* ---- buttons ------------------------------------------------------------ */
body[data-path="login"] .btn-primary,
body[data-path="login"] .btn-login {
	background: var(--fedco-500);
	border-color: var(--fedco-500);
	color: #FFFFFF;
	min-height: 46px;
	border-radius: 9px;
	font-weight: 600;
	font-size: 0.95rem;
	box-shadow: 0 2px 8px rgba(152, 74, 53, 0.28);
	transition: background-color 0.15s ease, transform 0.05s ease;
	/* Frappe replaces the label with "Invalid Login. Try again" on failure, so
	   the button has to be able to wrap rather than overflow the card. */
	white-space: normal;
	line-height: 1.3;
	padding: 10px 16px;
	height: auto;
}

body[data-path="login"] .btn-primary:hover,
body[data-path="login"] .btn-login:hover {
	background: var(--fedco-600);
	border-color: var(--fedco-600);
	color: #FFFFFF;
}

body[data-path="login"] .btn-primary:active {
	transform: translateY(1px);
}

body[data-path="login"] .btn-default {
	background: #FFFFFF;
	border: 1px solid #E2D5D0;
	color: var(--fedco-ink);
	min-height: 44px;
	height: auto;
	border-radius: 9px;
	font-weight: 500;
	white-space: normal;
	line-height: 1.3;
}

body[data-path="login"] .btn-default:hover {
	background: var(--fedco-50);
	border-color: var(--fedco-300);
	color: var(--fedco-700);
}

body[data-path="login"] a {
	color: var(--fedco-600);
	font-weight: 500;
}

body[data-path="login"] a:hover {
	color: var(--fedco-700);
	text-decoration: underline;
}

body[data-path="login"] .forgot-password-message {
	display: inline-block;
	margin-top: 4px;
	font-size: 0.85rem;
}

/* alerts must stay inside the card */
body[data-path="login"] .page-card .alert,
body[data-path="login"] #login-alert,
body[data-path="login"] .login-alert {
	border-radius: 9px;
	font-size: 0.85rem;
	word-break: break-word;
	white-space: normal;
	background: #FCE9E6;
	color: #A32D18;
	border: none;
}

/* ---- tablet: brand becomes a banner, card centres ----------------------- */
@media (max-width: 1024px) {
	body[data-path="login"] .page_content {
		justify-content: center;
		align-items: flex-start;
		padding: 0 24px 48px;
	}

	body[data-path="login"] .page_content > .section,
	body[data-path="login"] .page_content > section {
		justify-content: center;
	}

	body[data-path="login"] .page-card-container {
		justify-content: center;
		margin: 0 auto;
	}

	body[data-path="login"]::before {
		position: absolute;
		width: 100%;
		height: 220px;
		border-radius: 0 0 44% 44% / 0 0 24% 24%;
	}

	/* the strapline competes with the form once they share a column */
	body[data-path="login"]::after {
		display: none;
	}

	body[data-path="login"] .page-card {
		margin-top: 150px;
	}
}

/* ---- phone -------------------------------------------------------------- */
@media (max-width: 575.98px) {
	body[data-path="login"] .page_content {
		padding: 0 14px 32px;
	}

	body[data-path="login"]::before {
		height: 180px;
	}

	body[data-path="login"] .page-card {
		margin-top: 118px;
		padding: 28px 22px;
		border-radius: 14px;
	}

	body[data-path="login"] .page-card-head .app-logo {
		height: 44px;
	}

	/* 16px stops iOS zooming the page when a field takes focus */
	body[data-path="login"] .form-control {
		font-size: 16px;
	}
}

/* ==========================================================================
   Portal pages (employee self-service: claims, advances, payslips)
   ========================================================================== */
.web-sidebar .sidebar-item.active a,
.web-sidebar a:hover {
	color: var(--fedco-600);
}

.website-content .btn-primary,
.page-content .btn-primary {
	background-color: var(--fedco-500);
	border-color: var(--fedco-500);
}

.website-content .btn-primary:hover,
.page-content .btn-primary:hover {
	background-color: var(--fedco-600);
	border-color: var(--fedco-600);
}

.navbar.navbar-light {
	background-color: #FFFFFF;
	border-bottom: 1px solid #EADFDA;
}

.navbar.navbar-light .navbar-brand img {
	height: 30px;
}

footer {
	border-top: 1px solid #EADFDA;
	background: var(--fedco-50);
}

.indicator-pill.green { background: #E3F5E9; color: #106B2E; }
.indicator-pill.orange { background: #FDF0C4; color: #7A5B02; }
.indicator-pill.red { background: #FCE9E6; color: #A32D18; }
.indicator-pill.blue { background: var(--fedco-100); color: var(--fedco-700); }

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}
