/* Custom Theme Colors */
:root[data-bs-theme=light] {
    --bs-primary: #06F;
    --bs-primary-rgb: 0,102,255;
    --bs-danger: #F40000;
    --bs-danger-rgb: 244, 0, 0;
    --bs-secondary: #A5A7B4;
    --bs-secondary-rgb: 165, 167, 180;
    --bs-secondary-bg-subtle: #E5E5E5;
    --bs-secondary-bg-subtle-rgb: 229, 229, 229;
    --bs-primary-bg-subtle: #cfe2ff;
    --bs-primary-bg-subtle-rgb: 207, 226, 255;
    --bs-body-color: #010404;
    --bs-body-color-rgb: 1, 4, 4;
    --bs-secondary-color: #4A4E69;
    --bs-secondary-color-rgb: 74, 78, 105;
}

:root[data-bs-theme=dark] {
    --bs-secondary-bg-subtle: #25293C;
    --bs-secondary-bg-subtle-rgb: 37, 41, 60;
    --bs-primary: #1A75FF;
    --bs-primary-rgb: 26,117,255;
    --bs-body-bg: #2F3349;
    --bs-body-bg-rgb: 47,51,73;
    --bs-primary-bg-subtle: #191919;
}

/* Base styles */
:root {
    --bs-body-font-family: 'Lato', sans-serif;
}

:root[dir="rtl"] {
    --bs-body-font-family: 'Tajawal', sans-serif;
}

html {
    font-size: 15px;
    height: 100%;
}

body {
    font-family: var(--bs-body-font-family);
    height: 100%;
}

.font-ar {
    font-family: 'Tajawal', sans-serif;
}

.font-en {
    font-family: 'Lato', sans-serif;
}

/* Tree view styling - required for the WAI-ARIA Tree plugin */
[role="tree"] {
    margin: 0;
    padding: 0;
    list-style: none;
    cursor: default;
}

[role="tree"] li {
    margin: 0;
    padding: 0;
    list-style: none;
    position: relative;
    padding-left: 25px;
}

ul li[aria-expanded="false"] {

}

ul li[aria-expanded="true"] {

}

[role="tree"] li:after{
    content: '';
    display: block;
    width: 22px;
    height: 1px;
    border-bottom: solid 1px var(--bs-secondary);
    position: absolute;
    left: -1px;
    top: 12px;
}

[role="treeitem"][aria-expanded="false"] + [role="group"] {
    display: none;
}

[role="treeitem"][aria-expanded="true"] + [role="group"] {
    display: block;
}

[role="treeitem"].doc::before {
    font-family: "Font Awesome 6 Free";
    content: "\f15c";
    display: inline-block;
    padding-right: 7px;
    padding-left: 0px;
    vertical-align: middle;
    z-index: 1;
    position: relative;
    margin-left: -8px;
}

span.doc::before {
    font-family: "Font Awesome 6 Free";
    content: "\f15c";
    display: inline-block;
    padding-right: 7px;
    padding-left: 0px;
    vertical-align: middle;
    z-index: 1;
    position: relative;
    margin-left: -8px;
}

[role="treeitem"][aria-expanded="false"] > ul {
    display: none;
    padding-left: 0;
}

[role="treeitem"][aria-expanded="true"] > ul {
    display: block;
    padding-left: 0;
}


ul[role="group"],
ul[role="tree"]{
    position: relative;
}

ul[role="group"]:before,
ul[role="tree"]:before{
    content: '';
    display: block;
    width: 1px;
    border-left: solid 1px var(--bs-secondary);
    position: absolute;
    left: -1px;
    top: -7px;
    bottom: -10px;
}

ul[role="group"]:not(:has(li > ul)):before{
    bottom: 11px;
}

ul[role="tree"]:before{
    top: 10px;
    bottom: 10px;
}

[role="treeitem"][aria-expanded="false"] > span.branch::before {
    font-family: "Font Awesome 6 Free";
    content: "\f07b";
    display: inline-block;
    padding-right: 3px;
    vertical-align: middle;
    font-weight: 900;
    z-index: 1;
    position: relative;
}

[role="treeitem"][aria-expanded="false"] > span.branch::after,
[role="treeitem"][aria-expanded="true"] > span.branch::after {
    font-family: "Font Awesome 6 Free";
    content: "\f0fe"; /* plus square */
    display: inline-block;
    margin-left: 5px;
    vertical-align: middle;
    font-weight: 900;
    position: absolute;
    left: -12px;
    top: 3px;
    z-index: 1;
}

[role="treeitem"][aria-expanded="true"] > span.branch::after {
    font-family: "Font Awesome 6 Free";
    content: "\f146"; /* minus square */
}
[role="treeitem"][aria-expanded="true"] > span.branch::before {
    font-family: "Font Awesome 6 Free";
    content: "\f07c";
    display: inline-block;
    padding-right: 3px;
    vertical-align: middle;
    font-weight: 900;
    z-index: 1;
    position: relative;
}


[role="treeitem"],
[role="treeitem"] span {
    margin: 0;
    padding: 0.125em;
    display: block;
    margin-left: -8px;

}

/* Focus and selection styling */
[role="treeitem"]:focus {
    outline: 0;
}

