/* ParrotFilter – Frontend Styles */

:root {
	--pf-primary: #1a7a3a;
	--pf-primary-hover: #145c2c;
	--pf-border: #e5e7eb;
	--pf-text: #1f2937;
	--pf-muted: #6b7280;
	--pf-bg: #ffffff;
	--pf-radius: 10px;
}

.parrotfilter-wrapper {
	background: var(--pf-bg);
	border: 1px solid var(--pf-border);
	border-radius: var(--pf-radius);
	padding: 20px;
	font-size: 14px;
	color: var(--pf-text);
	box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.parrotfilter-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--pf-border);
}

.parrotfilter-title {
	margin: 0;
	font-size: 17px;
	font-weight: 600;
	color: var(--pf-primary);
}

.parrotfilter-clear {
	background: none;
	border: none;
	color: var(--pf-primary);
	font-size: 13px;
	cursor: pointer;
	padding: 0;
	text-decoration: underline;
}

.parrotfilter-clear:hover {
	color: var(--pf-primary-hover);
}

/* Sections */
.parrotfilter-section {
	border-bottom: 1px solid var(--pf-border);
	padding: 14px 0;
}

.parrotfilter-section:last-child {
	border-bottom: none;
}

.parrotfilter-section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	user-select: none;
}

.parrotfilter-section-title {
	font-weight: 600;
	font-size: 14px;
	color: var(--pf-text);
}

.parrotfilter-toggle::after {
	content: "▾";
	font-size: 12px;
	color: var(--pf-muted);
	transition: transform 0.2s;
}

.parrotfilter-section.collapsed .parrotfilter-toggle::after {
	transform: rotate(-90deg);
}

.parrotfilter-section.collapsed .parrotfilter-section-body {
	display: none;
}

.parrotfilter-section-body {
	margin-top: 12px;
}

/* Search */
.parrotfilter-search-section .parrotfilter-section-title {
	display: block;
	margin-bottom: 8px;
}

.parrotfilter-search-box {
	position: relative;
}

.parrotfilter-search-box input[type="search"] {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--pf-border);
	border-radius: 8px 0 0 8px;
	font-size: 16px; /* 16px prevents iOS zoom-on-focus */
	outline: none;
	transition: border-color 0.15s;
	-webkit-appearance: none;
	appearance: none;
}

.parrotfilter-search-box input[type="search"]:focus {
	border-color: var(--pf-primary);
}

.parrotfilter-search-icon {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--pf-muted);
	pointer-events: none;
}

/* Options list */
.parrotfilter-options {
	list-style: none;
	margin: 0;
	padding: 0;
}

.parrotfilter-options li {
	margin: 0 0 8px 0;
}

.parrotfilter-options label {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	font-weight: 400;
}

.parrotfilter-options input[type="checkbox"] {
	width: 16px;
	height: 16px;
	accent-color: var(--pf-primary);
	cursor: pointer;
	flex-shrink: 0;
}

.pf-label {
	flex: 1;
}

.pf-count {
	color: var(--pf-muted);
	font-size: 12px;
}

/* Price */
.parrotfilter-price-inputs {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 14px;
}

.parrotfilter-price-inputs input[type="number"] {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--pf-border);
	border-radius: 6px;
	font-size: 13px;
	text-align: center;
}

.pf-price-separator {
	color: var(--pf-muted);
}

/* Dual range slider */
.parrotfilter-price-slider {
	padding: 6px 0 10px;
}

.pf-slider-track {
	position: relative;
	height: 6px;
	background: #e5e7eb;
	border-radius: 99px;
}

.pf-slider-range {
	position: absolute;
	height: 100%;
	background: var(--pf-primary);
	border-radius: 99px;
	z-index: 1;
}

.pf-range {
	position: absolute;
	width: 100%;
	height: 6px;
	top: 0;
	left: 0;
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
	pointer-events: none;
	z-index: 2;
}

.pf-range::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--pf-primary);
	border: 2px solid #fff;
	box-shadow: 0 1px 4px rgba(0,0,0,0.2);
	cursor: pointer;
	pointer-events: auto;
	margin-top: -6px;
}

.pf-range::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--pf-primary);
	border: 2px solid #fff;
	box-shadow: 0 1px 4px rgba(0,0,0,0.2);
	cursor: pointer;
	pointer-events: auto;
}

/* Submit (non-AJAX) */
.parrotfilter-submit {
	display: block;
	width: 100%;
	margin-top: 16px;
	padding: 12px;
	background: var(--pf-primary);
	color: #fff;
	border: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s;
}

.parrotfilter-submit:hover {
	background: var(--pf-primary-hover);
}

