/**
 * DB Woo-Categories — storefront styles (scoped).
 */

.db-wc-categories {
	--db-wc-cat-indent: 1.25rem;
	--db-wc-cat-gap: 0.35rem;
	box-sizing: border-box;
	max-width: 100%;
	font-size: 0.95rem;
	line-height: 1.45;
}

.db-wc-categories *,
.db-wc-categories *::before,
.db-wc-categories *::after {
	box-sizing: inherit;
}

.db-wc-categories__title {
	margin: 0 0 0.75rem;
	font-size: 1.05rem;
	font-weight: 600;
}

.db-wc-categories__search-form {
	margin: 0 0 0.85rem;
}

.db-wc-categories__search-inner {
	display: flex;
	align-items: stretch;
	width: 100%;
	max-width: 100%;
}

.db-wc-categories__search-input {
	flex: 1;
	min-width: 0;
	padding: 0.5rem 0.65rem;
	border: 1px solid rgba(0, 0, 0, 0.14);
	border-radius: 6px 0 0 6px;
	border-right: 0;
	font: inherit;
	line-height: 1.35;
	background: #fff;
	color: inherit;
}

.db-wc-categories__search-input::placeholder {
	color: rgba(0, 0, 0, 0.45);
}

.db-wc-categories__search-input:focus {
	outline: none;
	border-color: rgba(0, 0, 0, 0.35);
}

.db-wc-categories__search-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	padding: 0 0.7rem;
	border: 1px solid rgba(0, 0, 0, 0.14);
	border-radius: 0 6px 6px 0;
	background: rgba(0, 0, 0, 0.05);
	color: inherit;
	cursor: pointer;
	touch-action: manipulation;
}

.db-wc-categories__search-submit:hover,
.db-wc-categories__search-submit:focus-visible {
	background: rgba(0, 0, 0, 0.09);
	outline: none;
}

.db-wc-categories__search-icon {
	display: block;
	width: 1.15rem;
	height: 1.15rem;
	opacity: 0.72;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.db-wc-categories__nav {
	margin: 0;
	padding: 0;
}

.db-wc-categories__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.db-wc-categories__list .db-wc-categories__list {
	margin-top: var(--db-wc-cat-gap);
	padding-left: var(--db-wc-cat-indent);
	border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.db-wc-categories__item {
	margin: 0 0 var(--db-wc-cat-gap);
}

.db-wc-categories__row {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	min-height: 1.75rem;
}

.db-wc-categories__toggle {
	flex: 0 0 1.75rem;
	width: 1.75rem;
	height: 1.75rem;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	color: inherit;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

.db-wc-categories__toggle:hover,
.db-wc-categories__toggle:focus-visible {
	background: rgba(0, 0, 0, 0.06);
	outline: none;
}

.db-wc-categories__toggle--spacer {
	visibility: hidden;
	pointer-events: none;
}

.db-wc-categories__chevron {
	display: block;
	width: 0.45rem;
	height: 0.45rem;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform 0.15s ease;
	margin-top: -0.15rem;
}

.db-wc-categories__item.is-open > .db-wc-categories__row .db-wc-categories__chevron {
	transform: rotate(45deg);
	margin-top: 0;
}

.db-wc-categories__link {
	flex: 1;
	min-width: 0;
	text-decoration: none;
	color: inherit;
	word-break: break-word;
	overflow-wrap: anywhere;
}

.db-wc-categories__link:hover,
.db-wc-categories__link:focus-visible {
	text-decoration: underline;
	outline: none;
}

.db-wc-categories__count {
	opacity: 0.65;
	font-size: 0.9em;
	font-weight: 400;
}

.db-wc-categories__item.is-current > .db-wc-categories__row .db-wc-categories__link {
	font-weight: 600;
}

.db-wc-categories__sub[hidden] {
	display: none !important;
}

/* Product grid target while AJAX load is in progress */
.db-wc-categories-target--loading {
	opacity: 0.55;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

/* Search form: loading spinner on the submit button while searching */
.db-wc-categories__search-form--searching .db-wc-categories__search-icon {
	-webkit-mask: none;
	mask: none;
	background: none;
	width: 1rem;
	height: 1rem;
	border: 2px solid rgba(0, 0, 0, 0.2);
	border-top-color: currentColor;
	border-radius: 50%;
	animation: db-wc-spin 0.6s linear infinite;
}

@keyframes db-wc-spin {
	to { transform: rotate(360deg); }
}

/* Sidebar / Elementor: never wider than parent column */
.widget.db-wc-categories-widget .db-wc-categories,
.elementor-widget-db_wc_categories .db-wc-categories {
	max-width: 100%;
}

/* Tablets: slightly smaller type and indent, larger hit areas */
@media (max-width: 1023px) {
	.db-wc-categories {
		--db-wc-cat-indent: 1rem;
		font-size: 0.9375rem;
	}

	.db-wc-categories__title {
		font-size: 1rem;
	}

	.db-wc-categories__row {
		min-height: 2.25rem;
	}

	.db-wc-categories__toggle {
		flex: 0 0 2.25rem;
		width: 2.25rem;
		height: 2.25rem;
		min-width: 2.25rem;
		min-height: 2.25rem;
	}
}

/* Phones: WCAG-friendly touch targets (~44px), tighter nesting */
@media (max-width: 767px) {
	.db-wc-categories {
		--db-wc-cat-indent: 0.75rem;
		--db-wc-cat-gap: 0.3rem;
		font-size: 0.9rem;
	}

	.db-wc-categories__title {
		margin-bottom: 0.6rem;
		font-size: 0.95rem;
	}

	.db-wc-categories__list .db-wc-categories__list {
		padding-left: min(var(--db-wc-cat-indent), 4vw);
	}

	.db-wc-categories__row {
		min-height: 2.75rem;
		gap: 0.2rem;
	}

	.db-wc-categories__toggle {
		flex: 0 0 2.75rem;
		width: 2.75rem;
		height: 2.75rem;
		min-width: 2.75rem;
		min-height: 2.75rem;
	}

	.db-wc-categories__chevron {
		width: 0.5rem;
		height: 0.5rem;
	}
}

/* Mixed search: post / page cards in product grid */
.db-wc-categories-search-result {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	text-align: left;
}

.db-wc-categories-search-result__badge {
	display: inline-block;
	margin-bottom: 0.35rem;
	font-size: 0.72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	opacity: 0.75;
}

.db-wc-categories-search-result__title {
	display: block;
	font-weight: 600;
	line-height: 1.3;
}

.db-wc-categories-search-result__excerpt {
	margin: 0.4rem 0 0;
	font-size: 0.85rem;
	line-height: 1.4;
	opacity: 0.85;
}

/* Very narrow viewports */
@media (max-width: 380px) {
	.db-wc-categories {
		--db-wc-cat-indent: 0.5rem;
	}
}
