/**
 * TDCSF search form — fully custom design, no theme dependencies.
 * Colors/radius are CSS variables (set from the widget's Design tab).
 * Font is inherited from the site (Kanit on the customer site).
 */

.tdcsf {
	--tdcsf-primary: #12233f;          /* buttons, checked states */
	--tdcsf-primary-contrast: #ffffff;
	--tdcsf-text: #002a3e;             /* labels */
	--tdcsf-muted: #8a939c;
	--tdcsf-pill-bg: #e8e4dc;          /* filter pills, icon circles */
	--tdcsf-panel-bg: #dcd7d1;         /* desktop expanding panel */
	--tdcsf-soft: #e8e7e6;             /* secondary button */
	--tdcsf-surface: #ffffff;          /* sheets, inputs */
	--tdcsf-border: #e6e1d8;
	--tdcsf-radius: 14px;

	font-size: 15px;
	color: var(--tdcsf-text);
	position: relative;
}

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

/* zero-specificity resets (:where) so every tdcsf-* class rule wins */
:where(.tdcsf) :where(button) {
	font: inherit;
	color: inherit;
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	text-align: left;
}

:where(.tdcsf) :where(ul) {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tdcsf svg {
	display: block;
	flex-shrink: 0;
}

.tdcsf-hidden {
	display: none !important;
}

html.tdcsf-locked,
html.tdcsf-locked body {
	overflow: hidden;
}

/* ================================================================= *
 * Icon row (always-visible category row)
 * ================================================================= */

.tdcsf-icon-row {
	margin-bottom: 20px;
}

.tdcsf-icon-row-list {
	display: flex;
	gap: 6px;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	justify-content: space-evenly;
}

.tdcsf-icon-row-list::-webkit-scrollbar {
	display: none;
}

.tdcsf-icon-item > button {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 8px 12px;
}

.tdcsf-icon-circle {
	width: 54px;
	height: 54px;
	border-radius: 50%;
	background: var(--tdcsf-pill-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border: 2px solid transparent;
	transition: border-color .15s, transform .15s;
	flex-shrink: 0;
}

.tdcsf-icon-item > button:hover .tdcsf-icon-circle {
	transform: translateY(-2px);
}

.tdcsf-icon-circle img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tdcsf-icon-circle svg,
.tdcsf-icon-circle i {
	width: 24px;
	height: 24px;
	font-size: 24px;
	color: var(--tdcsf-text);
	fill: var(--tdcsf-text);
}

.tdcsf-icon-item.tdcsf-selected .tdcsf-icon-circle {
	border-color: var(--tdcsf-primary);
	background: var(--tdcsf-panel-bg);
}

.tdcsf-icon-item.tdcsf-selected .tdcsf-icon-label {
	font-weight: 700;
}

.tdcsf-icon-text {
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 0;
}

.tdcsf-icon-label {
	font-weight: 600;
	font-size: 15.5px;
	white-space: nowrap;
	line-height: 1.25;
}

.tdcsf-icon-sub {
	font-size: 14px;
	color: var(--tdcsf-text);
	opacity: .85;
	white-space: nowrap;
	line-height: 1.25;
}

.tdcsf-media-fallback {
	font-size: 20px;
	font-weight: 700;
	color: var(--tdcsf-text);
}

/* ================================================================= *
 * Bar (pills / search / filter / sort buttons)
 * ================================================================= */

.tdcsf-bar {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

/* FILTER toggle: reveals pills marked "behind Filter button" */
.tdcsf-bar-toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-weight: 600;
	font-size: 15px;
	letter-spacing: .06em;
	text-transform: uppercase;
	margin-right: 8px;
	padding: 6px 2px;
}

.tdcsf-bar-toggle .tdcsf-badge {
	position: absolute;
	top: -4px;
	right: -14px;
}

/* pills hidden until the FILTER toggle expands them (desktop only —
   the mobile sheet always lists every filter) */
@media (min-width: 1025px) {
	.tdcsf-bar .tdcsf-extra {
		display: none;
	}

	.tdcsf.tdcsf-bar-expanded .tdcsf-bar .tdcsf-extra {
		display: inline-flex;
	}
}

/* Filter + Sort wrapper: invisible on desktop (children flow in the bar),
   full-width space-between row on mobile */
.tdcsf-bar-actions {
	display: contents;
}

/* icon-font icons from the Elementor picker */
.tdcsf-bar-toggle i,
.tdcsf-filter-btn i,
.tdcsf-sort-btn i,
.tdcsf-search i {
	font-size: 17px;
	line-height: 1;
}

.tdcsf-sheet-reset svg,
.tdcsf-sheet-reset i {
	width: 15px;
	height: 15px;
	font-size: 15px;
	line-height: 1;
}

.tdcsf-x i {
	font-size: 17px;
	line-height: 1;
}

.tdcsf-pill,
.tdcsf-filter-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--tdcsf-pill-bg);
	border-radius: 999px;
	padding: 9px 18px;
	font-weight: 500;
	transition: background .15s, color .15s;
	white-space: nowrap;
}

