/*!
 * EmptyCode FAQs — front-end styles.
 * Author: EmptyCode
 * License: GPL-2.0-or-later
 * Scoped controls resist theme styles without resetting answer content.
 */

.ec-faq,
.ec-faq__search,
.ec-faq__chips,
.ec-faq__pagination {
	--ec-faq-fg: #1f2937;
	--ec-faq-bg: #ffffff;
	--ec-faq-border: #e5e7eb;
	--ec-faq-accent: #2563eb;
	--ec-faq-accent-hover: #1d4ed8;
	--ec-faq-radius: 8px;
	--ec-faq-gap: 0.75rem;
	--ec-faq-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ec-faq {
	box-sizing: border-box;
	color: var(--ec-faq-fg);
	font-family: inherit;
}

.ec-faq *,
.ec-faq *::before,
.ec-faq *::after {
	box-sizing: border-box;
}

/* Reset only plugin-owned controls, including widgets outside .ec-faq.
   Component rules below restore their layout, colors and interaction states. */
:is(.ec-faq.ec-faq, .ec-faq__search.ec-faq__search, .ec-faq__chips.ec-faq__chips, .ec-faq__pagination.ec-faq__pagination) button:where(.ec-faq__question, .ec-faq__helpful-btn, .ec-faq__search-clear, .ec-faq__search-reset, .ec-faq__chip),
.ec-faq__pagination.ec-faq__pagination button,
.ec-faq__pagination.ec-faq__pagination a,
.ec-faq__pagination.ec-faq__pagination span,
.ec-faq__search input.ec-faq__search-input.ec-faq__search-input {
	-webkit-appearance: none;
	appearance: none;
	box-sizing: border-box;
	margin: 0;
	min-width: 0;
	max-width: 100%;
	min-height: 0;
	height: auto;
	float: none;
	font-family: inherit;
	font-size: inherit;
	line-height: 1.5;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	text-shadow: none;
	box-shadow: none;
	background-image: none;
}

.ec-faq button.ec-faq__question,
.ec-faq button.ec-faq__helpful-btn,
.ec-faq__search button,
.ec-faq__chips button.ec-faq__chip {
	border-radius: 0;
}

/* Theme button decorations must not replace the plugin's own icons. */
:is(.ec-faq.ec-faq, .ec-faq__search.ec-faq__search, .ec-faq__chips.ec-faq__chips, .ec-faq__pagination.ec-faq__pagination) button:where(.ec-faq__question, .ec-faq__helpful-btn, .ec-faq__search-clear, .ec-faq__search-reset, .ec-faq__chip)::before,
:is(.ec-faq.ec-faq, .ec-faq__search.ec-faq__search, .ec-faq__chips.ec-faq__chips, .ec-faq__pagination.ec-faq__pagination) button:where(.ec-faq__question, .ec-faq__helpful-btn, .ec-faq__search-clear, .ec-faq__search-reset, .ec-faq__chip)::after {
	content: none;
}

.ec-faq .ec-faq__question-text {
	min-width: 0;
	color: inherit;
	font: inherit;
	white-space: normal;
	overflow-wrap: anywhere;
}

.ec-faq__search *,
.ec-faq__chips *,
.ec-faq__pagination * {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------ */
/* Search                                                              */
/* ------------------------------------------------------------------ */
.ec-faq__search {
	position: relative;
	margin: 0 0 0.5rem;
}
.ec-faq__search .ec-faq__search-wrap {
	position: relative;
	display: flex;
	align-items: center;
	max-width: 30rem;
}
.ec-faq__search .ec-faq__search-icon {
	position: absolute;
	left: 0.75rem;
	top: 50%;
	transform: translateY(-50%);
	width: 1rem;
	height: 1rem;
	pointer-events: none;
	color: #6b7280;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.ec-faq__search .ec-faq__search-icon svg {
	width: 100%;
	height: 100%;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.ec-faq__search input.ec-faq__search-input.ec-faq__search-input {
	color: var(--ec-faq-fg);
	width: 100%;
	padding: 0.75rem 2.5rem 0.75rem 2.5rem;
	font-size: 1rem;
	border: 1px solid var(--ec-faq-border);
	border-radius: var(--ec-faq-radius);
	background: var(--ec-faq-bg);
	transition: border-color 120ms ease, box-shadow 120ms ease;
}
.ec-faq__search input.ec-faq__search-input.ec-faq__search-input::placeholder {
	color: #6b7280;
	opacity: 1;
}
.ec-faq__search input.ec-faq__search-input.ec-faq__search-input::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}
.ec-faq__search input.ec-faq__search-input.ec-faq__search-input:hover {
	border-color: #9ca3af;
}
.ec-faq__search input.ec-faq__search-input.ec-faq__search-input:focus {
	outline: none;
	border-color: var(--ec-faq-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--ec-faq-accent) 15%, transparent);
}
.ec-faq__search button.ec-faq__search-clear {
	position: absolute;
	right: 0.5rem;
	top: 50%;
	transform: translateY(-50%);
	display: none;
	width: 1.5rem;
	height: 1.5rem;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 50%;
	color: #6b7280;
	cursor: pointer;
	align-items: center;
	justify-content: center;
}
.ec-faq__search button.ec-faq__search-clear:hover {
	background: rgba(0, 0, 0, 0.05);
	color: var(--ec-faq-fg);
}
.ec-faq__search button.ec-faq__search-clear:focus {
	outline: 2px solid var(--ec-faq-accent);
	outline-offset: 1px;
}
.ec-faq__search button.ec-faq__search-clear::before,
.ec-faq__search button.ec-faq__search-clear::after {
	content: "";
	position: absolute;
	width: 12px;
	height: 2px;
	background: currentColor;
	border-radius: 1px;
}
.ec-faq__search button.ec-faq__search-clear::before {
	transform: rotate(45deg);
}
.ec-faq__search button.ec-faq__search-clear::after {
	transform: rotate(-45deg);
}
.ec-faq__search input.ec-faq__search-input.ec-faq__search-input:not(:placeholder-shown) ~ .ec-faq__search-clear {
	display: flex;
}
.ec-faq__search .ec-faq__search-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 0.25rem;
	font-size: 0.75rem;
	color: #6b7280;
	min-height: 0;
}
.ec-faq__search .ec-faq__search-count strong {
	color: var(--ec-faq-fg);
	font-weight: 600;
	/* Ensure a visible gap between the bold count and the trailing word
	   ("2 results") — relying on the literal space after </strong> in the
	   injected HTML is not safe across font rendering and whitespace rules. */
	margin-right: 0.25em;
}
.ec-faq__search button.ec-faq__search-reset {
	display: none;
	background: transparent;
	border: 0;
	color: var(--ec-faq-accent);
	font: inherit;
	font-size: 0.8125rem;
	cursor: pointer;
	padding: 0;
	text-decoration: underline;
}
.ec-faq__search button.ec-faq__search-reset:hover {
	color: var(--ec-faq-accent-hover);
}
.ec-faq__search .ec-faq__search-meta.is-filtered .ec-faq__search-reset {
	display: inline;
}

