/**
 * Authentication Pages Stylesheet
 *
 * Split-screen layout for login and registration pages.
 * Designed for Tutor LMS templates with micro-interactions.
 */

/* ============================================
   CSS Variables (inherit from theme)
   ============================================ */
:root {
	--auth-color-primary: #462877;
	--auth-color-primary-light: #5e3a9a;
	--auth-color-primary-dark: #301b51;
	--auth-color-accent: #0b4799;
	--auth-color-highlight: #925fca;
	--auth-color-success: #10b981;
	--auth-color-error: #dc3545;
	--auth-color-text: #1f2432;
	--auth-color-text-light: #6b7280;
	--auth-color-text-muted: #9ca3af;
	--auth-color-background: #fafafa;
	--auth-color-surface: #ffffff;
	--auth-color-border: #e5e7eb;
	--auth-font-family: 'Epilogue', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	--auth-radius: 12px;
	--auth-radius-lg: 16px;
	--auth-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
	--auth-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
	--auth-shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
	--auth-transition-fast: 0.15s ease;
	--auth-transition-base: 0.25s ease;
}

/* ============================================
   Page Layout - Split Screen
   ============================================ */
.auth-page {
	display: grid;
	grid-template-columns: 1fr 1fr;
	min-height: 100vh;
	background: var(--auth-color-background);
	font-family: var(--auth-font-family);
}

/* ============================================
   Left Panel - Brand/Visual
   ============================================ */