.tdcsf-pill:hover,
.tdcsf-filter-btn:hover {
	filter: brightness(.96);
}

.tdcsf-pill.tdcsf-filled,
.tdcsf-filter-btn.tdcsf-filled {
	background: var(--tdcsf-primary);
	color: var(--tdcsf-primary-contrast);
}

.tdcsf-caret {
	opacity: .8;
}

.tdcsf-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 19px;
	height: 19px;
	padding: 0 5px;
	border-radius: 999px;
	background: var(--tdcsf-primary);
	color: var(--tdcsf-primary-contrast);
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

.tdcsf-filled .tdcsf-badge {
	background: var(--tdcsf-primary-contrast);
	color: var(--tdcsf-primary);
}

.tdcsf-search {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--tdcsf-surface);
	border: 1px solid transparent;
	border-radius: 999px;
	padding: 10px 20px;
	flex: 1 1 220px;
	min-width: 180px;
	color: var(--tdcsf-muted);
	margin-left: auto;
	max-width: 360px;
}

.tdcsf-search:focus-within {
	border-color: var(--tdcsf-primary);
	color: var(--tdcsf-primary);
}

.tdcsf-search svg {
	order: 2;
}

.tdcsf-search input {
	border: none;
	outline: none;
	background: none;
	font: inherit;
	color: var(--tdcsf-text);
	width: 100%;
	padding: 0;
	-webkit-appearance: none;
}

.tdcsf-search input::placeholder {
	color: var(--tdcsf-muted);
}

/* ================================================================= *
 * Desktop expanding panel — full-bleed beige strip
 * ================================================================= */

.tdcsf-panel {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	width: var(--tdcsf-page-w, 100vw);
	z-index: 120;
	margin-top: 16px;
	background: var(--tdcsf-panel-bg);
	padding: 24px 40px 22px;
}

.tdcsf-panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 14px;
}

.tdcsf-panel-title {
	font-weight: 500;
	font-size: 18px;
}

.tdcsf-x {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	color: var(--tdcsf-text);
}

.tdcsf-x:hover {
	background: rgba(255, 255, 255, .45);
}

.tdcsf-x svg {
	width: 17px;
	height: 17px;
}

.tdcsf-panel-inner {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 40px;
}

.tdcsf-panel-body {
	flex: 1;
	max-height: 46vh;
	overflow-y: auto;
	align-self: flex-start;
}

.tdcsf-panel-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 380px;
	flex-shrink: 0;
}

.tdcsf-panel-actions .tdcsf-btn {
	width: 100%;
	padding: 9px 20px;
}

/* panel options: plain checkbox list, checkbox on the left, count inline */
.tdcsf-panel-body .tdcsf-option-list {
	display: grid;
	grid-template-columns: repeat(var(--tdcsf-cols, 2), max-content);
	gap: 8px 48px;
}

.tdcsf-panel-body .tdcsf-option > button {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 4px 2px;
	border-radius: 6px;
}

.tdcsf-panel-body .tdcsf-option > button:hover {
	background: none;
	opacity: .8;
}

.tdcsf-panel-body .tdcsf-media,
.tdcsf-panel-body .tdcsf-option-sub {
	display: none;
}

.tdcsf-panel-body .tdcsf-check {
	order: -1;
	background: var(--tdcsf-surface);
	border-color: var(--tdcsf-surface);
}

.tdcsf-panel-body .tdcsf-option.tdcsf-selected .tdcsf-check {
	background: var(--tdcsf-primary);
	border-color: var(--tdcsf-primary);
}

