/**
 * Cats front-end panel.
 *
 * Deliberately light-touch: inherits the theme's (Astra) typography and link
 * colors so the panel blends with the site. Mobile presentation keys off the
 * .cats-is-mobile class toggled by a matchMedia check against the configured
 * breakpoint (see cats.js) — no hardcoded media query, so the breakpoint
 * setting is the single source of truth.
 */

.cats-panel {
	margin: 0 0 1.5em;

	/* Amentara palette — override from theme/Elementor custom CSS, e.g.
	   .cats-panel { --cats-term-active-color: #c00; } */
	--cats-term-color: #ffffff;
	--cats-term-active-color: #e8a33d;
	--cats-term-divider: rgba( 255, 255, 255, 0.4 );
	--cats-tab-font-size: 11px;
	--cats-term-font-size: 0.85rem;
	--cats-drawer-bg: #141414;
	--cats-drawer-width: min( 320px, 85vw );
}

/* -------------------------------------------------------------------------
 * Tab controls (buttons)
 * ---------------------------------------------------------------------- */

.cats-tabs-nav {
	display: flex;
	gap: 0.4em;
	margin-bottom: 0.75em;
}

/* Tab layout modes (set from the "Tab layout" setting). */
.cats-panel.cats-tabs-horizontal .cats-tabs-nav {
	flex-wrap: nowrap;
	overflow-x: auto;
	scrollbar-width: none; /* one clean line; scrolls if it must */
}

.cats-panel.cats-tabs-horizontal .cats-tabs-nav::-webkit-scrollbar {
	display: none;
}

.cats-panel.cats-tabs-vertical .cats-tabs-nav {
	flex-direction: column;
	align-items: stretch;
}

.cats-panel.cats-tabs-wrap .cats-tabs-nav {
	flex-wrap: wrap;
}

/* Size only — the theme/Elementor kit's button styling (colors, pill shape)
   is kept on purpose so the tabs match the site's buttons. Extra ancestor
   classes outrank the kit's `.elementor-kit-* button` rules. */
