/**
 * Auth Management — Shared Stylesheet
 *
 * Globally enqueued by class-am-script-loader.php on every front-end page.
 */

/* ── Auth UI Container ─────────────────────────────────────────────────────── */
/* Single widget placed outside the Elementor form. JS moves children into place. */

.am-auth-ui {
	display: none;
}

/* ── Eye Toggle — positioned inside password field group ───────────────────── */

.am-has-eye-toggle {
	position: relative;
}

.am-has-eye-toggle .am-toggle-password {
	position: absolute;
	right: 1.6em;
  top: 33%;
	transform: translateY(-50%);
	z-index: 1;
	max-width: 50px;
}

/* Prevent text from hiding behind the button */
.am-has-eye-toggle input[type="password"],
.am-has-eye-toggle input[type="text"] {
	padding-right: 2.5em !important;
	box-sizing: border-box;
}

/* Optional reusable style for Elementor toggle container class used by CCMU templates. */
.am-has-eye-toggle .ccm-password-toggle {
	position: absolute !important;
	right: 10px !important;
	top: 40% !important;
	/* transform: translateY(-50%) !important; */
	width: 30px !important;
	height: 30px !important;
	border: 0 !important;
	background: transparent !important;
	padding: 0 !important;
	margin: 0 !important;
	z-index: 6 !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
}

.am-has-eye-toggle .ccm-password-toggle .elementor-icon,
.am-has-eye-toggle .ccm-password-toggle .elementor-icon-wrapper {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	line-height: 1 !important;
	width: 100%;
	height: 100%;
}

.am-has-eye-toggle .ccm-password-toggle .elementor-icon {
	font-size: 18px !important;
}

.am-has-eye-toggle input[type="password"],
.am-has-eye-toggle input[type="text"] {
	padding-right: 44px !important;
}

/* ── Eye Toggle Button ─────────────────────────────────────────────────────── */
/* JS moves this button inside .am-has-eye-toggle (the password field group). */

.am-toggle-password {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	color: inherit;
	line-height: 1;
	border-radius: 0;
	box-shadow: none;
	min-height: 0;
	min-width: 0;
}

.am-toggle-password:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.am-toggle-password svg {
	pointer-events: none;
}

/* Elementor/theme may reset [hidden] — force it back */
.am-toggle-password [hidden] {
	display: none;
}

/* ── Password Rules List ───────────────────────────────────────────────────── */

.am-pw-rules {
	list-style: none;
	margin: 0.5em 0 0;
	padding: 0;
	font-size: 0.85em;
}

.am-pw-rules[hidden] {
	display: none;
}

.am-pw-rule {
	padding: 0.15em 0;
	transition: color 0.15s ease;
}

.am-pw-rule.am-is-met {
	color: #1a7f37;
}

.am-pw-rule.am-is-met::before {
	content: "✓ ";
}

.am-pw-rule.am-is-unmet {
	color: #cf222e;
}

.am-pw-rule.am-is-unmet::before {
	content: "✗ ";
}

/* Elementor icon-list variant — SVG icons are already in the markup.
   Suppress the text ::before and swap X ↔ checkmark via class. */
.elementor-icon-list-items .am-pw-rule::before {
	content: none !important;
}

.am-pw-rules .am-icon-correct {
	display: none !important;
}

.am-pw-rules .am-pw-rule.am-is-met > .elementor-icon-list-icon:not( .am-icon-correct ) {
	display: none !important;
}

.am-pw-rules .am-pw-rule.am-is-met > .am-icon-correct {
	display: inline-flex !important;
}

/* ── Username Availability Status ──────────────────────────────────────────── */

.am-username-status {
	margin-top: 0.35em;
	font-size: 0.85em;
	min-height: 1.2em;
}

.am-username-status.am-checking {
	color: #666;
	display: flex;
	align-items: center;
	gap: 0.4em;
}

.am-username-status svg{
	display: none;
}

.am-username-status.am-checking::before {
	content: '';
	display: inline-block;
	width: 0.85em;
	height: 0.85em;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: am-spin 0.7s linear infinite;
	flex-shrink: 0;
}

.am-username-status.am-available {
	color: #1a7f37;
}

.am-username-status.am-unavailable {
	color: #cf222e;
}

/* ── Word Counter ───────────────────────────────────────────────────────────── */

.am-word-counter {
	margin-top: 0.35em;
	font-size: 0.82em;
	color: #666;
}
.am-word-counter svg{
	display: none;
}

.am-word-counter.am-is-met {
	color: #1a7f37;
}

.am-word-counter.am-is-unmet {
	color: #cf222e;
}

/* ── Spinner Keyframe ───────────────────────────────────────────────────────── */

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

/* Keep native checkbox styling but remove browser default offset/margin. */
.elementor-widget-form input[type="checkbox"] {
	margin: 0;
}

.elementor-widget-form input[type="checkbox"]:focus,
.elementor-widget-form input[type="checkbox"]:focus-visible {
	outline: none;
	box-shadow: none;
}

/* Full-page overlay removed in 1.0.1 — use a spinner widget (data-am-part=spinner). */

/* Submit button appearance is intentionally left to Elementor/theme styles. */

/* ── data-am-for / data-am-part (see project README) ───────────────────────── */
/* Add layout only in Elementor; optional utility: */
[data-am-for][data-am-part="spinner"][hidden] {
	display: none !important;
}
[data-am-for][data-am-part="password-rules"][hidden] {
	display: none !important;
}

/* Preserve newline-separated error/success text injected by JS. */
[data-am-for][data-am-part="error-text"] .elementor-heading-title,
[data-am-for][data-am-part="error-text"] .elementor-widget-container,
[data-am-for][data-am-part="success-text"] .elementor-heading-title,
[data-am-for][data-am-part="success-text"] .elementor-widget-container {
	white-space: pre-line;
}

/* Legacy / optional — Form Status Message (not used for new login/signup contract) */

.am-form-status {
	padding: 0.75em 1em;
	border-radius: 5px;
	font-size: 0.9em;
	line-height: 1.45;
	margin-bottom: 1em;
}

.am-form-status svg{
	display: none;
}

.am-form-status.am-status-success {
	background: #d1fae5;
	color: #065f46;
	border: 1px solid #6ee7b7;
}

.am-form-status.am-status-error {
	background: #fee2e2;
	color: #991b1b;
	border: 1px solid #fca5a5;
}

/* Per-key error lines: collapsed when hidden (Elementor flex/grid often ignores [hidden] sizing). */
[data-am-part^="error-"][hidden]:not([data-am-part="error-text"]) {
	display: none !important;
}