.auth-brand-panel {
	position: sticky;
	top: 0;
	height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: linear-gradient(160deg, #1a1035 0%, var(--auth-color-primary) 50%, var(--auth-color-accent) 100%);
	overflow: hidden;
	padding: 60px 40px;
}

.auth-brand-content {
	position: relative;
	z-index: 2;
	text-align: center;
	color: #fff;
	max-width: 380px;
}

.auth-brand-logo {
	margin-bottom: 40px;
}

.auth-brand-logo img {
	max-height: 52px;
	filter: brightness(0) invert(1);
}

.auth-brand-title {
	font-size: clamp(1.875rem, 3vw, 2.5rem);
	font-weight: 700;
	line-height: 1.2;
	margin: 0 0 20px 0;
	letter-spacing: -0.02em;
}

.auth-brand-subtitle {
	font-size: 1.0625rem;
	opacity: 0.85;
	line-height: 1.7;
	margin: 0 0 48px 0;
}

/* Feature Cards - Flow below content */
.auth-floating-cards {
	position: relative;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
	max-width: 400px;
}

.auth-float-card {
	padding: 12px 18px;
	background: rgba(255, 255, 255, 0.1);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 24px;
	color: #fff;
	font-size: 13px;
	font-weight: 500;
	display: flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
	transition: all var(--auth-transition-base);
}

.auth-float-card:hover {
	background: rgba(255, 255, 255, 0.18);
	transform: translateY(-2px);
}

.auth-float-card-icon {
	font-size: 16px;
	line-height: 1;
}

/* Removed absolute positioning - cards now in flow */
.auth-float-1,
.auth-float-2,
.auth-float-3 {
	/* No positioning needed - flex handles layout */
}

/* Background Decorative Shapes */
.auth-shapes {
	position: absolute;
	inset: 0;
	overflow: hidden;
	z-index: 0;
}

.auth-shape {
	position: absolute;
	border-radius: 50%;
	filter: blur(80px);
}

.auth-shape-1 {
	width: 500px;
	height: 500px;
	background: rgba(255, 255, 255, 0.08);
	top: -200px;
	right: -150px;
}

.auth-shape-2 {
	width: 400px;
	height: 400px;
	background: var(--auth-color-highlight);
	opacity: 0.15;
	bottom: -100px;
	left: -100px;
}

.auth-shape-3 {
	width: 200px;
	height: 200px;
	background: rgba(255, 255, 255, 0.05);
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

/* ============================================
   Right Panel - Form
   ============================================ */
.auth-form-panel {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px;
	overflow-y: auto;
	background: var(--auth-color-surface);
}

.auth-form-container {
	width: 100%;
	max-width: 420px;
}

/* Mobile Logo (hidden on desktop) */
.auth-mobile-logo {
	display: none;
	text-align: center;
	margin-bottom: 32px;
}

.auth-mobile-logo img {
	max-height: 40px;
}

/* Form Header */
.auth-form-header {
	margin-bottom: 36px;
}

.auth-form-title {
	font-size: 1.875rem;
	font-weight: 700;
	color: var(--auth-color-text);
	margin: 0 0 8px 0;
	line-height: 1.2;
}

.auth-form-subtitle {
	color: var(--auth-color-text-light);
	font-size: 1rem;
	margin: 0;
	line-height: 1.5;
}

/* ============================================
   Form Elements
   ============================================ */
.auth-form {
	margin: 0;
}

/* Field Group */
.auth-field {
	margin-bottom: 20px;
}

.auth-field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.auth-field-row .auth-field {
	margin-bottom: 20px;
}

/* Labels */
.auth-label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var(--auth-color-text);
	margin-bottom: 8px;
	transition: color var(--auth-transition-fast);
}

/* Input Wrapper */
.auth-input-wrapper {
	position: relative;
}

/* Input Fields */
.auth-input {
	width: 100%;
	padding: 14px 16px;
	padding-right: 44px;
	font-size: 15px;
	font-family: var(--auth-font-family);
	color: var(--auth-color-text);
	background: var(--auth-color-surface);
	border: 2px solid var(--auth-color-border);
	border-radius: var(--auth-radius);
	outline: none;
	transition: all var(--auth-transition-base);
	box-sizing: border-box;
}

.auth-input::placeholder {
	color: var(--auth-color-text-muted);
}

/* Focus State */
.auth-input:focus {
	border-color: var(--auth-color-primary);
	box-shadow: 0 0 0 4px rgba(70, 40, 119, 0.1);
}

.auth-field:focus-within .auth-label {
	color: var(--auth-color-primary);
}

/* Validation Icons */
.auth-input-icon {
	position: absolute;
	right: 14px;
	top: 50%;
	transform: translateY(-50%) scale(0.8);
	width: 20px;
	height: 20px;
	opacity: 0;
	transition: all var(--auth-transition-fast);
	pointer-events: none;
}

.auth-icon-valid {
	color: var(--auth-color-success);
}

.auth-icon-invalid {
	color: var(--auth-color-error);
}

/* Valid State */
.auth-field.is-valid .auth-input {
	border-color: var(--auth-color-success);
}

.auth-field.is-valid .auth-icon-valid {
	opacity: 1;
	transform: translateY(-50%) scale(1);
}

/* Invalid State */
.auth-field.is-invalid .auth-input {
	border-color: var(--auth-color-error);
}

.auth-field.is-invalid .auth-icon-invalid {
	opacity: 1;
	transform: translateY(-50%) scale(1);
}

/* Error Message */
.auth-field-feedback {
	display: block;
	font-size: 13px;
	color: var(--auth-color-error);
	margin-top: 6px;
	min-height: 0;
	opacity: 0;
	transform: translateY(-4px);
	transition: all var(--auth-transition-fast);
}

.auth-field.is-invalid .auth-field-feedback {
	opacity: 1;
	transform: translateY(0);
	min-height: 18px;
}

/* Shake Animation */
@keyframes authShake {

	0%,
	100% {
		transform: translateX(0);
	}

	10%,
	30%,
	50%,
	70%,
	90% {
		transform: translateX(-4px);
	}

	20%,
	40%,
	60%,
	80% {
		transform: translateX(4px);
	}
}

.auth-field.shake .auth-input {
	animation: authShake 0.5s ease-in-out;
}

/* ============================================
   Password Field
   ============================================ */
.auth-password-toggle {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	padding: 4px;
	cursor: pointer;
	color: var(--auth-color-text-muted);
	transition: color var(--auth-transition-fast);
	display: flex;
	align-items: center;
	justify-content: center;
}

.auth-password-toggle:hover {
	color: var(--auth-color-text);
}

.auth-password-toggle svg {
	width: 20px;
	height: 20px;
}

.auth-password-toggle .eye-closed {
	display: none;
}

.auth-password-toggle.is-visible .eye-open {
	display: none;
}

.auth-password-toggle.is-visible .eye-closed {
	display: block;
}

/* Password field with toggle needs more right padding */
.auth-field-password .auth-input {
	padding-right: 48px;
}

/* Password Strength Indicator */
.auth-password-strength {
	margin-top: 10px;
}

.auth-strength-bar {
	display: flex;
	gap: 4px;
	margin-bottom: 6px;
}

.auth-strength-segment {
	flex: 1;
	height: 4px;
	background: var(--auth-color-border);
	border-radius: 2px;
	transition: background var(--auth-transition-base);
}

/* Strength Levels */
.auth-strength-bar[data-strength="1"] .auth-strength-segment:nth-child(1) {
	background: var(--auth-color-error);
}

.auth-strength-bar[data-strength="2"] .auth-strength-segment:nth-child(-n+2) {
	background: #fd7e14;
}

.auth-strength-bar[data-strength="3"] .auth-strength-segment:nth-child(-n+3) {
	background: #ffc107;
}

.auth-strength-bar[data-strength="4"] .auth-strength-segment {
	background: var(--auth-color-success);
}

.auth-strength-text {
	font-size: 12px;
	color: var(--auth-color-text-muted);
	font-weight: 500;
}

/* ============================================
   Checkbox & Links Row
   ============================================ */
.auth-options-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 24px;
	flex-wrap: wrap;
	gap: 12px;
}

