/**
 * LAKASG Login widget — frontend styles (v2.8.0)
 *
 * Everything is scoped to `.lakasg-login-wrap` (the outer container) or
 * `.lakasg-login-form` (each of the four forms). This prevents any bleed
 * into sibling widgets — a login widget and a contact form widget can
 * coexist on the same page without conflicting selectors.
 */

/* ============================================================================
   Container + grid
   ============================================================================ */
.lakasg-login-wrap {
	position: relative;
	box-sizing: border-box;
}
.lakasg-login-wrap *,
.lakasg-login-wrap *::before,
.lakasg-login-wrap *::after {
	box-sizing: border-box;
}

.lakasg-login-form {
	display: grid;
	grid-template-columns: repeat(var(--lakasg-cols, 12), minmax(0, 1fr));
	row-gap: var(--lakasg-field-gap, 14px);
	column-gap: 14px;
}

.lakasg-login-form .lakasg-field,
.lakasg-login-form .lakasg-form-actions,
.lakasg-login-form .lakasg-login-options,
.lakasg-login-form .lakasg-login-form-header,
.lakasg-login-form .lakasg-turnstile,
.lakasg-login-form .lakasg-honeypot,
.lakasg-login-form .lakasg-status,
.lakasg-login-form .lakasg-social-buttons,
.lakasg-login-form .lakasg-social-divider {
	grid-column: span var(--lakasg-span, 12);
	min-width: 0;
}

/* Mobile collapse → every field becomes full-width */
@media (max-width: 600px) {
	.lakasg-login-wrap.lakasg-mobile-collapse .lakasg-login-form .lakasg-field,
	.lakasg-login-wrap.lakasg-mobile-collapse .lakasg-login-form .lakasg-form-actions,
	.lakasg-login-wrap.lakasg-mobile-collapse .lakasg-login-form .lakasg-login-options,
	.lakasg-login-wrap.lakasg-mobile-collapse .lakasg-login-form .lakasg-login-form-header,
	.lakasg-login-wrap.lakasg-mobile-collapse .lakasg-login-form .lakasg-social-buttons,
	.lakasg-login-wrap.lakasg-mobile-collapse .lakasg-login-form .lakasg-social-divider {
		grid-column: 1 / -1;
	}
}

/* ============================================================================
   Visual presets — quick starting points devs can override
   ============================================================================ */

/* Inline: no card at all, just fields */
.lakasg-login-preset-inline .lakasg-login-form { }

/* Card: elevated surface with shadow */
.lakasg-login-preset-card .lakasg-login-form {
	background: #fff;
	border: 1px solid #e4e7ea;
	border-radius: 8px;
	padding: 28px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* ============================================================================
   Form header (heading + subheading)
   ============================================================================ */
.lakasg-login-form-header {
	text-align: center;
}
.lakasg-login-form-header h2 {
	margin: 0 0 4px;
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.2;
}
.lakasg-login-form-header p {
	margin: 0;
	font-size: 0.95rem;
	color: #666;
}

/* ============================================================================
   Fields — base
   ============================================================================ */
.lakasg-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	position: relative;
}
.lakasg-field > label,
.lakasg-field-legend {
	font-size: 0.9rem;
	font-weight: 500;
	display: block;
}