.tdcsf-panel-body .tdcsf-option-body {
	flex-direction: row;
	align-items: center;
	gap: 6px;
	flex: 0 1 auto;
}

.tdcsf-panel-body .tdcsf-option-label {
	font-weight: 500;
	white-space: nowrap;
}

.tdcsf-panel-body .tdcsf-option-count {
	color: var(--tdcsf-text);
	opacity: .9;
}

/* ================================================================= *
 * Buttons
 * ================================================================= */

.tdcsf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	border-radius: 999px;
	padding: 10px 26px;
	font-weight: 400;
	font-size: 15.5px;
	transition: opacity .15s;
}

.tdcsf-btn:hover {
	opacity: .92;
}

.tdcsf-btn-primary {
	background: var(--tdcsf-primary);
	color: var(--tdcsf-primary-contrast);
}

.tdcsf-btn-ghost {
	background: var(--tdcsf-soft);
	color: var(--tdcsf-text);
}

.tdcsf-btn-link {
	color: var(--tdcsf-text);
	font-weight: 600;
	padding: 8px;
}

.tdcsf-btn-block {
	width: 100%;
	padding: 14px 20px;
	font-weight: 500;
}

.tdcsf-total:empty {
	display: none;
}

.tdcsf-total {
	font-weight: inherit;
	opacity: .9;
}

/* ================================================================= *
 * Options (cards / swatches / list / sort) — sheet context
 * ================================================================= */

.tdcsf-option-list {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2px;
}

.tdcsf-option > button {
	display: flex;
	align-items: center;
	gap: 13px;
	width: 100%;
	padding: 11px 10px;
	border-radius: calc(var(--tdcsf-radius) - 4px);
	transition: background .12s;
}

.tdcsf-option > button:hover {
	background: rgba(0, 0, 0, .03);
}

.tdcsf-media {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.tdcsf-media-img {
	width: 56px;
	height: 56px;
	border-radius: calc(var(--tdcsf-radius) - 4px);
	background: var(--tdcsf-pill-bg);
}

.tdcsf-media-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tdcsf-media-img svg,
.tdcsf-media-img i {
	width: 22px;
	height: 22px;
	font-size: 22px;
	color: var(--tdcsf-text);
	fill: var(--tdcsf-text);
}

.tdcsf-media-swatch {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 1px solid var(--tdcsf-border);
}

.tdcsf-media-swatch img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tdcsf-media-generic {
	background: var(--tdcsf-pill-bg);
}

.tdcsf-option-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	min-width: 0;
}

.tdcsf-option-label {
	font-weight: 600;
	line-height: 1.3;
}

.tdcsf-option-sub {
	font-size: 13px;
	color: var(--tdcsf-muted);
	line-height: 1.3;
}

.tdcsf-option-count {
	color: var(--tdcsf-muted);
	font-size: 13.5px;
	flex-shrink: 0;
}

.tdcsf-option.tdcsf-zero {
	opacity: .45;
}

/* checkbox / radio */
.tdcsf-check {
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	border-radius: 6px;
	border: 1.5px solid #c9d1d8;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .12s, border-color .12s;
	background: var(--tdcsf-surface);
}

/* plain box until selected — icon fully hidden, immune to theme svg styles */
.tdcsf-check svg {
	display: none;
	color: var(--tdcsf-primary-contrast);
}

.tdcsf-check svg path {
	fill: none;
	stroke: currentColor;
}

.tdcsf-check-radio {
	border-radius: 50%;
}

.tdcsf-option.tdcsf-selected .tdcsf-check {
	background: var(--tdcsf-primary);
	border-color: var(--tdcsf-primary);
}

.tdcsf-option.tdcsf-selected .tdcsf-check svg {
	display: block;
}

.tdcsf-option.tdcsf-selected .tdcsf-option-label {
	font-weight: 700;
}

.tdcsf-options-sort .tdcsf-option > button {
	padding: 13px 10px;
}

/* ================================================================= *
 * Overlay + sheets (mobile)
 * ================================================================= */

.tdcsf-overlay {
	position: fixed;
	inset: 0;
	z-index: 9990;
	background: rgba(15, 23, 32, .45);
}

.tdcsf-sheet {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9991;
	background: var(--tdcsf-surface);
	border-radius: 22px 22px 0 0;
	max-height: 88dvh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 -12px 40px -12px rgba(20, 32, 45, .35);
	animation: tdcsf-slide-up .28s cubic-bezier(.22,.68,0,1);
}

