﻿body {
    font-family: system-ui, Segoe UI, Roboto, Arial, sans-serif;
}

.node-tree {
    font-size: 0.95rem;
    user-select: none;
    transition: all 0.2s ease-in-out;
}

.tree-node {
    padding: 2px 0;
}

    .tree-node .toggle-icon {
        width: 16px;
        text-align: center;
        cursor: pointer;
    }

.node-label {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s ease-in-out;
}

    .node-label:hover {
        background-color: rgba(0, 123, 255, 0.08);
    }

.tree-node.active > .d-flex > .node-label {
    background-color: rgba(0, 123, 255, 0.15);
    font-weight: 600;
}

.tree-node i.fa-folder {
    color: #f4c542;
}
/* ----- InfoSafe Tree Styling ----- */
/* Remove bullets and tidy alignment */
/* --- COMPACT TREE VIEW STYLE TUNING --- */
.ifs-tree {
    font-size: 0.88rem;
    /* slightly smaller text */
    line-height: 1.25rem;
    /* tighter vertical spacing */
    overflow-x: auto;
    padding-bottom: 4px;
}

.ifs-tree-root, .ifs-children {
    list-style: none;
    margin: 0;
    padding-left: 0.6rem;
    /* smaller left indent per nesting level */
}

.ifs-node {
    margin: 1px 0;
    /* minimal vertical gap between nodes */
}

.ifs-toggle, .ifs-toggle-spacer {
    width: 1rem;
    /* narrower toggle width */
}

.ifs-label {
    cursor: pointer;
    user-select: none;
    padding: 1px 3px;
    /* reduced horizontal padding */
    border-radius: 3px;
    transition: background 0.15s ease-in-out;
    white-space: nowrap;
    /* prevent wrapping inside each node */
    text-overflow: ellipsis;
    overflow: hidden;
    display: inline-block;
    max-width: calc(100% - 1.5rem);
    /* allow long names to truncate gracefully */
}

    .ifs-label:hover {
        background: rgba(0, 123, 255, 0.08);
    }

.ifs-selected .ifs-label {
    background: rgba(0, 123, 255, 0.15);
    font-weight: 500;
}

.fa-folder, .fa-folder-open {
    color: #f0ad4e !important;
}

.fa-file {
    color: #0d6efd !important;
}

.ifs-toggle {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    color: #555;
    line-height: 1;
}

    .ifs-toggle:hover {
        color: #007bff;
    }
/* Slight tweak for smoother transitions when expanding */
.ifs-children {
    transition: all 0.1s ease-in-out;
}
/* Buttons (optional refinement) */
button:disabled.btn-success {
    background-color: #a3cdb3 !important;
    border-color: #a3cdb3 !important;
    color: #fff !important;
}
/* Card Area */
.card {
    border-radius: 0.6rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.card-header.bg-success {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
}

    .card-header.bg-success i {
        color: #fff !important;
    }

    .card-header.bg-success span, .card-header.bg-success h5 {
        color: #fff !important;
    }

.card-body {
    padding: 1rem 1.25rem 1.25rem 1.25rem;
}

hr {
    opacity: 0.15;
}

.container-fluid {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}
/* Soften the button transitions */
.btn {
    transition: background-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

    .btn:focus {
        box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    }
/* Buttons */
/* --- Normal Add Root button (unchanged) --- */
.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

    .btn-primary:hover {
        background-color: #0b5ed7;
        border-color: #0a58ca;
    }
/* --- Add Child default state (disabled look) --- */
.btn-child[disabled] {
    background-color: #cfe2ff !important;
    /* light pastel blue */
    border-color: #cfe2ff !important;
    color: #6c757d !important;
    opacity: 1 !important;
    /* remove Bootstrap dimming */
    cursor: not-allowed;
}
/* --- Add Child when active/enabled --- */
.btn-child:not([disabled]) {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #fff !important;
    transition: all 0.15s ease-in-out;
}

    .btn-child:not([disabled]):hover {
        background-color: #0b5ed7 !important;
        border-color: #0a58ca !important;
    }
/* === SPLIT VIEW LAYOUT === */
/* --- FINAL FIX for split-pane scroll behaviour --- */
.split-container {
    display: flex;
    width: 100%;
    height: calc(100vh - 140px);
    overflow: hidden;
}
/* Left pane (Nodes) */
.split-pane.left {
    flex: 0 0 400px;
    min-width: 260px;
    max-width: 60%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* prevent nested scrollbars */
}
    /* Allow entire left pane (card area) to scroll naturally */
    .split-pane.left .card {
        flex: 1 1 auto;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .split-pane.left .card-body {
        flex: 1 1 auto;
        overflow-y: auto;
        /* scroll content, not the pane itself */
        overflow-x: hidden;
        scrollbar-gutter: stable;
        /* keeps layout from shifting */
    }

.split-pane.right {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
/* Divider */
#splitDivider {
    width: 6px;
    background-color: #c7c7c7;
    cursor: col-resize;
    transition: background-color 0.2s ease-in-out;
}

    #splitDivider:hover {
        background-color: #888;
    }
/* Drag and Drop Highlight */
.ifs-drop-target {
    background-color: rgba(13, 110, 253, 0.15);
    border: 1px dashed #0d6efd;
}

.ifs-drop-root {
    border: 2px dashed #0d6efd;
    background-color: rgba(13, 110, 253, 0.05);
    border-radius: 6px;
    transition: background-color 0.2s ease-in-out;
}

    .ifs-drop-root:hover {
        background-color: rgba(13, 110, 253, 0.1);
    }
/* === Drawer === */
/* =========================================================== InfoSafeWeb – Custom Slide-out Drawer Styles =========================================================== */
/* === Drawer Overlay === */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.35);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
    z-index: 1040;
}

    .drawer-overlay.show {
        opacity: 1;
        visibility: visible;
    }
