/* ============================================================
   Canteen Inventory Manager – Login Page Styles
   ============================================================ */

/* ── Reset & Base ───────────────────────────────────────────── */
:root {
	--cim-blue:        #2271b1;
	--cim-blue-dark:   #1a5a8f;
	--cim-blue-light:  #e8f0fa;
	--cim-green:       #00a32a;
	--cim-green-dark:  #007a1f;
	--cim-green-light: #e6f4ea;
	--cim-gray:        #787c82;
	--cim-border:      #c3c4c7;
	--cim-radius:      12px;
	--cim-font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Body & Background ──────────────────────────────────────── */
body.login {
	background: linear-gradient( 135deg, #0f2027 0%, #203a43 50%, #2c5364 100% );
	min-height: 100vh;
	font-family: var(--cim-font);
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
}

/* Subtle animated background orbs */
body.login::before,
body.login::after {
	content: '';
	position: fixed;
	border-radius: 50%;
	opacity: 0.15;
	animation: cim-float 8s ease-in-out infinite;
	pointer-events: none;
	z-index: 0;
}

body.login::before {
	width: 500px;
	height: 500px;
	background: radial-gradient( circle, var(--cim-blue) 0%, transparent 70% );
	top: -120px;
	left: -120px;
	animation-delay: 0s;
}

body.login::after {
	width: 400px;
	height: 400px;
	background: radial-gradient( circle, var(--cim-green) 0%, transparent 70% );
	bottom: -100px;
	right: -100px;
	animation-delay: -4s;
}

@keyframes cim-float {
	0%, 100% { transform: translateY( 0 ) scale( 1 ); }
	50%       { transform: translateY( -30px ) scale( 1.05 ); }
}

/* ── Login Container ────────────────────────────────────────── */
#login {
	background: #FFFFFF;
	border-radius: 20px;
	box-shadow: 0 25px 60px rgba( 0, 0, 0, 0.35 ), 0 8px 20px rgba( 0, 0, 0, 0.2 );
	padding: 44px 44px 36px;
	width: 100%;
	max-width: 420px;
	position: relative;
	z-index: 1;
	box-sizing: border-box;
}

/* ── Logo / Branding ────────────────────────────────────────── */
/*    The URL below acts as a static fallback. The PHP method     */
/*    add_custom_logo_css() overrides it dynamically via          */
/*    login_head, allowing the URL to be filtered.                */
#login h1 a,
.login h1 a {
	display: block;
	width: 160px;
	height: 160px;
	margin: 0 auto 10px;
	background-image: url('https://isac.dominusit.online/wp-content/uploads/2026/03/isac_logo.png');
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	text-indent: -9999px;
	overflow: hidden;
}

/* Remove the emoji pseudo-element */
#login h1 a::before {
	content: none;
	display: none;
}

.login h1 {
	margin-bottom: 20px;
	text-align: center;
}

/* ── Form Labels ────────────────────────────────────────────── */
.login form .input,
.login input[type='text'],
.login input[type='password'] {
	border: 2px solid #e2e8f0;
	border-radius: 10px;
	padding: 12px 16px 12px 12px;
	font-size: 0.95rem;
	font-family: var(--cim-font);
	background: #f8fafc;
	color: #1e293b;
	width: 100%;
	box-sizing: border-box;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
	outline: none;
}

.login form .input:focus,
.login input[type='text']:focus,
.login input[type='password']:focus {
	border-color: var(--cim-blue);
	background: #fff;
	box-shadow: 0 0 0 4px rgba( 34, 113, 177, 0.12 );
}

/* Field wrappers – used for icon positioning */
.login form .input-text-wrap {
	position: relative;
}

/* Icon injected via pseudo-element on a wrapper span */
.login label[for='user_login'] + .input-text-wrap::before,
.login label[for='user_email'] + .input-text-wrap::before {
	content: '';
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY( -50% );
	width: 18px;
	height: 18px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-size: contain;
	pointer-events: none;
	z-index: 1;
}

.login label[for='user_pass'] + .input-text-wrap::before {
	content: '';
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY( -50% );
	width: 18px;
	height: 18px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-size: contain;
	pointer-events: none;
	z-index: 1;
}

/* ── Labels ─────────────────────────────────────────────────── */
.login label {
	font-size: 0.82rem;
	font-weight: 600;
	color: #475569;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	display: block;
	margin-bottom: 6px;
}

/* ── Remember Me ────────────────────────────────────────────── */
.login .forgetmenot {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 20px !important;
}

.login .forgetmenot label {
	font-size: 0.85rem;
	font-weight: 500;
	color: #64748b;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	margin-bottom: 0;
}

/* Custom checkbox */
.login .forgetmenot input[type='checkbox'] {
	appearance: none;
	-webkit-appearance: none;
	width: 18px;
	height: 18px;
	border: 2px solid #cbd5e1;
	border-radius: 5px;
	background: #f8fafc;
	cursor: pointer;
	position: relative;
	flex-shrink: 0;
	transition: border-color 0.2s, background 0.2s;
}

.login .forgetmenot input[type='checkbox']:checked {
	background: var(--cim-blue);
	border-color: var(--cim-blue);
}

.login .forgetmenot input[type='checkbox']:checked::after {
	content: '';
	position: absolute;
	left: 3px;
	top: 0px;
	width: 6px;
	height: 10px;
	border: 2px solid #fff;
	border-top: none;
	border-left: none;
	transform: rotate( 45deg );
}

/* ── Submit Button ──────────────────────────────────────────── */
.login .button-primary,
#wp-submit {
	background: linear-gradient( 135deg, var(--cim-blue) 0%, var(--cim-green) 100% );
	border: none;
	border-radius: 10px;
	color: #fff;
	font-family: var(--cim-font);
	font-size: 0.95rem;
	font-weight: 600;
	padding: 13px 20px;
	width: 100%;
	cursor: pointer;
	letter-spacing: 0.03em;
	box-shadow: 0 4px 14px rgba( 34, 113, 177, 0.3 );
	transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
	position: relative;
	overflow: hidden;
}

