/*
| Modern look for the Bootstrap 3 modals used across the app.
|
| Large soft cards, a roomy header, wide rounded action buttons sharing the
| dashboard palette (dark primary, green success, crimson danger, light
| neutral) and a quick scale/fade while opening.
*/

.modal-content {
	border: 0;
	border-radius: 24px;
	background: #fff;
	box-shadow: 0 30px 70px rgba(15, 23, 42, .22), 0 10px 24px rgba(15, 23, 42, .1);
}

/* Temporary space below modal forms while the mobile keyboard is open. */
.modal-keyboard-spacer {
	display: block;
	width: 100%;
	height: 0;
	pointer-events: none;
}

.modal-header {
	position: relative;
	padding: 22px 62px 4px 22px;
	min-height: 0;
	border-bottom: 0;
	border-radius: 24px 24px 0 0;
}

.modal-header .modal-title {
	margin: 0;
	color: #1f3049;
	font-size: 22px;
	font-weight: 600 !important;
	line-height: 1.3;
}

.modal-header .close {
	position: absolute;
	top: 12px;
	right: 12px;
	float: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 13px;
	background: #f2f5f9;
	color: #4a5a6a;
	font-family: inherit;
	font-size: 0;
	font-weight: 300;
	line-height: 0;
	opacity: 1;
	text-shadow: none;
	transition: background .15s ease, color .15s ease;
}

.modal-header .close::before,
.modal-header .close::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
	height: 2.4px;
	margin: -1.2px 0 0 -9px;
	border-radius: 2px;
	background: currentColor;
}

.modal-header .close::before {
	transform: rotate(45deg);
}

.modal-header .close::after {
	transform: rotate(-45deg);
}

.modal-header .close:hover,
.modal-header .close:focus {
	background: #e7eef6;
	color: #1f3049;
	opacity: 1;
	outline: 0;
}

.modal-body {
	padding: 4px 22px 18px;
	color: #5b6b7b;
	font-size: 15px;
	line-height: 1.55;
}

/* Forms keep their own inline padding in some modals. Align the content of
   the padding-less modals with the header and footer. */
#ajaxModalContent > form.smart-form > fieldset,
.modal .modal-content .modal-body[style*="padding:0px"] > form.smart-form > fieldset,
.modal .modal-content > form.smart-form > fieldset {
	padding-left: 22px !important;
	padding-right: 22px !important;
}

/* Footers and buttons */

.modal-footer,
.modal .modal-content form > footer {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
	margin: 0;
	padding: 12px 0 0;
	border: 0;
	background: transparent;
	text-align: left;
}

.modal-footer,
#ajaxModalContent > form > footer,
.modal .modal-content .modal-body[style*="padding:0px"] > form > footer,
.modal .modal-content > form > footer {
	padding: 12px 22px 22px;
	border-radius: 0 0 24px 24px;
}

.modal-footer .btn,
.modal .modal-content footer .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 1 1 0;
	min-width: 0;
	height: 50px;
	margin: 0 !important;
	padding: 0 16px;
	border: 0;
	border-radius: 16px;
	background: #f1f5f9;
	background-image: none;
	box-shadow: none;
	color: #33424f;
	font-family: inherit;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	text-shadow: none;
	white-space: nowrap;
	transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.modal-footer .btn i,
.modal .modal-content footer .btn i {
	margin-right: 7px;
	font-size: 1em;
}

.modal-footer .btn:focus,
.modal-footer .btn:active,
.modal .modal-content footer .btn:focus,
.modal .modal-content footer .btn:active {
	outline: 0;
	box-shadow: none;
}

.modal-footer .btn:disabled,
.modal .modal-content footer .btn:disabled {
	opacity: .55;
	cursor: default;
}

.modal-footer .btn-default,
.modal .modal-content footer .btn-default {
	border: 0;
	background: #f1f5f9;
	color: #33424f;
}

.modal-footer .btn-default:hover,
.modal-footer .btn-default:focus,
.modal .modal-content footer .btn-default:hover,
.modal .modal-content footer .btn-default:focus {
	background: #e6edf5;
	color: #1f3049;
}

.modal-footer .btn-primary,
.modal .modal-content footer .btn-primary {
	border: 0;
	background: #1b2433;
	color: #fff;
}

.modal-footer .btn-primary:hover,
.modal-footer .btn-primary:focus,
.modal .modal-content footer .btn-primary:hover,
.modal .modal-content footer .btn-primary:focus {
	background: #2a3750;
	color: #fff;
}

.modal-footer .btn-success,
.modal .modal-content footer .btn-success {
	border: 0;
	background: #0f9f57;
	color: #fff;
}

.modal-footer .btn-success:hover,
.modal-footer .btn-success:focus,
.modal .modal-content footer .btn-success:hover,
.modal .modal-content footer .btn-success:focus {
	background: #0c8a4b;
	color: #fff;
}

.modal-footer .btn-danger,
.modal .modal-content footer .btn-danger {
	border: 0;
	background: #e51245;
	color: #fff;
}

.modal-footer .btn-danger:hover,
.modal-footer .btn-danger:focus,
.modal .modal-content footer .btn-danger:hover,
.modal .modal-content footer .btn-danger:focus {
	background: #c80f3b;
	color: #fff;
}

/* Footers with a delete link: a two-column action row and a full-width
   link below it. */
