@import url('phosphor/fonts/regular/style.css');
html, body {
    height: 100%;
    background: var(--bdo-ui-bg);
}

app {
    display: block;
    height: 100%;
}

.header-logo {
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask: url('../images/Logo.svg');
    mask: url('../images/Logo.svg');
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    width: 28px;
    height: 24px;
}

#blazor-error-ui {
    background: inherit;
    bottom: 0;
    display: none;
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: 100001;
}

.ph-house {
    font-size: xx-large;
    text-align: center;
    align-content: center;
    font-family: Phosphor-Thin !important;
}

.ph-user-circle-gear {
    font-size: xx-large;
    text-align: center;
    align-content: center;
    font-family: Phosphor-Thin !important;
}

:root {
    --DS-color-surface-neutral-default-rest: var(--bdo-ui-bg) !important;
    --DS-color-content-neutral-default-rest: var(--bdo-ui-text) !important;
    --bs-heading-color: var(--bdo-ui-text);
    --bs-secondary-color: var(--bdo-ui-text) !important;
    --bs-card-border-color: var(--bdo-ui-border) !important;
    --DS-color-surface-neutral-default-selected-hovered: var(--bdo-ui-bg) !important;

    /* Shared invalid / error state color (red-400) */
    --bdo-invalid-color: #f87171;
    --bdo-invalid-color-rgb: 248, 113, 113;
}

/* Override sidebar width only when on insights page */
body.docpro-page .sidebar-container {
    width: var(--sidebar-width, 500px) !important;
    transition: width 0s !important;
}

body.docpro-page .dxbl-drawer-panel {
    width: var(--sidebar-width, 500px) !important;
    transition: width 0s !important;
}

/* Override ModuleLayout's GetHeaderStyle() for insights page */
body.docpro-page .main-content-container[style*="margin-left: 300px"],
body.docpro-page .main-content-container[style*="margin-left:300px"] {
    margin-left: var(--sidebar-width, 500px) !important;
    transition: margin-left 0s !important;
}

body.docpro-page .main-content-container[style*="margin-left: 0"],
body.docpro-page .main-content-container[style*="margin-left:0"] {
    margin-left: 0px !important;
}

/* Override ProductHeaderCard positioning for insights page */
body.docpro-page .product-header-card-wrapper[style*="left:300px"] {
    left: var(--sidebar-width, 500px) !important;
    transition: left 0s !important;
}

body.docpro-page .product-header-card-wrapper[style*="left:2px"] {
    left: 2px !important;
}

/* Resizer handle */
.sidebar-resizer {
    position: fixed;
    top: 0;
    left: var(--sidebar-width, 500px);
    width: 5px;
    height: 100vh;
    cursor: col-resize;
    z-index: 1000;
    background: transparent;
    transition: left 0s !important;
}

    .sidebar-resizer:hover,
    .sidebar-resizer.resizing {
        background: var(--bdo-ui-border-accented, rgba(0, 123, 255, 0.5));
    }

    .sidebar-resizer::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 3px;
        height: 40px;
        background: var(--bdo-ui-border, #ccc);
        border-radius: 2px;
        opacity: 0;
        transition: opacity 0.2s;
    }

    .sidebar-resizer:hover::before,
    .sidebar-resizer.resizing::before {
        opacity: 1;
    }

/* Prevent text selection during resize */
body.resizing {
    user-select: none;
    cursor: col-resize !important;
}

.user-mgmt-card-content {
    overflow: visible !important;
}

.insights-container-card {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    border: 1px solid var(--bdo-ui-border-accented);
    border-radius: 6px;
    background: var(--bdo-ui-bg);
    width: 100%;
    max-width: 800px;
}

.card {
    border-color: var(--bdo-ui-border-accented);
}

/* Lighten the DocSpace create dialog background (library uses --bdo-ui-bg-base which is too dark) */
.new-docspace-card--main {
    background: var(--bdo-ui-bg) !important;
}

.ph-git-fork {
    font-size: xxx-large;
    color: var(--bdo-ui-text);
}

.main-content-container {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    position: relative;
    background: var(--bdo-ui-bg);
}

.analyzer-job-card-info {
    display: flex;
    flex-direction: column;
    font-family: var(--bdo-font-family-base);
    max-height: 48px;
    min-width: 0; /* Allow the info section to shrink */
    flex: 1; /* Take remaining space but allow shrinking */
    overflow: hidden; /* Hide overflow */
}

