/**
 * WealthKube Portfolio Login + Investor Login UI
 * Brand colors: #2c7bbd (blue) · #ea232a (red)
 */

:root {
	--brand-blue: #2c7bbd;
	--brand-red: #ea232a;
	--blue-mid: #3d8fd0;
	--blue-soft: #e8f2fa;
	--blue-border: #b7d4eb;
	--blue-pale: #f3f8fc;
	--red-soft: #fdecee;
	--red-mid: #ef4a50;
	--ink: #1a2733;
	--muted: #6b7c8a;
	--white: #ffffff;
	--card: #ffffff;
	--shadow: 0 16px 48px rgba(26, 39, 51, 0.08);
	--radius: 20px;
	--font: "DM Sans", system-ui, sans-serif;
	--serif: "Libre Baskerville", Georgia, serif;
	--ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html, body {
	margin: 0;
	padding: 0;
	font-family: var(--font);
	color: var(--ink);
	-webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; height: auto; display: block; }

/* ==========================================================================
   PAGE 1 – Role selection
   ========================================================================== */
.page-select {
	min-height: 100vh;
	background:
		radial-gradient(ellipse 70% 45% at 15% 0%, rgba(44, 123, 189, 0.12), transparent 55%),
		radial-gradient(ellipse 55% 40% at 90% 10%, rgba(234, 35, 42, 0.07), transparent 50%),
		linear-gradient(180deg, #f7fafc 0%, #eef4f9 100%);
	padding: 22px 20px 56px;
	position: relative;
}

.back-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	background: var(--white);
	border-radius: 12px;
	box-shadow: 0 2px 10px rgba(26, 39, 51, 0.06);
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--ink);
	transition: box-shadow 0.22s var(--ease), transform 0.22s var(--ease), color 0.22s;
}

.back-btn:hover {
	box-shadow: 0 6px 18px rgba(44, 123, 189, 0.14);
	transform: translateY(-1px);
	color: var(--brand-blue);
}

.select-wrap {
	max-width: 760px;
	margin: 28px auto 0;
	text-align: center;
}

.brand-block {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 26px;
}

.brand-logo {
	width: auto;
	height: 110px;
	max-width: 340px;
	object-fit: contain;
}

.page-heading {
	margin: 0 0 8px;
	font-family: var(--serif);
	font-size: clamp(1.7rem, 4vw, 2.2rem);
	font-weight: 700;
	color: var(--ink);
	letter-spacing: -0.02em;
}

.page-sub {
	margin: 0 0 36px;
	font-size: 1rem;
	color: var(--muted);
	font-weight: 400;
}

.role-grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 18px;
	margin-bottom: 40px;
}

.role-card {
	width: 148px;
	min-height: 142px;
	background: var(--card);
	border-radius: 20px;
	box-shadow: 0 8px 24px rgba(26, 39, 51, 0.06);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 24px 12px;
	transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s;
	border: 1.5px solid rgba(183, 212, 235, 0.7);
	cursor: pointer;
}

.role-card:hover {
	transform: translateY(-6px);
	box-shadow: 0 18px 36px rgba(44, 123, 189, 0.16);
	border-color: var(--brand-blue);
}

.role-card:focus-visible {
	outline: 2px solid var(--brand-blue);
	outline-offset: 3px;
}

.role-icon {
	width: 56px;
	height: 56px;
	border-radius: 16px;
	background: var(--blue-soft);
	color: var(--brand-blue);
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
}

.role-card:nth-child(3n) .role-icon {
	background: var(--red-soft);
	color: var(--brand-red);
}

.role-label {
	font-size: 0.98rem;
	font-weight: 700;
	color: var(--ink);
}

.select-footer {
	margin: 0;
	min-height: 1em;
}

/* ==========================================================================
   PAGE 2 – Login
   ========================================================================== */
.page-login {
	min-height: 100vh;
	background:
		radial-gradient(ellipse 60% 40% at 85% 0%, rgba(234, 35, 42, 0.06), transparent 50%),
		radial-gradient(ellipse 70% 45% at 10% 100%, rgba(44, 123, 189, 0.08), transparent 50%),
		var(--blue-pale);
	display: flex;
	flex-direction: column;
}