.modal .modal-content footer.has-delete-link {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.modal .modal-content footer.has-delete-link .btn {
	width: 100%;
	margin-left: 0 !important;
}

.modal .modal-content footer.has-delete-link.no-cancel .btn-primary {
	grid-column: 1 / -1;
}

.modal .modal-content footer.has-delete-link .loadingrecent {
	grid-column: 1 / -1;
}

/* Destructive actions that only open a confirmation modal look like links. */
.modal .modal-content footer .btn.modal-delete-link {
	order: 4;
	flex: 1 0 100%;
	grid-column: 1 / -1;
	height: auto;
	min-height: 0;
	margin: 2px 0 0 !important;
	padding: 8px 10px;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: #e51245;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.3;
	white-space: normal;
	text-decoration: none;
}

.modal .modal-content footer .btn.modal-delete-link:hover,
.modal .modal-content footer .btn.modal-delete-link:focus {
	background: transparent;
	color: #c80f3b;
	text-decoration: underline;
}

.modal .modal-content footer .btn.modal-delete-link i {
	margin-right: 7px;
	font-size: 1.05em;
}

/* Cancel goes first, the main action last. */
.modal-footer .btn-default {
	order: 1;
}

.modal-footer .btn-danger,
.modal-footer .btn-primary,
.modal-footer .btn-success {
	order: 3;
}

.modal .modal-content footer .btn-default {
	order: 1;
}

.modal .modal-content footer .btn-danger {
	order: 2;
}

.modal .modal-content footer .btn-primary,
.modal .modal-content footer .btn-success {
	order: 3;
}

.modal .modal-content footer .loadingrecent {
	position: static;
	top: 0;
	margin-right: auto;
}

/* Compact logout confirmation. */
.modal-dialog.logout-dialog {
	max-width: 440px;
}

.logout-question {
	margin: 0;
	color: #5b6b7b;
	font-size: 16px;
	line-height: 1.55;
}

/* Quick scale/fade on open: Bootstrap only slides the dialog down. The base
   selector covers modals without the "fade" class (e.g. #ajaxModal). */
.modal .modal-dialog,
.modal.fade .modal-dialog {
	-webkit-transform: translateY(-10px) scale(.985);
	transform: translateY(-10px) scale(.985);
	opacity: 0;
	-webkit-transition: -webkit-transform .18s ease-out, opacity .18s ease-out;
	transition: transform .18s ease-out, opacity .18s ease-out;
}

.modal.in .modal-dialog {
	-webkit-transform: translateY(0) scale(1);
	transform: translateY(0) scale(1);
	opacity: 1;
}

@media (max-width: 767px) {
	.modal-content {
		border-radius: 20px;
	}

	.modal-header {
		padding: 18px 56px 2px 18px;
		border-radius: 20px 20px 0 0;
	}

	.modal-header .modal-title {
		font-size: 19px;
	}

	.modal-header .close {
		top: 9px;
		right: 9px;
		width: 38px;
		height: 38px;
		border-radius: 12px;
	}

	.modal-header .close::before,
	.modal-header .close::after {
		width: 16px;
		margin-left: -8px;
	}

	.modal-body {
		padding: 4px 18px 14px;
		font-size: 14.5px;
	}

	#ajaxModalContent > form.smart-form > fieldset,
	.modal .modal-content .modal-body[style*="padding:0px"] > form.smart-form > fieldset,
	.modal .modal-content > form.smart-form > fieldset {
		padding-left: 18px !important;
		padding-right: 18px !important;
	}

	.modal-footer,
	.modal .modal-content form > footer {
		gap: 8px;
	}

	.modal-footer,
	#ajaxModalContent > form > footer,
	.modal .modal-content .modal-body[style*="padding:0px"] > form > footer,
	.modal .modal-content > form > footer {
		padding: 10px 18px 18px;
		border-radius: 0 0 20px 20px;
	}

	.modal-footer .btn,
	.modal .modal-content footer .btn {
		flex: 1 1 120px;
		height: 46px;
		padding: 0 12px;
		border-radius: 13px;
		font-size: 14px;
	}

	.logout-question {
		font-size: 15px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.modal .modal-dialog,
	.modal.fade .modal-dialog {
		-webkit-transition: none;
		transition: none;
	}
}

/* Skeleton placeholders shown while a modal loads its data. */
.msk {
	display: block;
	background: linear-gradient(90deg, #e9edf1 25%, #f6f8fa 37%, #e9edf1 63%);
	background-size: 400% 100%;
	border-radius: 4px;
	animation: modal-skeleton-shimmer 1.3s ease-in-out infinite;
}

@keyframes modal-skeleton-shimmer {
	0% {
		background-position: 100% 50%;
	}
	100% {
		background-position: 0 50%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.msk {
		animation: none;
	}
}

.msk-body {
	padding: 20px;
}

.msk-label {
	width: 120px;
	height: 11px;
	margin-bottom: 7px;
	border-radius: 3px;
}

.msk-input {
	height: 40px;
	margin-bottom: 16px;
	border-radius: 5px;
}

.msk-input-lg {
	height: 46px;
}

.msk-row {
	display: flex;
	gap: 16px;
}

.msk-col {
	flex: 1 1 0;
	min-width: 0;
}

.msk-icons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 18px;
}

.msk-icon {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	border-radius: 10px;
}

.msk-checkbox {
	width: 210px;
	height: 16px;
	margin: 2px 0 14px;
	border-radius: 4px;
}

.msk-textarea {
	height: 74px;
	margin-bottom: 10px;
	border-radius: 5px;
}

.msk-footer {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
}

.msk-btn {
	display: inline-block;
	width: 120px;
	height: 46px;
	border-radius: 14px;
}

.msk-btn-wide {
	width: 150px;
}

.msk-btn-danger {
	margin-right: auto;
}

@media (max-width: 767px) {
	.msk-icon {
		width: 44px;
		height: 44px;
	}
	.msk-row {
		gap: 12px;
	}
}