/* === Drawer Panel === */
.drawer-panel {
    position: fixed;
    top: 0;
    right: -400px;
    /* start hidden */
    width: 400px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 6px rgba(0,0,0,0.25);
    transition: right 0.3s ease-in-out;
    z-index: 1050;
    display: flex;
    flex-direction: column;
}

    .drawer-panel.open {
        right: 0;
        /* slide in */
    }
/* === Drawer Content === */
.drawer-header {
    background-color: #007bff;
    color: white;
    padding: 0.75rem 1rem;
    font-weight: bold;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}
/* === Floating Toggle Button (bottom-right) === */
.drawer-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1060;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
/* === Base Drawer === */
.drawer-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 8px rgba(0,0,0,0.25);
    transition: right 0.3s ease-in-out, width 0.3s ease-in-out;
    z-index: 1050;
    display: flex;
    flex-direction: column;
}

    .drawer-panel.open {
        right: 0;
    }
/* === Drawer overlay === */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
    z-index: 1040;
}

    .drawer-overlay.show {
        backdrop-filter: none !important;
        background: rgba(0,0,0,0.25); /* dim but not blur */
    }

/* === Drawer header & body === */
.drawer-header {
    background: #0d6efd;
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}
/* === Floating Toggle Button === */
.drawer-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: #0d6efd;
    color: white;
    border: none;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    z-index: 1060;
    opacity: 0.85;
    transition: all 0.2s ease-in-out;
}

    .drawer-toggle:hover {
        opacity: 1;
        transform: scale(1.05);
    }

    .drawer-toggle i {
        font-size: 1.25rem;
    }
/* === Responsive: full-screen on mobile === */
@media (max-width: 768px) {
    .drawer-panel {
        width: 100%;
        right: -100%;
    }

        .drawer-panel.open {
            right: 0;
        }

    .drawer-header {
        font-size: 1rem;
        padding: 0.6rem 0.9rem;
    }

    .drawer-toggle {
        width: 46px;
        height: 46px;
        bottom: 16px;
        right: 16px;
    }
}
/* =========================================================== Keep right content pane usable when drawer overlaps =========================================================== */
/* Main split container should allow horizontal scroll if needed */
.split-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    /* ✅ enable side scroll */
    min-width: 750px;
    /* ✅ ensure layout doesn’t collapse */
}
/* Right pane (content editor) should never be hidden */
.split-pane.right {
    flex: 1 1 auto;
    min-width: 400px;
    /* ✅ minimum working width */
    overflow-x: auto;
    /* ✅ allow horizontal scrolling */
    position: relative;
    z-index: 1;
    /* ✅ stay below drawer */
}
/* Drawer stays above everything */
.drawer-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 8px rgba(0,0,0,0.25);
    transition: right 0.3s ease-in-out, width 0.3s ease-in-out;
    z-index: 1050;
    /* ✅ ensures drawer overlays content */
}

    .drawer-panel.open {
        right: 0;
    }
