/* ── Recipe Filter Widget ─────────────────────────────────────────────────── */

.rfw-wrapper {
	position: relative;
	display: inline-block;
}

/* ── Toggle button ─────────────────────────────────────────────────────────── */

.rfw-toggle-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	background-color: #2563eb; /* overridden by Elementor accent_color */
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: opacity 0.15s ease, box-shadow 0.15s ease;
	user-select: none;
}

.rfw-toggle-btn:hover {
	opacity: 0.9;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.rfw-toggle-btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.rfw-chevron {
	transition: transform 0.2s ease;
	flex-shrink: 0;
}

.rfw-toggle-btn.is-open .rfw-chevron {
	transform: rotate(180deg);
}

/* ── Panel ─────────────────────────────────────────────────────────────────── */

.rfw-panel {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	z-index: 999;
	min-width: 280px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
	animation: rfw-panel-in 0.15s ease;
}

@keyframes rfw-panel-in {
	from { opacity: 0; transform: translateY(-4px); }
	to   { opacity: 1; transform: translateY(0); }
}

.rfw-panel[hidden] {
	display: none;
}

.rfw-panel-inner {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 16px;
}

/* ── Fields ────────────────────────────────────────────────────────────────── */

.rfw-field {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.rfw-label {
	font-size: 12px;
	font-weight: 600;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

/* ── Search input ──────────────────────────────────────────────────────────── */

.rfw-input-wrap {
	position: relative;
}

.rfw-input-wrap svg {
	position: absolute;
	left: 10px;
	top: 50%;
	transform: translateY(-50%);
	color: #9ca3af;
	pointer-events: none;
}

.rfw-search-input {
	width: 100%;
	padding: 9px 12px 9px 34px;
	font-size: 14px;
	color: #111827;
	background: #f9fafb;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	outline: none;
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	/* Remove browser default 'x' clear button — we have reset */
	-webkit-appearance: none;
	appearance: none;
}

.rfw-search-input::-webkit-search-cancel-button {
	display: none;
}

.rfw-search-input:focus {
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
	background: #fff;
}

/* ── Select ────────────────────────────────────────────────────────────────── */

.rfw-select-wrap {
	position: relative;
}

.rfw-select {
	width: 100%;
	padding: 9px 34px 9px 12px;
	font-size: 14px;
	color: #111827;
	background: #f9fafb;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	outline: none;
	box-sizing: border-box;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rfw-select:focus {
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
	background: #fff;
}

.rfw-select-arrow {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	color: #9ca3af;
	pointer-events: none;
}

/* ── Footer / Reset ────────────────────────────────────────────────────────── */

.rfw-panel-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-top: 4px;
	border-top: 1px solid #f3f4f6;
	gap: 8px;
}

.rfw-reset-btn {
	padding: 7px 14px;
	font-size: 13px;
	font-weight: 500;
	color: #6b7280;
	background: none;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	cursor: pointer;
	transition: color 0.15s, border-color 0.15s;
}

.rfw-reset-btn:hover {
	color: #111827;
	border-color: #9ca3af;
}

.rfw-apply-btn {
	padding: 7px 18px;
	font-size: 13px;
	font-weight: 600;
	color: #fff;
	background-color: #2563eb;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: opacity 0.15s;
}

.rfw-apply-btn:hover {
	opacity: 0.85;
}

/* ── Loading state ─────────────────────────────────────────────────────────── */

[data-id].rfw-loading {
	position: relative;
	pointer-events: none;
}

[data-id].rfw-loading::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.65);
	border-radius: 4px;
	z-index: 10;
}

[data-id].rfw-loading::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 11;
	width: 28px;
	height: 28px;
	margin: -14px 0 0 -14px;
	border: 3px solid #e5e7eb;
	border-top-color: #2563eb;
	border-radius: 50%;
	animation: rfw-spin 0.6s linear infinite;
}

@keyframes rfw-spin {
	to { transform: rotate(360deg); }
}

/* ── Responsive: full-width panel on narrow viewports ─────────────────────── */

@media ( max-width: 480px ) {
	.rfw-wrapper {
		display: block;
	}

	.rfw-toggle-btn {
		width: 100%;
		justify-content: center;
	}

	.rfw-panel {
		position: fixed;
		inset: auto 0 0;
		min-width: 0;
		border-radius: 16px 16px 0 0;
		max-height: 90vh;
		overflow-y: auto;
	}
}