/* Loading state */
.parrotfilter-wrapper.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
	.parrotfilter-wrapper {
		margin-bottom: 24px;
	}
}

/* Scrollable filter body */
.parrotfilter-wrapper {
	max-height: var(--pf-max-height, 420px);
	overflow-y: auto;
	overflow-x: hidden;
}

.parrotfilter-header {
	position: sticky;
	top: 0;
	background: var(--pf-bg);
	z-index: 2;
}

/* Mobile drawer */
.parrotfilter-mobile-toggle {
	display: none;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	background: var(--pf-primary);
	color: #fff;
	border: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	margin-bottom: 16px;
}

.parrotfilter-drawer-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.4);
	z-index: 9998;
}

.parrotfilter-drawer-close {
	background: none;
	border: none;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	color: var(--pf-muted);
	padding: 0 4px;
}

.parrotfilter-header-actions {
	display: flex;
	align-items: center;
	gap: 12px;
}

@media (max-width: 768px) {
	.parrotfilter-mobile-toggle {
		display: inline-flex;
	}

	.parrotfilter-has-drawer {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		width: min(340px, 90vw);
		max-height: 100vh;
		z-index: 9999;
		border-radius: 0;
		transform: translateX(-105%);
		transition: transform 0.28s ease;
		box-shadow: 4px 0 24px rgba(0,0,0,0.12);
	}

	.parrotfilter-has-drawer.is-open {
		transform: translateX(0);
	}

	.parrotfilter-drawer-overlay.is-visible {
		display: block;
	}
}