/* Optional: minimum width to keep layout functional even with drawer open */
@media (max-width: 1000px) {
    .split-container {
        min-width: 1000px;
        /* ✅ allow horizontal scroll when drawer overlaps */
    }
}
/* Optional visual tweak for scrollbars */
.split-pane.right::-webkit-scrollbar {
    height: 8px;
}

.split-pane.right::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
}
/* =========================================================== InfoSafeWeb — Keep header + content aligned horizontally =========================================================== */
/* ✅ 1. Ensure header (blue strip) spans viewport width */
/* Full-width header that stays aligned with content */
.navbar, header, .top-row, .container-fluid.mt-4 {
    width: 100%;
    /* match page content width, not viewport */
    max-width: 100%;
    /* prevent overflow */
    position: relative;
    margin: 0 auto;
    box-sizing: border-box;
    z-index: 1200;
}
    /* Prevent Bootstrap containers from shrinking inside the header */
    .navbar .container, .top-row .container, header .container {
        max-width: none !important;
    }
/* ✅ 2. Sync min-width between header and main layout */
:root {
    --ifs-min-width: 1000px;
    /* match your desired layout minimum */
}
/* Body and main area must share the same min width */
html, body {
    overflow-x: auto !important;
    min-width: var(--ifs-min-width);
}

.split-container {
    display: flex;
    flex-wrap: nowrap;
    min-width: var(--ifs-min-width);
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}
/* ✅ 3. Ensure right pane doesn't hide when viewport shrinks */
.split-pane.right {
    flex: 1 1 auto;
    min-width: 400px;
    overflow-x: auto;
    overflow-y: auto;
}
/* ✅ 4. Keep blue header height consistent */
.navbar, header, .top-row {
    min-height: 64px;
}
/* =========================================================== 🩵 Fix: Drawer must always sit above header and content =========================================================== */
.drawer-panel, .drawer-overlay {
    z-index: 2000 !important;
    /* higher than header (1200) */
}

    .drawer-panel.open {
        right: 0;
    }
/* Optional: prevent underlying header/content from catching clicks */
.drawer-overlay {
    pointer-events: auto !important;
}

header, .navbar, .top-row {
    position: relative;
    z-index: 1000 !important;
    /* below drawer */
}
/* =========================================================== 🎯 Make drawer overlay blur negligible (clear background) =========================================================== */
.drawer-overlay.show {
    backdrop-filter: none !important;
    background-color: transparent !important;
    opacity: 1;
    visibility: visible;
}
/*------------*/
/* --- Header brand shouldn't force overflow --- */
.navbar .navbar-brand {
    min-width: 0;
}

    .navbar .navbar-brand span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 65vw;
        /* prevent brand from crowding toggler */
    }
/* --- Mobile mode: remove desktop min-widths & stack panes --- */
@media (max-width: 991.98px) {
    /* kill global min-width for mobile */
    html, body {
        min-width: 0 !important;
        overflow-x: hidden !important;
    }
    /* your variable is fine for desktop;
     ignore it on mobile */
    .split-container {
        min-width: 0 !important;
        width: 100%;
        flex-direction: column;
        /* stack left/right */
        height: auto;
        overflow-x: hidden;
    }

    .split-pane.left, .split-pane.right {
        min-width: 0 !important;
        max-width: none !important;
        flex: 1 1 auto;
    }

    #splitDivider {
        display: none;
    }
    /* slightly tighter padding so the toggler never gets pushed */
    .navbar > .container-fluid {
        padding-left: .75rem;
        padding-right: .75rem;
    }
}
/* If you previously set the toggler to position:absolute, revert it: */
.navbar-toggler {
    position: static;
    transform: none;
    right: auto;
}
/*----------*/
/* === Remove external white padding around main panes === */
.split-wrapper {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}
/* remove bootstrap spacing inherited from container-fluid/mt-4 */
.container-fluid.mt-4, .container-fluid {
    margin: 0 !important;
    padding: 0 !important;
}
/* keep split container flush with header/footer */
.split-container {
    margin: 0;
    padding: 0;
    border: none;
}
/* optional: prevent top overlap with header */
main {
    margin-top: 0;
    padding-top: 0;
}
/* =========================================================== 🔷 InfoSafe Web — Remove rounded corners on pane headers =========================================================== */
/* Remove all card rounding (global) */
.card, .card-header, .card-body {
    border-radius: 0 !important;
}
/* Or — if you only want to target your Nodes/Content panels: */
.split-pane .card, .split-pane .card-header, .split-pane .card-body {
    border-radius: 0 !important;
}
/* Ensure headers still look unified with content body */
.card-header {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}


