/* Tiimiriided CTA filtrid. Tootekaartide kujundus jääb Breakdance'i Products Listi + senise CSS-i peale. */

.trcf {
	--trcf-accent: #009AD2;
	--trcf-ink: #2d2622;
	--trcf-muted: #6b6560;
	--trcf-line: #e2dfdb;
	--trcf-bg: #fff;
	--trcf-radius: 6px;
	color: var(--trcf-ink);
	margin-bottom: 32px;
}
.trcf *, .trcf *::before, .trcf *::after { box-sizing: border-box; }
.trcf-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Products Listi asendavad WooCommerce'i elemendid ära */
.trcf-page .woocommerce-pagination,
.trcf-page .woocommerce-result-count,
.trcf-page .woocommerce-ordering { display: none !important; }
html[data-trcf-busy] .trcf-page .bde-wooproductslist,
html[data-trcf-busy] .bde-wooproductslist { opacity: .5; transition: opacity .15s; }

/* ---------- Tööriistariba ---------- */
.trcf-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.trcf-quick { display: flex; gap: 12px; flex: 1 1 auto; min-width: 0; }
.trcf-quick:empty { display: none; }

.trcf-chip {
	display: inline-flex; align-items: center; justify-content: center; flex: none;
	min-height: 44px; padding: 0 28px;
	border: 1px solid var(--trcf-line); border-radius: 999px; background: var(--trcf-bg);
	color: var(--trcf-ink); font-size: 14px; font-weight: 700; letter-spacing: .02em;
	text-transform: uppercase; text-decoration: none; white-space: nowrap;
	transition: border-color .15s, background-color .15s, color .15s;
}
.trcf-chip:hover { border-color: var(--trcf-ink); color: var(--trcf-ink); }
.trcf-chip[aria-current="true"] { background: var(--trcf-accent); border-color: var(--trcf-accent); color: #fff; }

.trcf-count { margin: 0; color: var(--trcf-muted); font-size: 14px; white-space: nowrap; }
.trcf-count:focus { outline: none; }
.trcf-actions { display: flex; gap: 12px; }

.trcf-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 48px; padding: 0 20px;
	border: 1px solid var(--trcf-line); border-radius: var(--trcf-radius); background: var(--trcf-bg);
	color: var(--trcf-ink); font: inherit; font-size: 14px; font-weight: 700; line-height: 1.2;
	letter-spacing: .02em; text-transform: uppercase; text-decoration: none; cursor: pointer;
	transition: border-color .15s, filter .15s;
}
.trcf-btn:hover { border-color: var(--trcf-ink); color: var(--trcf-ink); }
.trcf-btn--primary { background: var(--trcf-accent); border-color: var(--trcf-accent); color: #fff; }
.trcf-btn--primary:hover { border-color: var(--trcf-accent); color: #fff; filter: brightness(.92); }

.trcf-badge:empty { display: none; }
.trcf-badge {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
	background: var(--trcf-accent); color: #fff; font-size: 12px;
}

.trcf-select { position: relative; }
.trcf-select select {
	appearance: none; -webkit-appearance: none;
	min-height: 48px; padding: 0 40px 0 16px;
	border: 1px solid var(--trcf-line); border-radius: var(--trcf-radius);
	background: var(--trcf-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%232d2622' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 16px center;
	color: var(--trcf-ink); font: inherit; font-size: 14px; font-weight: 700; letter-spacing: .02em;
	text-transform: uppercase; cursor: pointer;
}

/* ---------- Aktiivsed filtrid ---------- */
.trcf-active { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.trcf-active[hidden] { display: none; }
.trcf-active li { margin: 0; }
.trcf-tag {
	display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
	border: 1px solid var(--trcf-line); border-radius: 999px; background: var(--trcf-bg);
	color: var(--trcf-ink); font-size: 14px; font-weight: 600; text-decoration: none;
}
.trcf-tag:hover { border-color: var(--trcf-ink); color: var(--trcf-ink); }
.trcf-tag__x { font-size: 18px; line-height: 1; }
.trcf-tag--clear { border-color: transparent; background: none; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Fookus ---------- */
.trcf a:focus-visible, .trcf button:focus-visible, .trcf select:focus-visible, .trcf summary:focus-visible,
.trcf-more a:focus-visible {
	outline: 3px solid var(--trcf-ink); outline-offset: 2px;
}
.trcf-opt input:focus-visible + label { outline: 3px solid var(--trcf-ink); outline-offset: 2px; border-radius: 4px; }

/* ---------- Filtripaneel ---------- */
.trcf-panel { margin-top: 24px; border: 1px solid var(--trcf-line); border-radius: var(--trcf-radius); background: var(--trcf-bg); }
.trcf-backdrop, .trcf:not(.trcf--js) [data-trcf-open], .trcf:not(.trcf--js) [data-trcf-close] { display: none; }

.trcf--js .trcf-panel {
	position: fixed; z-index: 100000; top: 0; right: 0; bottom: 0;
	width: min(420px, 100%); margin: 0; border: 0; border-radius: 0;
	display: flex; flex-direction: column;
	box-shadow: -8px 0 32px rgba(0, 0, 0, .12);
	transform: translateX(100%); visibility: hidden;
	transition: transform .25s ease, visibility 0s linear .25s;
}
.trcf--js .trcf-panel.is-open { transform: none; visibility: visible; transition: transform .25s ease; }
.trcf--js .trcf-backdrop {
	display: block; position: fixed; inset: 0; z-index: 99999;
	background: rgba(0, 0, 0, .4); opacity: 0; visibility: hidden;
	transition: opacity .25s, visibility 0s linear .25s;
}
.trcf--js .trcf-backdrop.is-open { opacity: 1; visibility: visible; transition: opacity .25s; }
html.trcf-lock { overflow: hidden; }

.trcf-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 8px 8px 20px; border-bottom: 1px solid var(--trcf-line); }
.trcf-panel__title { margin: 0; font-size: 20px; line-height: 1.3; }
.trcf-close { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border: 0; border-radius: var(--trcf-radius); background: none; color: var(--trcf-ink); cursor: pointer; }

.trcf-panel__body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 0 20px 16px; }
.trcf-facet { margin: 0; padding: 16px 0 8px; border: 0; border-bottom: 1px solid var(--trcf-line); min-width: 0; }
.trcf-facet legend { float: left; width: 100%; margin: 0 0 4px; padding: 0; font-size: 15px; font-weight: 700; }
.trcf-facet ul { clear: both; margin: 0; padding: 0; list-style: none; }
.trcf-opt { position: relative; margin: 0; }
.trcf-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.trcf-opt label { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-size: 15px; }
.trcf-opt label::before {
	content: ""; flex: none; width: 20px; height: 20px;
	border: 1.5px solid #8a847f; border-radius: 4px; background: #fff center/12px no-repeat;
}
.trcf-opt input:checked + label::before {
	border-color: var(--trcf-accent);
	background-color: var(--trcf-accent);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.trcf-n { margin-left: auto; color: var(--trcf-muted); font-size: 13px; }

/* Suurused: nupuruudustik */
.trcf-facet--chips ul { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 8px; }
.trcf-facet--chips .trcf-opt label {
	justify-content: center; min-width: 56px; min-height: 44px; padding: 0 12px;
	border: 1px solid var(--trcf-line); border-radius: var(--trcf-radius);
	font-size: 14px; font-weight: 600; text-transform: uppercase;
}
.trcf-facet--chips .trcf-opt label::before { display: none; }
.trcf-facet--chips .trcf-opt label:hover { border-color: var(--trcf-ink); }
.trcf-facet--chips .trcf-opt input:checked + label { background: var(--trcf-accent); border-color: var(--trcf-accent); color: #fff; }

/* Hind */
.trcf-price__row { display: flex; align-items: flex-end; gap: 8px; padding-bottom: 8px; }
.trcf-price__field { flex: 1 1 0; min-width: 0; }
.trcf-price__field label { display: block; margin-bottom: 4px; color: var(--trcf-muted); font-size: 13px; }
.trcf-price__input { position: relative; display: block; }
.trcf-price__input input {
	width: 100%; min-height: 48px; padding: 0 32px 0 12px;
	border: 1px solid var(--trcf-line); border-radius: var(--trcf-radius); background: #fff;
	color: var(--trcf-ink); font: inherit; font-size: 16px; -moz-appearance: textfield;
}
.trcf-price__input input::-webkit-outer-spin-button,
.trcf-price__input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.trcf-price__input input:focus-visible { outline: 3px solid var(--trcf-ink); outline-offset: 1px; }
.trcf-price__input > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--trcf-muted); pointer-events: none; }
.trcf-price__dash { padding-bottom: 12px; color: var(--trcf-muted); }

.trcf-extra { border-bottom: 1px solid var(--trcf-line); }
.trcf-extra summary { display: flex; align-items: center; justify-content: space-between; min-height: 52px; font-weight: 700; cursor: pointer; list-style: none; }
.trcf-extra summary::-webkit-details-marker { display: none; }
.trcf-extra summary::after { content: "+"; font-size: 22px; font-weight: 400; }
.trcf-extra[open] summary::after { content: "−"; }
.trcf-extra .trcf-facet:last-child { border-bottom: 0; }
.trcf-none { color: var(--trcf-muted); }

.trcf-panel__foot { display: flex; gap: 12px; padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--trcf-line); }
.trcf-panel__foot > * { flex: 1 1 0; }
.trcf-panel__foot .trcf-btn--primary { flex-grow: 1.6; }

/* ---------- Vaata rohkem ---------- */
.trcf-more { margin-top: 32px; text-align: center; }
.trcf-more:empty { display: none; }
.trcf-more__btn { min-width: 280px; }

/* ---------- Mobiil ---------- */
@media (max-width: 767px) {
	.trcf { margin-bottom: 20px; }
	.trcf-toolbar { gap: 12px; }
	/* Kiirkategooriad horisontaalselt keritavad, rida ulatub ekraani servani */
	.trcf-quick {
		flex: 1 1 100%; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity;
		margin-right: -16px; padding: 2px 16px 2px 2px; scrollbar-width: none;
	}
	.trcf-quick::-webkit-scrollbar { display: none; }
	.trcf-chip { padding: 0 18px; scroll-snap-align: start; }
	.trcf-count { flex: 1 1 100%; }
	.trcf-actions { flex: 1 1 100%; }
	.trcf-actions > * { flex: 1 1 0; min-width: 0; }
	.trcf-open { width: 100%; padding: 0 12px; }
	.trcf-select select { width: 100%; padding-left: 12px; }
	.trcf-more__btn { width: 100%; min-width: 0; }

	/* Filter alumise paneelina */
	.trcf--js .trcf-panel {
		top: auto; left: 0; width: 100%; max-height: 88vh; max-height: 88dvh;
		border-radius: 16px 16px 0 0; box-shadow: 0 -8px 32px rgba(0, 0, 0, .15);
		transform: translateY(100%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.trcf *, .trcf--js .trcf-panel, .trcf--js .trcf-backdrop { transition: none !important; }
}
