// Inputs

@import 'mediawiki.skin.variables.less';
@import 'mediawiki.mixins.less';

// Text inputs
//
// Apply the mw-ui-input class to input and textarea fields.

// mw-ui-input
//
// Style an input using MediaWiki UI.
// Currently in draft status and subject to change.
// When focused a progressive highlight appears to the left of the field.
//
// Markup:
// <input class="mw-ui-input" placeholder="Enter your name">
// <textarea class="mw-ui-input">Text here</textarea>
.mw-ui-input {
	box-sizing: border-box;
	display: block;
	width: 100%;
	border-width: @border-width-base;
	border-style: @border-style-base;
	border-radius: @border-radius-base;
	padding: 6px 8px;
	// `@box-shadow-color-transparent` necessary for smooth transition.
	box-shadow: @box-shadow-inset-small @box-shadow-color-transparent;
	font-family: inherit;
	font-size: inherit;
	line-height: 1.28571429em;
	vertical-align: middle;

	// Normalize & style placeholder text, see T139034
	.mixin-placeholder( {
		color: @color-placeholder;
		opacity: @opacity-base;
	} );

	// Firefox: Remove red outline when `required` attribute set and invalid content.
	// See https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid
	// This should come before `:focus` so latter rules take preference.
	&:invalid {
		box-shadow: none;
	}

	&:not( :disabled ) {
		background-color: @background-color-base;
		color: @color-emphasized;
		border-color: @border-color-base;
		transition-property: @transition-property-base;
		transition-duration: @transition-duration-medium;

		&:hover {
			border-color: @border-color-input--hover;
		}

		&:focus {
			border-color: @border-color-progressive--focus;
			box-shadow: @box-shadow-inset-small @box-shadow-color-progressive--focus;
			outline: @outline-base--focus;
		}
	}

	&:disabled {
		background-color: @background-color-disabled-subtle;
		color: @color-disabled;
		border-color: @border-color-disabled;
	}

	// Normalize styling for `<input type="search">`
	&[ type='search' ] {
		// Support: Safari/iOS `none` needed, Chrome would accept `textfield` as well.
		-webkit-appearance: none;
		// Support: Firefox.
		-moz-appearance: textfield;

		// Remove the inner padding and cancel buttons in Chrome on OS X and Safari on OS X
		&::-webkit-search-cancel-button,
		&::-webkit-search-decoration {
			-webkit-appearance: none;
		}
	}
}

textarea.mw-ui-input {
	min-height: 8em;
}

// mw-ui-input-inline
//
// Use mw-ui-input-inline with mw-ui-input in cases where you want a button to line up with the input.
//
// Markup:
// <input class="mw-ui-input mw-ui-input-inline">
// <button class="mw-ui-button mw-ui-progressive">Submit</button>
.mw-ui-input-inline {
	display: inline-block;
	width: auto;
	// Make sure we limit `width` to parent element because
	// in case of text `input` fields, `width: auto;` equals `size` attribute.
	max-width: 100%;
}

// mw-ui-input-large
//
// Use mw-ui-input-large with mw-ui-input in cases where there are multiple inputs on a screen and you
// want to draw attention to one instance. For example, replying with a subject line and more text.
// Currently in draft status and subject to change. When used on an input field, the text is styled
// in a large font. When used alongside another mw-ui-input large they are pushed together to form one
// contiguous block.
//
// Markup:
// <input value="input" class="mw-ui-input mw-ui-input-large" value="input" placeholder="Enter subject">
// <textarea class="mw-ui-input mw-ui-input-large" placeholder="Provide additional details"></textarea>
.mw-ui-input-large {
	margin-top: 0;
	margin-bottom: 0;

	// When two large inputs are together, we make them flush by hiding one of the borders
	& + .mw-ui-input-large {
		margin-top: -@position-offset-border-width-base;
	}
	// When focusing, make the input relative to raise it above any attached inputs to unhide its borders
	&:focus {
		position: relative;
	}
}

input.mw-ui-input-large {
	padding: 8px;
	font-size: 1.75em;
	font-weight: bold;
	line-height: 1.25em;
}