/* Checkbox */
.auth-checkbox {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}

.auth-checkbox input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: var(--auth-color-primary);
	cursor: pointer;
	margin: 0;
}

.auth-checkbox-label {
	font-size: 14px;
	color: var(--auth-color-text);
	user-select: none;
}

/* Forgot Password Link */
.auth-forgot-link {
	font-size: 14px;
	font-weight: 600;
	color: var(--auth-color-primary);
	text-decoration: none;
	transition: color var(--auth-transition-fast);
}

.auth-forgot-link:hover {
	color: var(--auth-color-primary-dark);
	text-decoration: underline;
}

/* ============================================
   Submit Button
   ============================================ */
.auth-submit {
	width: 100%;
	padding: 14px 24px;
	font-size: 16px;
	font-weight: 600;
	font-family: var(--auth-font-family);
	color: #fff;
	background: linear-gradient(135deg, var(--auth-color-primary) 0%, var(--auth-color-primary-light) 100%);
	border: none;
	border-radius: var(--auth-radius);
	cursor: pointer;
	position: relative;
	overflow: hidden;
	transition: all var(--auth-transition-base);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.auth-submit:hover:not(:disabled) {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(70, 40, 119, 0.35);
}

.auth-submit:active:not(:disabled) {
	transform: translateY(0);
}

.auth-submit:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

/* Loading State */
.auth-submit-text {
	transition: opacity var(--auth-transition-fast);
}

.auth-submit.is-loading .auth-submit-text {
	opacity: 0;
}

.auth-submit-spinner {
	position: absolute;
	width: 22px;
	height: 22px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	opacity: 0;
	animation: authSpin 0.8s linear infinite;
	transition: opacity var(--auth-transition-fast);
}

.auth-submit.is-loading .auth-submit-spinner {
	opacity: 1;
}

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

/* ============================================
   Form Footer
   ============================================ */
.auth-form-footer {
	margin-top: 28px;
	text-align: center;
	padding-top: 24px;
	border-top: 1px solid var(--auth-color-border);
}

.auth-switch-text {
	color: var(--auth-color-text-light);
	font-size: 14px;
}

.auth-switch-link {
	font-weight: 600;
	color: var(--auth-color-primary);
	text-decoration: none;
	transition: color var(--auth-transition-fast);
}

.auth-switch-link:hover {
	color: var(--auth-color-primary-dark);
	text-decoration: underline;
}

/* ============================================
   Alert Messages
   ============================================ */
.auth-alert {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px 16px;
	border-radius: var(--auth-radius);
	margin-bottom: 24px;
	font-size: 14px;
	line-height: 1.5;
}

.auth-alert-icon {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	margin-top: 1px;
}

.auth-alert-error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
}

.auth-alert-error .auth-alert-icon {
	color: var(--auth-color-error);
}

.auth-alert-success {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: #166534;
}

.auth-alert-success .auth-alert-icon {
	color: var(--auth-color-success);
}

.auth-alert-info {
	background: #eff6ff;
	border: 1px solid #bfdbfe;
	color: #1e40af;
}

/* ============================================
   Terms Checkbox (Registration)
   ============================================ */