/* ===========================================================
   🔹 Drawer close button refinement (non-breaking)
   =========================================================== */

.drawer-close-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px;
    color: #fff;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    padding: 0;
}

    .drawer-close-btn:hover {
        background: rgba(255,255,255,0.25);
        transform: scale(1.08);
    }

    .drawer-close-btn:active {
        background: rgba(255,255,255,0.35);
        transform: scale(0.95);
    }

    .drawer-close-btn i {
        pointer-events: none;
        font-size: 1.1rem;
    }

/* Mobile-friendly tap area */
@media (max-width: 768px) {
    .drawer-close-btn {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
    }
}

/* CKEditor content: reduce default paragraph gaps */
.ck-content p {
    margin: 0;
}

/* Preformatted legacy text blocks */
.ck-content pre.ifs-pre {
    white-space: pre-wrap; /* respect wrapping and newlines */
    margin: 0; /* no extra gaps before/after */
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    line-height: 1.25;
}

.tree-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 0.5rem;
    z-index: 10;
    font-size: 1rem;
    text-align: center;
    animation: fadein 0.2s ease-in;
}

@keyframes fadein {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.cache-status {
    position: fixed;
    bottom: 16px;
    left: 16px;
    background: rgba(255, 255, 255, 0.75);
    color: #0d6efd; /* Bootstrap primary blue */
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    z-index: 3000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    transition: all 0.4s ease-in-out;
    border: 1px solid rgba(13, 110, 253, 0.15);
}

    .cache-status.text-success {
        color: #198754; /* Bootstrap success green */
        border-color: rgba(25, 135, 84, 0.25);
    }

    .cache-status.text-info {
        color: #0dcaf0; /* Bootstrap info cyan */
        border-color: rgba(13, 202, 240, 0.25);
    }


.btn-secondary {
    background-color: #e9ecef;
    color: #212529;
    border: 1px solid #ced4da;
}

    .btn-secondary:hover {
        background-color: #dee2e6;
    }

.login-container {
    background: linear-gradient(145deg, #f5f8ff 0%, #eaf1ff 100%);
}

.card .form-label {
    font-size: 0.9rem;
}

.card input::placeholder {
    color: #999;
}

/* Prevent dead clicks during prerender */
app.preload {
    pointer-events: none;
    opacity: 0.4;
    transition: opacity 0.2s ease-in-out;
}

/* Remove faint shadow line at bottom of the left tree pane */
.split-pane.left.shadow-sm,
.split-pane.left .shadow-sm,
.tree-pane.shadow-sm,
.tree-pane .shadow-sm {
    box-shadow: none !important;
}

/* Ensure the pane background is solid and seamless */
.split-pane.left,
.tree-pane {
    background-color: var(--bs-body-bg) !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

.card-header .btn {
    padding-top: 0.0rem;
    padding-bottom: 0.0rem;
}

.drawer-toggle {
    position: fixed !important;
    bottom: 20px;
    right: 20px;
    z-index: 99999 !important; /* force to top */
    pointer-events: auto !important;
}

.drawer-overlay {
    z-index: 9990;
}

.drawer-panel {
    z-index: 9991;
}

.tree-loading-overlay {
    z-index: 9980;
}

/* Remove ANY blurring Blazor ever applies */
.blazor-loading,
app.preload,
app.preload *,
body.blazor-loading *,
app.preload-soft {
    filter: none !important;
    backdrop-filter: none !important;
    opacity: 1 !important;
}

.drawer-toggle {
    position: fixed !important;
    bottom: 20px;
    right: 20px;
    z-index: 99999 !important;
    pointer-events: auto !important;
}

.editor-header {
    position: sticky;
    top: 0;
    z-index: 10;
}