/* ==========================================================================
   Plantbaes Search — Modal Styles
   ========================================================================== */

:root {
	--pbs-backdrop: rgba(0, 0, 0, 0.35);
	--pbs-bg: #ffffff;
	--pbs-border: #eaeaea;
	--pbs-text: #1a1a1a;
	--pbs-text-secondary: #6b7280;
	--pbs-placeholder: #9ca3af;
	--pbs-hover: #f5f5f4;
	--pbs-selected: #ede9e3;
	--pbs-shadow: 0 -4px 40px rgba(0, 0, 0, 0.15);
	--pbs-radius: 12px;
	--pbs-radius-sm: 8px;
	--pbs-badge-recipe-bg: #dcfce7;
	--pbs-badge-recipe-text: #166534;
	--pbs-badge-post-bg: #dbeafe;
	--pbs-badge-post-text: #1e40af;
	--pbs-accent: #775973;
	--pbs-transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Prevent body scroll while modal is open */
body.plantbaes-search-open {
	overflow: hidden;
}

/* ==========================================================================
   Modal wrapper — hidden by default
   ========================================================================== */

.plantbaes-search-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	visibility: hidden;
	pointer-events: none;
}

.plantbaes-search-modal.is-open {
	visibility: visible;
	pointer-events: auto;
}

/* Scroll body — this is the actual scroll container */
.plantbaes-search-scroll-body {
	position: fixed;
	inset: 0;
	z-index: 1;
	overflow-y: auto;
	overflow-x: hidden;
	overscroll-behavior: none;
	transform: translateY(100%);
	transition: transform var(--pbs-transition);
}

.plantbaes-search-modal.is-open .plantbaes-search-scroll-body {
	transform: translateY(0);
}

/* ==========================================================================
   Backdrop
   ========================================================================== */

.plantbaes-search-backdrop {
	position: fixed;
	inset: 0;
	background: var(--pbs-backdrop);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	opacity: 0;
	transition: opacity var(--pbs-transition);
}

.plantbaes-search-modal.is-open .plantbaes-search-backdrop {
	opacity: 1;
}

/* ==========================================================================
   Container — no border radius
   ========================================================================== */

.plantbaes-search-container {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: none;
	min-height: 80vh;
	background: var(--pbs-bg);
	border-radius: 0;
	box-shadow: var(--pbs-shadow);
}

/* Inner content area */
.plantbaes-search-inner {
	display: flex;
	flex-direction: column;
	flex: 1;
	max-width: 1200px;
	width: 100%;
	margin: 0 auto;
	padding: 24px 40px 90px !important;
}

/* ==========================================================================
   Close button
   ========================================================================== */

.plantbaes-search-close {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	width: 100%;
	height: 20vh;
	padding: 0 0 12px;
	border: none;
	background: transparent;
	color: #ffffff;
	cursor: pointer;
	flex-shrink: 0;
}

/* ==========================================================================
   Favorites counter — top-right of backdrop
   ========================================================================== */

.plantbaes-search-fav-counter {
	position: fixed;
	top: 20px;
	right: 24px;
	z-index: 100001;
	display: flex;
	align-items: center;
	gap: 6px;
	color: #ffffff;
	text-decoration: none;
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--pbs-transition);
}

.plantbaes-search-modal.is-open .plantbaes-search-fav-counter {
	opacity: 1;
	pointer-events: auto;
}

.plantbaes-search-fav-icon {
	display: flex;
	align-items: center;
}

.plantbaes-search-fav-icon svg {
	width: 20px;
	height: 20px;
}

.plantbaes-search-fav-label {
	font-size: 11px;
	font-weight: 400;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	line-height: 1;
}

.plantbaes-search-fav-counter:hover {
	opacity: 0.7;
	color: #ffffff;
	text-decoration: none;
}

.plantbaes-search-close,
.plantbaes-search-close:hover,
.plantbaes-search-close:focus,
.plantbaes-search-close:active {
	background: transparent !important;
	color: #ffffff !important;
}

/* ==========================================================================
   Search input area — pill-shaped field with icon on right
   ========================================================================== */

.plantbaes-search-input-wrap {
	display: flex;
	align-items: center;
	position: relative;
	max-width: none;
	margin: 0 0 24px;
	width: 100%;
	flex-shrink: 0;
}

