/* ==========================================================
   BA.UI Tree (jsTree skin) + Tree Select Modal
   Scope: .ba-tree  (requires jstree default theme style.css)
   Restyles jsTree checkbox tree to match BA.UI look.
   ========================================================== */

.ba-tree-modal .ba-modal__dialog,
.ba-tree-modal .modal-dialog {
    max-width: 560px;
}

.ba-tree-modal .ba-modal__content {
    pointer-events: auto;
}

.ba-tree-modal__search {
    position: relative;
    margin-bottom: 14px;
}

.ba-tree-modal__search .ba-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--ba-text-muted, #98A2B3);
    pointer-events: none;
}

.ba-tree-modal__search .ba-control {
    padding-left: 42px;
    text-transform: uppercase;
}

.ba-tree-modal__search .ba-control::placeholder {
    text-transform: none;
}

.ba-tree {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    border: 1px solid var(--ba-form-border, #E4E7EC);
    border-radius: var(--ba-form-radius, 12px);
    background: var(--ba-form-bg, #fff);
}

.ba-tree.jstree-default .jstree-node {
    min-height: 32px;
    line-height: 32px;
    margin-left: 24px;
    min-width: 24px;
    background-image: none;
}

.ba-tree.jstree-default > .jstree-container-ul > .jstree-node {
    margin-left: 0;
}

.ba-tree.jstree-default .jstree-anchor {
    height: 32px;
    line-height: 32px;
    padding: 0 10px 0 4px;
    border-radius: 8px;
    color: var(--ba-text-primary, #2F3542);
    font-size: 14px;
}

.ba-tree.jstree-default .jstree-anchor:hover,
.ba-tree.jstree-default .jstree-hovered {
    background: var(--ba-bg-secondary, #F8FAFC);
    box-shadow: none;
}

.ba-tree.jstree-default .jstree-clicked,
.ba-tree.jstree-default .jstree-wholerow-clicked {
    background: rgba(52, 58, 67, .08);
    box-shadow: none;
    color: var(--ba-tree-accent, #343a43);
    font-weight: 600;
}

.ba-tree.jstree-default .jstree-icon:not(.jstree-themeicon-custom) {
    background-image: none;
}

/* open/close arrow */
.ba-tree.jstree-default .jstree-ocl {
    position: relative;
    width: 24px;
    height: 32px;
    line-height: 32px;
}

.ba-tree.jstree-default .jstree-open > .jstree-ocl,
.ba-tree.jstree-default .jstree-closed > .jstree-ocl,
.ba-tree.jstree-default .jstree-leaf > .jstree-ocl {
    background-image: none;
}

.ba-tree.jstree-default .jstree-closed > .jstree-ocl::before,
.ba-tree.jstree-default .jstree-open > .jstree-ocl::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 7px;
    height: 7px;
    margin: -5px 0 0 -5px;
    border-right: 2px solid var(--ba-text-muted, #98A2B3);
    border-bottom: 2px solid var(--ba-text-muted, #98A2B3);
    transform: rotate(-45deg);
    transition: transform .15s ease;
}

.ba-tree.jstree-default .jstree-open > .jstree-ocl::before {
    transform: rotate(45deg);
    margin-top: -7px;
}

.ba-tree.jstree-default .jstree-loading > .jstree-ocl {
    background: none;
}

/* checkbox */
.ba-tree.jstree-default .jstree-checkbox,
.ba-tree.jstree-default .jstree-checkbox:hover {
    position: relative;
    width: 18px;
    height: 18px;
    margin: 7px 8px 7px 2px;
    border: 2px solid #C5CBD6;
    border-radius: 5px;
    background-color: #fff;
    background-image: none;
    box-sizing: border-box;
    vertical-align: top;
    transition: background .15s, border-color .15s;
}

.ba-tree.jstree-default .jstree-clicked > .jstree-checkbox,
.ba-tree.jstree-default .jstree-checked > .jstree-checkbox,
.ba-tree.jstree-default .jstree-checked > .jstree-checkbox:hover,
.ba-tree.jstree-default .jstree-undetermined {
    background-color: var(--ba-tree-accent, #343a43);
    background-image: none;
    border-color: var(--ba-tree-accent, #343a43);
}

.ba-tree.jstree-default .jstree-clicked > .jstree-checkbox::after,
.ba-tree.jstree-default .jstree-checked > .jstree-checkbox::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.ba-tree.jstree-default .jstree-undetermined::after {
    content: "";
    position: absolute;
    left: 2px;
    top: 6px;
    width: 10px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

/* kategori ikonu (sunucudan gelen zmdi font ikonları: şube / acente / kullanıcı...) */
.ba-tree.jstree-default .jstree-themeicon {
    display: inline-block;
    width: 24px;
    height: 32px;
    margin-right: 6px;
    line-height: 32px;
    font-size: 18px;
    text-align: center;
    vertical-align: top;
    color: var(--ba-text-secondary, #667085);
}

.ba-tree.jstree-default .jstree-clicked > .jstree-themeicon {
    color: var(--ba-tree-accent, #343a43);
}

/* resim tabanlı (custom image) ikon gelirse ezilmesin */
.ba-tree.jstree-default .jstree-themeicon-custom:not(.zmdi):not([class*="zmdi-"]) {
    background-size: 18px 18px;
    background-repeat: no-repeat;
    background-position: center;
}

/* checkbox görünmez; seçim durumu satır vurgusuyla gösterilir (three_state mantığı çalışmaya devam eder) */
.ba-tree.jstree-default .jstree-checkbox {
    display: none;
}

.ba-tree.jstree-default .jstree-anchor {
    cursor: pointer;
}

.ba-tree.jstree-default .jstree-clicked {
    background: rgba(52, 58, 67, .12);
}

/* kısmen seçili üst düğüm: ince sol çizgi + kalın yazı */
.ba-tree.jstree-default .jstree-anchor:has(> .jstree-undetermined) {
    font-weight: 600;
    box-shadow: inset 3px 0 0 rgba(52, 58, 67, .45);
}

/* jQuery UI autocomplete popup for the search box */
.ui-autocomplete.ba-tree-autocomplete {
    border: 1px solid var(--ba-border-light, #E4E8EF);
    border-radius: 12px;
    padding: 6px;
    box-shadow: var(--ba-shadow-lg, 0 10px 30px rgba(15, 23, 42, .12));
    font-family: inherit;
}

.ui-autocomplete.ba-tree-autocomplete .ui-menu-item-wrapper {
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    font-size: 14px !important;
}

.ui-autocomplete.ba-tree-autocomplete .ui-state-active,
.ui-autocomplete.ba-tree-autocomplete .ui-menu-item-wrapper.ui-state-active {
    background: rgba(52, 58, 67, .08);
    border: 0;
    color: var(--ba-tree-accent, #343a43);
    margin: 0;
}

.ui-autocomplete.ba-tree-autocomplete {
    z-index: 2147483647;
    max-height: 300px;
    max-width: 480px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* remove dotted connector lines of the default theme */
.ba-tree.jstree-default .jstree-node,
.ba-tree.jstree-default .jstree-last {
    background-image: none;
}

/* Onay kutulu ağaç (çoklu seçim, ör. Dönem Faturası): kutular görünür, satır vurgusu hafifler */
.ba-tree.ba-tree--checkbox.jstree-default .jstree-checkbox {
    display: inline-block;
    flex: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin: 7px 8px 7px 2px;
    line-height: 18px;
    box-sizing: border-box;
    vertical-align: top;
}

.ba-tree.ba-tree--checkbox.jstree-default .jstree-clicked,
.ba-tree.ba-tree--checkbox.jstree-default .jstree-clicked:hover {
    background: transparent;
    font-weight: inherit;
}

/* ikonsuz düğümlerde (icon:false) boş ikon kutusu yer kaplamasın; kutu ile metin arası dar kalsın */
.ba-tree.ba-tree--checkbox.jstree-default .jstree-themeicon-hidden {
    display: none;
}

/* kısmen seçili üst düğümde sol çizgi/kalın yazı kullanılmaz (kutudaki "-" işareti yeterli) */
.ba-tree.ba-tree--checkbox.jstree-default .jstree-anchor:has(> .jstree-undetermined) {
    box-shadow: none;
    font-weight: inherit;
}

.ba-tree.ba-tree--checkbox.jstree-default .jstree-hovered,
.ba-tree.ba-tree--checkbox.jstree-default .jstree-anchor:hover {
    background: var(--ba-bg-secondary, #F8FAFC);
}

/* üst düğüm (yıl) kalın; alt dönemler normal ağırlıkta */
.ba-tree.ba-tree--checkbox.jstree-default > .jstree-container-ul > .jstree-node > .jstree-anchor {
    font-weight: 700;
    font-size: 15px;
}
