/* ==========================================================================
   FRVA Modal - Bootstrap 4 modal recreated with plain CSS + vanilla JS
   State is driven by the .frva-show class, added and removed by frva-modal.js
   ========================================================================== */

/* --------------------------------------------------------------------------
   Trigger button (.btn .btn-primary)
   -------------------------------------------------------------------------- */

.frva-modal-trigger {
	display: inline-block;
	padding: 0.375rem 0.75rem;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 400;
	line-height: 1.5;
	color: #fff;
	text-align: center;
	vertical-align: middle;
	background-color: #007bff;
	border: 1px solid #007bff;
	border-radius: 0.25rem;
	cursor: pointer;
	user-select: none;
	transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
		border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.frva-modal-trigger:hover {
	background-color: #0069d9;
	border-color: #0062cc;
}

.frva-modal-trigger:focus-visible {
	outline: 0;
	box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5);
}

/* --------------------------------------------------------------------------
   Modal shell
   -------------------------------------------------------------------------- */

.frva-modal {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1050;
	display: none; /* JS switches this to flex before adding .frva-show */
	align-items: flex-start;
	justify-content: center;
	overflow-x: hidden;
	overflow-y: auto;
	outline: 0;
	opacity: 0;
	transition: opacity 0.15s linear;
}

.frva-modal.frva-show,
.frva-modal-force-open {
	opacity: 1;
}

/* Editor preview only, set by the widget when Elementor is in edit mode */
.frva-modal-force-open {
	display: flex;
}

/* Backdrop (.modal-backdrop.show) */
.frva-modal-backdrop {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: -1; /* Behind the dialog, inside the modal stacking context */
	background-color: rgba(0, 0, 0, 0.5);
}

/* Dialog (.modal-dialog) */
.frva-modal-dialog {
	position: relative;
	width: auto;
	max-width: 1140px;
	width: 1140px;
	margin: 1.75rem auto;
	pointer-events: none; /* Clicks in the gutter fall through to the backdrop */
	transform: translateY(-50px);
	transition: transform 0.3s ease-out;
}

.frva-modal.frva-show .frva-modal-dialog,
.frva-modal-force-open .frva-modal-dialog {
	transform: none;
}

/* Content (.modal-content) */
.frva-modal-content {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	pointer-events: auto;
	background-color: #fff;
	background-clip: padding-box;
	border: 1px solid rgba(0, 0, 0, 0.2);
	border-radius: 0.3rem;
	outline: 0;
}

/* --------------------------------------------------------------------------
   Header, body, footer
   -------------------------------------------------------------------------- */

.frva-modal-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	padding: 1rem;
	border-bottom: 1px solid #dee2e6;
	border-top-left-radius: calc(0.3rem - 1px);
	border-top-right-radius: calc(0.3rem - 1px);
}

.frva-modal-title {
	margin: 0;
	font-size: 1.25rem;
	line-height: 1.5;
}

.frva-modal-close {
	padding: 1rem;
	margin: -1rem -1rem -1rem auto;
	font-family: inherit;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1;
	color: #000;
	text-shadow: 0 1px 0 #fff;
	background: transparent;
	border: 0;
	opacity: 0.5;
	cursor: pointer;
	appearance: none;
}

.frva-modal-close:hover {
	opacity: 0.75;
}

.frva-modal-close:focus-visible {
	outline: 2px solid #007bff;
	outline-offset: -6px;
	opacity: 0.75;
}

.frva-modal-body {
	position: relative;
	flex: 1 1 auto;
	padding: 1rem;
}

.frva-modal-body > *:last-child {
	margin-bottom: 0;
}

.frva-modal-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	padding: 0.75rem;
	border-top: 1px solid #dee2e6;
	border-bottom-right-radius: calc(0.3rem - 1px);
	border-bottom-left-radius: calc(0.3rem - 1px);
}

.frva-modal-footer > * {
	margin: 0.25rem;
}

.frva-modal-btn-secondary {
	display: inline-block;
	padding: 0.375rem 0.75rem;
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.5;
	color: #fff;
	text-align: center;
	background-color: #6c757d;
	border: 1px solid #6c757d;
	border-radius: 0.25rem;
	cursor: pointer;
	user-select: none;
	appearance: none;
}

.frva-modal-btn-secondary:hover {
	background-color: #5a6268;
	border-color: #545b62;
}

.frva-modal-btn-secondary:focus-visible {
	outline: 0;
	box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5);
}

/* --------------------------------------------------------------------------
   Variants
   -------------------------------------------------------------------------- */

.frva-modal-centered {
	align-items: center;
}

.frva-modal-centered .frva-modal-dialog {
	display: flex;
	align-items: center;
	min-height: calc(100% - 3.5rem);
}

.frva-modal-scrollable .frva-modal-content {
	max-height: calc(100vh - 3.5rem);
	overflow: hidden;
}

.frva-modal-scrollable .frva-modal-body {
	overflow-y: auto;
	overscroll-behavior: contain;
}

@media (max-width: 575.98px) {
	.frva-modal-dialog {
		max-width: none;
		margin: 0.5rem;
	}

	.frva-modal-centered .frva-modal-dialog {
		min-height: calc(100% - 1rem);
	}

	.frva-modal-scrollable .frva-modal-content {
		max-height: calc(100vh - 1rem);
	}
}

@media (min-width: 576px) {
	.frva-modal-sm .frva-modal-dialog {
		max-width: 500px;
	}
}

@media (min-width: 992px) {
	.frva-modal-lg .frva-modal-dialog,
	.frva-modal-xl .frva-modal-dialog {
		max-width: 900px;
	}
}

@media (min-width: 1200px) {
	.frva-modal-xl .frva-modal-dialog {
		max-width: 1140px;
	}
}

/* --------------------------------------------------------------------------
   Page scroll lock, applied to body by the script
   -------------------------------------------------------------------------- */

body.frva-modal-open {
	overflow: hidden;
}

/* --------------------------------------------------------------------------
   Motion preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.frva-modal,
	.frva-modal-dialog,
	.frva-modal-trigger {
		transition: none;
	}
}