.plantbaes-search-input {
	flex: 1;
	width: 100%;
	padding: 5px 48px 5px 20px !important;
	border: 1px solid var(--pbs-border);
	border-radius: 999px !important;
	outline: none;
	background: var(--pbs-bg);
	font-family: inherit;
	font-size: 14px;
	color: var(--pbs-text);
	text-transform: lowercase;
	transition: border-color var(--pbs-transition);
}

.plantbaes-search-input:focus {
	border-color: var(--pbs-accent);
}

.plantbaes-search-input::placeholder {
	color: var(--pbs-placeholder);
	text-transform: lowercase;
}

/* Magnifying glass icon — inside the field on the right */
.plantbaes-search-input-icon {
	position: absolute;
	right: 16px;
	top: 50%;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--pbs-accent);
	pointer-events: none;
}

.plantbaes-search-input-icon svg {
	width: 20px;
	height: 20px;
}

/* ==========================================================================
   Status message (loading / no results)
   ========================================================================== */

.plantbaes-search-status {
	padding: 16px 0;
	text-align: center;
	color: var(--pbs-text-secondary);
	font-size: 15px;
	line-height: 1.5;
}

/* ==========================================================================
   Fuzzy search results list
   ========================================================================== */

.plantbaes-search-results {
	list-style: none;
	margin: 0;
	padding: 6px 0;
}

/* ==========================================================================
   Single fuzzy search result item
   ========================================================================== */

.plantbaes-search-result {
	display: flex;
	align-items: center;
	gap: 0;
	padding: 0;
	transition: background var(--pbs-transition);
}

.plantbaes-search-result:hover {
	background: var(--pbs-hover);
}

.plantbaes-search-result.is-selected {
	background: var(--pbs-selected);
}

.plantbaes-result-link {
	display: flex;
	align-items: center;
	gap: 14px;
	flex: 1;
	min-width: 0;
	padding: 12px 0 12px 20px;
	text-decoration: none;
	color: var(--pbs-text);
}

.plantbaes-result-link:hover,
.plantbaes-result-link:focus {
	text-decoration: none;
	color: var(--pbs-text);
}

.plantbaes-result-favorite {
	flex-shrink: 0;
	padding: 0 16px;
}

.plantbaes-result-favorite .ccc-favorite-post-toggle > a > .text {
	display: none !important;
}

.plantbaes-result-favorite .ccc-favorite-post-toggle > a::before {
	font-size: 18px;
	color: var(--pbs-accent);
}

/* Thumbnail */
.plantbaes-result-thumb {
	flex-shrink: 0;
	width: 50px;
	height: 50px;
	border-radius: var(--pbs-radius-sm);
	overflow: hidden;
	background: var(--pbs-hover);
}

.plantbaes-result-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.plantbaes-result-thumb-placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--pbs-border);
}