/* ------------------------------------------------------------------ */
/* Filter chips                                                        */
/* ------------------------------------------------------------------ */
.ec-faq__chips {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.375rem;
	margin: 0 0 var(--ec-faq-gap);
	padding: 0;
	list-style: none;
}
.ec-faq__chips button.ec-faq__chip {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	padding: 0.3125rem 0.75rem;
	font-size: 0.8125rem;
	font-weight: 500;
	background: var(--ec-faq-bg);
	color: var(--ec-faq-fg);
	border: 1px solid var(--ec-faq-border);
	border-radius: 999px;
	cursor: pointer;
	transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}
.ec-faq__chips button.ec-faq__chip:hover {
	border-color: var(--ec-faq-accent);
	color: var(--ec-faq-accent);
	transform: translateY(-1px);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}
.ec-faq__chips button.ec-faq__chip.is-active {
	background: var(--ec-faq-accent);
	color: #fff;
	border-color: var(--ec-faq-accent);
	box-shadow: 0 2px 6px color-mix(in srgb, var(--ec-faq-accent) 25%, transparent);
}
.ec-faq__chips button.ec-faq__chip.is-active:hover {
	background: var(--ec-faq-accent-hover);
	border-color: var(--ec-faq-accent-hover);
	color: #fff;
}
.ec-faq__chips button.ec-faq__chip:focus {
	outline: 2px solid var(--ec-faq-accent);
	outline-offset: 2px;
}
.ec-faq__chips li {
	margin: 0;
	padding: 0;
	list-style: none;
}
.ec-faq__chips .ec-faq__chip-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.25rem;
	height: 1.25rem;
	padding: 0 0.375rem;
	font-size: 0.75rem;
	font-weight: 600;
	background: rgba(0, 0, 0, 0.06);
	border-radius: 999px;
}
.ec-faq__chips button.ec-faq__chip.is-active .ec-faq__chip-count {
	background: rgba(255, 255, 255, 0.25);
	color: #fff;
}

