/**
 * HUEGO Category Tree component.
 * Shared by WooCommerce product categories and the blog category sidebar.
 */

.huego-product-category-sidebar,
.huego-blog-category-sidebar {
    display: block;
    padding: 8px;
}

.huego-product-category-sidebar .huego-category-list,
.huego-product-category-sidebar .huego-category-children,
.huego-blog-category-sidebar .huego-category-list,
.huego-blog-category-sidebar .huego-category-children {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.huego-product-category-sidebar .huego-category-node,
.huego-blog-category-sidebar .huego-category-node {
    margin: 0;
    padding: 0;
}

.huego-product-category-sidebar .huego-category-row,
.huego-blog-category-sidebar .huego-category-row {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 38px;
    border-radius: 7px;
    transition: background-color 0.22s ease;
}

.huego-product-category-sidebar .huego-category-row:hover,
.huego-blog-category-sidebar .huego-category-row:hover {
    background: var(--huego-color-surface-soft);
}

.huego-product-category-sidebar .huego-category-item,
.huego-blog-category-sidebar .huego-category-item {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 7px;
    color: var(--huego-color-text);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0;
    word-spacing: 0;
    text-decoration: none;
    transition:
        color 0.22s ease,
        background-color 0.22s ease;
}

.huego-product-category-sidebar .huego-category-item:hover,
.huego-blog-category-sidebar .huego-category-item:hover {
    color: var(--huego-color-primary);
}

.huego-product-category-sidebar .huego-category-name,
.huego-blog-category-sidebar .huego-category-name {
    display: block;
    min-width: 0;
    margin: 0;
    padding: 0;
    line-height: 1.4;
    letter-spacing: 0;
    word-spacing: 0;
}

/* Toggle button. The reset is intentionally strong because Elementor/theme button rules can leak in. */
.huego-product-category-sidebar button.huego-category-toggle,
.huego-blog-category-sidebar button.huego-category-toggle {
    all: unset !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 22px !important;
    box-sizing: border-box !important;
    width: 22px !important;
    min-width: 22px !important;
    max-width: 22px !important;
    height: 22px !important;
    min-height: 22px !important;
    max-height: 22px !important;
    margin: 0 4px 0 0 !important;
    padding: 0 !important;
    border: 1px solid var(--huego-color-text) !important;
    border-radius: 4px !important;
    background: transparent !important;
    color: var(--huego-color-text) !important;
    box-shadow: none !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease !important;
}

.huego-product-category-sidebar button.huego-category-toggle:hover,
.huego-product-category-sidebar button.huego-category-toggle:focus-visible,
.huego-blog-category-sidebar button.huego-category-toggle:hover,
.huego-blog-category-sidebar button.huego-category-toggle:focus-visible {
    border-color: var(--huego-color-text) !important;
    background: var(--huego-color-text) !important;
    color: var(--huego-color-white) !important;
    outline: none !important;
}

.huego-product-category-sidebar button.huego-category-toggle:focus-visible,
.huego-blog-category-sidebar button.huego-category-toggle:focus-visible {
    box-shadow: 0 0 0 3px var(--huego-color-focus-ring) !important;
}

.huego-product-category-sidebar .huego-category-toggle span,
.huego-blog-category-sidebar .huego-category-toggle span {
    position: relative;
    display: block;
    width: 10px;
    height: 10px;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

.huego-product-category-sidebar .huego-category-toggle span::before,
.huego-blog-category-sidebar .huego-category-toggle span::before,
.huego-product-category-sidebar .huego-category-toggle span::after,
.huego-blog-category-sidebar .huego-category-toggle span::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    border: 0;
    border-radius: 1px;
    background-color: currentColor;
    transform: translate(-50%, -50%);
}

.huego-product-category-sidebar .huego-category-toggle span::before,
.huego-blog-category-sidebar .huego-category-toggle span::before {
    width: 9px;
    height: 1.5px;
}

.huego-product-category-sidebar .huego-category-toggle span::after,
.huego-blog-category-sidebar .huego-category-toggle span::after {
    width: 1.5px;
    height: 9px;
    transition: opacity 0.2s ease;
}

.huego-product-category-sidebar .huego-category-node.is-open > .huego-category-row > .huego-category-toggle span::after,
.huego-blog-category-sidebar .huego-category-node.is-open > .huego-category-row > .huego-category-toggle span::after {
    opacity: 0;
}

.huego-product-category-sidebar .huego-category-children,
.huego-blog-category-sidebar .huego-category-children {
    display: none;
    margin: 2px 0 4px 12px;
    padding-left: 10px;
    border-left: 1px solid var(--huego-color-border);
}

.huego-product-category-sidebar .huego-category-node.is-open > .huego-category-children,
.huego-blog-category-sidebar .huego-category-node.is-open > .huego-category-children {
    display: flex;
}

.huego-product-category-sidebar .huego-category-children .huego-category-item,
.huego-blog-category-sidebar .huego-category-children .huego-category-item {
    min-height: 34px;
    padding: 6px 8px;
    color: var(--huego-color-text-muted);
    font-size: 12.5px;
    font-weight: var(--huego-font-weight-regular);
}

.huego-product-category-sidebar .huego-category-children .huego-category-row,
.huego-blog-category-sidebar .huego-category-children .huego-category-row {
    min-height: 34px;
}

.huego-product-category-sidebar .huego-category-children .huego-category-row:hover,
.huego-blog-category-sidebar .huego-category-children .huego-category-row:hover {
    background: var(--huego-color-surface-soft);
}

.huego-product-category-sidebar .huego-category-children .huego-category-item:hover,
.huego-blog-category-sidebar .huego-category-children .huego-category-item:hover {
    color: var(--huego-color-primary);
}

.huego-product-category-sidebar .huego-category-children .huego-category-children,
.huego-blog-category-sidebar .huego-category-children .huego-category-children {
    margin-left: 10px;
}

.huego-product-category-sidebar .huego-category-item.is-active,
.huego-blog-category-sidebar .huego-category-item.is-active {
    color: var(--huego-color-primary);
    background: var(--huego-color-primary-soft);
    font-weight: var(--huego-font-weight-semibold);
}

.huego-product-category-sidebar .huego-category-item.is-active::before,
.huego-blog-category-sidebar .huego-category-item.is-active::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 3px;
    height: 18px;
    border-radius: 0 3px 3px 0;
    background: var(--huego-color-primary);
    transform: translateY(-50%);
}

.huego-product-category-sidebar .huego-category-children .huego-category-item.is-active,
.huego-blog-category-sidebar .huego-category-children .huego-category-item.is-active {
    color: var(--huego-color-primary);
    background: var(--huego-color-primary-soft);
}