/* Body (title + snippet) */
.plantbaes-result-body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.plantbaes-result-title {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.plantbaes-result-snippet {
	font-size: 13px;
	line-height: 1.4;
	color: var(--pbs-text-secondary);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ==========================================================================
   View More button at bottom of search results
   ========================================================================== */

.plantbaes-search-result-count {
	padding: 8px 20px;
	font-size: 12px;
	font-weight: 400;
	color: var(--pbs-text-secondary);
	text-align: left;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.plantbaes-search-pagination {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 4px;
	padding: 20px 20px 4px;
}

.plantbaes-page-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	height: 32px;
	padding: 0 8px;
	border: 1px solid var(--pbs-border);
	border-radius: 6px;
	background: transparent;
	color: var(--pbs-text-secondary);
	font-size: 13px;
	font-weight: 400;
	cursor: pointer;
	transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.plantbaes-page-btn:hover {
	background: var(--pbs-hover);
	color: var(--pbs-text);
}

.plantbaes-page-btn.is-active {
	background: var(--pbs-accent);
	border-color: var(--pbs-accent);
	color: #ffffff;
}

.plantbaes-page-prev,
.plantbaes-page-next {
	font-size: 12px;
	padding: 0 10px;
}

.plantbaes-page-info {
	font-size: 13px;
	color: var(--pbs-text-secondary);
	padding: 0 4px;
}

.plantbaes-search-view-more {
	display: flex;
	justify-content: flex-end;
	padding: 24px 20px 8px;
}

.plantbaes-search-view-more-btn {
	display: inline-block;
	padding: 8px 24px;
	border-radius: 999px;
	background: var(--pbs-accent);
	color: #ffffff !important;
	font-size: 12px;
	font-weight: 400;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	text-decoration: none;
	transition: opacity 150ms ease;
}

.plantbaes-search-view-more-btn:hover,
.plantbaes-search-view-more-btn:focus,
.plantbaes-search-view-more-btn:active {
	opacity: 0.8;
	color: #ffffff !important;
	text-decoration: none;
}

/* ==========================================================================
   Badge
   ========================================================================== */

.plantbaes-badge {
	flex-shrink: 0;
	padding: 3px 10px;
	border-radius: 20px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	line-height: 1;
	white-space: nowrap;
}

.plantbaes-badge--recipe {
	background: var(--pbs-badge-recipe-bg);
	color: var(--pbs-badge-recipe-text);
}

.plantbaes-badge--post {
	background: var(--pbs-badge-post-bg);
	color: var(--pbs-badge-post-text);
}

/* ==========================================================================
   Post grids — section headings + responsive grid
   ========================================================================== */

.plantbaes-search-grids {
	flex: 1;
}

.plantbaes-grid-section {
	margin-bottom: 28px;
}

.plantbaes-grid-section:last-child {
	margin-bottom: 0;
}

.plantbaes-grid-header {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0 0 12px;
}

.plantbaes-grid-heading {
	font-size: 13px;
	font-weight: 400;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--pbs-text-secondary);
	margin: 0;
	padding: 0;
	line-height: 1.3;
}

.plantbaes-grid-view-all {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--pbs-accent);
	opacity: 0;
	transition: opacity 150ms ease;
	text-decoration: none;
}

.plantbaes-grid-view-all svg {
	width: 16px;
	height: 16px;
}

.plantbaes-grid-section:hover .plantbaes-grid-view-all {
	opacity: 1;
}

.plantbaes-grid-view-all:hover {
	opacity: 0.7;
}

.plantbaes-grid-show-all {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 4px;
	background: var(--pbs-border);
	color: var(--pbs-text-secondary);
	font-size: 9px;
	font-weight: 400;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	text-decoration: none;
	line-height: 1.4;
	opacity: 0;
	transition: opacity 150ms ease;
}

.plantbaes-grid-section:hover .plantbaes-grid-show-all {
	opacity: 1;
}

.plantbaes-grid-show-all:hover {
	opacity: 0.8;
	color: var(--pbs-text-secondary);
	text-decoration: none;
}

/* Scroll wrapper with hover arrows */
.plantbaes-grid-scroll-wrap {
	position: relative;
}

.plantbaes-grid {
	display: flex;
	gap: 16px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none; /* Firefox */
	padding: 8px 0 12px;
	margin: -8px 0 -12px;
}

.plantbaes-grid::-webkit-scrollbar {
	display: none;
}

.plantbaes-grid-item {
	position: relative;
	min-width: 0;
	flex: 0 0 calc((100% - 7 * 16px) / 8);
}

/* Navigation arrows — hidden by default, shown on hover */
.plantbaes-grid-arrow {
	display: flex;
	position: absolute;
	top: 50%;
	transform: translateY(-70%);
	z-index: 20;
	width: 36px;
	height: 36px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.95);
	color: var(--pbs-text);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 150ms ease, background 150ms ease, color 150ms ease;
}

.plantbaes-grid-arrow svg {
	width: 18px;
	height: 18px;
}

.plantbaes-grid-arrow--left {
	left: -18px;
}

.plantbaes-grid-arrow--right {
	right: -18px;
}

.plantbaes-grid-scroll-wrap:hover .plantbaes-grid-arrow {
	opacity: 1;
	pointer-events: auto;
}

.plantbaes-grid-arrow:hover {
	background: var(--pbs-accent);
	color: #ffffff;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.plantbaes-grid-link {
	display: block;
	text-decoration: none;
	color: var(--pbs-text);
}

.plantbaes-grid-link:hover,
.plantbaes-grid-link:focus {
	text-decoration: none;
	color: var(--pbs-text);
}

.plantbaes-grid-thumb {
	position: relative;
	width: 100%;
	aspect-ratio: 1;
	border-radius: var(--pbs-radius-sm);
	background: var(--pbs-hover);
	margin-bottom: 8px;
}

.plantbaes-grid-thumb-link {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: var(--pbs-radius-sm);
	overflow: hidden;
	position: relative;
	z-index: 1;
}

.plantbaes-grid-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.plantbaes-grid-thumb-placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--pbs-border);
}

