/* ==========================================================================
   Asegure ERP - Modern Login Styles
   ========================================================================== */

/* CSS Variables for Brand Consistency */
:root {
	--asegure-primary: #1a1f71;
	--asegure-primary-light: #2d3494;
	--asegure-accent: #7c83ed;
	--asegure-accent-light: #a8aef5;
	--asegure-purple: #8b5cf6;
	--asegure-gradient: linear-gradient(135deg, #1a1f71 0%, #4f46e5 50%, #7c3aed 100%);
	--asegure-text: #1e293b;
	--asegure-text-muted: #64748b;
	--asegure-border: #e2e8f0;
	--asegure-bg: #f8fafc;
	--asegure-white: #ffffff;
	--asegure-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
	--asegure-shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
	--asegure-radius: 16px;
	--asegure-radius-sm: 10px;
	--asegure-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Body & Background */
body.login {
	background: var(--asegure-gradient);
	background-attachment: fixed;
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow-x: hidden;
}

/* Animated Background Pattern */
body.login::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background:
		radial-gradient(circle at 20% 80%, rgba(124, 131, 237, 0.3) 0%, transparent 50%),
		radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.3) 0%, transparent 50%),
		radial-gradient(circle at 40% 40%, rgba(79, 70, 229, 0.2) 0%, transparent 40%);
	animation: pulse 15s ease-in-out infinite alternate;
	pointer-events: none;
	z-index: 0;
}

@keyframes pulse {
	0% { opacity: 0.5; transform: scale(1); }
	100% { opacity: 0.8; transform: scale(1.1); }
}

/* Floating Shapes Animation */
body.login::after {
	content: '';
	position: fixed;
	width: 400px;
	height: 400px;
	background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 100%);
	border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
	top: -100px;
	right: -100px;
	animation: float 20s ease-in-out infinite;
	pointer-events: none;
	z-index: 0;
}

@keyframes float {
	0%, 100% { transform: translate(0, 0) rotate(0deg); }
	25% { transform: translate(-20px, 20px) rotate(5deg); }
	50% { transform: translate(0, 40px) rotate(0deg); }
	75% { transform: translate(20px, 20px) rotate(-5deg); }
}

/* Login Container */
#login {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 440px;
	padding: 48px 40px;
	margin: 20px;
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	border-radius: var(--asegure-radius);
	box-shadow: var(--asegure-shadow);
	border: 1px solid rgba(255, 255, 255, 0.2);
	animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
	from {
		opacity: 0;
		transform: translateY(30px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Logo Section */
#login h1 {
	margin-bottom: 8px;
}

#login h1 a,
.login h1 a {
	background: url('../img/asegure-logo.png') no-repeat center center;
	background-size: contain;
	width: 220px;
	height: 70px;
	display: block;
	margin: 0 auto 16px;
	text-indent: -9999px;
	outline: none;
	transition: var(--asegure-transition);
}

#login h1 a:hover {
	transform: scale(1.02);
}

/* Welcome Text */
#login h1::after {
	content: 'Welcome back';
	display: block;
	text-align: center;
	font-size: 15px;
	font-weight: 500;
	color: var(--asegure-text-muted);
	letter-spacing: 0.3px;
	margin-top: 4px;
}

/* Form Container */
#loginform,
#lostpasswordform,
#registerform {
	margin-top: 32px;
	padding: 0;
	background: transparent;
	border: none;
	box-shadow: none;
}

/* Labels */
#loginform label,
#lostpasswordform label,
#registerform label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--asegure-text);
	margin-bottom: 8px;
	letter-spacing: 0.2px;
}

/* Input Fields */
#loginform input[type="text"],
#loginform input[type="password"],
#lostpasswordform input[type="text"],
#registerform input[type="text"],
#registerform input[type="email"] {
	width: 100%;
	padding: 14px 18px;
	font-size: 15px;
	color: var(--asegure-text);
	background: var(--asegure-bg);
	border: 2px solid var(--asegure-border);
	border-radius: var(--asegure-radius-sm);
	outline: none;
	transition: var(--asegure-transition);
	margin-bottom: 8px;
	box-sizing: border-box;
}

