/* Right Pane: Navigation Tree */
.right-pane {
    background-color: #f8f9fa; /* Light mode background: light gray */
    padding: 20px;
    padding-top: 0px;
    overflow-y: scroll;  /* Allows scrolling */
    scrollbar-width: none;  /* For Firefox */
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s, color 0.3s; /* Combined transition */
}

.right-pane::-webkit-scrollbar {
    display: none;  /* For Chrome, Safari, and Opera */
}

.right-pane h2 {
    text-align: center;
    color: #333; /* Dark text for light mode */
    margin-bottom: 20px;
    font-size: 22px;
    border-bottom: 2px solid #007bff; /* Blue underline for light mode */
    padding-bottom: 10px;
    transition: background-color 0.3s, color 0.3s; /* Combined transition */
}

/* Dark Mode Overrides */
[data-theme="dark"] .right-pane {
    background-color: #242527; /* Dark mode background */
}

[data-theme="dark"] .right-pane h2 {
    color: #fff; /* White text in dark mode */
    border-bottom: 2px solid #009a9a; /* Teal underline for dark mode */
}

/*------------------------------------------------------------------------------------------------------*/
/* Search Bar Styling */
.search-bar {
    margin-bottom: 20px;
    padding-left: 15px;
    transition: background-color 0.6s, color 0.6s; /* Combined transition */
}

.search-bar input {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: none;
    outline: none;
    background-color: #ffffff; /* White background for light mode */
    color: #333; /* Dark text */
    font: bold 14px 'Segoe UI';
    transition: background-color 0.3s, color 0.3s; /* Combined transition */
}

#search-input::placeholder {
    color: #6c757d;  /* Lighter placeholder text */
    opacity: 1;  /* Ensures the placeholder has full opacity */
}

/* Dark Mode Overrides */
[data-theme="dark"] .search-bar input {
    background-color: #4b4b4b; /* Dark background for input */
    color: #fff; /* White text in dark mode */
    border: none;
}

/*------------------------------------------------------------------------------------------------------*/
/* Tree structure styling */
#nav-tree {
    user-select: none;
    list-style: none;
    padding-right: 0px;
    margin: 0;
    position: relative;
    direction: rtl; /* Set RTL direction */
}

/* Tree list items */
#nav-tree li {
    margin: 5px 0;
    cursor: pointer;
    position: relative;
    display: block;
}

/* Remove original arrow indicator */
#nav-tree li::before {
    content: none;
}

/* Node container styling */
#nav-tree li .node-content {
    display: flex;
    flex-direction: row; /* Normal row direction */
    align-items: center;
    font: bold 18px 'Segoe UI';
    padding: 0 10px;
    border-radius: 6px;
    background-color: #f1f1f1;
    color: #333;
    transition: background-color 0.3s ease, color 0.3s ease;
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    text-align: right;
}

/* Hover effect for node content */
#nav-tree li .node-content:hover {
    background-color: #007bff;
    color: #fff;
}

/* Node label styling */
#nav-tree li .node-label {
    flex-grow: 1;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right; /* Align text to the right */
}

/* Ping rectangle styling */
#nav-tree li .ping-rectangle {
    width: 5%;
    max-width: 15px;
    height: 100%;
    margin-left: 10px; /* Changed from margin-right */
    margin-right: 10px; /* Changed from margin-right */
    border-radius: 2px;
    flex-shrink: 0;
}

:root {
    --orange-ping-color: orange;
    --red-ping-color: red;
}

.ping-rectangle.flashing-red-rectangle {
    background-color: var(--red-ping-color);
}

.ping-rectangle.flashing-orange-rectangle {
    background-color: var(--orange-ping-color);
}


/* Arrow indicator styling */
#nav-tree li .arrow-indicator {
    width: 18px;
    height: 18px;
    background-image: url('data:image/svg+xml,%3Csvg fill=\'%23b2b2b2\' version=\'1.1\' xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\' viewBox=\'0 0 96.154 96.154\' xml:space=\'preserve\' transform=\'rotate(90)\'%3E%3Cg%3E%3Cpath d=\'M0.561,20.971l45.951,57.605c0.76,0.951,2.367,0.951,3.127,0l45.956-57.609c0.547-0.689,0.709-1.716,0.414-2.61 c-0.061-0.187-0.129-0.33-0.186-0.437c-0.351-0.65-1.025-1.056-1.765-1.056H2.093c-0.736,0-1.414,0.405-1.762,1.056 c-0.059,0.109-0.127,0.253-0.184,0.426C-0.15,19.251,0.011,20.28,0.561,20.971z\'%3E%3C/path%3E%3C/g%3E%3C/svg%3E');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