/* ------------------------------------------------------------------ */
/* Item                                                                */
/* ------------------------------------------------------------------ */
.ec-faq .ec-faq__item {
	border: 1px solid var(--ec-faq-border);
	border-radius: var(--ec-faq-radius);
	background: var(--ec-faq-bg);
	margin-bottom: var(--ec-faq-gap);
	box-shadow: var(--ec-faq-shadow);
	overflow: hidden;
}
.ec-faq .ec-faq__item.is-hidden {
	display: none;
}
.ec-faq .ec-faq__item:focus-within {
	outline: 2px solid var(--ec-faq-accent);
	outline-offset: 2px;
}
.ec-faq .ec-faq__heading {
	padding: 0;
	border: 0;
	background: transparent;
	line-height: inherit;
	letter-spacing: normal;
	text-transform: none;
	margin: 0;
	font-size: inherit;
	font-weight: inherit;
}
.ec-faq button.ec-faq__question {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	width: 100%;
	padding: 1rem 1.25rem;
	font: inherit;
	font-weight: 600;
	text-align: left;
	background: transparent;
	color: var(--ec-faq-fg);
	border: 0;
	cursor: pointer;
	transition: background-color 120ms ease;
}
.ec-faq button.ec-faq__question:hover {
	color: var(--ec-faq-fg);
	background: rgba(0, 0, 0, 0.025);
}
.ec-faq button.ec-faq__question:focus {
	background: rgba(0, 0, 0, 0.025);
	color: var(--ec-faq-fg);
	outline: none;
}
.ec-faq button.ec-faq__question[aria-expanded="true"] {
	background: rgba(0, 0, 0, 0.025);
}
.ec-faq .ec-faq__icon {
	flex-shrink: 0;
	width: 1rem;
	height: 1rem;
	position: relative;
}
.ec-faq .ec-faq__icon::before,
.ec-faq .ec-faq__icon::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 0.75rem;
	height: 2px;
	background: currentColor;
	transform: translate(-50%, -50%);
	transition: transform 150ms ease;
}
.ec-faq .ec-faq__icon::after {
	transform: translate(-50%, -50%) rotate(90deg);
}
.ec-faq button.ec-faq__question[aria-expanded="true"] .ec-faq__icon::after {
	transform: translate(-50%, -50%) rotate(0deg);
}

.ec-faq .ec-faq__answer {
	max-height: 0;
	overflow: hidden;
	transition: max-height 220ms ease, padding 220ms ease;
	padding: 0 1.25rem;
	line-height: 1.6;
}
.ec-faq .ec-faq__item.is-open .ec-faq__answer {
	max-height: 1500px;
	padding-bottom: 1rem;
}
.ec-faq--list .ec-faq__answer {
	max-height: none;
	padding-top: 0;
	padding-bottom: 1.25rem;
}

/* Search hit highlight inside answers. */
.ec-faq mark.ec-faq__hit {
	background: rgba(37, 99, 235, 0.18);
	color: inherit;
	padding: 0 2px;
	border-radius: 2px;
}

/* Empty state shown when search/filter returns zero matches. */
.ec-faq .ec-faq__empty {
	display: none;
	padding: 1.5rem;
	text-align: center;
	border: 1px dashed var(--ec-faq-border);
	border-radius: var(--ec-faq-radius);
	background: rgba(0, 0, 0, 0.015);
	color: #6b7280;
}
.ec-faq .ec-faq__empty:not([hidden]) {
	display: block;
}

/* Pagination */
.ec-faq__pagination[hidden] {
	display: none !important;
}
.ec-faq__pagination {
	margin: 1.5rem 0 0;
}
.ec-faq__pagination ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}
.ec-faq__pagination li {
	margin: 0;
}
.ec-faq__pagination.ec-faq__pagination a,
.ec-faq__pagination.ec-faq__pagination button,
.ec-faq__pagination.ec-faq__pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.25rem;
	height: 2.25rem;
	padding: 0 0.75rem;
	border: 1px solid var(--ec-faq-border);
	border-radius: 999px;
	background: var(--ec-faq-bg);
	color: var(--ec-faq-fg);
	font-size: 0.875rem;
	font-weight: 500;
	text-decoration: none;
	font-family: inherit;
	cursor: pointer;
	transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}
