/*
 * ModulawAI partner forms and dashboard. Matches the theme's brochure form (`.mlw-gate`):
 * DM Sans from the theme, transparent fields with a 1px border in the text colour, 6px radius,
 * and the theme's own `wp-element-button`. Colours come from the theme tokens, so the light
 * theme works without a second set of rules.
 */
.mpp {
	--mpp-fg: var(--wp--preset--color--contrast, currentColor);
	--mpp-bg: var(--wp--preset--color--base, transparent);
	--mpp-muted: color-mix(in srgb, var(--mpp-fg) 62%, transparent);
	--mpp-line: color-mix(in srgb, var(--mpp-fg) 88%, transparent);
	--mpp-soft: color-mix(in srgb, var(--mpp-fg) 14%, transparent);
	font-size: 0.875rem;
	color: var(--mpp-fg);
}

/* The theme centres narrow blocks; keep the wrapper at content width (aligned with the page
   text) and cap the form and dashboard inside it instead. */
.mpp-form,
.mpp-dash,
.mpp-notice,
.mpp-section {
	max-width: 720px;
}

.mpp-form {
	scroll-margin-top: 110px;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem 0.85rem;
	margin: 1.5rem 0 0;
}

/* Fields switched off by the payout method picker; beats the display rules below. */
.mpp [hidden] {
	display: none !important;
}

.mpp-field {
	display: grid;
	gap: 0.4rem;
	margin: 0;
	min-width: 0;
}

.mpp-field--wide,
.mpp-check,
.mpp-actions {
	grid-column: 1 / -1;
}

.mpp-label {
	font-size: 0.875rem;
	line-height: 1.4;
}

.mpp-label small {
	color: var(--mpp-muted);
	font-size: 0.8rem;
}

.mpp input[type="text"],
.mpp input[type="password"],
.mpp input[type="email"],
.mpp input[type="url"],
.mpp input[type="number"],
.mpp select,
.mpp textarea {
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--mpp-line);
	border-radius: 6px;
	background: transparent;
	color: var(--mpp-fg);
	font: inherit;
	font-size: 0.875rem;
	line-height: 1.6;
}

.mpp input::placeholder,
.mpp textarea::placeholder {
	color: var(--mpp-muted);
}

.mpp input:focus-visible,
.mpp select:focus-visible,
.mpp textarea:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent, var(--mpp-fg));
	outline-offset: 1px;
}

.mpp textarea {
	min-height: 7.5rem;
	resize: vertical;
}

/* Selects: no native chrome, a chevron drawn in the text colour. */
.mpp-select {
	position: relative;
}

.mpp-select select {
	appearance: none;
	-webkit-appearance: none;
	padding-right: 2.4rem;
	cursor: pointer;
}

.mpp-select::after {
	content: "";
	position: absolute;
	right: 0.95rem;
	top: 50%;
	width: 0.45rem;
	height: 0.45rem;
	border-right: 1.5px solid var(--mpp-fg);
	border-bottom: 1.5px solid var(--mpp-fg);
	transform: translateY(-70%) rotate(45deg);
	pointer-events: none;
}

.mpp select option {
	background: var(--mpp-bg);
	color: var(--mpp-fg);
}

.mpp-check {
	display: flex;
	gap: 0.6rem;
	align-items: flex-start;
	line-height: 1.5;
}

.mpp-check input {
	margin-top: 0.2rem;
	accent-color: var(--mpp-fg);
}

.mpp a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.mpp-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1rem;
	align-items: center;
	margin-top: 0.4rem;
}

.mpp-actions .wp-element-button {
	cursor: pointer;
}

.mpp-hint {
	margin: 0;
	color: var(--mpp-muted);
	font-size: 0.8rem;
}

.mpp-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Notices */
.mpp-notice {
	margin: 1.25rem 0 0;
	padding: 0.85rem 1rem;
	border: 1px solid var(--mpp-line);
	border-radius: 6px;
	line-height: 1.5;
}

.mpp-notice p {
	margin: 0;
}

.mpp-notice--error {
	border-color: #f87171;
}

/* Dashboard */
.mpp-dash {
	display: grid;
	gap: 1.75rem;
}

.mpp-section h3 {
	margin: 0 0 0.6rem;
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--mpp-muted);
}

.mpp-code {
	display: inline-block;
	padding: 0.35rem 0.7rem;
	border: 1px solid var(--mpp-line);
	border-radius: 6px;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 1.35rem;
	letter-spacing: 0.08em;
}

.mpp-link {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.75rem;
}

.mpp-link input {
	flex: 1;
}

