/* Shared auth page styles: login, signup, password reset */

/* Mobile-first responsive design with dark mode by default, light mode support */

/* Login Page Wrapper - Mobile First */
.login-page-wrapper {
	height: 100vh;
	max-height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 0 1rem;
	background-color: var(--clr-background);
	position: relative;
	transition: background-color 0.3s ease;
	overflow: hidden;
	min-height: 100vh;
	width: 100%;
	box-sizing: border-box;

	@media (min-width: 481px) {
		padding: 0 1.5rem;
	}

	@media (min-width: 768px) {
		padding: 0 2rem;
	}
}

/* Theme Toggle Button - Mobile First */
.theme-toggle-btn {
	position: fixed;
	inset-block-start: 1rem;
	inset-inline-end: 1rem;
	width: 44px;
	height: 44px;
	min-width: 44px;
	min-height: 44px;
	border-radius: 50%;
	border: 1px solid var(--clr-border, rgba(255, 255, 255, 0.1));
	background-color: var(--clr-surface-1, #1d1d1d);
	color: var(--clr-text-high, rgba(255, 255, 255, 0.87));
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition-property: background-color, border-color, color, box-shadow, transform;
	transition-duration: 0.3s;
	transition-timing-function: ease;
	z-index: 1000;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;

	&:hover {
		background-color: var(--clr-surface-2, #212121);
		transform: scale(1.05);
	}

	&:active {
		transform: scale(0.95);
	}

	.theme-icon {
		width: 20px;
		height: 20px;
		position: absolute;
		transition: opacity 0.3s ease, transform 0.3s ease;
	}

	.sun-icon {
		opacity: 0;
		transform: rotate(90deg);
	}

	.moon-icon {
		opacity: 1;
		transform: rotate(0deg);
	}

	@media (min-width: 481px) {
		inset-block-start: 1.5rem;
		inset-inline-end: 1.5rem;
		width: 48px;
		height: 48px;
		min-width: 48px;
		min-height: 48px;
	}

	@media (min-width: 768px) {
		inset-block-start: 2rem;
		inset-inline-end: 2rem;
	}
}

[data-theme="light"] .theme-toggle-btn {
	.sun-icon {
		opacity: 1;
		transform: rotate(0deg);
	}

	.moon-icon {
		opacity: 0;
		transform: rotate(-90deg);
	}
}

/* Brand Logo at Top - Mobile First */
.login-brand-top {
	position: absolute;
	top: 0;
	inset-inline: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 1.5rem 1rem 0;
	text-align: center;
	z-index: 1;
	width: 100%;
	box-sizing: border-box;

	@media (min-width: 481px) {
		padding: 2rem 1rem 0;
	}

	@media (min-width: 768px) {
		padding: 2.5rem 1rem 0;
	}
}

.login-logo {
	height: 2rem;
	width: auto;
	max-width: 150px;
	object-fit: contain;
	display: block;
	outline: none;

	@media (min-width: 481px) {
		height: 2.25rem;
		max-width: 175px;
	}

	@media (min-width: 768px) {
		height: 2.5rem;
		max-width: 200px;
	}
}

/* Login Container - Centered Content - Mobile First */
.login-container {
	width: 100%;
	max-width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	margin: auto;
	padding-top: 3rem;
	padding-bottom: 1.5rem;
	padding-left: 1rem;
	padding-right: 1rem;
	max-height: calc(100vh - 1.5rem);
	overflow-y: auto;
	overflow-x: hidden;
	box-sizing: border-box;
	-webkit-overflow-scrolling: touch;

	@media (min-width: 481px) {
		max-width: 420px;
		padding-top: 3.5rem;
		padding-bottom: 2rem;
		max-height: calc(100vh - 2rem);
	}

	@media (min-width: 768px) {
		padding-top: 4rem;
	}
}

/* Error Messages - Mobile First */
.login-error {
	width: 100%;
	padding: 0.75rem 1rem;
	margin-bottom: 1.25rem;
	background-color: var(--clr-danger-bg);
	border: 1px solid var(--clr-danger-border);
	border-radius: 8px;
	color: var(--clr-error);
	font-size: 0.875rem;
	line-height: 1.4;
	box-sizing: border-box;

	p {
		margin: 0;
	}

	@media (min-width: 481px) {
		margin-bottom: 1.5rem;
	}
}

/* Login Form - Mobile First */
.login-form {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	box-sizing: border-box;
}

/* Form Groups - Mobile First */
.form-group {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-bottom: 0;
	width: 100%;
	box-sizing: border-box;

	label {
		font-size: 0.875rem;
		font-weight: 400;
		color: var(--clr-text-high, rgba(255, 255, 255, 0.87));
		margin-bottom: 0;
		font-family: "Inter", sans-serif;
		line-height: 1.4;
	}
}

.password-group {
	margin-bottom: 0;
}

.password-label-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.5rem;
}

/* Password Input Wrapper - Mobile First */
.password-input-wrapper {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;

	input {
		padding-inline-end: 3rem;
		width: 100%;
	}
}

.password-toggle {
	position: absolute;
	inset-inline-end: 0.75rem;
	background: none;
	border: none;
	color: var(--clr-text-medium, rgba(255, 255, 255, 0.6));
	cursor: pointer;
	padding: var(--pd-200);
	min-width: 44px;
	min-height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s ease;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;

	&:hover {
		color: var(--clr-text-high, rgba(255, 255, 255, 0.87));
	}

	&:active {
		opacity: 0.7;
	}

	.password-icon {
		width: 18px;
		height: 18px;
	}
}

/* Form Inputs - Mobile First */
.login-form {

	input[type="email"],
	input[type="password"],
	input[type="text"] {
		width: 100%;
		padding: 0.625rem 0.875rem;
		min-height: 40px;
		border: 1px solid var(--clr-border, rgba(255, 255, 255, 0.1));
		border-radius: 6px;
		background-color: var(--clr-surface-1, #1d1d1d);
		color: var(--clr-text-high, rgba(255, 255, 255, 0.87));
		font-size: 0.9375rem;
		font-family: "Inter", sans-serif;
		transition-property: background-color, border-color, color, box-shadow, transform;
	transition-duration: 0.2s;
	transition-timing-function: ease;
		box-sizing: border-box;
		-webkit-appearance: none;
		appearance: none;

		&:focus {
			outline: none;
			border-color: var(--clr-focus, #6b7280);
			background-color: var(--clr-surface-2, #212121);
			box-shadow: 0 0 0 3px var(--clr-focus-ring, rgba(107, 114, 128, 0.1));
		}

		&::placeholder {
			color: transparent;
			opacity: 0;
		}

		@media (min-width: 481px) {
			padding: 0.5rem 0.75rem;
			font-size: 0.875rem;
		}
	}
}

/* Field Errors */
.field-error {
	font-size: var(--fs-450);
	color: var(--clr-error, #b82c2c);
	margin: 0;
	margin-top: 0.25rem;
}

/* Sign In Button - Mobile First */
.signin-btn {
	width: 100%;
	padding: 0.625rem 0.875rem;
	margin-top: 1.25rem;
	min-height: 40px;
	background-color: var(--clr-cta);
	border: none;
	border-radius: 6px;
	color: var(--clr-on-cta);
	font-size: 0.9375rem;
	font-weight: 500;
	font-family: "Inter", sans-serif;
	cursor: pointer;
	transition-property: background-color, border-color, color, box-shadow, transform;
	transition-duration: 0.2s;
	transition-timing-function: ease;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	box-sizing: border-box;

	&:hover {
		background-color: var(--clr-cta-hover);
		transform: translateY(-1px);
		box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
	}

	&:active {
		transform: translateY(0);
		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
		background-color: var(--clr-cta-active);
	}

	@media (min-width: 481px) {
		padding: 0.5rem 0.75rem;
		margin-top: 1.5rem;
		font-size: 0.875rem;
	}
}

/* Disabled Button State */
.signin-btn:disabled {
	background-color: var(--clr-surface-3);
	color: var(--clr-text-disabled);
	cursor: not-allowed;
	opacity: 0.6;

	&:hover {
		background-color: var(--clr-surface-3);
		transform: none;
		box-shadow: none;
	}

	&:active {
		transform: none;
		box-shadow: none;
		background-color: var(--clr-surface-3);
	}
}

/* Login Footer - Mobile First */
.login-footer {
	margin-top: 0.75rem;
	text-align: center;
	font-size: var(--fs-450);
	color: var(--clr-text-medium, rgba(255, 255, 255, 0.6));
	font-family: "Inter", sans-serif;
	line-height: 1.4;
	padding: 0 0.5rem;
	box-sizing: border-box;

	@media (min-width: 481px) {
		margin-top: 1rem;
	}
}

.signup-link {
	color: var(--clr-text-high, rgba(255, 255, 255, 0.87));
	text-decoration: none;
	font-weight: 400;
	margin-inline-start: 0.25rem;
	transition: color 0.2s ease;
	font-family: "Inter", sans-serif;
	padding: 0.125rem 0.25rem;
	min-height: auto;
	display: inline-flex;
	align-items: center;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;

	&:hover {
		color: var(--clr-primary, #6b7280);
		text-decoration: underline;
	}

	&:active {
		opacity: 0.7;
	}
}

/* Ensure body background matches on login/signup page and prevent scrolling */
body:has(.login-page-wrapper),
html:has(.login-page-wrapper) {
	background-color: var(--clr-background);
	height: 100%;
	overflow: hidden;
}

body:has(.login-page-wrapper) {

	.body,
	.container-fluid,
	.main-content-wrapper,
	.page-wrapper {
		height: 100%;
		overflow: hidden;
		padding: 0;
		margin: 0;
	}
}

/* Override page-wrapper padding when login/signup page is present */
body:not(.user-authenticated) .page-wrapper:has(.login-page-wrapper),
.page-wrapper:has(.login-page-wrapper) {
	padding: 0 !important;
	height: 100vh;
	overflow: hidden;
}

/* Ensure main-content-wrapper doesn't add spacing */
body:not(.user-authenticated) .main-content-wrapper:has(.login-page-wrapper),
.main-content-wrapper:has(.login-page-wrapper) {
	height: 100vh;
	overflow: hidden;
	margin: 0;
}
