
/*	–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
	CORE/FORM/CLASSES.CSS
	––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */

/**
 * VISIOFRAMEWORK
 * This file is part of VISIOFRAMEWORK.
 * @package		visioframework
 * @author		Agência Visio <contato@agenciavisio.com.br>
 * @copyright	Copyright (c) 2023-present. M. Souza & Souza LTDA. (CNPJ: 21.284.748/0001-33). All rights reserved.
 * @license		Proprietary
 * @link		https://www.agenciavisio.com.br
 */

/* Bootstrap override (will use box style instead) */
.form-input--self.form-control {
	border: none !important;
}

.form-input--self.form-control,
.form-input--self.form-control:focus {
	outline				: none			!important;
	box-shadow			: none			!important;
	border-radius		: 0				!important;
	background-color	: transparent	!important;
}

/*	The caret is drawn from gradients, not Bootstrap's SVG: a data URI cannot read
	`currentColor`, and the baked stroke went invisible on dark forms. The half-pixel
	feather is what keeps the 45° edges from stepping — a hard stop renders serrated */
.form-select {
	background-color	: transparent;
	background-image	:
		linear-gradient(45deg, transparent calc(50% - 0.5px), currentColor calc(50% + 0.5px)),
		linear-gradient(135deg, currentColor calc(50% - 0.5px), transparent calc(50% + 0.5px));
	background-position	: right calc(0.75rem + 6px) center, right 0.75rem center;
	background-repeat	: no-repeat;
	background-size		: 6px 6px;
	border				: none;
	border-color		: transparent;
	color				: unset;
}

textarea {
	resize: none;
}

.form-switch .form-check-input {
	margin-left: unset;
}

.form-switch {
	padding-left: unset;
}

.form-check .form-check-input {
	float		: unset;
	margin-left	: unset;
}

/*	Same as .hero-banner--image: the image is height-driven (h-100 w-auto), so
	art narrower than `container height × image aspect` leaves the box uncovered
	at the sides. min-width only sets a floor; object-fit: cover, already on the
	element, does the cropping. */
.converter--image {
	min-width: 100%;
}

/*	Same as .hero-banner--images: a glow anywhere inside uncrops this box (the trade
	in style/classes.css), and the art layer's fractional last row escapes under it.
	The spotlight is a nested .box, so a glow in it uncrops this one — the outer. */
.converter--images {
	border-radius	: inherit;		/* an uncropped box no longer rounds the corners */
	overflow		: hidden;
}

/*	#region		Check accent */

/*	Bootstrap 5.3 compiled writes its blue as a literal in every control rule rather
	than reading --bs-primary, and `appearance: none` on these boxes rules out
	`accent-color`. So the hex lives here once, as the fallback of a single token */
:root {
	--form-accent-color: #0d6efd;
}

.form-check-input:checked,
.form-check-input[type='checkbox']:indeterminate {
	background-color	: var(--form-accent-color)	!important;
	border-color		: var(--form-accent-color)	!important;
}

/*	#endregion	Check accent */

/*	#region		Label placement */

/*	Bootstrap styles the floating label only; outside `.form-floating` a label is
	a bare inline element */
.form-input--label--stacked {
	display			: block;
	margin-bottom	: .5rem;
}

/*	Bootstrap sizes only `.form-floating` as an input-group child — without this
	the wrapper shrinks to its content, leaving the input narrower than its box
	(validation icon adrift, autofill stopping short of the right edge) */
.input-group > .form-input--stacked {
	flex		: 1 1 auto;
	width		: 1%;
	min-width	: 0;
}

.input-group > .form-input--stacked:focus-within {
	z-index: 5;
}

/*	#endregion	Label placement */

/*	#region		Input height */

.form-floating > .form-control,
.form-floating > .form-control-plaintext,
.form-floating > .form-select {
	height			: calc((3.5rem + calc(var(--bs-border-width) * 2)) * var(--input-height)) !important;
	--input-height	: 1;
}

