/*
 * BarabNeo shell-specific custom CSS.
 *
 * Loaded AFTER barabneo-theme.css. Holds layout primitives that have no Radzen
 * equivalent (Activity Bar, dense status bar, scope-strip chip groups). Goal
 * per PRD-20: keep this file under ~120 lines total — Radzen primitives do
 * everything else.
 */

/* ── Header ────────────────────────────────────────────────────────────── */
/* Three-zone grid: brand (220px) | scope strip (1fr) | utilities (auto).
   44px tall. White surface with ink text — matches the design bundle
   (Design/UI-UX/claude-design-bundle/project/styles.css .header rule), NOT
   Radzen Fluent's default orange-painted RadzenHeader. The .rz-header override
   below kills the Radzen primary background so the surface shows through. */
.rz-header:has(.bn-header) {
    background: var(--rz-base-background-color, #ffffff);
    border-bottom: 1px solid var(--rz-base-200);
    box-shadow: none;
    padding: 0;
}

.bn-header {
    display: grid;
    grid-template-columns: 220px 1fr auto;
    align-items: center;
    gap: 12px;
    height: var(--bn-header-h);
    padding: 0 12px;
    width: 100%;
    color: var(--rz-text-color);
}

.bn-header__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
/* Diamond brand mark — solid orange with white inset, mirroring
   .brand-mark::before / ::after from the bundle. */
.bn-header__brand-mark {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
}
.bn-header__brand-mark::before,
.bn-header__brand-mark::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: rotate(45deg);
    background: var(--bn-orange);
}
.bn-header__brand-mark::after {
    inset: 4px;
    background: #ffffff;
}
.bn-header__wordmark {
    font-size: 16px;
    font-weight: 700;
    color: var(--rz-text-color);
    letter-spacing: 0;
}
.bn-header__sub {
    font-size: var(--bn-fs-small);
    color: var(--rz-text-tertiary-color);
    padding-left: 8px;
    margin-left: 4px;
    border-left: 1px solid var(--rz-base-200);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bn-header__scope {
    display: flex;
    align-items: center;
    min-width: 0;
}

.bn-header__utils {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--rz-text-color);
}
.bn-header__user {
    font-size: var(--bn-fs-small);
    color: var(--rz-text-secondary-color);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Search trigger — soft surface pill matching the bundle's .search-trigger. */
.bn-header__search {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    min-width: 220px;
    padding: 0 8px;
    border: 1px solid var(--rz-base-200);
    background: var(--rz-base-50);
    border-radius: 4px;
    color: var(--rz-text-tertiary-color);
    font-size: var(--bn-fs-small);
    cursor: pointer;
}
.bn-header__search:hover { border-color: var(--rz-base-300); }
.bn-header__search[disabled] { cursor: not-allowed; opacity: 0.65; }
.bn-header__search kbd {
    background: var(--rz-base-100);
    color: var(--rz-text-secondary-color);
    border-radius: 3px;
    padding: 0 4px;
    font-size: 10px;
    margin-left: auto;
}

.bn-header__bell {
    background: transparent;
    border: 0;
    color: var(--rz-text-secondary-color);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}
.bn-header__bell:hover { background: var(--rz-base-100); }
.bn-header__bell[disabled] { cursor: not-allowed; opacity: 0.65; }

/* ── Scope strip ───────────────────────────────────────────────────────── */
/* On the white header surface — chips ride on surface-2 with subtle border;
   module chips get the terracotta accent. */
.bn-scope {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    min-width: 0;
    flex: 1 1 auto;
}
/* Issue #14 / Phase D: chip containers. Wide variant wraps + truncates;
   narrow variant collapses behind a summary chip below the breakpoint. */
.bn-scope__chips--wide {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}
.bn-scope__chips--narrow {
    display: none;
    position: relative;
}
/* Issue #14 / Phase D-2: wide/narrow swap driven by ResizeObserver via
   [data-collapsed] attribute — no media query. JS sets el.dataset.collapsed. */
.bn-scope[data-collapsed="false"] .bn-scope__chips--wide  { display: flex; }
.bn-scope[data-collapsed="false"] .bn-scope__chips--narrow { display: none; }
.bn-scope[data-collapsed="true"]  .bn-scope__chips--wide  { display: none; }
.bn-scope[data-collapsed="true"]  .bn-scope__chips--narrow { display: block; }
/* Add buttons stay anchored at the right edge of the strip. */
.bn-scope > .bn-scope__add { margin-left: auto; }
.bn-scope > .bn-scope__add + .bn-scope__add { margin-left: 0; }
/* Summary chip — styled like a regular chip but interactive. */
.bn-scope__summary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 22px;
    padding: 0 8px;
    background: var(--rz-base-50);
    color: var(--rz-text-color);
    border: 1px solid var(--rz-base-200);
    border-radius: 11px;
    font-size: var(--bn-fs-small);
    cursor: pointer;
    white-space: nowrap;
}
.bn-scope__summary:hover { border-color: var(--bn-orange); }
.bn-scope__summary-caret { font-size: 10px; opacity: 0.7; }
.bn-scope__summary-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    min-width: 240px;
    max-width: min(360px, 90vw);
    background: var(--rz-base-background-color, #fff);
    border: 1px solid var(--rz-base-200);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.bn-scope__hint {
    color: var(--rz-text-tertiary-color);
    font-size: var(--bn-fs-small);
    font-style: italic;
}
.bn-scope__chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 22px;
    padding: 0 4px 0 8px;
    background: var(--rz-base-50);
    color: var(--rz-text-color);
    border: 1px solid var(--rz-base-200);
    border-radius: 11px;
    font-size: var(--bn-fs-small);
    white-space: nowrap;
}
.bn-scope__chip[data-kind="module"] {
    background: var(--bn-terracotta);
    border-color: var(--bn-terracotta);
    color: #ffffff;
}
.bn-scope__remove {
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 14px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
    border-radius: 50%;
}
.bn-scope__remove:hover { background: rgba(0, 0, 0, 0.08); }

