.fang-search-php { font-family: inherit; color: inherit; }
.fang-search-php *, .fang-search-php *::before, .fang-search-php *::after { box-sizing: border-box; }

.fsphp-searchbar { position: relative; display: flex; gap: 8px; margin-bottom: 12px; }
.fsphp-input { flex: 1 1 auto; padding: 12px 14px; border: 1px solid #d0d0d8; border-radius: 10px; font-size: 16px; outline: none; }
.fsphp-input:focus { border-color: #0a84ff; box-shadow: 0 0 0 3px rgba(10,132,255,0.2); }
.fsphp-submit { padding: 10px 18px; border: 0; background: #0a84ff; color: #fff; border-radius: 10px; cursor: pointer; font-weight: 600; }
.fsphp-submit:hover { background: #006ee0; }

.fsphp-suggest { position: absolute; top: 100%; left: 0; right: 0; margin-top: 6px; background: #fff; border: 1px solid #e0e0e6; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.1); z-index: 50; max-height: 420px; overflow: auto; }
.fsphp-suggest[hidden] { display: none; }
.fsphp-suggest-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: inherit; text-decoration: none; border-bottom: 1px solid #f2f2f5; }
.fsphp-suggest-item:last-child { border-bottom: 0; }
.fsphp-suggest-item:hover { background: #f6f7fb; }
.fsphp-suggest-item img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.fsphp-suggest-title { flex: 1 1 auto; font-size: 14px; }
.fsphp-suggest-price { font-weight: 600; }

.fsphp-toolbar { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 16px; flex-wrap: wrap; gap: 8px; }
.fsphp-count { font-size: 13px; opacity: 0.75; }
.fsphp-toolbar-right { display: flex; gap: 8px; align-items: center; }
.fsphp-filter-toggle { display: none; padding: 8px 12px; border-radius: 8px; border: 1px solid #d0d0d8; background: #fff; cursor: pointer; }
.fsphp-sort { padding: 8px 10px; border-radius: 8px; border: 1px solid #d0d0d8; background: #fff; }

.fsphp-layout { display: grid; grid-template-columns: 260px 1fr; gap: 24px; }
.fsphp-filters { border: 1px solid #ececf2; border-radius: 12px; padding: 12px; background: #fcfcfd; align-self: start; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.fsphp-filters-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 10px; border-bottom: 1px solid #ececf2; margin-bottom: 8px; }
.fsphp-clear-all { background: none; border: 0; color: #0a84ff; cursor: pointer; font-size: 13px; }
.fsphp-facet { padding: 10px 0; border-bottom: 1px solid #ececf2; }
.fsphp-facet:last-child { border-bottom: 0; }
.fsphp-facet-head { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 2px 0; background: none; border: 0; font-weight: 600; font-size: 14px; cursor: pointer; text-align: left; color: inherit; }
.fsphp-facet-caret { opacity: 0.5; font-weight: normal; }
.fsphp-facet-list { margin-top: 8px; display: grid; gap: 4px; }
.fsphp-facet-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.fsphp-facet-item:hover { background: #f1f2f6; }
.fsphp-facet-item input { margin: 0; }
.fsphp-facet-item.is-checked { background: rgba(10,132,255,0.1); }
.fsphp-facet-label { flex: 1 1 auto; }
.fsphp-facet-count { opacity: 0.6; font-size: 12px; }
.fsphp-facet-more { margin-top: 6px; background: none; border: 0; color: #0a84ff; cursor: pointer; font-size: 13px; padding: 4px 0; }
.fsphp-facet-price { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.fsphp-facet-price input { width: 70px; padding: 6px; border-radius: 6px; border: 1px solid #d0d0d8; }
.fsphp-price-apply { padding: 6px 10px; border-radius: 6px; border: 0; background: #0a84ff; color: #fff; cursor: pointer; }
.fsphp-toggles { display: grid; gap: 6px; }
.fsphp-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

.fsphp-results[aria-busy="true"] { opacity: 0.6; }
.fsphp-loading, .fsphp-empty, .fsphp-error { padding: 24px; text-align: center; font-size: 14px; opacity: 0.7; }

.fsphp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.fsphp-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; border: 1px solid #ececf2; border-radius: 12px; overflow: hidden; transition: box-shadow 0.15s, transform 0.15s; background: #fff; }
.fsphp-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.08); transform: translateY(-2px); }
.fsphp-card-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #f4f4f7; }
.fsphp-card-body { padding: 10px 12px 12px; display: grid; gap: 4px; }
.fsphp-card-brand { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.6; }
.fsphp-card-title { font-size: 14px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fsphp-card-price { font-weight: 600; display: flex; gap: 6px; align-items: baseline; }
.fsphp-sale { color: #d30000; }
.fsphp-strike { text-decoration: line-through; opacity: 0.55; font-weight: 400; font-size: 13px; }
.fsphp-oos { font-size: 12px; color: #a13; margin-top: 2px; }

.fsphp-pager { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; margin-top: 24px; }
.fsphp-page { min-width: 36px; padding: 8px 10px; border: 1px solid #d0d0d8; background: #fff; border-radius: 8px; cursor: pointer; font-weight: 500; }
.fsphp-page.is-active { background: #0a84ff; color: #fff; border-color: #0a84ff; }

/* Sidebar shortcode (accordion) */
.fang-search-php-sidebar { width: 100%; }
.fang-search-php-sidebar.is-sticky { position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); overflow: auto; }
.fang-search-php-sidebar .fsphp-side { border: 1px solid #ececf2; border-radius: 12px; padding: 12px; background: #fcfcfd; }
.fang-search-php-sidebar .fsphp-side-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 10px; border-bottom: 1px solid #ececf2; margin-bottom: 8px; }
.fang-search-php-sidebar .fsphp-side-title { font-size: 14px; }
.fang-search-php-sidebar .fsphp-side-cats { display: flex; flex-direction: column; gap: 2px; }

/* Each category row = clickable header + collapsible panel */
.fang-search-php-sidebar .fsphp-cat-row { display: flex; flex-direction: column; border-radius: 8px; overflow: hidden; }
.fang-search-php-sidebar .fsphp-cat-row.is-active > .fsphp-cat-item { background: #0a84ff; color: #fff; }
.fang-search-php-sidebar .fsphp-cat-row.is-active > .fsphp-cat-item .fsphp-cat-count { color: rgba(255,255,255,0.85); }
.fang-search-php-sidebar .fsphp-cat-row.is-active > .fsphp-cat-item .fsphp-cat-caret { color: rgba(255,255,255,0.95); }

.fang-search-php-sidebar .fsphp-cat-item {
	display: flex; align-items: center; gap: 8px;
	padding: 9px 10px;
	background: none; border: 0; border-radius: 8px;
	cursor: pointer; text-align: left; font-size: 14px;
	color: inherit; width: 100%;
}
.fang-search-php-sidebar .fsphp-cat-item:hover { background: #f1f2f6; }
.fang-search-php-sidebar .fsphp-cat-row.is-active > .fsphp-cat-item:hover { background: #0773df; }

.fang-search-php-sidebar .fsphp-cat-caret {
	display: inline-block; width: 12px; line-height: 1; flex: 0 0 auto;
	font-size: 11px; opacity: 0.6;
	transition: transform 0.18s ease;
	transform: rotate(0deg);
}
.fang-search-php-sidebar .fsphp-cat-row.is-expanded > .fsphp-cat-item .fsphp-cat-caret { transform: rotate(90deg); }
.fang-search-php-sidebar .fsphp-cat-row-all .fsphp-cat-item { padding-left: 24px; }

.fang-search-php-sidebar .fsphp-cat-name { flex: 1 1 auto; font-weight: 500; }
.fang-search-php-sidebar .fsphp-cat-count { font-size: 12px; opacity: 0.6; flex: 0 0 auto; }

/* Inline accordion panel */
.fang-search-php-sidebar .fsphp-cat-attrs {
	max-height: 0;
	overflow: hidden;
	padding: 0 6px;
	transition: max-height 0.28s ease, padding 0.28s ease;
}
.fang-search-php-sidebar .fsphp-cat-row.is-expanded > .fsphp-cat-attrs {
	max-height: 4000px;
	padding: 4px 6px 8px 6px;
}
.fang-search-php-sidebar .fsphp-cat-attrs .fsphp-facet { padding: 8px 0; border-bottom: 1px solid #ececf2; }
.fang-search-php-sidebar .fsphp-cat-attrs .fsphp-facet:last-child { border-bottom: 0; }
.fang-search-php-sidebar .fsphp-cat-attrs .fsphp-facet-head { font-weight: 600; font-size: 13px; margin-bottom: 4px; opacity: 0.85; }
.fang-search-php-sidebar .fsphp-cat-attrs .fsphp-facet-list { display: grid; gap: 2px; padding-left: 4px; }

.fang-search-php-sidebar .fsphp-side-empty,
.fang-search-php-sidebar .fsphp-side-error { padding: 10px; font-size: 13px; opacity: 0.7; }
.fang-search-php-sidebar .fsphp-side-error { color: #b22; }
.fang-search-php-sidebar .fsphp-loading { padding: 10px; font-size: 13px; opacity: 0.7; }
.fang-search-php-sidebar .fsphp-side-apply-row { margin-top: 12px; }
.fang-search-php-sidebar .fsphp-side-apply { width: 100%; padding: 10px; background: #0a84ff; color: #fff; border: 0; border-radius: 8px; cursor: pointer; font-weight: 600; }
.fang-search-php-sidebar .fsphp-side-apply:hover { background: #006ee0; }
.fang-search-php-sidebar .fsphp-clear-all { background: none; border: 0; color: #0a84ff; cursor: pointer; font-size: 13px; }

/* AJAX in-place loop swap — smooth cross-fade with subtle dim, no jump. */
.fsphp-loop-loading { position: relative; pointer-events: none; }
.fsphp-loop-loading > * { transition: opacity 0.18s ease, filter 0.18s ease; opacity: 0.55; filter: saturate(0.85); }
.fsphp-loop-loading::after {
	content: ''; position: absolute; top: 24px; left: 50%;
	width: 28px; height: 28px; margin-left: -14px;
	border-radius: 50%;
	border: 3px solid rgba(10,132,255,0.18);
	border-top-color: #0a84ff;
	animation: fsphp-spin 0.7s linear infinite;
	z-index: 5;
}
@keyframes fsphp-spin { to { transform: rotate(360deg); } }

/* Active filter chips */
.fang-search-php-sidebar .fsphp-active-chips {
	display: flex; flex-wrap: wrap; gap: 6px;
	padding: 8px 4px 12px; margin-bottom: 6px;
	border-bottom: 1px solid #ececf2;
}
.fang-search-php-sidebar .fsphp-active-chips[hidden] { display: none; }
.fsphp-chip {
	display: inline-flex; align-items: center; gap: 4px;
	padding: 4px 4px 4px 10px;
	background: rgba(10,132,255,0.1);
	color: #0a84ff;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 500;
	max-width: 100%;
}
.fsphp-chip-label {
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	max-width: 180px;
}
.fsphp-chip-x {
	display: inline-flex; align-items: center; justify-content: center;
	width: 18px; height: 18px;
	border: 0; background: rgba(10,132,255,0.2);
	color: #0a84ff;
	border-radius: 50%;
	font-size: 14px; line-height: 1;
	cursor: pointer;
	padding: 0;
}
.fsphp-chip-x:hover { background: #0a84ff; color: #fff; }

/* Mobile drawer toggle button (hidden on desktop, shown on mobile) */
.fang-search-php-sidebar .fsphp-mobile-toggle { display: none; }
.fang-search-php-sidebar .fsphp-mobile-close  { display: none; }
.fang-search-php-sidebar .fsphp-drawer-backdrop { display: none; }

/* Filter count badge on mobile toggle */
.fsphp-filter-count-badge {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 22px; height: 22px;
	padding: 0 6px;
	background: #0a84ff; color: #fff;
	border-radius: 999px;
	font-size: 11px; font-weight: 700;
	margin-left: auto;
}
.fsphp-filter-count-badge[hidden] { display: none; }

/* Sub-category drill-down list */
.fang-search-php-sidebar .fsphp-sub-cats { padding: 8px 0 12px; border-bottom: 1px solid #ececf2; margin-bottom: 8px; }
.fang-search-php-sidebar .fsphp-sub-cat-list { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }
.fang-search-php-sidebar .fsphp-sub-cat-item {
	display: flex; align-items: center; justify-content: space-between; gap: 8px;
	padding: 6px 10px; padding-left: 24px;
	border-radius: 6px;
	color: inherit; text-decoration: none;
	font-size: 13px;
}
.fang-search-php-sidebar .fsphp-sub-cat-item::before {
	content: '└';
	margin-right: 6px;
	opacity: 0.4;
	font-size: 11px;
}
.fang-search-php-sidebar .fsphp-sub-cat-item:hover { background: #eef4ff; color: #0a84ff; }
.fang-search-php-sidebar .fsphp-sub-cat-item.is-in-chain {
	background: #eef4ff;
	color: #04395e;
	font-weight: 600;
}
.fang-search-php-sidebar .fsphp-sub-cat-item.is-current {
	background: #0a84ff;
	color: #fff;
	font-weight: 600;
}
.fang-search-php-sidebar .fsphp-sub-cat-item.is-current::before { color: rgba(255,255,255,0.85); }
.fang-search-php-sidebar .fsphp-sub-cat-item.is-current .fsphp-sub-cat-count { color: rgba(255,255,255,0.85); }
.fang-search-php-sidebar .fsphp-sub-cat-name { flex: 1 1 auto; }
.fang-search-php-sidebar .fsphp-sub-cat-count { font-size: 11px; opacity: 0.55; flex: 0 0 auto; }

/* Nested sub-cat lists (deeper than depth 0) */
.fang-search-php-sidebar .fsphp-sub-cat-list-nested {
	margin-left: 18px;
	border-left: 2px solid #e1e6f0;
	padding-left: 6px;
	margin-top: 2px;
	margin-bottom: 4px;
}
.fang-search-php-sidebar .fsphp-sub-cat-depth-1 { padding-left: 20px; }
.fang-search-php-sidebar .fsphp-sub-cat-depth-2 { padding-left: 18px; }
.fang-search-php-sidebar .fsphp-sub-cat-depth-3 { padding-left: 16px; }
.fang-search-php-sidebar .fsphp-sub-cat-depth-1::before,
.fang-search-php-sidebar .fsphp-sub-cat-depth-2::before,
.fang-search-php-sidebar .fsphp-sub-cat-depth-3::before { content: ''; margin-right: 0; }

/* Dual-handle price range slider */
.fsphp-facet-price-slider .fsphp-range-rail {
	position: relative;
	height: 28px;
	margin: 12px 6px 4px;
}
.fsphp-facet-price-slider .fsphp-range-rail::before {
	content: '';
	position: absolute;
	top: 13px; left: 0; right: 0;
	height: 4px;
	background: #e9ebef;
	border-radius: 2px;
}
.fsphp-facet-price-slider .fsphp-range-fill {
	position: absolute;
	top: 13px;
	height: 4px;
	background: #0a84ff;
	border-radius: 2px;
	pointer-events: none;
}
.fsphp-facet-price-slider input[type="range"] {
	position: absolute;
	top: 0; left: 0; right: 0;
	width: 100%;
	height: 28px;
	background: none;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
	margin: 0;
}
.fsphp-facet-price-slider input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none; appearance: none;
	width: 18px; height: 18px;
	border-radius: 50%;
	background: #0a84ff;
	border: 2px solid #fff;
	box-shadow: 0 1px 4px rgba(0,0,0,0.2);
	pointer-events: auto;
	cursor: grab;
}
.fsphp-facet-price-slider input[type="range"]::-moz-range-thumb {
	width: 18px; height: 18px;
	border-radius: 50%;
	background: #0a84ff;
	border: 2px solid #fff;
	box-shadow: 0 1px 4px rgba(0,0,0,0.2);
	pointer-events: auto;
	cursor: grab;
}
.fsphp-range-labels {
	display: flex; justify-content: space-between;
	margin: 0 6px;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	font-weight: 500;
	opacity: 0.85;
}

/* Skeleton loading cards */
.fsphp-loop-skeletoned > .fsphp-skeleton-card {
	list-style: none;
	display: flex; flex-direction: column;
	padding: 8px;
	border: 1px solid #ececf2;
	border-radius: 10px;
	background: #fff;
	overflow: hidden;
	animation: fsphp-skeleton-pulse 1.4s ease-in-out infinite;
}
.fsphp-skeleton-img {
	aspect-ratio: 1;
	background: linear-gradient(90deg, #eef0f3 0%, #e0e3e8 50%, #eef0f3 100%);
	background-size: 200% 100%;
	animation: fsphp-skeleton-shimmer 1.4s ease-in-out infinite;
	border-radius: 6px;
	margin-bottom: 8px;
}
.fsphp-skeleton-line {
	height: 10px;
	background: linear-gradient(90deg, #eef0f3 0%, #e0e3e8 50%, #eef0f3 100%);
	background-size: 200% 100%;
	animation: fsphp-skeleton-shimmer 1.4s ease-in-out infinite;
	border-radius: 4px;
	margin: 4px 0;
}
.fsphp-skel-90 { width: 90%; }
.fsphp-skel-60 { width: 60%; }
.fsphp-skel-40 { width: 40%; }
@keyframes fsphp-skeleton-pulse  { 0%, 100% { opacity: 1; } 50% { opacity: 0.85; } }
@keyframes fsphp-skeleton-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Active filter chips bar above the products grid */
.fsphp-grid-chips {
	display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
	padding: 8px 0 12px;
	margin-bottom: 4px;
	border-bottom: 1px solid #ececf2;
}
.fsphp-grid-chips[hidden] { display: none; }
.fsphp-grid-chips-clear {
	background: none; border: 0;
	color: #555;
	font-size: 12px;
	cursor: pointer;
	padding: 4px 8px;
	margin-left: auto;
	text-decoration: underline;
}
.fsphp-grid-chips-clear:hover { color: #0a84ff; }

/* AI search input + hint banner */
.fang-search-php-sidebar .fsphp-side-search-wrap {
	position: relative;
	margin: 0 4px 8px;
}
.fang-search-php-sidebar .fsphp-side-search {
	width: 100%;
	padding: 10px 38px 10px 12px;
	border: 1px solid #d0d0d8;
	border-radius: 10px;
	font-size: 13px;
	outline: none;
	transition: border-color 0.15s, box-shadow 0.15s;
}
.fang-search-php-sidebar .fsphp-side-search:focus {
	border-color: #0a84ff;
	box-shadow: 0 0 0 3px rgba(10,132,255,0.18);
}
.fang-search-php-sidebar .fsphp-side-search-btn {
	position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
	display: inline-flex; align-items: center; justify-content: center;
	width: 30px; height: 30px;
	background: none; border: 0; border-radius: 8px;
	color: #0a84ff;
	cursor: pointer;
}
.fang-search-php-sidebar .fsphp-side-search-btn:hover { background: rgba(10,132,255,0.1); }

.fsphp-ai-hint {
	margin: 0 4px 8px;
	padding: 8px 10px;
	border-radius: 8px;
	font-size: 12px;
	line-height: 1.4;
}
.fsphp-ai-hint[hidden] { display: none; }
.fsphp-ai-hint.is-loading { background: #fff7e6; color: #5a4500; }
.fsphp-ai-hint.is-success { background: rgba(10,132,255,0.08); color: #04395e; border-left: 3px solid #0a84ff; }
.fsphp-ai-hint.is-info    { background: #f4f5f7; color: #555; }
.fsphp-ai-hint.is-error   { background: #fde7e9; color: #8a1c25; }

/* Mobile drawer (≤768px) */
@media (max-width: 768px) {
	.fang-search-php-sidebar.is-sticky { position: static; max-height: none; overflow: visible; }

	.fang-search-php-sidebar .fsphp-mobile-toggle {
		display: inline-flex; align-items: center; gap: 8px;
		width: 100%;
		padding: 10px 14px;
		background: #0a84ff; color: #fff;
		border: 0; border-radius: 10px;
		font-weight: 600; font-size: 14px;
		cursor: pointer;
	}
	.fang-search-php-sidebar .fsphp-mobile-toggle:hover { background: #006ee0; }

	.fang-search-php-sidebar .fsphp-side {
		position: fixed;
		top: 0; right: 0; bottom: 0;
		width: min(380px, 90vw);
		max-width: none;
		background: #fff;
		z-index: 999999;
		overflow-y: auto;
		transform: translateX(100%);
		transition: transform 0.28s ease;
		box-shadow: -8px 0 28px rgba(0,0,0,0.18);
		padding-top: 56px; /* room for the close button */
		border-radius: 16px 0 0 16px;
	}
	.fang-search-php-sidebar.fsphp-drawer-open .fsphp-side { transform: translateX(0); }

	.fang-search-php-sidebar .fsphp-mobile-close {
		display: inline-flex; align-items: center; justify-content: center;
		position: absolute; top: 12px; right: 12px;
		width: 36px; height: 36px;
		background: #f4f4f7;
		border: 0; border-radius: 50%;
		cursor: pointer;
		color: #333;
		z-index: 2;
	}
	.fang-search-php-sidebar .fsphp-mobile-close:hover { background: #e9ebef; }

	.fang-search-php-sidebar .fsphp-drawer-backdrop {
		display: block;
		position: fixed; inset: 0;
		background: rgba(20,24,30,0.45);
		z-index: 999998;
		opacity: 0;
		transition: opacity 0.2s ease;
		pointer-events: none;
	}
	.fang-search-php-sidebar.fsphp-drawer-open .fsphp-drawer-backdrop {
		opacity: 1;
		pointer-events: auto;
	}
	.fang-search-php-sidebar .fsphp-drawer-backdrop[hidden] { display: none; }
}

@media (max-width: 860px) {
	.fsphp-layout { grid-template-columns: 1fr; }
	.fsphp-filters { position: static; max-height: none; display: none; }
	.fsphp-filters.is-open { display: block; }
	.fsphp-filter-toggle { display: inline-flex; }
}
