/* Tinna Filters - per-group dropdown bar, styled to sit with Woodmart's shop UI. */

.tinna-filters {
	margin: 0 0 30px;
}

.tinna-filters__inner {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: flex-start;
}

/* Each group is a <details> dropdown. */
.tinna-filter-group.tinna-filter-group {
	position: relative;
	margin: 0;
	padding: 0;
	border: 0;
	max-width: 100%;
}

/* Toggle pill (the <summary>) - styled in the site's heading font (Josefin Sans),
   uppercase, as a soft pill that sits with the beige recipe cards. */
.tinna-filter-group__toggle {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	padding: 11px 20px;
	background: #fff;
	border: 1px solid #ddd8cf;
	border-radius: 40px;
	font-family: var(--wd-title-font, "Josefin Sans", Arial, Helvetica, sans-serif);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	line-height: 1.2;
	color: var(--wd-title-color, #242424);
	cursor: pointer;
	white-space: nowrap;
	user-select: none;
	list-style: none;
	transition: border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

/* Remove the native disclosure triangle. */
.tinna-filter-group__toggle::-webkit-details-marker {
	display: none;
}
.tinna-filter-group__toggle::marker {
	content: "";
}

.tinna-filter-group__toggle:hover,
.tinna-filter-group[open] .tinna-filter-group__toggle {
	border-color: var(--wd-title-color, #242424);
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.07);
}

/* A group with an active selection picks up the brand accent (red). */
.tinna-filter-group.is-active .tinna-filter-group__toggle {
	border-color: var(--wd-primary-color, #ed1b2f);
	color: var(--wd-primary-color, #ed1b2f);
}

.tinna-filter-group__label {
	flex: 0 1 auto;
}

.tinna-filter-group__badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 9px;
	background: var(--wd-primary-color, #ed1b2f);
	color: #fff;
	font-family: var(--wd-title-font, "Josefin Sans", Arial, Helvetica, sans-serif);
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

.tinna-filter-group__badge[hidden] {
	display: none;
}

.tinna-filter-group__caret {
	flex: 0 0 auto;
	width: 0;
	height: 0;
	margin-left: 2px;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
	opacity: 0.6;
	transition: transform 0.15s ease;
}

.tinna-filter-group[open] .tinna-filter-group__caret {
	transform: rotate(180deg);
}

/* Dropdown panel. */
.tinna-filter-group__panel {
	position: absolute;
	z-index: 99;
	top: calc(100% + 6px);
	left: 0;
	min-width: 240px;
	max-width: 320px;
	max-height: 340px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #ece9e2;
	border-radius: 8px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.13);
	padding: 8px 0;
	margin-top: 2px;
}

.tinna-filter-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	font-family: var(--wd-title-font, "Josefin Sans", Arial, Helvetica, sans-serif);
	font-size: 14px;
}

.tinna-filter-option {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tinna-filter-option::before {
	display: none;
	content: none;
}

.tinna-filter-option__link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 16px;
	color: inherit;
	text-decoration: none;
	line-height: 1.35;
	cursor: pointer;
}

a.tinna-filter-option__link:hover {
	background: #f6f5f0;
}

/* Checkbox indicator. */
.tinna-filter-option__box {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	border: 1px solid var(--wd-border-color, #cfcfcf);
	border-radius: 2px;
	background: #fff;
	position: relative;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.tinna-filter-option.chosen .tinna-filter-option__box {
	background: var(--wd-primary-color, #ed1b2f);
	border-color: var(--wd-primary-color, #ed1b2f);
}

.tinna-filter-option.chosen .tinna-filter-option__box::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 1px;
	width: 5px;
	height: 10px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.tinna-filter-option__name {
	flex: 1 1 auto;
}

.tinna-filter-option .count {
	flex: 0 0 auto;
	margin-left: 8px;
	opacity: 0.55;
	font-size: 0.88em;
}

/* Excluded option (0 results in the current context): greyed, not selectable. */
.tinna-filter-option--empty {
	opacity: 0.4;
}

.tinna-filter-option--empty .tinna-filter-option__link {
	cursor: default;
}

/* Clear-all link, sits after the pills. */
.tinna-filters__actions {
	margin-top: 12px;
}

.tinna-filters__clear {
	font-family: var(--wd-title-font, "Josefin Sans", Arial, Helvetica, sans-serif);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	text-decoration: none;
	border-bottom: 1px solid currentColor;
	padding-bottom: 1px;
	color: var(--wd-text-color, #777);
	cursor: pointer;
	transition: color 0.15s ease;
}

.tinna-filters__clear:hover {
	color: var(--wd-primary-color, #ed1b2f);
}

/* Shortcode/page context (bar + own grid). */
.tinna-filters-app .tinna-filters {
	margin-bottom: 18px;
}

.tinna-filters-app__results {
	transition: opacity 0.15s ease;
}

.tinna-filters-app.is-loading .tinna-filters-app__results {
	opacity: 0.5;
	pointer-events: none;
}

.tinna-filters-count {
	margin: 0 0 14px;
	opacity: 0.7;
	font-size: 0.9em;
}

.tinna-filters-pagination {
	margin-top: 24px;
}

/* Injected page context: dim the wd_products widget while a filter swap is in
   flight. The bar itself stays interactive; only the grid area fades. */
.elementor-widget-wd_products.tinna-is-loading .wd-products-element {
	opacity: 0.5;
	transition: opacity 0.15s ease;
	pointer-events: none;
}

/* Category-archive bar with the result count moved inline (right side). */
.tinna-filters--with-count {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	row-gap: 8px;
}

.tinna-filters--with-count .tinna-filters__inner {
	flex: 0 1 auto;
}

.tinna-filters__count {
	margin: 0 0 0 auto;
	padding-left: 16px;
	opacity: 0.7;
	font-size: 0.92em;
	white-space: nowrap;
}

.tinna-filters__count .woocommerce-result-count {
	margin: 0;
}

.tinna-filters--with-count .tinna-filters__actions {
	flex: 0 0 100%;
	margin-top: 6px;
}

/* On configured category archives: hide the whole theme toolbar row - breadcrumb,
   stand-alone result count and the "Röðun" filters-area button. The result count is
   shown inline in our bar and filtering is done through our pills; the product grid
   is untouched. The section id (6ffa411) is the shop-archive layout's toolbar row;
   the widget-type rules below are a portable fallback. */
body.has-tinna-filters .elementor-element-6ffa411,
body.has-tinna-filters .elementor-widget-wd_wc_breadcrumb,
body.has-tinna-filters .elementor-widget-wd_shop_archive_result_count,
body.has-tinna-filters .elementor-widget-wd_shop_archive_filters_area_btn {
	display: none !important;
}

/* NOTE: the uppskrift card visuals (beige image panel, contain + drop-shadow,
   product-name font, stock-hide) live in a site-wide inline <style> printed by
   Tinna_Filters_Uppskriftir::print_card_css(), scoped to the product's own
   .product_cat-<slug> classes - so they apply wherever an uppskrift card renders,
   independent of whether a filter is configured. Only the filter bar/pills below
   are gated on a config (this stylesheet only loads on configured pages). */

@media (max-width: 575px) {
	.tinna-filter-group.tinna-filter-group {
		flex: 1 1 100%;
	}
	.tinna-filter-group__toggle {
		width: 100%;
		justify-content: space-between;
	}
	.tinna-filter-group__panel {
		position: static;
		min-width: 0;
		max-width: none;
		box-shadow: none;
		margin-top: 6px;
	}
}