.ec-faq__pagination.ec-faq__pagination a:hover,
.ec-faq__pagination.ec-faq__pagination button:hover {
	border-color: var(--ec-faq-accent);
	color: var(--ec-faq-accent);
	transform: translateY(-1px);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}
.ec-faq__pagination.ec-faq__pagination a:focus-visible,
.ec-faq__pagination.ec-faq__pagination button:focus-visible {
	outline: 2px solid var(--ec-faq-accent);
	outline-offset: 2px;
}
.ec-faq__pagination.ec-faq__pagination .is-disabled,
.ec-faq__pagination.ec-faq__pagination button[disabled] {
	opacity: 0.4;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}
.ec-faq__pagination.ec-faq__pagination .is-disabled:hover,
.ec-faq__pagination.ec-faq__pagination button[disabled]:hover {
	border-color: var(--ec-faq-border);
	color: var(--ec-faq-fg);
	transform: none;
	box-shadow: none;
}
.ec-faq__pagination.ec-faq__pagination .current,
.ec-faq__pagination.ec-faq__pagination .is-current {
	background: var(--ec-faq-accent);
	color: #fff;
	border-color: var(--ec-faq-accent);
	box-shadow: 0 2px 6px color-mix(in srgb, var(--ec-faq-accent) 25%, transparent);
}
.ec-faq__pagination.ec-faq__pagination .current:hover,
.ec-faq__pagination.ec-faq__pagination .is-current:hover {
	background: var(--ec-faq-accent-hover);
	border-color: var(--ec-faq-accent-hover);
	transform: none;
}
.ec-faq .ec-faq__empty-title {
	font-weight: 600;
	color: var(--ec-faq-fg);
	margin: 0 0 0.25rem;
}

/* ------------------------------------------------------------------ */
/* Display modes                                                       */
/* ------------------------------------------------------------------ */
/* list: flat, no card chrome, all answers always visible. */
.ec-faq--list .ec-faq__item {
	border: 0;
	border-bottom: 1px solid var(--ec-faq-border);
	border-radius: 0;
	box-shadow: none;
	margin-bottom: 0;
}
.ec-faq--list .ec-faq__item:last-child {
	border-bottom: 0;
}
.ec-faq--list button.ec-faq__question {
	padding: 1rem 0;
	cursor: default;
	pointer-events: none;
}
.ec-faq--list .ec-faq__icon {
	display: none;
}
.ec-faq--list .ec-faq__answer {
	padding: 0 0 1.25rem;
}

/* toggle: same look + same +/− icon as accordion; only behavior differs (multi-open). */

/* ------------------------------------------------------------------ */
/* Helpful feedback widget                                             */
/* ------------------------------------------------------------------ */
.ec-faq .ec-faq__helpful {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
	margin-top: 1rem;
	margin-bottom: 0.5rem;
	padding-top: 0.75rem;
	border-top: 1px solid var(--ec-faq-border);
	font-size: 0.875rem;
	color: #6b7280;
}
.ec-faq .ec-faq__helpful-label {
	margin-right: 0.5rem;
}
.ec-faq button.ec-faq__helpful-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	padding: 0.4375rem 0.875rem;
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 500;
	background: var(--ec-faq-bg);
	color: var(--ec-faq-fg);
	border: 1px solid var(--ec-faq-border);
	border-radius: 999px;
	cursor: pointer;
	transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
.ec-faq button.ec-faq__helpful-btn:hover {
	background: rgba(0, 0, 0, 0.03);
	border-color: var(--ec-faq-accent);
	color: var(--ec-faq-accent);
}
.ec-faq button.ec-faq__helpful-btn:focus {
	outline: 2px solid var(--ec-faq-accent);
	outline-offset: 2px;
}
.ec-faq button.ec-faq__helpful-btn[disabled] {
	opacity: 0.5;
	cursor: default;
}
.ec-faq .ec-faq__helpful-thanks {
	color: var(--ec-faq-accent);
	font-weight: 500;
}

/* ------------------------------------------------------------------ */
/* Reduced motion                                                      */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
	.ec-faq *,
	.ec-faq *::before,
	.ec-faq *::after {
		transition-duration: 0ms !important;
	}
	.ec-faq__answer {
		max-height: none !important;
		padding-bottom: 1rem !important;
	}
}