.login-topbar {
	background: var(--white);
	padding: 12px 28px;
	box-shadow: 0 1px 0 rgba(26, 39, 51, 0.05);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.topbar-brand {
	display: inline-flex;
	align-items: center;
}

.topbar-brand img {
	width: auto;
	height: 72px;
	max-width: 260px;
	object-fit: contain;
}

.login-page-wrap {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 36px 20px;
}

.login-card {
	display: flex;
	width: 100%;
	max-width: 920px;
	background: var(--white);
	border: 1px solid rgba(183, 212, 235, 0.85);
	border-radius: 24px;
	box-shadow: var(--shadow);
	overflow: hidden;
	min-height: 480px;
}

.login-visual {
	flex: 1.05;
	background: linear-gradient(165deg, #eef5fb 0%, #e6eef7 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 28px 24px;
	position: relative;
	overflow: hidden;
}

.login-visual-img {
	width: 100%;
	height: 100%;
	max-height: 420px;
	object-fit: contain;
	object-position: center;
}

.login-panel {
	flex: 1;
	padding: 44px 42px 40px;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.change-role {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--brand-blue);
	margin-bottom: 14px;
	align-self: flex-start;
}

.change-role:hover { text-decoration: underline; }

.login-heading {
	margin: 0 0 22px;
	font-size: 1.75rem;
	font-weight: 700;
	color: var(--brand-blue);
	letter-spacing: -0.03em;
}

.rv-form {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin: 0;
}

.rv-field {
	position: relative;
	display: flex;
	align-items: center;
}

.rv-field-icon {
	position: absolute;
	left: 14px;
	color: var(--brand-blue);
	pointer-events: none;
	line-height: 0;
	z-index: 1;
}

.rv-field input {
	width: 100%;
	height: 50px;
	padding: 0 44px;
	border: 1.5px solid var(--blue-border);
	border-radius: 12px;
	background: #fbfdfe;
	font-family: var(--font);
	font-size: 0.96rem;
	color: var(--ink);
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.rv-field input::placeholder { color: #93a3b0; }

.rv-field input:focus {
	border-color: var(--brand-blue);
	background: var(--white);
	box-shadow: 0 0 0 4px rgba(44, 123, 189, 0.15);
}

.rv-field input.is-invalid {
	border-color: var(--brand-red);
	box-shadow: 0 0 0 3px rgba(234, 35, 42, 0.12);
}

.rv-toggle-pass {
	position: absolute;
	right: 10px;
	border: none;
	background: transparent;
	color: var(--muted);
	cursor: pointer;
	padding: 6px;
	border-radius: 8px;
	line-height: 0;
	display: inline-flex;
}

.rv-toggle-pass:hover {
	color: var(--brand-blue);
	background: var(--blue-soft);
}

.rv-form-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 2px;
}

.rv-remember {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 0.88rem;
	color: var(--muted);
	cursor: pointer;
	user-select: none;
}

.rv-remember input {
	width: 16px;
	height: 16px;
	accent-color: var(--brand-blue);
}

.rv-link {
	border: none;
	background: none;
	color: var(--brand-red);
	font-family: var(--font);
	font-size: 0.88rem;
	font-weight: 600;
	cursor: pointer;
	padding: 0;
}

.rv-link:hover { text-decoration: underline; }

.rv-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	align-self: flex-start;
	min-width: 148px;
	height: 48px;
	padding: 0 28px;
	border: none;
	border-radius: 10px;
	background: linear-gradient(135deg, var(--brand-blue) 0%, #2569a3 100%);
	color: #fff;
	font-family: var(--font);
	font-size: 0.98rem;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 8px 20px rgba(44, 123, 189, 0.3);
	transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
	margin-top: 6px;
}

.rv-btn:hover:not(:disabled) {
	transform: translateY(-1px);
	box-shadow: 0 12px 26px rgba(44, 123, 189, 0.38);
}

.rv-btn:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

.rv-spinner {
	width: 16px;
	height: 16px;
	border: 2.5px solid rgba(255,255,255,0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: spin 0.65s linear infinite;
}

.rv-spinner[hidden] { display: none !important; }

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

.rv-toast {
	margin-top: 8px;
	padding: 11px 13px;
	border-radius: 10px;
	font-size: 0.86rem;
	font-weight: 600;
	line-height: 1.4;
}

.rv-toast[hidden] { display: none !important; }

.rv-toast.is-error {
	background: var(--red-soft);
	color: var(--brand-red);
	border: 1px solid rgba(234, 35, 42, 0.18);
}

.rv-toast.is-success {
	background: #eaf5ee;
	color: #1f7a3a;
	border: 1px solid rgba(31, 122, 58, 0.15);
}

/* Modal */
.rv-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.rv-modal[hidden] { display: none !important; }

.rv-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(26, 39, 51, 0.48);
	backdrop-filter: blur(4px);
}

.rv-modal-dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 400px;
	background: var(--white);
	border-radius: 18px;
	padding: 28px 24px 22px;
	box-shadow: 0 24px 60px rgba(0,0,0,0.2);
}

.rv-modal-close {
	position: absolute;
	top: 10px;
	right: 12px;
	border: none;
	background: var(--blue-soft);
	width: 32px;
	height: 32px;
	border-radius: 8px;
	font-size: 1.3rem;
	color: var(--muted);
	cursor: pointer;
	line-height: 1;
}

.rv-modal-close:hover { color: var(--ink); }

.rv-modal-dialog h3 {
	margin: 0 0 6px;
	font-size: 1.3rem;
	color: var(--brand-blue);
	font-weight: 700;
}

.rv-modal-sub {
	margin: 0 0 18px;
	font-size: 0.9rem;
	color: var(--muted);
}

.rv-back-step {
	display: block;
	width: 100%;
	text-align: center;
	margin-top: 4px;
	color: var(--muted);
}

body.modal-open { overflow: hidden; }

@media (max-width: 768px) {
	.brand-logo {
		height: 88px;
		max-width: 280px;
	}

	.topbar-brand img {
		height: 56px;
		max-width: 200px;
	}

	.login-card {
		flex-direction: column;
		max-width: 440px;
	}

	.login-visual {
		min-height: 240px;
		padding: 16px 20px;
	}

	.login-visual-img {
		max-height: 220px;
	}

	.login-panel {
		padding: 28px 22px 24px;
	}

	.rv-btn {
		width: 100%;
	}

	.role-card {
		width: calc(50% - 10px);
		min-width: 128px;
	}
}

@media (max-width: 400px) {
	.role-card {
		width: 100%;
	}
}
