/**
 * Public-facing styles for OTP 2FA plugin
 * Styled to match WordPress login page exactly
 */

/* Hide regular login form ONLY when OTP token is present */
body.login:has(#otp-2fa-form) #loginform,
body.login #otp-2fa-form ~ #loginform {
	display: none !important;
}

/* Show OTP form when token is present */
body.login #otp-2fa-verification-wrapper {
	display: block !important;
}

body.login #otp-2fa-form {
	display: block !important;
}

/* Ensure OTP form is visible */
#otp-2fa-verification-wrapper {
	display: block !important;
}

#otp-2fa-form {
	display: block !important;
}

/* OTP Verification Form - WordPress Login Style */
#otp-2fa-verification-wrapper {
	width: 100%;
	max-width: 320px;
	margin: 0 auto;
	padding: 0;
}

#otp-2fa-form {
	margin-top: 20px;
	padding: 26px 24px 34px;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13);
	border: none;
}

#otp-2fa-form h1 {
	margin: 0 0 20px;
	padding: 0;
	font-size: 24px;
	font-weight: 400;
	line-height: 1.3;
	text-align: center;
	color: #23282d;
}

#otp-2fa-form .otp-description {
	margin: 0 0 16px;
	font-size: 14px;
	line-height: 1.5;
	color: #555;
	text-align: center;
}

#otp-2fa-form p {
	margin: 0 0 16px;
}

#otp-2fa-form label {
	display: block;
	margin-bottom: 3px;
	font-weight: 600;
	font-size: 14px;
	color: #23282d;
}

#otp-2fa-form #otp_code {
	width: 100%;
	padding: 3px 5px;
	font-size: 24px;
	font-weight: 400;
	line-height: 1.5;
	color: #23282d;
	background-color: #fff;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	box-shadow: 0 0 0 transparent;
	letter-spacing: 8px;
	text-align: center;
	font-family: 'Courier New', monospace;
	transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#otp-2fa-form #otp_code:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	outline: 2px solid transparent;
}

#otp-2fa-form #otp_code::placeholder {
	color: #c3c4c7;
	letter-spacing: 0;
}

#otp-2fa-form .otp-actions {
	margin-top: 20px;
	display: flex;
	gap: 10px;
	align-items: center;
	justify-content: space-between;
}

#otp-2fa-form .otp-actions .button {
	height: auto;
	padding: 6px 12px;
	font-size: 13px;
	line-height: 2.15384615;
}

#otp-2fa-form .otp-actions .button-primary {
	width: 100%;
	flex: 1;
}

#otp-2fa-form .otp-actions .button-secondary {
	margin-right: auto;
}

#otp-2fa-form .back-to-login {
	margin-top: 20px;
	text-align: center;
}

#otp-2fa-form .back-to-login a {
	color: #50575e;
	text-decoration: none;
	font-size: 13px;
}

#otp-2fa-form .back-to-login a:hover {
	color: #2271b1;
}

/* Error Messages - WordPress Style */
#otp-2fa-form #login_error {
	background: #fcf0f1;
	border-left: 4px solid #d63638;
	padding: 12px;
	margin: 0 0 16px;
	box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
	color: #1d2327;
	font-size: 13px;
	line-height: 1.5;
}

#otp-2fa-form .message {
	background: #fff;
	border-left: 4px solid #72aee6;
	padding: 12px;
	margin: 0 0 16px;
	box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
	color: #1d2327;
	font-size: 13px;
	line-height: 1.5;
}

/* Loading state for email OTP button */
#send-email-otp:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Ensure form appears in correct location */
body.login #otp-2fa-verification-wrapper {
	position: relative;
}

/* Match WordPress login form spacing */
body.login #otp-2fa-form {
	margin-bottom: 0;
}

/* Style the form to match login form exactly */
body.login #otp-2fa-form input[type="text"] {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Loading spinner for email OTP */
#send-email-otp.loading::before {
	content: "";
	display: inline-block;
	width: 12px;
	height: 12px;
	margin-right: 8px;
	border: 2px solid #fff;
	border-top-color: transparent;
	border-radius: 50%;
	animation: spin 0.6s linear infinite;
	vertical-align: middle;
}

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

/* Responsive adjustments */
@media screen and (max-width: 782px) {
	#otp-2fa-verification-wrapper {
		max-width: 100%;
		padding: 0 20px;
	}

	#otp-2fa-form {
		padding: 20px;
	}

	#otp-2fa-form h1 {
		font-size: 20px;
	}

	#otp-2fa-form #otp_code {
		font-size: 20px;
		letter-spacing: 6px;
	}

	#otp-2fa-form .otp-actions {
		flex-direction: column;
	}

	#otp-2fa-form .otp-actions .button-secondary {
		width: 100%;
		margin-right: 0;
		margin-bottom: 10px;
	}
}

/* Print styles */
@media print {
	#otp-2fa-verification-wrapper {
		display: none;
	}
}