#loginform input[type="text"]:hover,
#loginform input[type="password"]:hover,
#lostpasswordform input[type="text"]:hover,
#registerform input[type="text"]:hover,
#registerform input[type="email"]:hover {
	border-color: var(--asegure-accent-light);
	background: var(--asegure-white);
}

#loginform input[type="text"]:focus,
#loginform input[type="password"]:focus,
#lostpasswordform input[type="text"]:focus,
#registerform input[type="text"]:focus,
#registerform input[type="email"]:focus {
	border-color: var(--asegure-primary);
	background: var(--asegure-white);
	box-shadow: 0 0 0 4px rgba(26, 31, 113, 0.1);
}

#loginform input::placeholder,
#lostpasswordform input::placeholder,
#registerform input::placeholder {
	color: var(--asegure-text-muted);
	opacity: 0.7;
}

/* Password Field Container */
.user-pass-wrap {
	margin-top: 20px;
}

/* Remember Me & Forgot Password Row */
.forgetmenot {
	display: flex;
	align-items: center;
	margin: 20px 0 !important;
}

.forgetmenot label {
	display: inline-flex !important;
	align-items: center;
	gap: 10px;
	font-size: 14px !important;
	font-weight: 500 !important;
	color: var(--asegure-text-muted) !important;
	cursor: pointer;
	margin-bottom: 0 !important;
	line-height: 1;
}

/* Custom Checkbox */
#rememberme {
	width: 20px;
	height: 20px;
	margin: 0 8px 0 0;
	padding: 0;
	accent-color: var(--asegure-primary);
	cursor: pointer;
	border-radius: 4px;
	flex-shrink: 0;
	vertical-align: middle;
}

/* Submit Button */
#wp-submit,
.button.button-large {
	width: 100%;
	padding: 16px 24px;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.5px;
	color: var(--asegure-white);
	background: var(--asegure-gradient);
	border: none;
	border-radius: var(--asegure-radius-sm);
	cursor: pointer;
	transition: var(--asegure-transition);
	text-transform: none;
	box-shadow: 0 4px 15px rgba(26, 31, 113, 0.3);
	position: relative;
	overflow: hidden;
	margin-top: 8px;
}

#wp-submit::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
	transition: left 0.5s ease;
}

#wp-submit:hover::before {
	left: 100%;
}

#wp-submit:hover,
.button.button-large:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(26, 31, 113, 0.4);
}

#wp-submit:active,
.button.button-large:active {
	transform: translateY(0);
}

#wp-submit:focus {
	outline: none;
	box-shadow: 0 0 0 4px rgba(26, 31, 113, 0.2), 0 8px 25px rgba(26, 31, 113, 0.4);
}

/* Submit Row Layout */
.submit {
	margin-top: 24px;
}

/* Navigation Links */
#nav,
#backtoblog {
	text-align: center;
	margin: 20px 0 0;
	padding: 0;
}

#nav a,
#backtoblog a {
	color: var(--asegure-primary);
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	transition: var(--asegure-transition);
	position: relative;
}

#nav a::after,
#backtoblog a::after {
	content: '';
	position: absolute;
	bottom: -2px;
	left: 0;
	width: 0;
	height: 2px;
	background: var(--asegure-primary);
	transition: width 0.3s ease;
}

#nav a:hover::after,
#backtoblog a:hover::after {
	width: 100%;
}

#nav a:hover,
#backtoblog a:hover {
	color: var(--asegure-primary-light);
}

#nav {
	border-top: 1px solid var(--asegure-border);
	padding-top: 24px;
	margin-top: 28px;
}

/* Error Messages */
#login_error,
.login .message,
.login .success {
	margin: 0 0 24px;
	padding: 16px 20px;
	border-radius: var(--asegure-radius-sm);
	font-size: 14px;
	line-height: 1.5;
	border: none;
	box-shadow: var(--asegure-shadow-sm);
}