.cats-panel .cats-tabs-controls .cats-tab {
	font-size: var( --cats-tab-font-size );
	line-height: 1.3;
	padding: 0.35em 0.75em;
	min-height: 0;
	max-width: 100%;
	box-sizing: border-box;
	text-transform: none;
	letter-spacing: 0.02em;
	flex: 0 0 auto;
	cursor: pointer;
	opacity: 0.75;
	transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

/* Vertical and wrap modes: when a squeezed column compresses the button,
   the label reflows onto more lines inside the pill instead of spilling
   out of it. */
.cats-panel.cats-tabs-vertical .cats-tabs-nav .cats-tab,
.cats-panel.cats-tabs-wrap .cats-tabs-nav .cats-tab {
	white-space: normal;
	overflow-wrap: break-word;
	height: auto;
}

/* Horizontal one-line mode: labels must not wrap — the row scrolls instead. */
.cats-panel.cats-tabs-horizontal .cats-tabs-nav .cats-tab {
	white-space: nowrap;
}

.cats-panel .cats-tabs-controls .cats-tab:hover,
.cats-panel .cats-tabs-controls .cats-tab:focus-visible {
	opacity: 1;
}

.cats-panel .cats-tabs-controls .cats-tab.is-active {
	opacity: 1;
	box-shadow: 0 0 0 2px var( --cats-term-active-color );
}

/* -------------------------------------------------------------------------
 * Tab controls (dropdown display mode) + mobile selects
 * ---------------------------------------------------------------------- */

.cats-tab-select,
.cats-mobile-tab-select,
.cats-mobile-term-select {
	display: block;
	width: 100%;
	max-width: 100%;
	margin-bottom: 0.75em;
	padding: 0.5em;
	font: inherit;
}

/* Mobile controls exist in the DOM only after JS builds them; hide them
   above the breakpoint. */
.cats-panel .cats-mobile-controls {
	display: none;
}

/* -------------------------------------------------------------------------
 * Tab panels: all panels stack in the same grid cell, so the container is
 * permanently sized by its largest tab. Hidden tabs keep reserving their
 * space (visibility, not display) — switching tabs can never resize the
 * panel, so auto-sized page columns around it never reflow.
 * ---------------------------------------------------------------------- */

.cats-panels {
	display: grid;
}

.cats-panels .cats-tab-panel {
	grid-area: 1 / 1;
}

.cats-panels .cats-tab-panel[hidden] {
	display: block;
	visibility: hidden;
	pointer-events: none;
}

/* -------------------------------------------------------------------------
 * Term lists
 * ---------------------------------------------------------------------- */

/* High-specificity selectors on purpose: the panel renders inside an
   Elementor Shortcode widget, and theme/Elementor list styles (bullets,
   list padding, link colors) must not bleed in. */

.cats-panel ul.cats-term-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cats-panel ul.cats-term-list li {
	list-style: none;
	margin: 0;
	padding: 0;
	border-bottom: 1px solid var( --cats-term-divider );
}

.cats-panel ul.cats-term-list a {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 0.5em;
	padding: 0.5em 0.1em;
	text-decoration: none;
	color: var( --cats-term-color );
	font-size: var( --cats-term-font-size );
	line-height: 1.4;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	transition: color 0.15s ease;
}

/* Active term and hover: golden text only — no background, no bolding. */
.cats-panel ul.cats-term-list a:hover,
.cats-panel ul.cats-term-list a:focus-visible,
.cats-panel ul.cats-term-list li.is-active > a {
	color: var( --cats-term-active-color );
	background: none;
}

.cats-count {
	font-size: 0.85em;
	opacity: 0.75;
}

.cats-empty {
	font-style: italic;
	opacity: 0.7;
}

/* -------------------------------------------------------------------------
 * AJAX grid swap: applied to the grid container while a term's products load.
 * ---------------------------------------------------------------------- */

.cats-loading {
	opacity: 0.45;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

/* Empty-term result injected into the product list by the AJAX loader. */
.cats-no-products {
	list-style: none;
	width: 100%;
	grid-column: 1 / -1;
	padding: 2em 0;
	font-style: italic;
	opacity: 0.75;
}

/* -------------------------------------------------------------------------
 * Mobile (.cats-is-mobile is toggled by cats.js at the configured breakpoint)
 * ---------------------------------------------------------------------- */

/* Dropdown mobile mode: the two selects replace tabs + list entirely. */
.cats-panel.cats-mobile-dropdown.cats-is-mobile .cats-mobile-controls {
	display: block;
}

.cats-panel.cats-mobile-dropdown.cats-is-mobile .cats-tabs-controls,
.cats-panel.cats-mobile-dropdown.cats-is-mobile .cats-panels {
	display: none;
}

/* Stacked mobile mode: keep tab buttons and the vertical list; just tighten
   spacing. Panel-above-grid stacking is the template's column behavior. */
.cats-panel.cats-mobile-stacked.cats-is-mobile .cats-tabs-nav {
	gap: 0.15em;
}

.cats-panel.cats-mobile-stacked.cats-is-mobile .cats-tab {
	padding: 0.4em 0.6em;
}

/* -------------------------------------------------------------------------
 * Drawer mobile mode: the panel becomes a fixed off-canvas sheet sliding in
 * from the left; a toggle button (JS-built) sits where the panel was.
 * ---------------------------------------------------------------------- */

.cats-drawer-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	cursor: pointer;
	font-size: var( --cats-tab-font-size, 0.8rem );
	line-height: 1.3;
}

.cats-panel.cats-mobile-drawer.cats-is-mobile {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	width: var( --cats-drawer-width );
	margin: 0;
	padding: 3.25rem 1.25rem 1.5rem;
	overflow-y: auto;
	background: var( --cats-drawer-bg );
	z-index: 100000;
	transform: translateX( -105% );
	visibility: hidden;
	transition: transform 0.25s ease, visibility 0.25s ease;
	box-shadow: 4px 0 24px rgba( 0, 0, 0, 0.45 );
}

.cats-panel.cats-mobile-drawer.cats-is-mobile.is-open {
	transform: none;
	visibility: visible;
}

/* The close (×) button exists only in drawer mode, and shows only on mobile. */
.cats-drawer-close {
	display: none;
}

.cats-panel.cats-mobile-drawer.cats-is-mobile .cats-drawer-close {
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	top: 0.6rem;
	right: 0.6rem;
	width: 2rem;
	height: 2rem;
	padding: 0;
	font-size: 1.4rem;
	line-height: 1;
	background: none;
	border: none;
	color: var( --cats-term-color );
	cursor: pointer;
	opacity: 0.8;
}

.cats-drawer-backdrop {
	position: fixed;
	inset: 0;
	background: rgba( 0, 0, 0, 0.55 );
	z-index: 99999;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cats-drawer-backdrop.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}
