/* Custom Scrollbars */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.4);
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 114, 128, 0.6);
}

/* Tree View Styles */
ul.tree-list {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

ul.tree-list ul {
    margin-left: 20px;
    padding-left: 0;
    border-left: 1px dashed #cbd5e1;
}

:is(.dark) ul.tree-list ul {
    border-left-color: #374151;
}

li.tree-node {
    position: relative;
    padding-left: 14px;
    margin-top: 4px;
}

/* Connective horizontal lines */
li.tree-node::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 0;
    width: 10px;
    height: 1px;
    border-top: 1px dashed #cbd5e1;
}

:is(.dark) li.tree-node::before {
    border-top-color: #374151;
}

/* Fix last child vertical line overflow */
ul.tree-list>li.tree-node:last-child::after {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 0;
    left: -1px;
    width: 2px;
    background: #f9fafb;
    /* bg-gray-50 */
}

:is(.dark) ul.tree-list>li.tree-node:last-child::after {
    background: #111827;
    /* dark:bg-neutral-900 */
}

/* Re-adjust for nested ul last child */
ul.tree-list ul>li.tree-node:last-child::after {
    left: -21px;
    /* Overlap parent border */
}

.tree-carets {
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    position: absolute;
    left: 6px;
    top: 3px;
    z-index: 10;
}

:is(.dark) .tree-carets {
    background: #1f2937;
    border-color: #374151;
}

.tree-carets:hover {
    border-color: #0ea5e9;
    color: #0ea5e9;
}

.tree-carets.collapsed {
    transform: rotate(-90deg);
}

.tree-node-content {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s;
}

.tree-node-content:hover {
    background: #e0f2fe;
    /* primary-100 */
}

:is(.dark) .tree-node-content:hover {
    background: rgba(14, 165, 233, 0.15);
    /* primary-500 with opacity */
}

.tag-num {
    color: #64748b;
    margin-right: 4px;
}

:is(.dark) .tag-num {
    color: #9ca3af;
}

.tag-name {
    color: #0284c7;
    font-weight: 600;
}

:is(.dark) .tag-name {
    color: #38bdf8;
}

.tag-oid {
    color: #16a34a;
    font-weight: 600;
}

:is(.dark) .tag-oid {
    color: #4ade80;
}

.tag-len {
    color: #94a3b8;
    font-size: 0.9em;
    margin-left: 4px;
}

:is(.dark) .tag-len {
    color: #6b7280;
}

.tag-val {
    color: #ca8a04;
    margin-left: 8px;
    word-break: break-all;
}

:is(.dark) .tag-val {
    color: #facc15;
}

.tag-val-hex {
    color: #8b5cf6;
    margin-left: 8px;
    word-break: break-all;
}

:is(.dark) .tag-val-hex {
    color: #a78bfa;
}


/* Syntax Highlighting for JSON Output */
pre code {
    display: block;
    line-height: 1.5;
}

/* Toast */
.toast-visible {
    opacity: 1 !important;
    transform: translate(-50%, -10px) !important;
}

/* Popup transition */
.popup-visible {
    display: flex !important;
    opacity: 1 !important;
}

.popup-visible #detailCard {
    transform: scale(1) !important;
}