/* Recipe Kit Filter Addon */

/* =========================================================
   Filter Bar
   ========================================================= */

#rk_filter {
	display: none;
	flex-wrap: wrap;
	gap: 10px;
	align-items: flex-end;
	justify-content: space-between;
	margin: 20px 0;
}

/* =========================================================
   Filter Items
   ========================================================= */

.rk-filter-group {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: flex-end;
}

.rk-filter-item {
	flex: 0 0 auto;
}

.rk-filter-item--combobox {
	width: 200px;
}

.rk-filter-item--clear {
	flex: 0 0 auto;
	min-width: auto;
	align-self: flex-end;
}

/* =========================================================
   Custom Dropdown
   ========================================================= */

.rk-dropdown {
	position: relative;
}

.rk-dropdown__trigger {
	padding: 10px 32px 10px 12px;
	border: 1px solid #ddd;
	border-radius: 6px;
	cursor: pointer;
	font-size: 14px;
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	color: #333;
	box-sizing: border-box;
	transition: border-color 0.2s, box-shadow 0.2s;
	text-align: left;
	white-space: nowrap;
	max-width: 320px;
	overflow: hidden;
	text-overflow: ellipsis;
}

.rk-dropdown__trigger:hover {
	border-color: #bbb;
}

.rk-dropdown__trigger:focus {
	outline: none;
	border-color: var(--rk-accent, #333);
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--rk-accent, #333) 15%, transparent);
}

.rk-dropdown__menu {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 100%;
	max-width: 320px;
	margin-top: 4px;
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	max-height: 240px;
	overflow-y: auto;
	z-index: 50;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
	list-style: none;
	padding: 4px;
	margin-bottom: 0;
}

.rk-dropdown__option {
	padding: 5px 10px;
	cursor: pointer;
	font-size: 14px;
	border-radius: 4px;
	transition: background 0.15s;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.rk-dropdown__option:hover {
	background: #f5f5f5;
}

.rk-dropdown__option--active {
	background: #f0f0f0;
}

.rk-dropdown__option--selected {
	color: var(--rk-accent, #333);
	font-weight: 600;
}

/* =========================================================
   Combobox
   ========================================================= */

.rk-combobox {
	position: relative;
}

.rk-combobox__input {
	width: 100%;
	padding: 10px 32px 10px 12px;
	border: 1px solid #ddd;
	border-radius: 6px;
	font-size: 14px;
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	appearance: none;
	-webkit-appearance: none;
	box-sizing: border-box;
	color: #333;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.rk-combobox__input:hover {
	border-color: #bbb;
}

.rk-combobox__input:focus {
	outline: none;
	border-color: var(--rk-accent, #333);
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--rk-accent, #333) 15%, transparent);
}

.rk-combobox__dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	margin-top: 4px;
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	max-height: 240px;
	overflow-y: auto;
	z-index: 50;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
	list-style: none;
	padding: 4px;
	margin-bottom: 0;
}

.rk-combobox__option {
	padding: 5px 10px;
	cursor: pointer;
	font-size: 14px;
	border-radius: 4px;
	transition: background 0.15s;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.rk-combobox__option:hover {
	background: #f5f5f5;
}

.rk-combobox__option--active {
	background: #f0f0f0;
	color: var(--rk-accent, #333);
}

.rk-combobox__empty {
	padding: 8px 10px;
	color: #999;
	font-style: italic;
	font-size: 14px;
}

/* =========================================================
   Clear Button
   ========================================================= */

.rk-btn--clear {
	padding: 10px 18px;
	color: #fff;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	background-color: var(--rk-accent, #333);
	transition: opacity 0.2s;
}

.rk-btn--clear:hover {
	opacity: 0.85;
}

/* =========================================================
   Recipe Search
   ========================================================= */

.rk-filter-item--search {
	width: 360px;
	min-width: 0;
}

.rk-search {
	position: relative;
	margin: 0;
}

#rk_filter .rk-search__input {
	width: 100%;
	padding: 10px 12px 10px 34px;
	border: 1px solid #ccc;
	border-radius: 6px;
	font-size: 14px;
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: left 12px center;
	box-sizing: border-box;
	color: #333;
	/* Inputs don't inherit the page font on their own, so the bar used the browser's.
	   A theme can pick another with --rk-search-font, for example its heading font. */
	font-family: var(--rk-search-font, inherit);
	-webkit-appearance: none;
	appearance: none;
	transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

#rk_filter .rk-search__input:hover {
	border-color: #bbb;
}

#rk_filter .rk-search__input:focus {
	outline: none;
	border-color: var(--rk-accent, #333);
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--rk-accent, #333) 15%, transparent);
	background-color: #fff;
}

.rk-search__results {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	margin-top: 4px;
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	max-height: 320px;
	overflow-y: auto;
	z-index: 50;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
	list-style: none;
	padding: 4px;
	margin-bottom: 0;
}

.rk-search__item {
	display: flex;
	align-items: center;
	gap: 10px;
	/* Themes space out every list item; these rows sit in our own box. */
	margin: 0;
	padding: 6px 10px;
	cursor: pointer;
	border-radius: 4px;
	transition: background 0.15s;
}

.rk-search__item:hover {
	background: #f5f5f5;
}

.rk-search__item--active {
	background: #f0f0f0;
}

.rk-search__thumb {
	width: 36px;
	height: 36px;
	border-radius: 4px;
	object-fit: cover;
	flex-shrink: 0;
}

.rk-search__title {
	font-size: 14px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.rk-search__empty {
	padding: 8px 10px;
	color: #999;
	font-style: italic;
	font-size: 14px;
}

/* Large search bar: the block's "Search bar size" setting, and always on the results page */

.rk-filter-item--search-large {
	width: 640px;
	max-width: 100%;
}

#rk_filter .rk-filter-item--search-large .rk-search__input {
	/* Many themes fix every input at one height, which would crush the padding. */
	height: auto;
	padding: 16px 20px 16px 54px;
	font-size: 18px;
	border-radius: 8px;
	background-size: 20px 20px;
	background-position: left 20px center;
}

.rk-search__results--large .rk-search__item {
	gap: 12px;
	padding: 10px 12px;
}

.rk-search__results--large .rk-search__thumb {
	width: 48px;
	height: 48px;
}

.rk-search__results--large .rk-search__title {
	font-size: 16px;
}

/* =========================================================
   Results Page (/apps/recipekit/search)
   ========================================================= */

.rk-search-page {
	max-width: 1200px;
	margin: 0 auto;
	padding: 40px 16px 64px;
	box-sizing: border-box;
}

.rk-search-page__title {
	margin: 0 0 8px;
	text-align: center;
	overflow-wrap: anywhere;
}

.rk-search-page #rk_filter {
	justify-content: center;
	margin: 16px 0 8px;
}

.rk-results__status {
	margin: 0 0 32px;
	text-align: center;
	opacity: 0.75;
}

.rk-results {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
	gap: 32px 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rk-results__card {
	margin: 0;
	padding: 0;
}

.rk-results__card[hidden] {
	display: none;
}

.rk-results__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.rk-results__image {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: 6px;
	background: #f3f3f3;
}

.rk-results__title {
	display: block;
	margin-top: 12px;
	font-size: 17px;
	line-height: 1.35;
}

.rk-results__link:hover .rk-results__title,
.rk-results__link:focus-visible .rk-results__title {
	text-decoration: underline;
}

#rk_search_results .rk-results__more {
	display: block;
	margin: 40px auto 0;
	padding: 12px 28px;
	font-size: 14px;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 767px) {
	#rk_filter {
		flex-direction: column;
	}

	.rk-filter-group {
		flex-direction: column;
		width: 100%;
	}

	.rk-filter-item {
		min-width: auto;
		width: 100%;
		flex-basis: 100%;
	}

	.rk-filter-item--combobox {
		width: 100%;
	}

	.rk-dropdown,
	.rk-dropdown__trigger {
		width: 100%;
		max-width: none;
	}

	.rk-filter-item--clear {
		width: 100%;
	}

	.rk-btn--clear {
		width: 100%;
	}

	.rk-filter-item--search {
		width: 100%;
	}

	/* iOS zooms the page into any input under 16px when it is tapped. */
	#rk_filter .rk-search__input {
		font-size: 16px;
	}

	/* The results page keeps its bigger box on a phone. */
	#rk_filter .rk-filter-item--search-large .rk-search__input {
		font-size: 18px;
	}

	#rk_search_results .rk-results__more {
		width: 100%;
	}
}
