/**
 * Shared front-end form styles
 *
 * One home for the structural form roles used across every public-facing form
 * (register, sign-in, reset-password, and future subscribe/unsubscribe). Each
 * role is styled once here so shared items render identically in every form and
 * sizes cannot drift. Sizes come from the --mp-form-* tokens in style.css; see
 * _documentation/front-end-form-typography.md for the accessibility floor.
 *
 * Page-specific layout (containers, banners, toggles, dividers) stays in each
 * page's own stylesheet. Do not add per-form font-size overrides here or there.
 */

/* Auth / single-message card. Shared by sign-in, register, reset-password,
   sign-out, region-not-supported, and the alert page (render_alert_page_and_exit).
   The .register-container alias keeps the register markup unchanged. */
.signin-container,
.register-container {
	max-width: 480px;
	margin: 3rem auto;
	padding: 2.5rem;
	background: var(--bg-primary);
	border: 1px solid var(--border-light);
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
	font-size: 1rem;
	line-height: 1.5;
}

.signin-container h1,
.register-container h1 {
	margin-top: 0;
	margin-bottom: 1.5rem;
	text-align: center;
}

/* Field wrapper: label stacked over its control. */
.form-group {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

/* Field label. Primary content, not a caption. */
.form-group label {
	font-weight: 600;
	color: var(--text-primary);
	font-size: var(--mp-form-label-size);
}

/* Text inputs, select and textarea share one look and one size. The explicit
   1rem also prevents iOS auto-zoom on focus. */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="tel"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
	padding: 0.75rem 1rem;
	border: 1px solid var(--border-medium);
	border-radius: 6px;
	font-size: var(--mp-form-input-size);
	transition: all 0.2s ease;
	background: var(--bg-primary);
	color: var(--text-primary);
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="tel"]:focus,
.form-group input[type="url"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus,
.form-group textarea:focus {
	outline: 2px solid var(--link-focus);
	outline-offset: 0;
	border-color: var(--link-focus);
}

/* Consent / checkbox row. The checkbox label inherits the 1rem field-label size
   above, so legally meaningful consent text is never fine print. Handles both
   markup shapes: checkbox as a sibling of the label, and checkbox nested inside
   the label. */
.form-group-checkbox {
	flex-direction: row;
	align-items: flex-start;
	gap: 0.75rem;
}

.form-group-checkbox label {
	font-weight: 400;
	cursor: pointer;
}

.form-group-checkbox label:has(> input[type="checkbox"]) {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
}

.form-group-checkbox input[type="checkbox"] {
	margin-top: 0.25rem;
	width: 18px;
	height: 18px;
	cursor: pointer;
	flex-shrink: 0;
}

/* Inline field errors and the error banner text. One size for all error text. */
.error-message {
	color: var(--error);
	margin: 0;
	font-size: var(--mp-form-error-size);
}

/* Helper hint under a field. Genuine fine print only, at the floor size. */
.form-help,
.form-help-note {
	font-size: var(--mp-form-hint-size);
	color: var(--text-secondary);
	margin-top: -0.25rem;
}

/* Mandatory-field legend and its required star. */
.form-required-note {
	font-size: var(--mp-form-hint-size);
	color: var(--text-secondary);
	margin: 0;
}

.form-required-note abbr,
.form-group label abbr {
	text-decoration: none;
	color: var(--error, #c0392b);
	font-weight: 700;
}

/* Footer below a form: secondary links (sign in / register, lost password). */
.form-footer {
	text-align: center;
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px solid var(--border-light);
}

.form-footer p {
	margin: 0.5rem 0;
	font-size: var(--mp-form-secondary-size);
	color: var(--text-secondary);
}

/* Auth-card dark mode + responsive (shared by every card listed above). */
[data-theme="dark"] .signin-container,
[data-theme="dark"] .register-container {
	background: var(--bg-secondary);
	border-color: var(--border-medium);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .signin-container,
	:root:not([data-theme="light"]) .register-container {
		background: var(--bg-secondary);
		border-color: var(--border-medium);
		box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
	}
}

@media (max-width: 767px) {
	.signin-container,
	.register-container {
		margin: 1.5rem auto;
		padding: 1.5rem;
	}
}

/* Contact-form result notice: a fixed top-of-viewport confirmation/error shown
   after a submit (the in-page panel can sit far down the page). Reuses the house
   .ua-notice convention — soft tinted background, base-colour border, dark text —
   so it matches every other result notice; only the fixed positioning is new. */
.mp-contact-notice {
	position: fixed;
	/* Fallback offset; contact-forms.js refines it to sit just below the actual
	   (two-row, variable-height) sticky header. */
	top: 8rem;
	left: 50%;
	transform: translateX(-50%);
	z-index: 1001; /* above the sticky top bar (z-index 1000) */
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	width: min(440px, calc(100vw - 2rem));
	padding: 1rem 1.25rem;
	border-radius: 8px;
	border: 1px solid var(--border-light);
	/* Opaque, so a notice floating over the header/page is always readable. */
	background: var(--bg-primary);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

/* Opaque tinted fill: the translucent palette tint layered over the solid page
   colour, so it carries the semantic hue without letting content bleed through. */
.mp-contact-notice--success {
	background: linear-gradient(var(--success-alpha), var(--success-alpha)), var(--bg-primary);
	border-color: var(--success);
	color: var(--success-dark);
}

.mp-contact-notice--error {
	background: linear-gradient(var(--error-alpha), var(--error-alpha)), var(--bg-primary);
	border-color: var(--error);
	color: var(--error-dark);
}

.mp-contact-notice__body {
	flex: 1;
}

.mp-contact-notice__body p {
	margin: 0;
	line-height: 1.5;
}

.mp-contact-notice__title {
	font-weight: 700;
	margin-bottom: 0.25rem;
}

/* Bare close glyph: reset the global button chrome (width/padding/shadow/bg). */
.mp-contact-notice__close {
	width: auto;
	padding: 0;
	background: none;
	border: none;
	box-shadow: none;
	color: inherit;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
}
