/* Base structure */
.custom-categories-menu,
.custom-categories-menu .categories-list,
.custom-categories-menu .subcategory-list,
.custom-categories-menu .category-item,
.custom-categories-menu .subcategory-list li {
    margin: 0;
    padding: 0;
}
.custom-categories-menu {
    background-color: var(--light-grey);
    padding: 0;
    margin: 0;
}
.custom-categories-menu .categories-list {
    list-style-type: none;
}
.custom-categories-menu .category-item {
    margin-bottom: 0;
    border-bottom: 1px solid var(--dark-grey);
    display: flex;
    flex-direction: column;
    height: auto;
    padding: 0;
    min-height: 40px;
}
.custom-categories-menu .categories-list > .category-item:last-child {
    border-bottom: none;
}
.custom-categories-menu .category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 5px;
    min-height: 40px;
    transition: background-color 0.3s;
    position: relative;
}

/* Font color by level (default) */
.custom-categories-menu .category-header[data-depth="0"] .category-link {
    color: #555555;
    padding-left: 5px;
}
.custom-categories-menu .category-header[data-depth="1"] .category-link {
    color: #555555;
    font-weight: 500 !important;
    padding-left: 5px;
}
.custom-categories-menu .category-header[data-depth="2"] .category-link {
    color: #555555;
    font-weight: 300 !important;
    font-size: 11px !important;
    padding-left: 5px;
}

/* FA icon before depth 2 categories */
.custom-categories-menu .category-header[data-depth="2"]::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f105"; /* fa-angle-right */
    margin: 0px 5px;
    display: inline-block;
    font-size: 12px;}

.custom-categories-menu .category-header.active-category[data-depth="2"]::before {
    color: white !important;
}

/* Active + last-level only = green */
.custom-categories-menu .category-header.active-category[data-depth="0"] .category-link, .custom-categories-menu .category-header.active-category[data-last="true"] .category-link {
    color: white !important;
}

.custom-categories-menu .category-header.active-category[data-depth="1"] .category-link {
    color: white !important;
}

/* Default backgrounds */
.custom-categories-menu .category-header[data-depth="0"] {
    background-color: var(--light-grey);
}
.custom-categories-menu .category-header[data-depth="1"] {
    background-color: var(--light-blue) !important;
}

.custom-categories-menu .category-header[data-depth="2"] {
    background-color: #f6fcff !important;
}

/* Active backgrounds */
.custom-categories-menu .category-header.active-category[data-depth="0"] {
    background-color: var(--dark-blue) !important;
    border-bottom: var(--light-grey) 1px solid !important;
}
.custom-categories-menu .category-header.active-category[data-depth="1"] {
    background-color: var(--dark-blue) !important;
}

.custom-categories-menu .category-header.active-category[data-depth="2"] {
    background-color: var(--dark-blue) !important;
    border-top: white 1px solid !important;
}

/* Last active category (no children) overrides to dark-blue */
.custom-categories-menu .category-header.active-category[data-last="true"] {
    background-color: var(--dark-blue) !important;
}

/* Hover styles (optional enhancement) */
.custom-categories-menu .category-header[data-depth="0"]:hover,
.custom-categories-menu .category-header[data-depth="1"]:hover,
.custom-categories-menu .category-header[data-depth="2"]:hover {
    background-color: var(--dark-blue) !important;
    color: var(--white);
}
.custom-categories-menu .category-header:hover .category-link {
    color: var(--white);
}
.custom-categories-menu .category-header:hover .toggle-button {
    color: var(--white);
}

/* Category links */
.custom-categories-menu .category-link {
    font-weight: bold;
    text-decoration: none;
    padding-right: 5px;
    font-size: 12px;
    line-height: 1.5;
    flex-grow: 1;
    transition: color 0.3s;
}

/* Toggle button */
.custom-categories-menu .toggle-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--dark-blue);
    transition: transform 0.3s, color 0.3s;
    padding: 2px;
    margin: 0;
}

.custom-categories-menu .category-header.active-category .toggle-button,
/* Only active category gets white toggle */
.custom-categories-menu .category-header.active-category .toggle-button {
    color: var(--white) !important;
}

/* Hover makes toggle white */
.custom-categories-menu .category-header:hover .toggle-button {
    color: var(--white) !important;
}

/* Default toggle color */
.custom-categories-menu .toggle-button {
    color: var(--dark-blue);
}

.custom-categories-menu .toggle-button[aria-expanded='true'] {
    transform: rotate(180deg);
}

/* Subcategories */
.custom-categories-menu .subcategory-list {
    list-style-type: none;
    display: none;
}
.custom-categories-menu .subcategory-list.is-open {
    display: block;
}
.custom-categories-menu .subcategory-list > li {
    position: relative;
    padding-left: 8px;
    font-size: 12px;
    border-bottom: 1px solid var(--dark-grey);
}
.custom-categories-menu .subcategory-list > li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 8px;
    height: 100%;
    background-color: var(--dark-blue);
}
.custom-categories-menu .subcategory-list > li > .subcategory-list > li {
    position: relative;
    padding-left: 16px;
    margin-left: -8px;
    font-size: 12px;
    border-bottom: 1px solid var(--dark-grey);
}
.custom-categories-menu .subcategory-list > li > .subcategory-list > li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 8px;
    width: 8px;
    height: 100%;
    background-color: var(--light-blue);
}
.custom-categories-menu .subcategory-list > li > .subcategory-list > li > .subcategory-list > li {
    position: relative;
    padding-left: 24px;
    margin-left: -8px;
    font-size: 12px;
    border-bottom: 1px solid var(--dark-grey);
}
.custom-categories-menu .subcategory-list > li > .subcategory-list > li > .subcategory-list > li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 16px;
    width: 8px;
    height: 100%;
    background-color: var(--light-grey);
}
.custom-categories-menu .subcategory-list li:last-child {
    border-bottom: none;
}

/* Icons */
.custom-categories-menu .category-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 5px;
    object-fit: cover;
    vertical-align: middle;
}