.bn-scope__add {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 22px;
    padding: 0 8px;
    background: transparent;
    color: var(--rz-text-tertiary-color);
    border: 1px dashed var(--rz-base-300);
    border-radius: 11px;
    font-size: var(--bn-fs-small);
    cursor: pointer;
}
.bn-scope__add:hover { color: var(--rz-text-color); border-color: var(--bn-orange); }
.bn-scope__add[disabled] { cursor: not-allowed; opacity: 0.6; }

/* PRD-21b — Construction grouping. Chips of one Construction sit inside a
   subtle bordered frame with a "Stavba: …" label so admins can read scope
   structure at a glance. */
.bn-scope__group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px 2px 6px;
    border: 1px dashed var(--rz-border-color);
    border-radius: 12px;
    background: rgba(var(--bn-orange-rgb, 255, 134, 0), 0.04);
}
.bn-scope__group-label {
    font-size: 0.75rem;
    color: var(--rz-text-tertiary-color);
    margin-right: 4px;
    white-space: nowrap;
}

/* PRD-21b — Picker dialog content. Compact stacked rows with checkbox + label. */
.bn-picker { display: flex; flex-direction: column; gap: 0.5rem; min-width: 480px; }
.bn-picker__list { max-height: 50vh; overflow-y: auto; padding: 4px; }
.bn-picker__row {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px;
    cursor: pointer;
}
.bn-picker__row:hover { background: var(--rz-base-100); }
.bn-picker__name { flex: 1; }
.bn-picker__code { color: var(--rz-text-tertiary-color); font-family: var(--bn-mono, monospace); font-size: 0.85em; }
.bn-picker__group { color: var(--rz-text-secondary-color); font-size: 0.85em; }
.bn-picker__empty { padding: 1rem; color: var(--rz-text-tertiary-color); text-align: center; }
.bn-picker__footer { display: flex; justify-content: flex-end; gap: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--rz-border-color); }

/* ── Activity Bar ──────────────────────────────────────────────────────── */
/* Vertical 44px icon strip on the left edge. Active state = 3px orange
   left border + ink-strong icon color; hover = soft orange tint. */