/*	`FormInputHeight` multiplies whatever base the field carries, so a stacked
	field needs its own rule — anchored on `.form-floating`, `fih-*` would go
	silently dead the moment the label leaves the field */
.form-input--stacked > .form-control,
.form-input--stacked > .form-control-plaintext,
.form-input--stacked > .form-select {
	height			: calc((2.75rem + calc(var(--bs-border-width) * 2)) * var(--input-height)) !important;
	--input-height	: 1;
}

.fih-1 {
	--input-height: 1 !important;
}

.fih-2 {
	--input-height: 2 !important;
}

.fih-3 {
	--input-height: 3 !important;
}

.fih-4 {
	--input-height: 4 !important;
}

.fih-5 {
	--input-height: 5 !important;
}

/*	#endregion	Input height */

/*	#region		Selector */

/*	Bootstrap moves and resizes a validated select's background layers to fit its icon,
	and here those layers are the drawn caret, which would come apart */
.was-validated .form-input--self.form-select {
	background-position	: right calc(0.75rem + 6px) center, right 0.75rem center !important;
	background-size		: 6px 6px !important;
	padding-right		: 2.25rem !important;
}

/*	Windows and Linux paint a select's list with its options' colours, which inherit the
	field's: the light text of a dark form would open on white. A multiple select's list is
	in the page instead, on the field's own background */
.form-input--self.form-select:not([multiple]) option {
	background-color	: Canvas;
	color				: CanvasText;
}

.multiselector {
	position: relative;
}

.multiselector-toggler,
.multiselector-display {
	overflow		: hidden;
	text-align		: start;
	text-overflow	: ellipsis;
	white-space		: nowrap;
}

/*	A touch screen opens the system's picker from a tap anywhere on the field: the native select lies on it,
	transparent, and the field shows the picks. With a mouse a multiple select is a list box, usable only in
	sight, so the display steps aside */
@media (pointer: coarse) {
	.form-input--self.multiselector-native {
		inset		: 0;
		opacity		: 0;
		position	: absolute;
		z-index		: 3;
	}

	.multiselector:focus-within > .multiselector-display {
		box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
	}
}

@media (pointer: fine), (pointer: none) {
	.multiselector-display {
		display: none;
	}
}

/*	In the system's colours, as the browser draws a select's list, so a form's two kinds of
	list read as one control */
.multiselector-options {
	background-color	: Canvas;
	border				: 1px solid rgba(0, 0, 0, 0.25);
	box-shadow			: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
	color				: CanvasText;
	left				: 0;
	max-height			: 18rem;
	overflow-x			: hidden;
	overflow-y			: auto;
	padding				: 0.25rem 0;
	position			: absolute;
	right				: 0;
	top					: 100%;
	z-index				: 1000;
}

.multiselector--up .multiselector-options {
	bottom	: 100%;
	top		: auto;
}

/*	Every .box crops its content, and a field sits in one: uncropped while the list is open, as
	`.box:has(.dropdown-menu.show)` in core/style/classes.css does for a dropdown */
.box:has(.multiselector-options:not([hidden])) {
	overflow: visible !important;
}

.multiselector-option {
	align-items	: center;
	cursor		: default;
	display		: flex;
	gap			: 0.5em;
	margin		: 0;
	padding		: 0.25rem 0.75rem;
	position	: relative;
	user-select	: none;
}

.multiselector-option:hover,
.multiselector-option:focus-within {
	background-color	: Highlight;
	color				: HighlightText;
}

/*	The box keeps the focus and the keys; the row shows the pick with a check, as a system
	menu does */
.multiselector-option input {
	opacity			: 0;
	pointer-events	: none;
	position		: absolute;
}

.multiselector-check {
	flex		: 0 0 1em;
	height		: 1em;
	position	: relative;
}

.multiselector-option input:checked + .multiselector-check::after {
	border			: solid currentColor;
	border-width	: 0 0.14em 0.14em 0;
	content			: '';
	height			: 0.6em;
	left			: 0.35em;
	position		: absolute;
	top				: 0.1em;
	transform		: rotate(45deg);
	width			: 0.3em;
}

/*	#endregion	Selector */
