﻿.yalla-tree-card {
    --tree-red: #fc5700;
    --tree-soft: #fff2f3;
    position: sticky;

    padding: 19px 14px 16px !important;
    border: 1px solid #ececef !important;
    border-radius: 17px !important;
    background: #fff !important;
    box-shadow: 0 12px 35px rgba(24, 24, 27, .09) !important;
    overflow: visible
}

.yalla-tree-card .tree {
    max-height: 480px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-inline-end: 4px
}

.yalla-tree-card .tree::-webkit-scrollbar {
    width: 6px;
    height: 6px
}

.yalla-tree-card .tree::-webkit-scrollbar-track {
    background: transparent
}

.yalla-tree-card .tree::-webkit-scrollbar-thumb {
    background: var(--tree-red);
    border-radius: 10px;
    opacity: .5
}

.yalla-tree-card .tree {
    scrollbar-width: thin;
    scrollbar-color: var(--tree-red) transparent
}

.yalla-tree-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 5px 15px !important;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f2;
    color: #202024 !important;
    font-size: 17px !important;
    font-weight: 800 !important
}

.yalla-tree-title i {
    color: var(--tree-red);
    font-size: 14px
}

.yalla-tree-card .tree,
.yalla-tree-card .tree.rtl,
.yalla-tree-card .tree.ltr {
    direction: rtl !important;
    text-align: right !important;
    font-family: inherit !important;
    color: #333 !important;
    font-size: 13px !important
}

.yalla-tree-card .tree ul,
.yalla-tree-card .tree.rtl ul,
.yalla-tree-card .tree.ltr ul {
    padding: 0 !important;
    margin: 0 !important;
    list-style: none
}

.yalla-tree-card .tree li {
    padding: 0 !important;
    margin: 3px 0 !important
}

.yalla-tree-card .tree li::before,
.yalla-tree-card .tree li::after {
    display: none !important
}

.yalla-tree-card .tree .node-content {
    min-height: 38px;
    padding: 5px 8px !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #fff !important;
    color: #303034 !important;
    transition: .18s ease
}

.yalla-tree-card .tree .node-content:hover {
    background: #fff7f8 !important;
    border-color: #ffd9dd;
    transform: translateX(-2px)
}

.yalla-tree-card .tree .node-icon {
    order: 1;
    width: 25px !important;
    height: 25px !important;
    margin: 0 !important;
    padding: 4px;
    border-radius: 7px;
    background: #f7f7f8;
    flex: none
}

.yalla-tree-card .tree .node-icon img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important
}

.yalla-tree-card .tree input[type=checkbox] {
    position: absolute;
    opacity: 0;
    pointer-events: none
}

.yalla-tree-card .tree .node-label {
    order: 2;
    min-width: 0;
    margin: 0 !important;
    color: #303034 !important;
    font-size: 12px !important;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer
}

.yalla-tree-card .tree .node-count {
    order: 3;
    margin-right: auto !important;
    margin-left: 2px !important;
    min-width: 23px;
    height: 21px;
    padding: 0 6px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: #f2f2f4;
    color: #777 !important;
    font-size: 10px !important;
    font-weight: 700
}

.yalla-tree-card .tree .toggle-btn {
    order: 4;
    width: 22px !important;
    height: 22px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 7px !important;
    background: transparent !important;
    color: #8a8a8f !important;
    font-size: 0 !important;
    line-height: 0 !important;
    visibility: visible !important
}

.yalla-tree-card .tree li.has-children>.node-content>.toggle-btn::before {
    content: "053" !important;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 10px;
    transition: .2s
}

.yalla-tree-card .tree li.has-children.open>.node-content>.toggle-btn::before {
    content: "078" !important
}

.yalla-tree-card .tree li:not(.has-children)>.node-content>.toggle-btn {
    visibility: hidden !important
}

.yalla-tree-card .tree li.active>.node-content {
    border-color: var(--tree-red) !important;
    background: linear-gradient(135deg, #fc5700, #fc5700) !important;
    box-shadow: 0 5px 13px rgba(237, 27, 47, .2)
}

.yalla-tree-card .tree li.active>.node-content .node-label,
.yalla-tree-card .tree li.active>.node-content .toggle-btn {
    color: #fff !important
}

.yalla-tree-card .tree li.active>.node-content .node-icon {
    background: rgba(255, 255, 255, .18)
}

.yalla-tree-card .tree li.active>.node-content .node-count {
    background: rgba(255, 255, 255, .2);
    color: #fff !important
}

.yalla-tree-card .tree li>ul {
    position: relative;
    display: none !important;
    margin: 5px 10px 7px 0 !important;
    padding-right: 15px !important
}

.yalla-tree-card .tree li.open>ul {
    display: block !important;
    animation: yallaTreeOpen .2s ease
}

.yalla-tree-card .tree li>ul::before {
    content: "";
    position: absolute;
    right: 5px;
    top: 0;
    bottom: 9px;
    width: 1px;
    background: #ffd6da
}

.yalla-tree-card .tree li>ul>li>.node-content {
    min-height: 34px;
    padding-block: 3px !important
}

.yalla-tree-card .tree li>ul>li>.node-content::before {
    content: "";
    position: absolute;
    right: -10px;
    width: 10px;
    height: 1px;
    background: #ffd6da
}

.yalla-tree-card .tree li>ul .node-label {
    font-size: 11px !important
}

.yalla-tree-card .tree li>ul .node-icon {
    width: 22px !important;
    height: 22px !important
}

@keyframes yallaTreeOpen {
    from {
        opacity: 0;
        transform: translateY(-4px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

@media(max-width:991px) {
    .yalla-tree-card {
        position: relative;
        top: auto
    }

    .yalla-tree-card .tree>ul {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px 8px
    }
}

@media(max-width:520px) {
    .yalla-tree-card .tree>ul {
        grid-template-columns: 1fr !important
    }
}

/* Branch expand/collapse control: normal flex flow (order:0, placed first),
   not absolutely positioned — nothing can knock it out of the layout. */
.yalla-tree-card .tree li.has-children>.node-content {
    gap: 10px !important
}

.yalla-tree-card .tree li.has-children>.node-content>.toggle-btn {
    order: 0 !important;
    position: static !important;
    display: grid !important;
    place-items: center !important;
    width: 24px !important;
    height: 24px !important;
    visibility: visible !important;
    opacity: 1 !important;
    border: 1px solid #ffd1d5 !important;
    border-radius: 7px !important;
    background: #fff0f2 !important;
    color: #fc5700 !important;
    flex: none !important;
}

/* Native chevron drawn with a pseudo-element border (no icon font dependency) */
.yalla-tree-card .tree li.has-children>.node-content>.toggle-btn::before {
    content: "" !important;
    display: block !important;
    width: 7px !important;
    height: 7px !important;
    margin: 0 !important;
    border: 0 !important;
    border-left: 2px solid currentColor !important;
    border-bottom: 2px solid currentColor !important;
    transform: rotate(-45deg) !important;
    transition: transform .2s ease !important;
    font-family: inherit !important;
    background: none !important;
}

.yalla-tree-card .tree li.has-children.open>.node-content>.toggle-btn::before {
    content: "" !important;
    transform: rotate(45deg) !important;
}

.yalla-tree-card .tree li.has-children.active>.node-content>.toggle-btn {
    background: #fff !important;
    border-color: #fff !important;
    color: #fc5700 !important;
}