/*
 * The look of the widgets in /assets/js/venduur-ui.js, on top of Bootstrap 4.
 * Loaded on every page after bootstrap.min.css and before theme.css, which supplies the colours
 * (light and dark). Nothing here sets a fixed colour that the theme needs to override.
 */

/* ------------------------------------------------------------------ motion */

/*
 * How things move, everywhere: short, and eased so they settle rather than stop. One set of curves and
 * times is used by every widget below and by the page itself. Everything here is switched off for anyone
 * whose device asks for less motion (the block at the end of this file).
 */
:root {
	--ui-ease-out: cubic-bezier(.2, .8, .2, 1);     /* arriving: quick, then settling */
	--ui-ease-in-out: cubic-bezier(.4, 0, .2, 1);
	--ui-quick: .16s;
	--ui-medium: .24s;
}

/*
 * Going from one page to the next: the browser cross-fades the two pages instead of blanking between them.
 * Each screen is its own page, so this is what makes moving round the app feel continuous. Browsers that do
 * not do this yet simply load the page as before.
 */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation-duration: .14s; animation-timing-function: ease-in; }
::view-transition-new(root) { animation-duration: .2s; animation-timing-function: ease-out; }

/* a page's own content rises into place once it is ready (after the loading outline) */
@keyframes ui-rise {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}
@keyframes ui-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}
#content > .container,
#content > .container-fluid {
	animation: ui-rise var(--ui-medium) var(--ui-ease-out) backwards;
}

/* ------------------------------------------------------------------ toasts */

.ui-toaster {
	position: fixed;
	top: .75rem;
	right: .75rem;
	z-index: 1100;
	width: 350px;
	max-width: calc(100vw - 1.5rem);
	pointer-events: none;
}
.ui-toast {
	pointer-events: auto;
	max-width: 100%;
	margin-bottom: .75rem;
	opacity: 0;
	transform: translateX(16px);
	transition: opacity .22s ease, transform .25s var(--ui-ease-out);
}
.ui-toast.show { opacity: 1; transform: none; }
.ui-toast .toast-header strong { overflow-wrap: anywhere; }
.ui-toast .toast-body { overflow-wrap: anywhere; white-space: pre-line; }
.ui-toast .close { font-size: 1.25rem; line-height: 1; background: transparent; border: 0; }

/* ------------------------------------------------------------------ modal */

/* several can be open at once (a pop-up opened from a pop-up): each brings its own backdrop */
.ui-modal { overflow-x: hidden; overflow-y: auto; outline: 0; }
.ui-modal .modal-header .close { background: transparent; border: 0; }

/* opening: the window fades in and drops the last few pixels into place; closing is the same, quicker */
.modal.ui-modal.ui-modal-enter-active { transition: opacity var(--ui-medium) ease; }
.modal.ui-modal.ui-modal-leave-active { transition: opacity var(--ui-quick) ease; pointer-events: none; }
.modal.ui-modal.ui-modal-enter-active .modal-dialog { transition: transform .28s var(--ui-ease-out); }
.modal.ui-modal.ui-modal-leave-active .modal-dialog { transition: transform var(--ui-quick) ease-in; }
.modal.ui-modal.ui-modal-enter-from,
.modal.ui-modal.ui-modal-leave-to { opacity: 0; }
.modal.ui-modal.ui-modal-enter-from .modal-dialog { transform: translateY(-14px) scale(.985); }
.modal.ui-modal.ui-modal-leave-to .modal-dialog { transform: translateY(6px) scale(.985); }
/* (Bootstrap's own slide for .modal.fade is not used: these windows are shown and hidden by Vue) */
.modal.ui-modal .modal-dialog { transition: none; transform: none; }

.modal-backdrop.fade.ui-backdrop-enter-active { transition: opacity var(--ui-medium) ease; }
.modal-backdrop.fade.ui-backdrop-leave-active { transition: opacity var(--ui-quick) ease; pointer-events: none; }
.modal-backdrop.fade.ui-backdrop-enter-from,
.modal-backdrop.fade.ui-backdrop-leave-to { opacity: 0; }

/* ------------------------------------------------------------------ collapse */

/* opened and closed by <ui-collapse> itself: the height slides while the content fades (venduur-ui.js) */
.ui-collapse { will-change: height, opacity; }

/* ------------------------------------------------------------------ overlay */

.ui-overlay-wrap { min-height: 1px; }
.ui-fade-enter-active, .ui-fade-leave-active { transition: opacity var(--ui-quick) ease; }
.ui-fade-enter-from, .ui-fade-leave-to { opacity: 0; }

/* ------------------------------------------------------------------ avatar */