.lakasg-field input:not([type=checkbox]):not([type=radio]),
.lakasg-field textarea,
.lakasg-field select {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #d0d5db;
	border-radius: 4px;
	background: #fff;
	font: inherit;
	color: inherit;
	transition: border-color 150ms, box-shadow 150ms;
}
.lakasg-field input:focus,
.lakasg-field textarea:focus,
.lakasg-field select:focus {
	outline: none;
	border-color: #2271b1;
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.lakasg-field.has-error input:not([type=checkbox]):not([type=radio]),
.lakasg-field.has-error textarea,
.lakasg-field.has-error select {
	border-color: #d33;
}

.lakasg-field-error {
	font-size: 0.8rem;
	color: #d33;
	min-height: 0;
}
.lakasg-field.has-error .lakasg-field-error {
	min-height: 1rem;
}

.lakasg-required-indicator {
	color: #d33;
	margin-left: 2px;
}

.lakasg-field-help {
	font-size: 0.8rem;
	color: #6c757d;
}

/* ============================================================================
   Label positions (mirrors contact form)
   ============================================================================ */

/* Inline — label beside input */
.lakasg-label-inline .lakasg-field {
	flex-direction: row;
	align-items: center;
	gap: 12px;
}
.lakasg-label-inline .lakasg-field > label {
	flex: 0 0 30%;
	margin: 0;
}
.lakasg-label-inline .lakasg-field .lakasg-password-wrap,
.lakasg-label-inline .lakasg-field input,
.lakasg-label-inline .lakasg-field select,
.lakasg-label-inline .lakasg-field textarea {
	flex: 1 1 auto;
}

/* Floating — label sits over input, animates to top-left on focus/fill.
   NOTE: Our render puts the <label> before the <input>, so we can't use
   `input:focus ~ label` (general sibling requires the label to come after).
   We rely on :focus-within on the .lakasg-field parent, plus a
   .lakasg-has-value class that JS adds when the input has content. */
.lakasg-label-floating .lakasg-field {
	position: relative;
}
.lakasg-label-floating .lakasg-field > label {
	position: absolute;
	top: 12px;
	left: 12px;
	pointer-events: none;
	background: #fff;
	padding: 0 4px;
	transition: top 150ms, font-size 150ms, color 150ms;
	color: #888;
	margin: 0;
}
.lakasg-label-floating .lakasg-field:focus-within > label,
.lakasg-label-floating .lakasg-field.lakasg-has-value > label {
	top: -8px;
	font-size: 0.75rem;
	color: #2271b1;
}

/* Inside — label on top-left of input (modern "stacked" look) */
.lakasg-label-inside .lakasg-field {
	position: relative;
}
.lakasg-label-inside .lakasg-field input:not([type=checkbox]):not([type=radio]),
.lakasg-label-inside .lakasg-field textarea {
	padding-top: 22px;
	padding-bottom: 6px;
}
.lakasg-label-inside .lakasg-field > label {
	position: absolute;
	top: 6px;
	left: 12px;
	font-size: 0.75rem;
	color: #888;
	margin: 0;
}

/* SR-only */
.lakasg-label-sr_only .lakasg-field > label {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0,0,0,0);
	white-space: nowrap; border: 0;
}

/* ============================================================================
   Password wrapper (input + visibility toggle + strength meter)
   ============================================================================ */
.lakasg-password-wrap {
	position: relative;
	display: flex;
}
.lakasg-password-wrap input {
	padding-right: 40px; /* room for the eye icon */
}
.lakasg-password-toggle {
	position: absolute;
	right: 6px;
	top: 50%;
	transform: translateY(-50%);
	background: transparent;
	border: 0;
	padding: 4px;
	cursor: pointer;
	color: #888;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.lakasg-password-toggle:hover {
	color: #333;
}

