/* Search Modal Styling */

#search-modal-wrapper {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 999;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.modal-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 999;
}

.modal-content {
	position: relative;
	background: white;
	border-radius: 8px;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
	z-index: 1000;
	max-width: 500px;
	width: 90%;
	max-height: 90vh;
	overflow-y: auto;
	overflow-x: hidden;
	margin: auto;
	box-sizing: border-box;
}

.search-modal-content {
	max-height: 90vh;
	overflow-y: auto;
	overflow-x: hidden;
	box-sizing: border-box;
}

.modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1.5rem;
	border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 600;
}

.modal-close-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 1.5rem;
	color: #666;
	padding: 0;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.modal-close-btn:hover {
	color: #333;
}

.modal-body {
	padding: 1.5rem;
	width: 100%;
	box-sizing: border-box;
}

.form-group {
	margin-bottom: 1.25rem;
	width: 100%;
	box-sizing: border-box;
}

.form-group label {
	display: block;
	margin-bottom: 0.5rem;
	font-weight: 500;
	color: #333;
}

.form-control {
	width: 100%;
	padding: 0.75rem;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	font-size: 1rem;
	font-family: inherit;
	box-sizing: border-box;
}

.form-control:focus {
	outline: none;
	border-color: #0066cc;
	box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-text {
	display: block;
	margin-top: 0.25rem;
	font-size: 0.875rem;
	color: #666;
}

.text-danger {
	color: #dc3545;
	font-size: 0.875rem;
	margin-top: 0.25rem;
}

/* Status dropdown (RadzenDropDown) styled to match the native .form-control inputs.
   A Radzen component is used here instead of a native <select> so the popup renders
   outside the modal's scroll container and cannot overflow the viewport.
   Radzen's own .rz-dropdown is `display: inline-flex; flex-direction: column`, so it
   must stay a column flex box - forcing a row here is what previously centred the text. */
.status-dropdown.rz-dropdown {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: stretch;
	width: 100%;
	min-height: 0;
	padding: 0;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	background: white;
	box-sizing: border-box;
	text-align: start;
}

.status-dropdown.rz-dropdown:hover {
	border-color: #d0d0d0;
}

.status-dropdown.rz-dropdown.rz-state-focused,
.status-dropdown.rz-dropdown.rz-dropdown-open {
	border: 1px solid #0066cc;
	box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
	background: white;
}

/* The inner label holds the text, so it owns the padding.
   Radzen zeroes its block padding via --rz-dropdown-label-* custom properties,
   so those variables are overridden rather than the shorthand. */
.status-dropdown.rz-dropdown .rz-dropdown-label {
	display: block;
	width: 100%;
	padding-block: 0.75rem;
	padding-inline: 0.75rem var(--rz-icon-size, 1.5rem);
	margin: 0;
	border: none;
	background: transparent;
	font-size: 1rem;
	font-family: inherit;
	color: #333;
	line-height: 1.5;
	text-align: start;
}

.status-dropdown.rz-dropdown .rz-placeholder {
	color: #6c757d;
}

/* Radzen absolutely positions the trigger against the control's inline end; keep that */
.status-dropdown.rz-dropdown .rz-dropdown-trigger {
	background: transparent;
	border: none;
	color: #666;
}

.status-dropdown.rz-dropdown .rz-dropdown-clear-icon {
	color: #666;
}

/* Keep the popup within the modal width and scrollable rather than overflowing the viewport */
.rz-dropdown-panel {
	z-index: 1100;
	max-height: 260px;
	box-sizing: border-box;
}

.rz-dropdown-panel .rz-dropdown-items-wrapper {
	max-height: 260px;
	overflow-y: auto;
}

.rz-dropdown-panel .rz-dropdown-item {
	padding: 0.625rem 0.75rem;
	font-size: 1rem;
	font-family: inherit;
	white-space: normal;
	word-break: break-word;
}

.modal-footer {
	display: flex;
	gap: 1rem;
	justify-content: flex-end;
	padding: 1.5rem;
	border-top: 1px solid #e0e0e0;
}

@keyframes spinner-border {
	to {
		transform: rotate(360deg);
	}
}

/* Search Results Banner Styling */

.search-results-banner {
	width: 100%;
	background-color: #e2e2e2;
	border-right: 1px solid #e2e2e2;
	border-bottom: 1px solid #e2e2e2;
	border-left: 1px solid #e2e2e2;
	box-sizing: border-box;
	display: flex;
	align-items: flex-start;
	padding: 16px 24px;
	gap: 20px;
	text-align: left;
	font-size: 14px;
	color: #000;
	font-family: 'Open Sans';
}

.banner-content {
	display: flex;
	align-items: center;
	gap: 16px;
	width: 100%;
	justify-content: space-between;
}

.banner-info {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 4px;
	flex-wrap: wrap;
	align-content: center;
}

.banner-info strong {
	font-weight: 600;
	line-height: 20px;
}

.criteria-summary {
	font-weight: 300;
	line-height: 20px;
	max-width: 225px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.btn-search-again {
	border-radius: 6px;
	background-color: #39827d;
	display: flex;
	align-items: center;
	padding: 10px 12px 10px 16px;
	gap: 8px;
	font-size: 16px;
	color: #fff;
	border: none;
	cursor: pointer;
	font-weight: 500;
	transition: background-color 0.2s ease;
	white-space: nowrap;
	line-height: 18px;
}

.btn-search-again:hover {
	background-color: #2d6d6a;
}

.btn-clear-search {
	height: 24px;
	width: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	color: #000;
	font-size: 16px;
	cursor: pointer;
	transition: opacity 0.2s ease;
	padding: 0;
	line-height: 1;
}

.btn-clear-search:hover {
	opacity: 0.7;
}

@media (max-width: 768px) {
	#search-modal-wrapper {
		align-items: flex-start;
		padding-top: 20px;
		padding-bottom: 20px;
		overflow: hidden;
	}

	.modal-content {
		max-width: 100%;
		width: 95%;
		max-height: calc(100vh - 40px);
		overflow-x: hidden;
		box-sizing: border-box;
	}

	/* Keep the popup from extending past the modal on narrow viewports */
	.rz-dropdown-panel {
		max-height: 200px;
	}

	.rz-dropdown-panel .rz-dropdown-items-wrapper {
		max-height: 200px;
	}

	.search-results-banner {
		flex-direction: column;
		padding: 16px;
		gap: 7px;
	}

	.banner-content {
		flex-direction: column;
		align-items: flex-start;
	}

	.banner-info {
		gap: 7px;
		width: 100%;
	}

	.criteria-summary {
		max-width: 100%;
	}

	.btn-search-again {
		align-self: flex-start;
	}

	.btn-clear-search {
		align-self: flex-end;
	}
}

/* Search Button Container */
.search-button-container {
	margin-bottom: 1.5rem;
}