.mpp-stats {
	display: flex;
	flex-wrap: wrap;
	gap: 2rem;
}

.mpp-stat strong {
	display: block;
	font-size: 1.75rem;
	font-weight: 500;
	line-height: 1.2;
}

.mpp-stat span {
	color: var(--mpp-muted);
}

.mpp-table {
	width: 100%;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

.mpp-table th,
.mpp-table td {
	padding: 0.6rem 0.75rem 0.6rem 0;
	border-bottom: 1px solid var(--mpp-soft);
	text-align: left;
}

.mpp-table th {
	font-weight: 500;
	color: var(--mpp-muted);
}

/* Login ([modulaw_partner_login], core wp_login_form markup) */
.mpp-login form {
	display: grid;
	gap: 1rem;
	max-width: 420px;
	margin: 1.5rem 0 1rem;
}

.mpp-login form p {
	display: grid;
	gap: 0.4rem;
	margin: 0;
}

.mpp-login .login-remember label {
	display: flex;
	gap: 0.5rem;
	align-items: center;
	color: var(--mpp-muted);
}

.mpp-login .login-remember input {
	accent-color: var(--mpp-fg);
}

.mpp-login .login-submit {
	margin-top: 0.25rem;
}

@media (max-width: 640px) {
	.mpp-form {
		grid-template-columns: minmax(0, 1fr);
	}

	.mpp-link {
		flex-direction: column;
	}

	.mpp-table {
		display: block;
		overflow-x: auto;
	}
}

/* Student ambassador details (PP-37): the same two-column grid as the form, framed. */
.mpp-ambassador {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem 0.85rem;
	margin: 0;
	padding: 1rem 1.1rem 1.1rem;
	border: 1px solid var(--mpp-soft);
	border-radius: 8px;
	min-width: 0;
}

.mpp-ambassador legend {
	padding: 0 0.35rem;
}

.mpp-ambassador__stage {
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1.4rem;
}

.mpp-ambassador .mpp-check {
	grid-column: auto;
}

.mpp-ambassador input[type="file"] {
	box-sizing: border-box;
	width: 100%;
	padding: 0.6rem 0.85rem;
	border: 1px dashed var(--mpp-line);
	border-radius: 6px;
	color: var(--mpp-muted);
	font: inherit;
	font-size: 0.85rem;
}

.mpp-ambassador input[type="file"]::file-selector-button {
	margin-right: 0.75rem;
	padding: 0.35rem 0.8rem;
	border: 1px solid var(--mpp-line);
	border-radius: 4px;
	background: transparent;
	color: var(--mpp-fg);
	font: inherit;
	cursor: pointer;
}

@media (max-width: 640px) {
	.mpp-ambassador {
		grid-template-columns: 1fr;
	}
}

/* Path chooser on the application form: six cards, one radio each. The anchor or ?track= picks one. */
.mpp-paths {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.mpp-paths legend {
	margin-bottom: 0.6rem;
	padding: 0;
}

.mpp-paths__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.6rem;
}

.mpp-path {
	position: relative;
	display: grid;
	gap: 0.2rem;
	padding: 0.95rem 1rem 1rem;
	border: 1px solid var(--mpp-soft);
	border-radius: 8px;
	cursor: pointer;
	scroll-margin-top: 110px;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.mpp-path:hover {
	border-color: color-mix(in srgb, var(--mpp-fg) 40%, transparent);
}

.mpp-path input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.mpp-path:has(input:checked) {
	border-color: var(--mpp-fg);
	background: color-mix(in srgb, var(--mpp-fg) 5%, transparent);
	box-shadow: inset 0 0 0 1px var(--mpp-fg);
}

.mpp-path:has(input:focus-visible) {
	outline: 2px solid var(--wp--preset--color--accent, var(--mpp-fg));
	outline-offset: 2px;
}

.mpp-path__join {
	font-size: 0.72rem;
	color: var(--mpp-muted);
}

.mpp-path__name {
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: -0.01em;
}

.mpp-path__earn {
	font-size: 0.8rem;
	line-height: 1.45;
	color: var(--mpp-muted);
}

/* The tick on the chosen card. */
.mpp-path::after {
	content: "";
	position: absolute;
	top: 0.95rem;
	right: 1rem;
	width: 0.9rem;
	height: 0.9rem;
	border: 1px solid var(--mpp-soft);
	border-radius: 50%;
}

.mpp-path:has(input:checked)::after {
	border: 0.28rem solid var(--mpp-fg);
}

@media (max-width: 560px) {
	.mpp-paths__grid {
		grid-template-columns: minmax(0, 1fr);
	}
}