.ui-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	vertical-align: middle;
	flex-shrink: 0;
	width: 2.5rem;
	height: 2.5rem;
	overflow: hidden;
	font-weight: 400;
	line-height: 1;
	text-align: center;
}
.ui-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ui-avatar svg { width: 60%; height: 60%; }
.ui-avatar-text { font-size: 40%; text-transform: uppercase; white-space: nowrap; }

/* ------------------------------------------------------------------ tabs */

.ui-tabs .nav-link { cursor: pointer; transition: background-color var(--ui-quick) ease, color var(--ui-quick) ease, border-color var(--ui-quick) ease; }
/* the tab that was just opened fades up into place */
.ui-tabs > .tab-content > .tab-pane.active { animation: ui-rise .2s var(--ui-ease-out) backwards; }
.ui-tabs .nav-link.disabled { cursor: default; }

/* ------------------------------------------------------------------ pagination */

.ui-pagination { flex-wrap: wrap; }
.ui-pagination .page-link { cursor: pointer; }
.ui-pagination .page-item.disabled .page-link { cursor: default; }

/* ------------------------------------------------------------------ table */

/* a column that can be sorted: a pair of arrows at the right of its heading, the active one solid */
.table.ui-table > thead > tr > [aria-sort] {
	cursor: pointer;
	background-repeat: no-repeat;
	background-size: .65em 1em;
	background-position: right .375rem center;
	padding-right: calc(.75rem + .65em);
	user-select: none;
}
.table.ui-table > thead > tr > [aria-sort="none"] { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='101' height='101' viewBox='0 0 101 101' preserveAspectRatio='none'%3e%3cpath opacity='.3' d='M51 1l25 23 24 22H1l25-22zM51 101l25-23 24-22H1l25 22z'/%3e%3c/svg%3e"); }
.table.ui-table > thead > tr > [aria-sort="ascending"] { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='101' height='101' viewBox='0 0 101 101' preserveAspectRatio='none'%3e%3cpath d='M51 1l25 23 24 22H1l25-22z'/%3e%3cpath opacity='.3' d='M51 101l25-23 24-22H1l25 22z'/%3e%3c/svg%3e"); }
.table.ui-table > thead > tr > [aria-sort="descending"] { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='101' height='101' viewBox='0 0 101 101' preserveAspectRatio='none'%3e%3cpath opacity='.3' d='M51 1l25 23 24 22H1l25-22z'/%3e%3cpath d='M51 101l25-23 24-22H1l25 22z'/%3e%3c/svg%3e"); }
.table.ui-table > thead > tr > [aria-sort]:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
.ui-table-empty > td { cursor: default; }

/* ------------------------------------------------------------------ tooltip */

.ui-tooltip { position: absolute; z-index: 1200; pointer-events: none; opacity: .92; animation: ui-fade-in var(--ui-quick) ease backwards; }

/* ------------------------------------------------------------------ less motion */

/* asked for on the device (Reduce motion): everything appears and goes at once */
@media (prefers-reduced-motion: reduce) {
	@view-transition { navigation: none; }
	#content > .container,
	#content > .container-fluid,
	.ui-tabs > .tab-content > .tab-pane.active,
	.ui-tooltip { animation: none; }
	.ui-toast { transition: none; transform: none; }
	.modal.ui-modal.ui-modal-enter-active,
	.modal.ui-modal.ui-modal-leave-active,
	.modal.ui-modal.ui-modal-enter-active .modal-dialog,
	.modal.ui-modal.ui-modal-leave-active .modal-dialog,
	.modal-backdrop.fade.ui-backdrop-enter-active,
	.modal-backdrop.fade.ui-backdrop-leave-active,
	.ui-fade-enter-active,
	.ui-fade-leave-active,
	.ui-tabs .nav-link { transition: none; }
}

/* ------------------------------------------------------------------ staging / demo strip (venduur-ui.js) */
/* a small label in the bottom corner: it never covers a button (clicks pass through it) and never moves the page */
.venduur-environment {
    position: fixed;
	left: auto;
    right: 10px;
    bottom: 10px;
    z-index: 2147483000;
    max-width: calc(100vw - 24px);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    pointer-events: none;
    opacity: .92;
}
.venduur-environment-staging { background: #b45309; }
.venduur-environment-demo { background: #6d28d9; }
@media print { .venduur-environment { display: none; } }

/* ------------------------------------------------------------------ location picker (facilities, location-picker.js) */
.location-picker-menu {
    max-height: 22rem;
    overflow-y: auto;
    margin-top: 2px;
    z-index: 1060;
}
.location-picker-menu .dropdown-item { white-space: normal; padding-top: .45rem; padding-bottom: .45rem; }
.appointments-location-filter { flex: 0 1 26rem; min-width: 14rem; margin-right: 1rem; }