.auth-terms {
	margin-bottom: 24px;
}

.auth-terms .auth-checkbox {
	align-items: flex-start;
}

.auth-terms .auth-checkbox-label {
	line-height: 1.5;
}

.auth-terms-link {
	color: var(--auth-color-primary);
	text-decoration: none;
}

.auth-terms-link:hover {
	text-decoration: underline;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
	.auth-page {
		grid-template-columns: 1fr;
	}

	.auth-brand-panel {
		display: none;
	}

	.auth-form-panel {
		padding: 32px 24px;
		min-height: 100vh;
	}

	.auth-mobile-logo {
		display: block;
	}
}

@media (max-width: 480px) {
	.auth-form-container {
		max-width: 100%;
	}

	.auth-form-title {
		font-size: 1.625rem;
	}

	.auth-form-panel {
		padding: 24px 20px;
	}

	.auth-options-row {
		flex-direction: column;
		align-items: flex-start;
	}

	.auth-field-row {
		grid-template-columns: 1fr;
		gap: 0;
	}

	.auth-input {
		padding: 12px 14px;
		padding-right: 40px;
	}

	.auth-submit {
		padding: 12px 20px;
	}
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
	.auth-float-card {
		animation: none;
	}

	.auth-submit-spinner {
		animation-duration: 1.5s;
	}

	.auth-field.shake .auth-input {
		animation: none;
	}

	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
	}
}

/* ============================================
   GSAP Animation Initial States
   ============================================ */
.auth-page.gsap-ready .auth-brand-logo,
.auth-page.gsap-ready .auth-brand-title,
.auth-page.gsap-ready .auth-brand-subtitle {
	opacity: 0;
	transform: translateY(30px);
}

.auth-page.gsap-ready .auth-float-card {
	opacity: 0;
	transform: scale(0.8);
}

.auth-page.gsap-ready .auth-form-header,
.auth-page.gsap-ready .auth-field,
.auth-page.gsap-ready .auth-options-row,
.auth-page.gsap-ready .auth-terms,
.auth-page.gsap-ready .auth-submit,
.auth-page.gsap-ready .auth-form-footer {
	opacity: 0;
	transform: translateY(20px);
}

/* ============================================
   User Type Selector (Parent/Student)
   ============================================ */
.auth-user-type-selector {
	margin-bottom: 1.5rem;
}

.auth-user-type-options {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1rem;
	margin-top: 0.5rem;
}

.auth-user-type-option {
	cursor: pointer;
}

.auth-user-type-option input[type="radio"] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.auth-user-type-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	padding: 1.25rem 1rem;
	background: var(--auth-color-background);
	border: 2px solid var(--auth-color-border);
	border-radius: var(--auth-radius);
	transition: all var(--auth-transition-base);
	text-align: center;
}

.auth-user-type-option:hover .auth-user-type-card {
	border-color: var(--auth-color-primary);
	background: #f8f6fb;
}

.auth-user-type-option input:checked+.auth-user-type-card,
.auth-user-type-option.selected .auth-user-type-card {
	border-color: var(--auth-color-primary);
	background: #f3eef9;
	box-shadow: 0 0 0 3px rgba(70, 40, 119, 0.1);
}

.auth-user-type-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	background: var(--auth-color-surface);
	border-radius: 50%;
	color: var(--auth-color-primary);
	transition: all var(--auth-transition-base);
}

.auth-user-type-option input:checked+.auth-user-type-card .auth-user-type-icon {
	background: var(--auth-color-primary);
	color: #fff;
}

.auth-user-type-icon svg {
	width: 24px;
	height: 24px;
}

.auth-user-type-label {
	font-weight: 600;
	font-size: 0.9375rem;
	color: var(--auth-color-text);
}

.auth-user-type-desc {
	font-size: 0.8125rem;
	color: var(--auth-color-text-light);
	line-height: 1.4;
}

/* Parent Email Field */
.auth-field-parent-email {
	transition: all 0.3s ease;
}

.auth-field-help {
	display: block;
	font-size: 0.8125rem;
	color: var(--auth-color-text-muted);
	margin-top: 0.375rem;
	line-height: 1.4;
}

/* Mobile: Stack vertically */
@media (max-width: 480px) {
	.auth-user-type-options {
		grid-template-columns: 1fr;
	}
}