.login .button-primary::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba( 255, 255, 255, 0 );
	transition: background 0.2s ease;
}

.login .button-primary:hover,
#wp-submit:hover {
	opacity: 0.92;
	transform: translateY( -1px );
	box-shadow: 0 6px 20px rgba( 34, 113, 177, 0.4 );
}

.login .button-primary:active,
#wp-submit:active {
	transform: translateY( 0 );
	box-shadow: 0 2px 8px rgba( 34, 113, 177, 0.25 );
}

/* Loading state */
.login .button-primary.cim-loading {
	pointer-events: none;
	opacity: 0.75;
}

.login .button-primary.cim-loading::before {
	content: '';
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid rgba( 255, 255, 255, 0.4 );
	border-top-color: #fff;
	border-radius: 50%;
	animation: cim-spin 0.7s linear infinite;
	margin-right: 8px;
	vertical-align: middle;
}

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

/* ── Password Toggle ────────────────────────────────────────── */
.cim-pw-wrap {
	position: relative;
}

.login .button.wp-hide-pw{ margin-top: 4px !important;  }
.cim-pw-toggle {
	display: none !important;
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY( -50% );
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	color: #94a3b8;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s ease;
	z-index: 2;
}

.cim-pw-toggle:hover {
	color: var(--cim-blue);
}

.cim-pw-toggle svg {
	width: 18px;
	height: 18px;
	pointer-events: none;
}

/* ── "Lost your password?" link ─────────────────────────────── */
#nav,
#backtoblog {
	text-align: center;
	margin-top: 16px;
}

#nav a,
#backtoblog a {
	color: var(--cim-blue);
	font-size: 0.85rem;
	text-decoration: none;
	transition: color 0.2s ease;
}

#nav a:hover,
#backtoblog a:hover {
	color: var(--cim-blue-dark);
	text-decoration: underline;
}

/* ── Error / Info Messages ──────────────────────────────────── */
.login #login_error,
.login .message,
.login .success {
	border-radius: 10px;
	border-left: none;
	padding: 12px 16px;
	font-size: 0.88rem;
	margin-bottom: 16px;
}

.login #login_error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #b91c1c;
}

.login .message {
	background: var(--cim-blue-light);
	border: 1px solid #bfdbfe;
	color: #1e40af;
}

.login .success {
	background: var(--cim-green-light);
	border: 1px solid #bbf7d0;
	color: var(--cim-green-dark);
}

/* ── Form spacing ───────────────────────────────────────────── */
.login form {
	margin-top: 0;
	padding: 0;
	background: none;
	border: none;
	box-shadow: none;
}

.login form p {
	margin-bottom: 16px;
}

.login form .forgetmenot {
	float: none;
}

.login #wp-submit {
	float: none;
}

.login .submit {
	padding: 0;
	margin-top: 4px;
}

/* Divider between "Remember me" and submit */
.login .login-remember-submit {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* ── Enhanced Responsive Styles ─────────────────────────────── */

/* Tablet and smaller */
@media (max-width: 768px) {
	#login {
		max-width: 380px;
		padding: 36px 32px 30px;
	}
	
	#login h1 a,
	.login h1 a {
		width: 140px;
		height: 140px;
	}
}

/* Mobile devices */
@media (max-width: 480px) {
	body.login {
		padding: 16px;
	}
	
	#login {
		margin: 16px auto;
		padding: 28px 20px 24px;
		border-radius: 16px;
		max-width: 100%;
		width: 100%;
	}
	
	#login h1 a,
	.login h1 a {
		width: 120px;
		height: 120px;
		margin-bottom: 8px;
	}
	
	.login h1 {
		margin-bottom: 16px;
	}
	
	/* Form inputs - 16px font prevents iOS zoom on focus */
	.login form .input,
	.login input[type='text'],
	.login input[type='password'] {
		padding: 14px 16px 14px 12px;
		font-size: 16px;
	}
	
	/* Labels */
	.login label {
		font-size: 0.75rem;
	}
	
	/* Submit button - better touch target */
	.login .button-primary,
	#wp-submit {
		padding: 14px 20px;
		font-size: 1rem;
		min-height: 48px;
	}
	
	/* Remember me checkbox */
	.login .forgetmenot {
		margin-bottom: 16px !important;
	}
	
	.login .forgetmenot label {
		font-size: 0.8rem;
	}
	
	/* Links */
	#nav,
	#backtoblog {
		margin-top: 12px;
	}
	
	#nav a,
	#backtoblog a {
		font-size: 0.8rem;
	}
	
	/* Error/Info messages */
	.login #login_error,
	.login .message,
	.login .success {
		padding: 10px 14px;
		font-size: 0.82rem;
		margin-bottom: 12px;
	}
	
	/* Form spacing */
	.login form p {
		margin-bottom: 14px;
	}
}

/* Extra small devices */
@media (max-width: 360px) {
	#login {
		padding: 24px 16px 20px;
	}
	
	#login h1 a,
	.login h1 a {
		width: 100px;
		height: 100px;
	}
	
	.login form .input,
	.login input[type='text'],
	.login input[type='password'] {
		padding: 12px 14px 12px 10px;
	}
}

/* Fix for iOS safe areas (notch and home indicator) */
@supports (padding: max(0px)) {
	body.login {
		padding-left: max(16px, env(safe-area-inset-left));
		padding-right: max(16px, env(safe-area-inset-right));
		padding-bottom: max(16px, env(safe-area-inset-bottom));
	}
}