/* v1.2: accessible accordion and nested category presentation */
.parrotfilter-wrapper .parrotfilter-section-header { width:100%; background:transparent; border:0; padding:0; text-align:left; font:inherit; color:inherit; }
.parrotfilter-wrapper .parrotfilter-section-header:focus-visible,
.parrotfilter-wrapper .pf-category-expand:focus-visible { outline:2px solid var(--pf-primary, #126b38); outline-offset:3px; }
.parrotfilter-wrapper .parrotfilter-section-header .parrotfilter-toggle::after { content:'⌃'; display:inline-block; font-size:20px; transform:none; transition:transform .2s; color:var(--pf-primary,#14532d); }
.parrotfilter-wrapper .parrotfilter-section.collapsed .parrotfilter-toggle::after { transform:rotate(180deg); }
.parrotfilter-wrapper .parrotfilter-section-body { overflow:visible; }
.parrotfilter-wrapper .pf-category-tree { list-style:none; padding:0; margin:0; }
.parrotfilter-wrapper .pf-category-tree .pf-category-tree { padding-left:14px; border-left:1px solid var(--pf-border,#ddd); margin-left:6px; }
.parrotfilter-wrapper .pf-category-line { display:flex; align-items:center; justify-content:space-between; gap:5px; min-height:32px; }
.parrotfilter-wrapper .pf-category-line label { display:flex; align-items:center; gap:7px; min-width:0; flex:1; cursor:pointer; }
.parrotfilter-wrapper .pf-category-line .pf-label { overflow-wrap:anywhere; }
.parrotfilter-wrapper .pf-category-expand { flex:0 0 28px; width:28px; height:28px; border:0; background:transparent; color:var(--pf-primary,#14532d); font-size:20px; cursor:pointer; padding:0; }
.parrotfilter-wrapper .pf-category-children[hidden] { display:none !important; }
.parrotfilter-wrapper [data-filter="product_cat"] > .parrotfilter-section-body { max-height:var(--pf-max-height,380px); overflow-y:auto; overscroll-behavior:contain; }
.parrotfilter-wrapper .parrotfilter-search-section { order:-1; }
.parrotfilter-wrapper { box-sizing:border-box; max-width:100%; }
.parrotfilter-wrapper *, .parrotfilter-wrapper *::before, .parrotfilter-wrapper *::after { box-sizing:border-box; }
@media (max-width:768px) { .parrotfilter-wrapper { width:100%; max-width:100%; } .parrotfilter-wrapper .parrotfilter-section-header { min-height:40px; } }

/* v1.3: unified premium appearance and tablet/mobile drawer */
.parrotfilter-wrapper { --pf-primary:#155c3b; --pf-primary-hover:#0d452c; --pf-border:#e5ebe7; --pf-text:#24382d; --pf-muted:#718177; --pf-radius:16px; background:#fff; border:1px solid #e3eae5; border-radius:16px; box-shadow:0 8px 30px rgba(18,67,40,.07); padding:22px; max-height:none; overflow:visible; width:100%; min-width:0; }
.parrotfilter-wrapper .parrotfilter-header { position:static; padding:0 0 18px; margin-bottom:5px; background:#fff; }
.parrotfilter-wrapper .parrotfilter-title { color:#155c3b; font-size:19px; font-weight:700; letter-spacing:-.3px; }
.parrotfilter-wrapper .parrotfilter-section { padding:16px 0; border-bottom:1px solid #e5ebe7; }
.parrotfilter-wrapper .parrotfilter-section-header { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:38px; cursor:pointer; border-radius:6px; }
.parrotfilter-wrapper .parrotfilter-section-title { font-size:14px; font-weight:650; color:#244c36; }
.parrotfilter-wrapper .parrotfilter-section-header .parrotfilter-toggle { width:24px; height:24px; display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; }
.parrotfilter-wrapper .parrotfilter-section-header .parrotfilter-toggle::after { content:''; display:block; width:8px; height:8px; border-right:2px solid #155c3b; border-bottom:2px solid #155c3b; transform:rotate(225deg); transition:transform .18s ease; font-size:0; }
.parrotfilter-wrapper .parrotfilter-section.collapsed .parrotfilter-toggle::after { transform:rotate(45deg); }
.parrotfilter-wrapper .parrotfilter-options label { padding:5px 0; line-height:1.45; }
.parrotfilter-wrapper .parrotfilter-options input[type=checkbox] { accent-color:#155c3b; }
.parrotfilter-wrapper .parrotfilter-search-box input[type=search], .parrotfilter-wrapper .parrotfilter-price-inputs input { border:1px solid #d9e5dd; border-radius:9px; background:#fbfdfb; min-height:42px; }
.parrotfilter-wrapper .pf-category-expand { display:flex; align-items:center; justify-content:center; font-size:0; border-radius:6px; }
.parrotfilter-wrapper .pf-category-expand span { display:block; width:8px; height:8px; border-right:2px solid #155c3b; border-bottom:2px solid #155c3b; transform:rotate(45deg); font-size:0; }
.parrotfilter-wrapper .pf-category-expand[aria-expanded=true] span { transform:rotate(225deg); }
.parrotfilter-wrapper [data-filter="product_cat"] > .parrotfilter-section-body { max-height:min(360px,45vh); overflow-y:auto; padding-right:5px; }
.parrotfilter-wrapper .parrotfilter-submit { background:#155c3b; border-radius:9px; }
.parrotfilter-wrapper .parrotfilter-clear { font-size:12px; text-decoration:none; font-weight:600; }
.parrotfilter-drawer-close { display:none; }
@media (min-width:1025px) { .parrotfilter-mobile-toggle, .parrotfilter-drawer-overlay { display:none!important; } }
@media (max-width:1024px) {
 .parrotfilter-mobile-toggle { display:inline-flex!important; align-items:center; justify-content:center; gap:9px; width:100%; min-height:46px; margin:0 0 14px; border-radius:10px; background:#155c3b; color:white; font-size:14px; box-shadow:0 3px 10px rgba(21,92,59,.15); }
 .parrotfilter-wrapper.parrotfilter-has-drawer { position:fixed!important; top:0!important; bottom:0!important; left:0!important; width:min(390px,92vw)!important; max-width:92vw!important; height:100dvh!important; max-height:100dvh!important; overflow-y:auto!important; overflow-x:hidden!important; overscroll-behavior:contain; z-index:999999!important; border-radius:0 16px 16px 0!important; padding:20px!important; transform:translate3d(-110%,0,0)!important; visibility:hidden; pointer-events:none; transition:transform .25s ease,visibility .25s; box-shadow:8px 0 32px rgba(0,0,0,.18); }
 .parrotfilter-wrapper.parrotfilter-has-drawer.is-open { transform:translate3d(0,0,0)!important; visibility:visible; pointer-events:auto; }
 .parrotfilter-drawer-overlay.is-visible { display:block!important; position:fixed!important; inset:0!important; z-index:999998!important; background:rgba(12,29,18,.55); }
 .parrotfilter-wrapper .parrotfilter-header { position:sticky; top:-20px; z-index:5; padding:14px 0 16px; }
 .parrotfilter-wrapper .parrotfilter-section-header { min-height:44px; }
 .parrotfilter-drawer-close { display:inline-flex; align-items:center; justify-content:center; width:36px; height:36px; background:#f1f6f2; border-radius:50%; color:#155c3b; padding:0; }
 body.parrotfilter-drawer-active { overflow:hidden!important; }
}
@media (prefers-reduced-motion:reduce) { .parrotfilter-wrapper.parrotfilter-has-drawer, .parrotfilter-section-header .parrotfilter-toggle::after { transition:none!important; } }


/* Search submit control: real, accessible button rather than a decorative icon. */
.parrotfilter-search-box { display:flex; align-items:stretch; width:100%; }
.parrotfilter-search-box input[type="search"] { flex:1 1 auto; min-width:0; }
.parrotfilter-search-submit { flex:0 0 44px; display:inline-flex; align-items:center; justify-content:center; border:0; border-radius:0 8px 8px 0; background:var(--pf-primary, #174d39); color:#fff; cursor:pointer; padding:0; }
.parrotfilter-search-submit:hover, .parrotfilter-search-submit:focus { background:var(--pf-primary-hover, #103a2b); color:#fff; }
.parrotfilter-search-submit svg { display:block; }
.parrotfilter-search-submit:focus-visible { outline:2px solid currentColor; outline-offset:2px; }


/* v1.5.4: inline filter panel on every device; main categories expand as dropdowns. */
.parrotfilter-mobile-toggle,
.parrotfilter-drawer-overlay,
.parrotfilter-drawer-close { display:none !important; }
.parrotfilter-wrapper.parrotfilter-has-drawer,
.parrotfilter-wrapper.parrotfilter-has-drawer.is-open {
 position:relative !important; inset:auto !important; width:100% !important; max-width:100% !important;
 height:auto !important; max-height:none !important; overflow:visible !important; transform:none !important;
 visibility:visible !important; pointer-events:auto !important; border-radius:16px !important;
 box-shadow:0 8px 30px rgba(18,67,40,.07) !important;
}
body.parrotfilter-drawer-active { overflow:visible !important; }
@media (max-width:1024px) {
 .parrotfilter-wrapper { display:block !important; width:100% !important; max-width:100% !important; min-width:0 !important; padding:16px !important; margin:0 0 18px !important; position:relative !important; }
 .parrotfilter-wrapper .parrotfilter-header { position:static !important; padding:0 0 12px !important; }
 .parrotfilter-wrapper .parrotfilter-section { padding:11px 0 !important; }
 .parrotfilter-wrapper .parrotfilter-section-header { min-height:44px !important; }
 .parrotfilter-wrapper [data-filter="product_cat"] > .parrotfilter-section-body { max-height:280px !important; overflow-y:auto !important; overscroll-behavior:contain; padding:8px 4px 4px 0; }
 .parrotfilter-wrapper .pf-category-tree .pf-category-tree { margin-left:8px !important; padding-left:12px !important; }
}
@media (max-width:600px) {
 .parrotfilter-wrapper { padding:14px !important; border-radius:12px !important; }
 .parrotfilter-wrapper .parrotfilter-title { font-size:17px !important; }
 .parrotfilter-wrapper .parrotfilter-section-title { font-size:14px !important; }
 .parrotfilter-wrapper .parrotfilter-search-box {
   display:flex !important;
   align-items:stretch !important;
   width:100% !important;
   position:relative !important;
   z-index:2 !important;
 }
 .parrotfilter-wrapper .parrotfilter-search-box input[type="search"] {
   min-height:48px !important;
   font-size:16px !important; /* prevent iOS zoom */
   padding:12px 14px !important;
   border-radius:10px 0 0 10px !important;
   flex:1 1 auto !important;
   min-width:0 !important;
   -webkit-appearance:none !important;
   appearance:none !important;
 }
 .parrotfilter-wrapper .parrotfilter-search-submit {
   min-width:48px !important;
   width:48px !important;
   min-height:48px !important;
   flex:0 0 48px !important;
   border-radius:0 10px 10px 0 !important;
   touch-action:manipulation;
   -webkit-tap-highlight-color:transparent;
   pointer-events:auto !important;
   position:relative !important;
   z-index:3 !important;
 }
 .parrotfilter-wrapper .pf-category-line { min-height:40px !important; }
 .parrotfilter-wrapper .pf-category-expand { min-width:34px !important; min-height:34px !important; }
}

/* Product grid loading state while AJAX filter runs */
ul.products.parrotfilter-grid-loading,
.elementor-loop-container.parrotfilter-grid-loading,
.shopengine-product-grid.parrotfilter-grid-loading,
.parrotfilter-grid-loading {
	opacity: 0.45;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

/* Mobile/tablet: reliable search control hit target */
.parrotfilter-search-submit {
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	pointer-events: auto !important;
	position: relative;
	z-index: 2;
}
.parrotfilter-search-box input[type="search"] {
	font-size: 16px;
}
@media (max-width: 1024px) {
	.parrotfilter-search-section {
		position: relative;
		z-index: 2;
	}
	.parrotfilter-search-box {
		display: flex !important;
		align-items: stretch !important;
		width: 100% !important;
	}
	.parrotfilter-search-box input[type="search"] {
		font-size: 16px !important;
		min-height: 44px;
	}
	.parrotfilter-search-submit {
		min-width: 44px;
		min-height: 44px;
	}
}