.tdcsf-sheet[hidden] {
	display: none;
}

@keyframes tdcsf-slide-up {
	from { transform: translateY(60px); opacity: 0; }
	to { transform: translateY(0); opacity: 1; }
}

.tdcsf-sheet-head {
	padding: 10px 20px 14px;
	border-bottom: 1px solid var(--tdcsf-border);
	flex-shrink: 0;
}

.tdcsf-sheet-handle {
	display: block;
	width: 44px;
	height: 4px;
	border-radius: 999px;
	background: #d8d4cc;
	margin: 0 auto 14px;
}

.tdcsf-sheet-head-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.tdcsf-sheet-title {
	font-size: 21px;
	font-weight: 700;
	line-height: 1.25;
}

.tdcsf-subsheet-title {
	font-size: 17px;
	flex: 1;
	text-align: center;
}

.tdcsf-sheet-sub {
	font-size: 13px;
	color: var(--tdcsf-muted);
	margin-top: 2px;
}

.tdcsf-sheet-reset {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13.5px;
	font-weight: 500;
	color: var(--tdcsf-muted);
	flex-shrink: 0;
}

.tdcsf-back {
	flex-shrink: 0;
}

.tdcsf-sheet-body {
	flex: 1;
	overflow-y: auto;
	padding: 6px 14px;
	overscroll-behavior: contain;
}

.tdcsf-sheet-footer {
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--tdcsf-border);
}

/* filter rows in main sheet */
.tdcsf-row {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	padding: 15px 6px;
	border-bottom: 1px solid var(--tdcsf-border);
}

.tdcsf-row:last-child {
	border-bottom: none;
}

.tdcsf-row-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 13px;
	border: 1px solid var(--tdcsf-border);
	flex-shrink: 0;
}

.tdcsf-row-icon svg,
.tdcsf-row-icon i {
	width: 19px;
	height: 19px;
	font-size: 19px;
	color: var(--tdcsf-text);
	fill: var(--tdcsf-text);
}

.tdcsf-row-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	min-width: 0;
}

.tdcsf-row-label {
	font-weight: 600;
	font-size: 14.5px;
	line-height: 1.3;
}

.tdcsf-row-value {
	font-size: 13px;
	color: var(--tdcsf-muted);
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.tdcsf-badge-zero {
	background: transparent;
	border: 1.5px solid var(--tdcsf-border);
	color: var(--tdcsf-muted);
}

.tdcsf-row-caret {
	color: var(--tdcsf-muted);
}

.tdcsf-row-caret svg {
	transform: rotate(-90deg);
}

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

@media (min-width: 1025px) {
	.tdcsf-filter-btn {
		display: none;
	}
}

@media (max-width: 1024px) {
	.tdcsf-bar .tdcsf-pill:not(.tdcsf-sort-btn),
	.tdcsf.tdcsf-bar-expanded .tdcsf-bar .tdcsf-pill:not(.tdcsf-sort-btn),
	.tdcsf-bar-toggle {
		display: none;
	}

	.tdcsf-panel {
		display: none !important;
	}

	.tdcsf-bar {
		gap: 8px;
	}

	.tdcsf-search {
		flex-basis: 100%;
		order: -1;
		margin-left: 0;
		max-width: none;
		border-color: var(--tdcsf-border);
	}

	.tdcsf-bar-actions {
		display: flex;
		width: 100%;
		align-items: center;
		justify-content: space-between;
		gap: 8px;
	}

	.tdcsf-filter-btn,
	.tdcsf-sort-btn {
		flex: 0 0 auto;
	}

	/* icon row: stacked circle-over-label, like the mobile design */
	.tdcsf-icon-row-list {
		justify-content: flex-start;
	}

	.tdcsf-icon-item > button {
		flex-direction: column;
		align-items: center;
		gap: 7px;
		min-width: 78px;
		padding: 6px 8px;
	}

	.tdcsf-icon-text {
		align-items: center;
	}

	.tdcsf-icon-circle {
		width: 60px;
		height: 60px;
	}

	.tdcsf-icon-label {
		font-size: 13.5px;
	}

	.tdcsf-icon-sub {
		font-size: 12.5px;
	}
}
