/* vx-datamap.css — the handful of classes the Data Map markup uses that Bootstrap 5 does not
   define. Everything else in the markup is plain Bootstrap 5 utility/component classes.
   Ported from VXconnect.Admin.UI/wwwroot/css/common.css's "Data Map Editor" and "Expression
   Builder Modal" sections, trimmed to the classes actually referenced by the moving markup and
   using only standard Bootstrap 5 CSS custom properties (--bs-*) so it is host-neutral. Host
   chrome — icon sprites (v1-icon), themed icon buttons (btn-icon), page-header layout
   (content-header) — stays in the host per the design's "host chrome stays in host" rule and is
   deliberately not reproduced here. */

.flex-1 {
    flex: 1;
}

/* ── Data Map Editor: canvas connection nodes ────────────────────────────── */

.src-col-node {
    transition: background-color 0.1s, border-color 0.1s;
}

.src-col-node--active,
.src-col-node:hover {
    background-color: var(--bs-primary-subtle) !important;
    border-color: var(--bs-primary) !important;
}

.dst-col-node {
    transition: background-color 0.1s, border-color 0.1s;
}

.dst-col-node--droppable {
    border-color: var(--bs-primary) !important;
    border-style: dashed !important;
    opacity: 0.85;
}

/* An auto-mapped Similarity proposal: a suggestion, not yet a link. Muted and dashed so it
   never reads as a committed mapping — the user must click Accept before it becomes one. */
.dm-automap-proposal {
    border-style: dashed !important;
    border-color: var(--bs-warning) !important;
    background-color: var(--bs-warning-bg-subtle);
    opacity: 0.8;
}

/* ── Expression Builder Modal ─────────────────────────────────────────────── */

.builder-grid {
    display: grid;
    grid-template-columns: 265px 1fr;
    height: 560px;
    overflow: hidden;
}

.builder-tree {
    border-right: 1px solid var(--bs-border-color);
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bs-body-bg);
}

/* Sticky container for header + search — sits above scrolling content */
.builder-tree-top {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #ffffff;
    background-color: var(--bs-body-bg, #ffffff);
    border-bottom: 2px solid rgba(0,0,0,0.10);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.builder-tree-header {
    padding: 0.55rem 0.75rem 0.4rem;
    font-weight: 700;
    font-size: 0.67rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bs-secondary-color);
}

.builder-search-wrap {
    padding: 0.35rem 0.6rem 0.4rem;
}

.builder-search-input {
    font-size: 0.78rem;
}

.builder-search-results {
    border-bottom: none;
}

.builder-op-cat-tag {
    margin-left: auto;
    font-size: 0.65rem;
    color: var(--bs-secondary-color);
    background: var(--bs-secondary-bg);
    border-radius: 8px;
    padding: 1px 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Category header row */
.builder-cat-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    user-select: none;
}
.builder-cat-header:hover { background: var(--bs-tertiary-bg); }

/* Subtle rule between category groups */
.builder-tree > div + div > .builder-cat-header {
    border-top: 1px solid rgba(0,0,0,0.08);
}

/* Colored icon box — letter/symbol per category */
.builder-cat-icon {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    flex-shrink: 0;
    color: white;
}
.cat-common     { background: #1a73e8; }
.cat-string     { background: #00897b; }
.cat-math       { background: #e37400; }
.cat-conversion { background: #7b1fa2; }
.cat-logical    { background: #c62828; }

.builder-cat-name {
    font-size: 0.81rem;
    font-weight: 600;
    flex: 1;
    color: var(--bs-body-color);
}

.builder-cat-chevron {
    font-size: 0.65rem;
    color: var(--bs-secondary-color);
    transition: transform 0.15s;
    display: inline-block;
}
.builder-cat-header.open .builder-cat-chevron { transform: rotate(90deg); }

.builder-cat-count {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
    background: var(--bs-secondary-bg);
    border-radius: 10px;
    padding: 1px 7px;
    min-width: 1.5rem;
    text-align: center;
}

.builder-cat-body {
    padding: 0.1rem 0 0.3rem;
}

/* Operation items — tree-view connecting lines via pseudo-elements */
.builder-op-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.75rem 0.28rem 2rem;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--bs-body-color);
    user-select: none;
}

/* Vertical trunk: full height on all items except last (which gets └) */
.builder-op-item::before {
    content: '';
    position: absolute;
    left: 1.05rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(0,0,0,0.20);
}
.builder-op-item:last-child::before {
    bottom: 50%; /* stop at midpoint → └ shape */
}

/* Horizontal branch */
.builder-op-item::after {
    content: '';
    position: absolute;
    left: 1.05rem;
    top: 50%;
    width: 0.6rem;
    height: 1px;
    background: rgba(0,0,0,0.20);
}

.builder-op-item:hover { background: var(--bs-tertiary-bg); }

.builder-op-active {
    background: var(--bs-primary-bg-subtle) !important;
    color: var(--bs-primary) !important;
    font-weight: 600;
}

.builder-form {
    padding: 1.1rem 1.25rem;
    overflow-y: auto;
    overflow-x: hidden;
}

.builder-preview {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
}

/* Expression rule list in table view */
.dm-rule-row {
    display: flex;
    align-items: flex-start;
    gap: 0.25rem;
    margin-bottom: 0.35rem;
}
.dm-rule-num {
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
    padding-top: 0.4rem;
    min-width: 1.2rem;
    text-align: right;
    flex-shrink: 0;
}
.dm-rule-textarea {
    font-family: var(--bs-font-monospace);
    font-size: 0.78rem;
    resize: vertical;
    min-height: 2.4rem;
}

/* ── Modal stacking ───────────────────────────────────────────────────────────
   These modals render inline, inside the host's page content, so they compete
   with the host's own header for paint order. The VXconnect Utility Portal's
   header is `position: sticky; z-index: 1030`, which sits above Bootstrap's
   default modal z-index of 1055 in practice, clipping the dialog title.

   Bootstrap already exposes the value as a custom property, so raise it rather
   than hard-coding a z-index and fighting the framework. 1080 clears both the
   1030 header and Bootstrap's own 1070 tooltip layer, while staying below the
   toast layer at 1090. */
.vx-datamap-modal {
    --bs-modal-zindex: 1080;
    z-index: 1080;
}