.analyzer-job-card-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--bdo-ui-text);
    line-height: 24px;
    margin-bottom: 2px;
    /* Text overflow handling */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-width: 0; /* Allow shrinking */
}

.analyzer-job-card-runon-row {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0; /* Allow the row to shrink */
    overflow: hidden; /* Hide overflow for the entire row */
}

.analyzer-job-card-runon-label {
    color: var(--bdo-ui-text-dimmed);
    font-size: 14px;
    font-weight: var(--bdo-font-weight-normal);
    opacity: 0.7;
    white-space: nowrap; /* Keep "Run on:" text on one line */
    flex-shrink: 0; /* Don't shrink the label */
}

.analyzer-job-card-runon-value {
    color: var(--bdo-ui-text);
    font-size: 14px;
    font-weight: var(--bdo-font-weight-normal);
    opacity: 0.95;
    /* Text overflow handling */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-width: 0; /* Allow shrinking */
    flex: 1; /* Take remaining space */
}

.dxbl-menu-item-text {
    color: var(--bdo-ui-text)
}

.dxbl-btn:hover {
    background: var(--bdo-ui-bg-accented)
}

.card {
    background-color: var(--DS-color-surface-neutral-default-rest, var(--bs-card-bg)) !important;
}

/* ==============================================================
   Left sidebar layout fix
   --------------------------------------------------------------
   The shared ModuleLayout stacks the nav menu (.sticky-menu-container)
   and the list panel (SidebarContent, e.g. the DocSpaces list or the
   Builder toolbox) as plain block children inside a fixed, 100vh
   .sidebar-container that neither flexes nor scrolls. The panel uses
   height:100% (= full 100vh) yet sits *below* the nav, so nav height +
   100vh runs off the bottom of the screen with no way to scroll to it.
   Adding nav items (e.g. Explore Analyzers, Analyzer Dashboards) makes
   the overflow worse.

   Turning .sidebar-container into a bounded flex column lets the nav
   take its natural height while the panel fills only the remaining
   space and scrolls internally. This is robust to any number of nav
   items. Kept here (BDODocPro global CSS) rather than in the shared
   library.
   ============================================================== */
.bdo-aipm-layout-page .sidebar-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Nav menu keeps its natural height at the top. */
.bdo-aipm-layout-page .sidebar-container > .sticky-menu-container {
    flex: 0 0 auto;
    min-height: 0;
}

/* The list panel (or any wrapper the layout renders around it) fills the
   remaining height and provides its own internal scroll. */
.bdo-aipm-layout-page .sidebar-container > :last-child:not(.sticky-menu-container) {
    flex: 1 1 auto;
    min-height: 0;
}

/* When the panel is an InsightsContainerCard, its inner elements are rendered by
   that child component, so a consumer's ::deep CSS can't reach them (no scoped
   ancestor). Propagate the bounded flex column down to the card's content area
   here instead, so the panel's own scroll region (e.g. .docspace-scrollable-container)
   is bounded and can scroll when the list is long. */
.bdo-aipm-layout-page .sidebar-container .insights-container-card {
    height: 100%;
}

.bdo-aipm-layout-page .sidebar-container .insights-container-content {
    flex: 1 1 auto;
    min-height: 0;
}

/* Only the scroll list should flex and scroll. Any other direct child of the
   content area (e.g. the single "My DocSpace" card) keeps its natural height so
   it isn't compressed into its own scrollbar. Covers both the DocSpaces list
   (.docspace-scrollable-container) and the Builder toolbox (.toolbox-scrollable-container).
   max-height:none overrides the components' scoped viewport caps (65vh / calc(100vh-320px)),
   which are measured from the top of the viewport and let the bottom run off-screen when
   the panel is pushed down. */
.bdo-aipm-layout-page .sidebar-container .insights-container-content > .docspace-scrollable-container,
.bdo-aipm-layout-page .sidebar-container .insights-container-content > .toolbox-scrollable-container {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
}

.bdo-aipm-layout-page .sidebar-container .insights-container-content > :not(.docspace-scrollable-container):not(.toolbox-scrollable-container) {
    flex: 0 0 auto;
}