.bn-activity {
    grid-area: bn-activity;
    width: var(--bn-activity-w);
    background: var(--rz-base-50);
    border-right: 1px solid var(--rz-base-200);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 4px 0;
    overflow: hidden;
}

.bn-activity__cell {
    height: var(--bn-activity-w);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rz-text-secondary-color);
    border-left: var(--accent-strip-w, 3px) solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 80ms ease, color 80ms ease;
}
.bn-activity__cell:hover {
    background: var(--bn-orange-soft);
    color: var(--rz-text-color);
}
.bn-activity__cell.active {
    border-left-color: var(--bn-orange);
    color: #050505;
    background: transparent;
}
.bn-activity__cell .rzi {
    font-size: 22px;
}

.bn-activity__sep {
    height: 1px;
    background: var(--rz-base-200);
    margin: 6px 8px;
}

.bn-activity__spacer {
    flex: 1 1 auto;
}

/* ── Mode-aware sidebar ────────────────────────────────────────────────── */
.bn-sidebar-mode {
    padding: 8px 0;
}
.bn-sidebar-section {
    padding: 4px 12px 12px;
}
.bn-sidebar-section__title {
    font-size: var(--bn-fs-small);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--rz-text-tertiary-color);
    margin: 0 0 6px;
}
.bn-sidebar-section__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.bn-sidebar-mode__hint {
    font-size: var(--bn-fs-small);
    color: var(--rz-text-secondary-color);
    margin: 0;
    line-height: 1.4;
}
.bn-sidebar-mode__btn {
    width: 100%;
    justify-content: flex-start;
}

/* ── Entity tree (PRD-12) ──────────────────────────────────────────────── */
.bn-entity-tree {
    margin: 0 -8px;
    font-size: var(--bn-fs-small);
}
.bn-entity-tree .rz-tree-node-content {
    padding: 2px 4px;
    line-height: 1.2;
}
.bn-entity-tree__label {
    margin-left: 4px;
    color: var(--rz-text-color);
}
/* E-5 (Issue #0001 #40): sticky search/filter input above the tree. */
.bn-entity-tree__search {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--rz-panel-background-color, var(--rz-base-background-color));
    padding: 4px 0 6px;
    margin: 0 -4px 4px;
}
.bn-entity-tree__empty {
    color: var(--rz-text-tertiary-color);
    font-size: var(--bn-fs-small);
    padding: 8px 4px;
    margin: 0;
}

/* E-6 (Issue #0001 #41): per-row pin (★) toggle. Always visible but dim by
   default so users can discover and target it deliberately; full opacity on
   hover, and orange when the row is pinned (active state). */
