/* =========================================================================
   Category accordion — used by [wooforge_product_categories accordion="yes"]
   Only activates when hierarchy="nested" and a parent has children.
   ========================================================================= */

/* Parent card header: link + toggle side by side */
.wooforge-categories-accordion .wooforge-category-parent .wooforge-category-main {
	display: flex;
	align-items: center;
}

.wooforge-categories-accordion .wooforge-category-parent .wooforge-category-main .wooforge-category-link {
	flex: 1 1 auto;
	min-width: 0;
}

/* Toggle button */
.wooforge-accordion-toggle {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	margin-left: 4px;
	background: transparent;
	border: none;
	cursor: pointer;
	color: currentColor;
	opacity: .55;
	transition: opacity .15s;
}

.wooforge-accordion-toggle:hover,
.wooforge-category-parent.is-open .wooforge-accordion-toggle {
	opacity: 1;
}

.wooforge-accordion-toggle svg {
	display: block;
	pointer-events: none;
	transition: transform .3s ease;
}

.wooforge-category-parent.is-open .wooforge-accordion-toggle svg {
	transform: rotate(180deg);
}

/* Subcategories: collapsed by default via grid-template-rows trick.
   Requires a single direct child (.wooforge-subcategories-inner) with
   min-height:0 so the grid row can collapse to true zero height.       */
.wooforge-categories-accordion .wooforge-category-parent .wooforge-subcategories {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows .3s ease;
}

.wooforge-categories-accordion .wooforge-category-parent.is-open .wooforge-subcategories {
	grid-template-rows: 1fr;
}

.wooforge-categories-accordion .wooforge-subcategories-inner {
	min-height: 0;
	overflow: hidden;
}

/* icon="plus", or General -> Layout -> Accordion icon set to plus: the same
   ::before mark the coupon accordions use (see coupon-accordion.css), rather
   than a second svg - a plus that becomes a minus while open.

   The chevron svg is printed unconditionally by the shortcode, so it is
   hidden here rather than skipped in PHP: one markup, both looks, and the
   button keeps its size and hit area either way. */
.wooforge-categories-accordion--icon-plus .wooforge-accordion-toggle svg {
	display: none;
}

.wooforge-categories-accordion--icon-plus .wooforge-accordion-toggle::before {
	content: '+';
	font-size: 20px;
	line-height: 1;
}

.wooforge-categories-accordion--icon-plus .wooforge-category-parent.is-open .wooforge-accordion-toggle::before {
	content: '\2212';
}

/* The chevron rotates when open; the plus must not - it swaps glyph instead,
   and a rotated "+" or "-" reads as a rendering glitch. */
.wooforge-categories-accordion--icon-plus .wooforge-category-parent.is-open .wooforge-accordion-toggle {
	transform: none;
}