/* Rotate arrow when expanded */
#nav-tree li.expanded > .node-content > .arrow-indicator {
    transform: rotate(-90deg);  /* Arrow pointing down when expanded */
}


/* Child elements hidden by default */
#nav-tree li ul {
    display: none;
    padding-right: 20px;  /* Changed from padding-left */
}

/* Expanded tree nodes show their children */
#nav-tree li.expanded ul {
    display: block;
}

/* Dark Mode Overrides */
[data-theme="dark"] #nav-tree li .node-content {
    background-color: #3b3b3b;
    color: #fff;
}

[data-theme="dark"] #nav-tree li .node-content:hover {
    background-color: #009a9a;
    color: #fff;
}

[data-theme="dark"] #nav-tree li .arrow-indicator {
    background-image: url('data:image/svg+xml,%3Csvg fill=\'%23ffffff\' version=\'1.1\' xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\' viewBox=\'0 0 96.154 96.154\' xml:space=\'preserve\' transform=\'rotate(90)\'%3E%3Cg%3E%3Cpath d=\'M0.561,20.971l45.951,57.605c0.76,0.951,2.367,0.951,3.127,0l45.956-57.609c0.547-0.689,0.709-1.716,0.414-2.61 c-0.061-0.187-0.129-0.33-0.186-0.437c-0.351-0.65-1.025-1.056-1.765-1.056H2.093c-0.736,0-1.414,0.405-1.762,1.056 c-0.059,0.109-0.127,0.253-0.184,0.426C-0.15,19.251,0.011,20.28,0.561,20.971z\'%3E%3C/path%3E%3C/g%3E%3C/svg%3E');
}


/*------------------------------------------------------------------------------------------------------*/
#context-menu {
    position: absolute;
    display: none;
    background-color: #ffffff; /* Light mode background: white */
    border: 1px solid #ced4da; /* Light gray border */
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);  /* Fancy shadow */
    transition: opacity 0.3s ease, transform 0.3s ease;  /* Smooth transitions */
    opacity: 0;
    transform: translateY(10px);  /* Start slightly below the cursor */
    direction: rtl;
    min-width: 180px;
}

#context-menu.show {
    opacity: 1;
    transform: translateY(0);  /* Move into position smoothly */
}

.context-menu-item {
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #333333;  /* Dark text in light mode */
    text-align: right;  /* Align text to the right for RTL */
    transition: background-color 0.3s ease, color 0.3s ease;  /* Smooth hover transition */
}

.context-menu-item:hover {
    background-color: #007bff;  /* Blue hover effect in light mode */
    color: #ffffff;  /* White text on hover */
}

.context-menu-item:active {
    background-color: #0056b3;  /* Slightly darker blue when active */
    color: #ffffff;
}

.context-menu-divider {
    height: 1px;
    margin: 5px 0;
    background-color: #e9ecef;  /* Light gray divider */
}

/* Dark Mode Overrides */
[data-theme="dark"] #context-menu {
    background-color: #3b3b3b; /* Dark mode background */
    border: 1px solid #2c2c2c; /* Dark border */
}

[data-theme="dark"] .context-menu-item {
    color: #ffffff;  /* White text in dark mode */
}

[data-theme="dark"] .context-menu-item:hover {
    background-color: #009a9a;  /* Teal hover effect in dark mode */
    color: #ffffff;  /* White text on hover */
}

[data-theme="dark"] .context-menu-item:active {
    background-color: #008080;  /* Slightly darker teal when active */
}

[data-theme="dark"] .context-menu-divider {
    background-color: #444;  /* Dark gray divider */
}

/*------------------------------------------------------------------------------------------------------*/
/* Icon styles for different device types */
.node-icon {
    width: 24px; /* Ensure width is set */
    height: 24px; /* Ensure height is set */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: inline-block; /* Ensure the element is displayed correctly */
    flex-shrink: 0;
}


.node-icon::before {
    content: ''; /* Placeholder for the icon */
    display: inline-block;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Folder icon */
.folder-icon::before {
    content: "📁";
    margin-left: 10px;
    margin-right: -4px;
}

/* Device icon specific styling */
.device-icon {
    /* Additional styles if needed */
}