.plantbaes-grid-title {
	font-size: 13px;
	font-weight: 400;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	padding-top: 6px;
}

/* Favorite button — bottom-right of image with background tab */
.plantbaes-grid-favorite {
	position: absolute;
	bottom: 0;
	right: 0;
	z-index: 10;
	background: rgba(255, 255, 255, 0.9);
	border-radius: 12px 0 0 0;
	min-width: 24px;
	min-height: 24px;
	padding: 4px 6px;
	line-height: 1;
}

.plantbaes-grid-favorite .ccc-favorite-post-toggle > a > .text {
	display: none !important;
}

.plantbaes-grid-favorite .ccc-favorite-post-toggle > a::before {
	font-size: 16px;
	color: var(--pbs-accent);
}

/* ==========================================================================
   All Recipes button — below post grids
   ========================================================================== */

.plantbaes-search-all-recipes-wrap {
	display: flex;
	justify-content: flex-end;
	margin-top: 24px;
}

.plantbaes-search-all-recipes {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 28px;
	border-radius: 999px;
	background: #2B2B2B;
	color: #ffffff !important;
	font-size: 12px;
	font-weight: 400;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	text-decoration: none;
	transition: background 150ms ease;
}

.plantbaes-search-all-recipes:hover,
.plantbaes-search-all-recipes:focus {
	background: var(--pbs-accent);
	color: #ffffff !important;
	text-decoration: none;
}

/* ==========================================================================
   Floating trigger button (FAB) — bottom-right corner
   ========================================================================== */

.plantbaes-search-fab {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 99998;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: var(--pbs-accent);
	color: #ffffff;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
	cursor: pointer;
	transition: transform var(--pbs-transition), box-shadow var(--pbs-transition);
}

.plantbaes-search-fab:hover {
	transform: scale(1.08);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

.plantbaes-search-fab svg {
	width: 22px;
	height: 22px;
}

/* Hide the FAB while the modal is open */
body.plantbaes-search-open .plantbaes-search-fab {
	display: none;
}

/* ==========================================================================
   Inline trigger button — for shortcode / header placement
   ========================================================================== */

.plantbaes-search-inline {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transition: background var(--pbs-transition), color var(--pbs-transition);
}

.plantbaes-search-inline:hover {
	background: var(--pbs-hover);
	color: var(--pbs-accent);
}

.plantbaes-search-inline svg {
	width: 20px;
	height: 20px;
}

/* ==========================================================================
   Tablet — max 1024px: 100vh height, 4-column grids
   ========================================================================== */

@media (max-width: 1024px) {
	.plantbaes-search-close {
		height: 40vh;
	}

	.plantbaes-search-container {
		min-height: 60vh;
	}

	.plantbaes-search-inner {
		padding: 24px 24px 90px;
	}

	.plantbaes-grid-item {
		flex: 0 0 calc((100% - 3 * 16px) / 4);
	}

	.plantbaes-grid-view-all {
		opacity: 1;
	}

	.plantbaes-grid-show-all {
		opacity: 1;
	}

	.plantbaes-search-all-recipes-wrap {
		margin-top: 50px;
	}
}

/* ==========================================================================
   Mobile — max 640px: 3-column grids, smaller text
   ========================================================================== */

@media (max-width: 640px) {
	.plantbaes-search-close {
		height: 15vh;
	}

	.plantbaes-search-container {
		min-height: 85vh;
	}

	.plantbaes-search-inner {
		padding: 16px 16px 90px !important;
	}

	.plantbaes-search-results {
		margin-left: -16px;
		margin-right: -16px;
	}

	.plantbaes-search-input {
		font-size: 16px; /* prevent iOS zoom */
	}

	.plantbaes-grid {
		gap: 12px;
	}

	.plantbaes-grid-item {
		flex: 0 0 calc((100% - 1.3 * 12px) / 2.3);
	}

	.plantbaes-grid-title {
		font-size: 12px;
	}

	.plantbaes-search-all-recipes-wrap {
		justify-content: stretch;
		margin-top: 50px;
		margin-bottom: 20px;
	}

	.plantbaes-search-all-recipes {
		display: block;
		width: 100%;
		text-align: center;
	}

	.plantbaes-search-view-more {
		justify-content: stretch;
	}

	.plantbaes-search-view-more-btn {
		display: block;
		width: 100%;
		text-align: center;
	}
}
