@import 'variables.less';

input {
	font-family: @fonts;
}

// Because weird special cases that get broken by this usually aren't forms?
form {
	// Special-case out the datetime widget and revision-compare button
	input:not( .mw-widgets-datetime-dateTimeInputWidget-editField ):not( .mw-history-compareselectedversions-button ) {
		margin: 0.5em 0;
		padding: 0.35em;
	}

	// Special-case out also rather more normal multiselect
	.oo-ui-tagMultiselectWidget-handle input {
		margin: unset;
		padding: unset;
	}

	// Padding on checkboxes seems to cause misalignment with its text
	.oo-ui-checkboxInputWidget input:not( .mw-widgets-datetime-dateTimeInputWidget-editField ):not( .mw-history-compareselectedversions-button ) {
		margin: unset;
	}
}

.oo-ui-buttonElement-framed.oo-ui-labelElement > .oo-ui-buttonElement-button,
.oo-ui-textInputWidget .oo-ui-inputWidget-input,
.oo-ui-dropdownWidget-handle,
button,
textarea,
select {
	padding: 0.35em;
	box-sizing: border-box;
	height: unset;
}

.oo-ui-buttonElement-framed.oo-ui-labelElement > .oo-ui-buttonElement-button,
button {
	padding: 0.35em 1em;
}

.mw-input-with-label {
	display: block; // wat (this is probably an awful idea but aaaaaah whatever)
}

// Fix for half-arsed date input conversion on special:contributions and anywhere else
// that's not actually ooui: add just enough margin to keep multiple widgets from fondling
// each other
.mw-widget-dateInputWidget {
	margin: 0 0 0.2em 0;
}

// More fondling, because we've removed the default margins in normalise
input[ type='radio' ],
input[ type='checkbox' ] {
	margin: 0.35em 0.2em 0.25em 0.35em;
	box-sizing: border-box;
}

textarea,
#searchInput {
	box-sizing: border-box;
	box-shadow: inset 0 1px 1px 1px rgba( 0, 0, 0, 0.05 );
}

textarea {
	width: 100%;
	// stylelint-disable-next-line plugin/no-unsupported-browser-features
	resize: vertical;
	box-sizing: border-box;
	line-height: 1.3em;
}

div.editOptions {
	padding: 1.25em 1.75em;
	border: solid @base70;
	border-width: 0 1px @border;
	background: @base80;

	// For Extension:TemplateSandbox and the like
	fieldset {
		margin-top: 1em;
	}
}

form:not( .oo-ui-layout ) {
	textarea,
	input {
		border: solid 1px @base70;
		border-radius: 2px;
	}

	input[ type='file' ] {
		border: unset;
		border-radius: unset;
	}

	button,
	input[ type='submit' ] {
		border-radius: 2px;
		padding: 0.35em 1em;
		background-color: #36c;
		font-weight: bold;
		color: #fff;
		border: solid 1px #36c;

		&:not( :disabled ):hover,
		&:not( :disabled ):active {
			background-color: #47f;
		}
	}

	fieldset {
		border: 0;
		margin: 1.5em 0 0;
		padding: 0;

		legend {
			font-weight: bold;
			font-size: 110%;
		}
	}
}

// Essentially revert T182320 (core change)
.mw-editfont-monospace,
.mw-editfont-sans-serif,
.mw-editfont-serif {
	font-size: inherit;
}

body .mw-editfont-monospace {
	font-family: @fonts-mono;
}

body .mw-editfont-sans-serif {
	font-family: @fonts-sans;
}

body .mw-editfont-serif {
	font-family: @fonts-serif;
}

/* Extension:TemplateSandbox stuff */
.mw-templatesandbox-page label {
	padding: 0;
}

#wpTemplateSandboxPreview {
	margin-left: 0.5em;
}

/* fixes for non-JavaScript filtering on Special:Watchlist
 * @see https://phabricator.wikimedia.org/T225412
 */
.mw-special-Watchlist .mw-input-with-label {
	display: inline-block;
}
