/**
 * CouncilWare event search.
 *
 * Deliberately low specificity and neutral colours so a council theme can
 * restyle it without fighting !important. The one branded value is the BSA
 * blue already used throughout calendar/style.css.
 */

.cw-event-search {
	position: relative;
	margin: 0 0 20px;
	max-width: 520px;
}

.cw-event-search--inline {
	margin-bottom: 12px;
}

.cw-event-search__label {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
}

.cw-event-search__field {
	position: relative;
	display: block;
}

.cw-event-search__input {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 36px 10px 14px;
	font-size: 16px; /* Under 16px, iOS Safari zooms the page on focus. */
	line-height: 1.4;
	border: 1px solid #c6c9cc;
	border-radius: 4px;
	background: #fff;
}

.cw-event-search__input:focus {
	outline: none;
	border-color: #003f87;
	box-shadow: 0 0 0 2px rgba(0, 63, 135, 0.18);
}

.cw-event-search__clear {
	position: absolute;
	top: 50%;
	right: 6px;
	transform: translateY(-50%);
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #6b7177;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.cw-event-search__clear:hover {
	background: #eef0f2;
	color: #1d2327;
}

.cw-event-search__clear[hidden] {
	display: none;
}

.cw-event-search__status {
	margin-top: 6px;
	font-size: 13px;
	color: #6b7177;
	min-height: 18px;
}

.cw-event-search__results {
	position: absolute;
	z-index: 900; /* Above the calendar, below Bootstrap popovers at 1060. */
	left: 0;
	right: 0;
	margin: 4px 0 0;
	padding: 0;
	list-style: none;
	max-height: 380px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #d5d8db;
	border-radius: 4px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.cw-event-search__results[hidden] {
	display: none;
}

.cw-event-search__result {
	margin: 0;
	padding: 0;
	border-left: 4px solid #003f87;
	border-bottom: 1px solid #eef0f2;
}

.cw-event-search__result:last-child {
	border-bottom: 0;
}

.cw-event-search__result.is-active,
.cw-event-search__result:hover {
	background: #f2f6fb;
}

.cw-event-search__result.is-cancelled .cw-event-search__title {
	text-decoration: line-through;
	color: #6b7177;
}

.cw-event-search__link {
	display: block;
	padding: 10px 14px;
	text-decoration: none;
	color: inherit;
}

.cw-event-search__link:hover,
.cw-event-search__link:focus {
	text-decoration: none;
	color: inherit;
}

.cw-event-search__title {
	display: block;
	font-weight: 600;
	line-height: 1.3;
}

.cw-event-search__title mark {
	padding: 0;
	background: #fff2ab;
	color: inherit;
}

.cw-event-search__meta {
	display: block;
	margin-top: 2px;
	font-size: 13px;
	color: #6b7177;
}

.cw-event-search__flag {
	display: inline-block;
	margin-top: 4px;
	padding: 1px 6px;
	border-radius: 3px;
	background: #d9534f;
	color: #fff;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

/**
 * Brief pulse on the event a search result landed on.
 *
 * The popover opens at the same time, but on a busy month it is not always
 * obvious which cell it belongs to.
 */
.cw-search-target {
	animation: cw-search-pulse 1.6s ease-out 2;
	outline: 2px solid #ffb700;
	outline-offset: 1px;
}

@keyframes cw-search-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(255, 183, 0, 0.7); }
	70%  { box-shadow: 0 0 0 8px rgba(255, 183, 0, 0); }
	100% { box-shadow: 0 0 0 0 rgba(255, 183, 0, 0); }
}

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

@media (max-width: 799px) {
	.cw-event-search {
		max-width: none;
	}

	.cw-event-search__results {
		max-height: 60vh;
	}
}