[role="treeitem"][aria-selected="true"] {
}

[role="treeitem"] {
    /*border-left: 1px solid var(--bs-secondary);*/
}

[role="treeitem"].focus,
[role="treeitem"] span.focus {
    border-color: var(--bs-body-color);
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary) ;
}
li:has(> span.selected_node) {
    border-color: var(--bs-body-color);
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary) ;
}


[role="treeitem"].hover,
[role="treeitem"] span:hover {
    background-color: var(--bs-primary-bg-subtle) ;
    color: var(--bs-primary) ;
}

[role="treeitem"] .doc:hover {
    background-color: var(--bs-primary-bg-subtle) ;
    color: var(--bs-primary) ;
}

/* Layout containers */
.tree-container {
    padding: 10px 20px;
    height: 500px;
    min-height: 90vh;
    overflow-y: auto;
    background-color: #fff;
}

.sidebar-wrapper .tree-container{
    height: 100%;
    border-radius: 10px;
    background-color: rgba(var(--bs-primary-bg-subtle-rgb), 0.5);
}

.form-container {
    border: 1px solid var(--bs-secondary);
    padding: 15px;
    background-color: var(--bs-body-bg);
}

.section-header {
    background-color: var(--bs-secondary-bg-subtle);
    padding: 8px;
    border: 1px solid var(--bs-secondary);
    font-weight: bold;
}

.form-highlight {
    /*background-color: #d7ffd8;*/
}

/* Control visibility based on selection */
.accounts-section {
    display: none;
}

.form-section {
    /*display: none;*/
}

/* When corresponding items are selected, show content */
.show-accounts {
    display: block;
}

.show-form {
    display: block;
}

/* Style Label */
.style-label {
    position: absolute;
    margin-top: -9px;
    margin-left: 16px;
    font-weight: 700;
    background: var(--bs-body-bg);
    line-height: 16px;
    z-index: 6;
}

.form-select {
    padding-bottom: 7px;
    padding-top: 7px;
    font-weight: 500;
}

.form-select.form-select-lg,
.form-control.form-control-lg {
    padding-bottom: 10px;
    padding-top: 10px;
    font-size: 16px;
    font-weight: 500;
}

/* RTL Support */
html[dir="rtl"] .style-label {
    margin-left: 0;
    margin-right: 16px;
}

html[dir="rtl"] [role="treeitem"][aria-selected="true"] {
    padding-left: 0;
    padding-right: 4px;
    border-left: none;
}

html[dir="rtl"] [role="treeitem"] {
}

html[dir="rtl"] [role="treeitem"].hover,
html[dir="rtl"] [role="treeitem"] span:hover {
    padding-left: 0;
    border-left: none;
}

/* Dark mode overrides */
html[data-bs-theme="dark"] .tree-container,
html[data-bs-theme="dark"] .form-container,
html[data-bs-theme="dark"] .form-select,
html[data-bs-theme="dark"] .form-control {
    background-color: var(--bs-body-bg) !important;
    color: #fff !important;
}

html[data-bs-theme="dark"] .section-header {
    background-color: var(--bs-secondary-bg-subtle);
}

html[data-bs-theme="dark"] [role="treeitem"].focus,
html[data-bs-theme="dark"] [role="treeitem"] span.focus {
    background-color: var(--bs-primary-bg-subtle);
}

html[data-bs-theme="dark"] .style-label {
    color: var(--bs-body-color);
}

.right-col{
    background-color: var(--bs-secondary-bg-subtle) ;
    border-radius: 2px 2px 0px 0px ;
    padding: 1rem ;
}

.middle-col{
    background-color: var(--bs-secondary-bg-subtle) ;
    border-radius: 2px 2px 0px 0px ;
    padding: 1rem ;
}

.middle-col-header{

}

/* Additional RTL Tree View Styling */
html[dir="rtl"] [role="tree"] li {
    padding-left: 0;
    padding-right: 25px;
}

html[dir="rtl"] [role="tree"] li:after {
    left: auto;
    right: -1px;
}

html[dir="rtl"] ul[role="group"]:before,
html[dir="rtl"] ul[role="tree"]:before {
    left: auto;
    right: -1px;
}

html[dir="rtl"] [role="treeitem"].doc::before {
    padding-right: 0px;
    padding-left: 7px;
    margin-left: 0;
    margin-right: -8px;
}

html[dir="rtl"] [role="treeitem"][aria-expanded="false"] > span::after,
html[dir="rtl"] [role="treeitem"][aria-expanded="true"] > span::after {
    margin-left: 0;
    margin-right: 5px;
    left: auto;
    right: -12px;
}

html[dir="rtl"] [role="treeitem"],
html[dir="rtl"] [role="treeitem"] span {
    margin-left: 0;
    margin-right: -8px;
}

html[dir="rtl"] [role="treeitem"][aria-expanded="false"] > span::before,
html[dir="rtl"] [role="treeitem"][aria-expanded="true"] > span::before {
    padding-right: 0;
    padding-left: 3px;
}

html[dir="rtl"] [role="treeitem"][aria-expanded="false"] > ul,
html[dir="rtl"] [role="treeitem"][aria-expanded="true"] > ul {
    padding-left: 0;
    padding-right: 0;
}