#login_error {
	background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
	border-left: 4px solid #ef4444;
	color: #991b1b;
}

.login .message {
	background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
	border-left: 4px solid var(--asegure-primary);
	color: var(--asegure-primary);
}

.login .success {
	background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
	border-left: 4px solid #22c55e;
	color: #166534;
}

#login_error a {
	color: #dc2626;
	font-weight: 600;
}

/* Privacy Policy Link */
.privacy-policy-page-link {
	text-align: center;
	margin-top: 20px;
}

.privacy-policy-page-link a {
	color: var(--asegure-text-muted);
	font-size: 12px;
	text-decoration: none;
	transition: var(--asegure-transition);
}

.privacy-policy-page-link a:hover {
	color: var(--asegure-primary);
}

/* Language Switcher */
.language-switcher {
	margin-top: 24px;
	text-align: center;
}

.language-switcher select {
	padding: 8px 16px;
	font-size: 13px;
	border: 2px solid var(--asegure-border);
	border-radius: var(--asegure-radius-sm);
	background: var(--asegure-white);
	color: var(--asegure-text);
	cursor: pointer;
	transition: var(--asegure-transition);
}

.language-switcher select:hover {
	border-color: var(--asegure-accent-light);
}

/* Hide unnecessary elements */
.login #login_error + #login_error,
.login form .input,
.login input[type="text"]:focus,
.login input[type="password"]:focus {
	box-shadow: none;
}

/* Interim Login Adjustments */
.interim-login #login {
	margin: 0 auto;
}

/* Two Factor Auth Compatibility */
.login .backup-methods-wrap {
	margin-top: 20px;
	text-align: center;
}

/* Password Visibility Toggle */
.wp-pwd {
	position: relative;
}

.wp-pwd .button.wp-hide-pw {
	position: absolute;
	right: 0;
	top: 0;
	height: calc(100% - 8px);
	width: 50px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	padding: 0;
	color: var(--asegure-text-muted);
	cursor: pointer;
	transition: var(--asegure-transition);
}

.wp-pwd .button.wp-hide-pw:hover {
	color: var(--asegure-primary);
	background: transparent;
}

.wp-pwd .button.wp-hide-pw:focus {
	outline: none;
	box-shadow: none;
}

.wp-pwd .button.wp-hide-pw .dashicons {
	display: flex;
	align-items: center;
	justify-content: center;
}

.wp-pwd input[type="password"],
.wp-pwd input[type="text"] {
	padding-right: 50px;
}

/* Loading State */
#wp-submit[disabled] {
	opacity: 0.7;
	cursor: not-allowed;
	transform: none !important;
}

/* Shake Animation for Errors */
@keyframes shake {
	0%, 100% { transform: translateX(0); }
	10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
	20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.login-error-shake {
	animation: shake 0.5s ease-in-out;
}

/* Mobile Responsive */
@media screen and (max-width: 480px) {
	#login {
		padding: 36px 28px;
		margin: 16px;
		max-width: calc(100% - 32px);
	}

	#login h1 a,
	.login h1 a {
		width: 180px;
		height: 56px;
	}

	#loginform input[type="text"],
	#loginform input[type="password"] {
		padding: 12px 16px;
		font-size: 16px; /* Prevents zoom on iOS */
	}

	#wp-submit {
		padding: 14px 20px;
	}
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
	#login {
		border: 2px solid var(--asegure-primary);
	}

	#loginform input[type="text"],
	#loginform input[type="password"] {
		border-width: 2px;
	}
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
	body.login::before,
	body.login::after {
		animation: none;
	}

	#login {
		animation: none;
		opacity: 1;
		transform: none;
	}

	#wp-submit::before {
		display: none;
	}

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
	/* Keep light theme for login - brand consistency */
}

/* Print Styles */
@media print {
	body.login {
		background: white;
	}

	body.login::before,
	body.login::after {
		display: none;
	}

	#login {
		box-shadow: none;
		border: 1px solid #ddd;
	}
}