.bn-entity-tree__pin {
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 0 4px;
    margin-left: auto;
    font-size: 13px;
    line-height: 1;
    color: var(--rz-text-tertiary-color);
    opacity: 0.3;
    transition: opacity 0.12s ease;
}
.bn-entity-tree .rz-tree-node-content:hover .bn-entity-tree__pin,
.bn-entity-tree__pin:hover,
.bn-entity-tree__pin--active {
    opacity: 1;
}
.bn-entity-tree__pin--active {
    color: var(--bn-orange, #ff8c00);
}

/* E-6: collapsible "Oblíbené" section above the tree. */
.bn-entity-tree__pinned {
    margin: 0 -4px 6px;
    padding: 0 4px 6px;
    border-bottom: 1px solid var(--rz-border-color, #eee);
}
.bn-entity-tree__pinned-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: 0;
    cursor: pointer;
    width: 100%;
    padding: 4px 4px;
    font-size: var(--bn-fs-small);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--rz-text-secondary-color);
}
.bn-entity-tree__pinned-toggle:hover {
    color: var(--rz-text-color);
}
.bn-entity-tree__pinned-list {
    display: flex;
    flex-direction: column;
    padding: 2px 0;
}
.bn-entity-tree__pinned-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px;
    text-decoration: none;
    color: inherit;
    font-size: var(--bn-fs-small);
    border-radius: 3px;
}
.bn-entity-tree__pinned-item:hover {
    background: var(--rz-base-50, #f5f5f5);
}

/* E-3 (Issue #0001 #20): status-dot slot at the right end of a tree row. */
.bn-entity-tree__dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 0.5rem;
    vertical-align: middle;
    flex-shrink: 0;
}
.bn-entity-tree__dot[data-status="ok"]   { background: var(--rz-success, #4caf50); }
.bn-entity-tree__dot[data-status="warn"] { background: var(--rz-warning, #ff9800); }
.bn-entity-tree__dot[data-status="crit"] { background: var(--rz-danger,  #f44336); }
.bn-entity-tree__dot[data-status="info"] { background: var(--rz-info,    #2196f3); }

/* ── Entity detail (PRD-12) ────────────────────────────────────────────── */
/* Layout (padding, breadcrumb, header row) is now provided by the shared
   WorkspaceShell primitive (Issue #0001 A3). Only consumer-specific styling
   remains here — currently the inline "code" chip rendered next to the
   entity-type badge in the title row. */
.bn-entity-detail__code {
    color: var(--rz-text-tertiary-color);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--bn-fs-small);
}

/* Generic Info panel <dl> grid: label column auto, value column 1fr. */
.bn-panel-info {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 16px;
    row-gap: 4px;
    margin: 0;
    max-width: 800px;
}
.bn-panel-info dt {
    color: var(--rz-text-tertiary-color);
    font-size: var(--bn-fs-small);
}
.bn-panel-info dd {
    margin: 0;
    color: var(--rz-text-color);
    font-size: var(--bn-fs-body);
}
.bn-panel-info__epsg {
    margin-left: 8px;
    padding: 0 4px;
    background: var(--rz-base-100);
    color: var(--rz-text-tertiary-color);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 10px;
    border-radius: 3px;
}

/* ── Audit panel (PRD-12) ──────────────────────────────────────────────── */
.bn-audit {
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: 900px;
}
.bn-audit__row {
    display: grid;
    grid-template-columns: 130px 18px max-content 1fr;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid var(--rz-base-100);
    font-size: var(--bn-fs-body);
}
.bn-audit__row:last-child { border-bottom: 0; }
.bn-audit__time {
    color: var(--rz-text-tertiary-color);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--bn-fs-small);
}
.bn-audit__actor {
    color: var(--rz-text-secondary-color);
    font-size: var(--bn-fs-small);
    white-space: nowrap;
}
.bn-audit__what {
    color: var(--rz-text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Quickopen dialog (PRD-12) ─────────────────────────────────────────── */
.bn-quickopen {
    display: flex;
    flex-direction: column;
    max-height: 60vh;
    min-height: 320px;
}
/* BarabPickerSearchRow visuals when used standalone (e.g. in QuickopenDialog).
   When the row lives inside <BarabPicker>, BarabPicker.razor.css supplies the
   scoped equivalents — these globals are the de-duplication target referenced
   by Issue #0001 A2-5. */
.bn-picker__inputbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--rz-base-200);
}
.bn-picker__inputbox .rzi { font-size: 18px; color: var(--rz-text-tertiary-color); }
.bn-picker__search-input {
    flex: 1 1 auto;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 15px;
    color: var(--rz-text-color);
}
.bn-picker__clear {
    background: transparent;
    border: 0;
    color: var(--rz-text-tertiary-color);
    cursor: pointer;
    padding: 0 6px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
}
.bn-picker__clear:hover { background: var(--rz-base-100); }

.bn-quickopen__status {
    padding: 16px;
    color: var(--rz-text-tertiary-color);
    font-size: var(--bn-fs-small);
}

.bn-quickopen__list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    overflow-y: auto;
}
.bn-quickopen__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    cursor: pointer;
    font-size: var(--bn-fs-body);
}
.bn-quickopen__item:hover { background: var(--rz-base-50); }
.bn-quickopen__item.active { background: var(--bn-orange-soft); }
.bn-quickopen__item .rzi { font-size: 16px; }
.bn-quickopen__item-name { flex: 0 1 auto; color: var(--rz-text-color); }
.bn-quickopen__item-code {
    color: var(--rz-text-tertiary-color);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--bn-fs-small);
}
.bn-quickopen__item-type {
    margin-left: auto;
    color: var(--rz-text-tertiary-color);
    font-size: var(--bn-fs-small);
}

/* ── Status bar ────────────────────────────────────────────────────────── */
/* Single dense row, 22px tall, 11px type, 12px horizontal padding. */
.bn-statusbar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--bn-status-h);
    padding: 0 12px;
    font-size: var(--bn-fs-small);
    color: var(--rz-text-secondary-color);
    background: var(--rz-base-100);
    border-top: 1px solid var(--rz-base-200);
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
}

.bn-statusbar > span,
.bn-statusbar > a {
    flex: 0 0 auto;
}

.bn-statusbar__spacer {
    flex: 1 1 auto;
}

/* Env badge — color-coded by data-env (dev = green, staging = amber, prod = red).
   Unknown envs use the secondary text color so the surface still works in tests. */
.bn-statusbar__env {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #ffffff;
    background: var(--rz-text-tertiary-color);
}
.bn-statusbar__env[data-env="dev"]     { background: var(--bn-ok); }
.bn-statusbar__env[data-env="staging"] { background: var(--bn-orange); }
.bn-statusbar__env[data-env="prod"]    { background: var(--bn-err); }

/* Alarm link — orange link tone; click navigates to /status. */
.bn-statusbar__warn {
    color: var(--bn-warn);
    text-decoration: none;
}
.bn-statusbar__warn:hover {
    text-decoration: underline;
}

/* User / scope / count / sync / build all share the muted secondary tone. */
.bn-statusbar__db,
.bn-statusbar__user,
.bn-statusbar__scope,
.bn-statusbar__count,
.bn-statusbar__sync,
.bn-statusbar__build {
    color: var(--rz-text-secondary-color);
}

/* Override the RadzenFooter default vertical padding so the 22px height is honored. */
.rz-footer:has(.bn-statusbar) {
    padding: 0;
    min-height: var(--bn-status-h);
}

/* ---------- Admin dashboard (/admin) ---------- */
.bn-admin-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}
.bn-admin-tile { padding: 1rem; }
.bn-admin-tile--wide { grid-column: 1 / -1; }
.bn-admin-counts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}
.bn-admin-count {
    text-decoration: none;
    color: inherit;
    text-align: center;
    padding: 0.5rem;
    border-radius: 4px;
}
.bn-admin-count:hover { background: var(--rz-base-50, #f5f5f5); }
.bn-admin-count__num {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--bn-orange, #ff8c00);
}
.bn-admin-count__label {
    display: block;
    font-size: 0.75rem;
    color: var(--rz-text-secondary-color);
    margin-top: 0.25rem;
}
.bn-admin-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    margin-top: 0.5rem;
}
.bn-admin-meta dt { color: var(--rz-text-secondary-color); font-size: 0.875rem; }
.bn-admin-meta dd { margin: 0; font-size: 0.875rem; }
.bn-admin-meta__time { color: var(--rz-text-secondary-color); font-size: 0.75rem; }
.bn-admin-status--ok { color: var(--bn-ok, green); font-weight: 600; }
.bn-admin-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.bn-admin-list li {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--rz-border-color, #eee);
}
.bn-admin-list li:last-child { border-bottom: 0; }
.bn-admin-list a {
    text-decoration: none;
    color: inherit;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.bn-admin-list a:hover { color: var(--bn-orange, #ff8c00); }
.bn-admin-empty {
    color: var(--rz-text-secondary-color);
    font-style: italic;
    margin: 0.5rem 0 0;
}
.bn-admin-status--error { color: var(--bn-err, #d32f2f); font-weight: 600; }
.bn-admin-status--unknown { color: var(--rz-text-secondary-color); font-weight: 600; }
.bn-admin-count--warn .bn-admin-count__num { color: var(--bn-orange, #ff8c00); }
.bn-admin-count__sub {
    display: block;
    font-size: 0.7rem;
    color: var(--bn-err, #d32f2f);
    margin-top: 0.125rem;
}

