@layer base {
	html, body {
		height: 100%;
		background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
		overflow: hidden;
	}
}

/* Login feedback icons keep a readable foreground on both theme surfaces. */
.login-toast-icon {
	width: 2rem;
	height: 2rem;
	border-radius: 9999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 2rem;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1;
	border: 1px solid transparent;
}

.login-toast-icon-success { background: rgba(34, 197, 94, .18); color: #22c55e; border-color: rgba(34, 197, 94, .42); }
.login-toast-icon-error { background: rgba(239, 68, 68, .18); color: #ef4444; border-color: rgba(239, 68, 68, .42); }
.login-toast-icon-info { background: rgba(249, 115, 22, .18); color: #f97316; border-color: rgba(249, 115, 22, .42); }

/* Override the page-wide Font Awesome foreground so feedback icons retain their status color. */
.login-toast-icon .fa { color: currentColor !important; }

html[data-theme="light"] .login-toast-icon-success { background: #dcfce7; color: #166534; border-color: #22c55e; }
html[data-theme="light"] .login-toast-icon-error { background: #fee2e2; color: #991b1b; border-color: #ef4444; }
html[data-theme="light"] .login-toast-icon-info { background: #ffedd5; color: #9a3412; border-color: #f97316; }

.login-viewport {
	height: 100vh;
	overflow-x: hidden;
	overflow-y: auto;
}

@media (max-height: 820px) {
	.login-viewport {
		align-items: flex-start !important;
	}
}

.grid-bg {
	position: absolute;
	width: 200%;
	height: 200%;
	top: -50%;
	left: -50%;
	background-image: 
		linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px), 
		linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
	background-size: 40px 40px;
	transform: perspective(500px) rotateX(60deg);
	animation: gridMove 20s linear infinite;
	z-index: 0;
}

@keyframes gridMove {
	0% { transform: perspective(500px) rotateX(60deg) translateY(0); }
	100% { transform: perspective(500px) rotateX(60deg) translateY(40px); }
}

.scanline {
	position: absolute;
	width: 100%;
	height: 2px;
	background: linear-gradient(90deg, transparent, rgba(99,102,241,0.8), transparent);
	top: 0;
	left: 0;
	z-index: 1;
	animation: scanline 4s linear infinite;
	pointer-events: none;
}

@keyframes scanline {
	0% { top: 0; }
	100% { top: 100%; }
}

.ring-container {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
}

.ring {
	position: absolute;
	border: 1px solid rgba(99,102,241,0.15);
	border-radius: 50%;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
}

.ring:nth-child(1) { width: 300px; height: 300px; animation: ringPulse 3s ease-in-out infinite; }
.ring:nth-child(2) { width: 500px; height: 500px; animation: ringPulse 4s ease-in-out infinite 0.5s; }
.ring:nth-child(3) { width: 700px; height: 700px; animation: ringPulse 5s ease-in-out infinite 1s; }

@keyframes ringPulse {
	0%, 100% {
		transform: translate(-50%, -50%) scale(1);
		opacity: 0.3;
	}
	50% {
		transform: translate(-50%, -50%) scale(1.05);
		opacity: 0.6;
	}
}

.particles {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	z-index: 0;
	pointer-events: none;
	overflow: hidden;
}

.particle {
	position: absolute;
	width: 4px;
	height: 4px;
	background: #6366f1;
	border-radius: 50%;
	animation: particleFloat 15s ease-in-out infinite;
	box-shadow: 0 0 10px rgba(99,102,241,0.5);
}

.particle:nth-child(1) { top: 20%; left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { top: 30%; right: 15%; animation-delay: 2s; }
.particle:nth-child(3) { bottom: 25%; left: 20%; animation-delay: 4s; }
.particle:nth-child(4) { top: 50%; right: 25%; animation-delay: 6s; }
.particle:nth-child(5) { bottom: 40%; left: 30%; animation-delay: 8s; }
.particle:nth-child(6) { top: 60%; right: 35%; animation-delay: 10s; }
.particle:nth-child(7) { bottom: 15%; right: 40%; animation-delay: 12s; }
.particle:nth-child(8) { top: 75%; left: 45%; animation-delay: 14s; }

@keyframes particleFloat {
	0%, 100% {
		transform: translateY(0) translateX(0);
		opacity: 0;
	}
	10% { opacity: 1; }
	90% { opacity: 1; }
	100% {
		transform: translateY(-100px) translateX(50px);
		opacity: 0;
	}
}

.fa, .fa-user, .fa-lock, .fa-id-card, .fa-chevron-right, .fa-check {
	color: #ffffff !important;
}

#login-form .input-field,
#register-form .input-field,
.input-field,
.input-field:hover,
.input-field:focus,
.input-field:active,
.input-field:disabled {
	height: 52px !important;
	border-radius: 12px !important;
	border: 1px solid rgba(99,102,241,0.4) !important;
	background: rgba(20,20,35,0.9) !important;
	color: #fff !important;
	font-size: 15px !important;
	transition: none !important;
	box-shadow: inset 0 2px 4px rgba(0,0,0,0.1) !important;
	padding-left: 55px !important;
	opacity: 1 !important;
}

.input-field:focus {
	border-color: #6366f1 !important;
	box-shadow: 0 0 0 3px rgba(99,102,241,0.2) !important;
	outline: none !important;
}

.input-field::placeholder {
	color: rgba(255,255,255,0.5) !important;
	letter-spacing: 1px !important;
}

html body #login-form .input-field:-webkit-autofill,
html body #login-form .input-field:-webkit-autofill:hover,
html body #login-form .input-field:-webkit-autofill:focus,
html body #login-form .input-field:-webkit-autofill:active,
html body #register-form .input-field:-webkit-autofill,
html body #register-form .input-field:-webkit-autofill:hover,
html body #register-form .input-field:-webkit-autofill:focus,
html body #register-form .input-field:-webkit-autofill:active,
.input-field:-webkit-autofill,
.input-field:-webkit-autofill:hover,
.input-field:-webkit-autofill:focus,
.input-field:-webkit-autofill:active {
	-webkit-box-shadow: 0 0 0 1000px rgba(20,20,35,0.9) inset !important;
	-webkit-text-fill-color: #fff !important;
	transition: background-color 5000s ease-in-out 0s !important;
	background-color: rgba(20,20,35,0.9) !important;
	caret-color: #fff !important;
	animation-name: none !important;
	-webkit-animation-name: none !important;
}

.input-field:-moz-autofill,
.input-field:-moz-autofill:hover,
.input-field:-moz-autofill:focus {
	box-shadow: 0 0 0 1000px rgba(20,20,35,0.9) inset !important;
	-moz-text-fill-color: #fff !important;
}

.shimmer-btn {
	position: relative;
	overflow: hidden;
}

.shimmer-btn::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(120deg, transparent, rgba(255,255,255,0.25), transparent);
	transition: left 0.5s ease;
}

.shimmer-btn:hover::before {
	left: 100%;
}

/* Keep login actions branded while a request is in progress. The shared
   theme marks every disabled button neutral, which makes these actions look
   like empty white boxes in the light theme. */
html[data-theme] #login-form #login-btn:disabled,
html[data-theme] #forgot-form #forgot-btn:disabled,
html[data-theme] #register-form #register-btn:disabled {
	background-color: transparent !important;
	background-image: linear-gradient(90deg, #3b82f6, #06b6d4) !important;
	border-color: transparent !important;
	color: #ffffff !important;
	opacity: 0.86 !important;
	cursor: wait !important;
}

.logo {
	width: 80px;
	height: 80px;
	border-radius: 24px;
	background: 
		linear-gradient(#1a1a2e, #1a1a2e) padding-box, 
		linear-gradient(135deg, #6366f1, #ec4899, #8b5cf6, #6366f1) border-box;
	background-size: 200% 200%;
	animation: 
		logoGradient 3s ease infinite, 
		logoGlow 2s ease-in-out infinite alternate;
	box-shadow: 
		0 0 30px rgba(99,102,241,0.4), 
		0 0 60px rgba(236,72,153,0.2), 
		inset 0 0 20px rgba(99,102,241,0.2);
	border: 2px solid transparent;
}

@keyframes logoGradient {
	0% { background-position: 0% 50%; }
	50% { background-position: 100% 50%; }
	100% { background-position: 0% 50%; }
}

@keyframes logoGlow {
	0% { box-shadow: 0 0 30px rgba(99,102,241,0.4), 0 0 60px rgba(236,72,153,0.2); }
	100% { box-shadow: 0 0 50px rgba(236,72,153,0.5), 0 0 80px rgba(99,102,241,0.3); }
}

@keyframes logoRotate {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

@keyframes borderGradient {
	0% { background-position: 0% 50%; }
	50% { background-position: 100% 50%; }
	100% { background-position: 0% 50%; }
}

.slider-captcha-track {
	width: 100%;
	height: 52px;
	background: rgba(20,20,35,0.9);
	border: 1px solid rgba(99,102,241,0.3);
	border-radius: 12px;
	position: relative;
	overflow: hidden;
	cursor: pointer;
}

.slider-captcha-text {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: rgba(255,255,255,0.5);
	font-size: 14px;
	z-index: 1;
	pointer-events: none;
}

.slider-captcha-progress {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 0;
	background: linear-gradient(90deg, rgba(99,102,241,0.2), rgba(139,92,246,0.3));
	z-index: 2;
	pointer-events: none;
	transition: none;
}

.slider-captcha-btn {
	position: absolute;
	left: 0;
	top: 2px;
	bottom: 2px;
	width: 48px;
	background: linear-gradient(135deg, #6366f1, #8b5cf6);
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 18px;
	z-index: 3;
	cursor: grab;
	box-shadow: 0 2px 8px rgba(99,102,241,0.4);
	transition: background 0.2s ease;
	user-select: none;
}

.slider-captcha-btn:hover {
	background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.slider-captcha-success .slider-captcha-progress {
	background: linear-gradient(90deg, rgba(34,197,94,0.3), rgba(74,222,128,0.4));
}

.slider-captcha-success .slider-captcha-text {
	color: #4ade80;
}

.slider-captcha-success .slider-captcha-btn {
	background: linear-gradient(135deg, #22c55e, #4ade80);
}

.wechat-dialog-card {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 384px;
	padding: 24px;
	border: 1px solid rgba(148, 163, 184, 0.45);
	border-radius: 16px;
	background: #ffffff;
	color: #1e293b;
	text-align: center;
	box-shadow: 0 24px 60px rgba(15, 23, 42, 0.30);
}

.wechat-dialog-close {
	position: absolute;
	top: 12px;
	right: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	background: transparent;
	color: #64748b;
	cursor: pointer;
	font-size: 22px;
	font-weight: 700;
	line-height: 1;
}

.wechat-dialog-close:hover {
	background: #f1f5f9;
	color: #334155;
}

.wechat-dialog-title {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	line-height: 28px;
	letter-spacing: 0;
	color: #1e293b;
}

.wechat-dialog-qr {
	display: block;
	box-sizing: border-box;
	width: 176px;
	height: 176px;
	margin: 16px auto 0;
	padding: 8px;
	border-radius: 8px;
	background: #ffffff;
	object-fit: contain;
}

.wechat-dialog-copy {
	margin: 12px 0 0;
	font-size: 14px;
	line-height: 20px;
	letter-spacing: 0;
	color: #475569;
}

.wechat-dialog-code {
	font-size: 20px;
	letter-spacing: 0.2em;
	color: #2563eb;
}

.wechat-dialog-status {
	margin: 8px 0 0;
	font-size: 12px;
	line-height: 18px;
	letter-spacing: 0;
	color: #64748b;
}

.wechat-dialog-account-hint {
	margin-top: 8px;
}

.wechat-dialog-select {
	display: block;
	box-sizing: border-box;
	width: 100%;
	min-height: 160px;
	margin-top: 16px;
	padding: 8px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	background: #ffffff;
	color: #334155;
	font-size: 14px;
	line-height: 20px;
	text-align: left;
}

.wechat-dialog-primary {
	border: 0;
	border-radius: 8px;
	background: #2563eb;
	color: #ffffff;
	font-size: 14px;
	font-weight: 600;
	line-height: 20px;
	cursor: pointer;
}

.wechat-dialog-primary:hover {
	background: #1d4ed8;
}

.wechat-dialog-restart {
	margin-top: 12px;
	padding: 8px 12px;
}

.wechat-dialog-submit {
	width: 100%;
	margin-top: 16px;
	padding: 10px 12px;
}

html[data-theme="dark"] .wechat-dialog-card {
	border-color: rgba(255, 255, 255, 0.14);
	background: #0f172a;
	color: #f8fafc;
}

html[data-theme="dark"] .wechat-dialog-close {
	border-color: rgba(255, 255, 255, 0.18);
	color: #cbd5e1;
}

html[data-theme="dark"] .wechat-dialog-close:hover {
	background: rgba(255, 255, 255, 0.10);
	color: #ffffff;
}

html[data-theme="dark"] .wechat-dialog-title {
	color: #ffffff;
}

html[data-theme="dark"] .wechat-dialog-copy,
html[data-theme="dark"] .wechat-dialog-status {
	color: #cbd5e1;
}

html[data-theme="dark"] .wechat-dialog-code {
	color: #93c5fd;
}

html[data-theme="dark"] .wechat-dialog-select {
	border-color: rgba(255, 255, 255, 0.18);
	background: #1e293b;
	color: #f8fafc;
}