.lakasg-password-strength-wrap {
	margin-top: 6px;
	font-size: 0.75rem;
}
.lakasg-password-strength {
	height: 4px;
	background: #e0e4e8;
	border-radius: 2px;
	margin-bottom: 4px;
	transition: background-color 200ms, width 200ms;
	width: 0;
}
.lakasg-password-strength.level-1 { width: 20%;  background-color: #d33; }
.lakasg-password-strength.level-2 { width: 40%;  background-color: #d33; }
.lakasg-password-strength.level-3 { width: 70%;  background-color: #dba617; }
.lakasg-password-strength.level-4 { width: 100%; background-color: #46b450; }

.lakasg-password-strength-label {
	color: #666;
	min-height: 1em;
}

/* ============================================================================
   Checkbox / radio styling
   ============================================================================ */
.lakasg-choices {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.lakasg-choice {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	font-size: 0.9rem;
}
.lakasg-choice input {
	width: 16px;
	height: 16px;
	margin: 0;
	cursor: pointer;
}

/* ============================================================================
   Remember-me / forgot-password row
   ============================================================================ */
.lakasg-login-options {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.875rem;
}
.lakasg-login-remember {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
}
.lakasg-login-remember input { margin: 0; }
.lakasg-login-forgot a {
	text-decoration: none;
}

/* ============================================================================
   Submit button
   ============================================================================ */
.lakasg-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 20px;
	border: 0;
	border-radius: 4px;
	background: #111;
	color: #fff;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 150ms, opacity 150ms;
	width: 100%;
}
.lakasg-submit:hover { background: #333; }
.lakasg-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.lakasg-submit-spinner {
	display: none;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-left-color: #fff;
	border-radius: 50%;
	animation: lakasg-spin 600ms linear infinite;
}
.lakasg-submit.is-loading .lakasg-submit-spinner { display: inline-block; }

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

/* ============================================================================
   Mode switcher — tabs variant
   ============================================================================ */
.lakasg-login-tabs {
	display: flex;
	gap: 4px;
	border-bottom: 1px solid #e4e7ea;
	margin-bottom: 20px;
}
.lakasg-login-tab {
	padding: 10px 16px;
	color: #666;
	text-decoration: none;
	font-weight: 500;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	transition: color 150ms, border-color 150ms;
}
.lakasg-login-tab:hover {
	color: #333;
}
.lakasg-login-tab.is-active {
	color: #111;
	border-bottom-color: #111;
}

/* ============================================================================
   Mode switcher — toggle-links variant
   ============================================================================ */
.lakasg-login-switch-link {
	margin-top: 16px;
	text-align: center;
	font-size: 0.9rem;
}
.lakasg-login-switch-link a {
	color: #2271b1;
	text-decoration: none;
	font-weight: 500;
}
.lakasg-login-switch-link a:hover {
	color: #135e96;
	text-decoration: underline;
}

/* Hide switch-links attached to a form that isn't currently visible. */
.lakasg-login-wrap .lakasg-login-form[style*="display:none"] ~ .lakasg-login-switch-link[data-lakasg-switch-from],
.lakasg-login-wrap .lakasg-login-form[style*="display: none"] ~ .lakasg-login-switch-link[data-lakasg-switch-from] {
	/* Fallback only — JS handles proper visibility. */
}

/* ============================================================================
   Status / messages
   ============================================================================ */
.lakasg-status:empty { display: none; }
.lakasg-status .lakasg-success {
	padding: 10px 14px;
	border-radius: 4px;
	background: #e6f4ea;
	color: #1e6c2c;
	font-size: 0.9rem;
	margin-bottom: 16px;
}
.lakasg-status .lakasg-error {
	padding: 10px 14px;
	border-radius: 4px;
	background: #fdecea;
	color: #a12622;
	font-size: 0.9rem;
	margin-bottom: 16px;
}

/* ============================================================================
   Honeypot — invisible to users, visible to bots
   ============================================================================ */
.lakasg-honeypot {
	position: absolute !important;
	left: -9999px !important;
	top: -9999px !important;
	width: 1px; height: 1px;
	overflow: hidden;
}

/* ============================================================================
   Logged-in panel
   ============================================================================ */
.lakasg-loggedin-panel {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 20px 24px;
	background: #f6f7f7;
	border-radius: 8px;
	flex-wrap: wrap;
}
.lakasg-loggedin-avatar img {
	border-radius: 50%;
	display: block;
}
.lakasg-loggedin-text {
	flex: 1 1 auto;
	min-width: 200px;
}
.lakasg-loggedin-greeting {
	font-size: 1.1rem;
	font-weight: 600;
	margin-bottom: 4px;
}
.lakasg-loggedin-subtext {
	font-size: 0.85rem;
	color: #666;
}
.lakasg-loggedin-actions {
	display: flex;
	gap: 16px;
	flex-wrap: wrap;
	margin-top: 8px;
}
.lakasg-loggedin-actions a {
	font-size: 0.9rem;
	text-decoration: none;
}
.lakasg-loggedin-dashboard {
	color: #2271b1;
	font-weight: 500;
}
.lakasg-loggedin-logout {
	color: #666;
}
.lakasg-loggedin-logout:hover {
	color: #d33;
}
.lakasg-loggedin-redirect {
	text-align: center;
	padding: 40px 0;
	color: #666;
}
