/* ── Dashboard page styles ───────────────────────────────────────────────────
   These rules intentionally target DevExpress component internals and child
   component elements, which is why they live in a global CSS file rather than
   a Blazor-scoped Dashboard.razor.css.
──────────────────────────────────────────────────────────────────────────── */

/* Remove the drawer panel border so it doesn't double-up with the sidebar */
.dxbl-drawer-left.dxbl-drawer-mini.dxbl-drawer.dxbl-drawer-shrink > .dxbl-drawer-panel,
.dxbl-drawer-left.dxbl-drawer-open.dxbl-drawer.dxbl-drawer-shrink > .dxbl-drawer-panel {
    border-right: 0;
}

/* ── No-scroll dashboard layout ─────────────────────────────────────────── */

/* Fixed-height container. Flex column so the topbar sits above the drawer
   area without affecting the viewport height calculation. */
.dashboard-viewport {
    height: calc(100dvh - 48px - 0.5rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */

/* Always-visible strip at the top containing the search-panel toggle and the
   chart-collapse toggle. Shrinks to its content height; does not scroll. */
.dashboard-topbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0 0.5rem 0;
    background: var(--bs-body-bg);
}

/* ── Drawer area ─────────────────────────────────────────────────────────── */

/* Drawer area fills the remaining height below the topbar. */
.dashboard-drawer-area {
    flex: 1;
    min-height: 0;
    overflow: visible;
}

/* Propagate height through the DevExpress Drawer */
.dashboard-drawer-area .dxbl-drawer,
.dashboard-drawer-area .dxbl-drawer-content {
    height: 100%;
}

/* Propagate height through the DevExpress LoadingPanel */
.dashboard-drawer-area .dxbl-loading-panel,
.dashboard-drawer-area .dxbl-loading-panel-content {
    height: 100%;
}

/* Force CSS grid items in DxGridLayout to allow shrinking below content size */
.dashboard-drawer-area .dxbl-grid-layout > * {
    min-height: 0;
}

/* ── Player area ─────────────────────────────────────────────────────────── */

/* Flex split container replacing DxGridLayout for chart + player */
.dashboard-split-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible;
}

.dashboard-chart-pane {
    flex-shrink: 0;
    overflow: visible;
    min-height: 80px;
}

.dashboard-divider {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    height: 6px;
    cursor: ns-resize;
    background: #dee2e6;
    border-radius: 3px;
    margin: 2px 0;
    touch-action: none;
    transition: background 0.15s;
}

.dashboard-splitter-dragging,
.dashboard-splitter-dragging * {
    user-select: none !important;
    -webkit-user-select: none !important;
}

.dashboard-splitter-dragging {
    cursor: ns-resize !important;
}

.dashboard-divider:hover,
.dashboard-divider--dragging {
    background: #0d6efd;
}

.dashboard-player-pane {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Player area fills its pane */
.dashboard-player-area {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* The stack-source-container inside StackofImageSource fills the player area */
.dashboard-player-area .stack-source-container {
    flex: 1;
    min-height: 0;
}

/* Visibility-toggle wrapper must participate in the flex column */
.dashboard-player-area-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* output-wrapper becomes a flex column so the camera-name title stacks
   above the player and the player takes the remaining height */
.dashboard-player-area .output-wrapper {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Camera-name title line does not grow */
.dashboard-player-area .output-wrapper > .fw-bold {
    flex-shrink: 0;
}

.dashboard-player-area .player-toolbar,
.dashboard-player-area .player-toolbar * {
    user-select: none;
    -webkit-user-select: none;
}

/* Bootstrap's w-100 padding-top trick disabled; container-query sizing in
   StackofImageSource.razor handles the correct contained 16:9 dimensions. */
.dashboard-player-area .ratio.ratio-16x9 {
    padding-top: 0 !important;
    margin: 0 auto;
}

.dashboard-player-area .ratio.ratio-16x9::before {
    content: none !important;
}

/* ── Chart area ──────────────────────────────────────────────────────────── */

/* Chart area fills its grid cell; canvas fills all available space. */
.dashboard-chart-item {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 0;
}

/* Chart canvas fills remaining space. Keep overflow visible so chart tooltips
   can escape the pane and render above the pill strip. */
.dashboard-chart-canvas {
    flex: 1;
    min-height: 0;
    overflow: visible;
}

/* DxStackLayout (and any other direct child) fills the canvas */
.dashboard-chart-canvas > * {
    min-height: 0;
    height: 100% !important;
}

/* EventCollectionChart flex layout (toolbar + chart body) */
.event-chart-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 12px;
    position: relative;
    z-index: 0;
}

.event-chart-toolbar {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.event-chart-body {
    flex: 1;
    min-height: 0;
    overflow: visible;
    position: relative;
    z-index: 2;
}

/* ── Chart tooltip ──────────────────────────────────────────────────────── */

/* DevExpress sets dxbl-chart-tooltip at z-index:1; raise it above chart headers. */
.event-chart-body .dxbl-chart-tooltip {
    z-index: 2000 !important;
}

.chart-tooltip {
    font-size: 0.82rem;
    line-height: 1.4;
    min-width: 140px;
    max-width: 300px;
}

.chart-tooltip-header {
    font-weight: 600;
    margin-bottom: 4px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 3px;
}

.chart-tooltip-total {
    font-weight: 600;
    margin-bottom: 3px;
}

.chart-tooltip-items {
    display: block;
}

.chart-tooltip-items--columns {
    columns: 2 120px;
    column-gap: 16px;
    max-width: 420px;
}

.chart-tooltip-item {
    break-inside: avoid;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 1px 0;
}

.chart-tooltip-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Chart time scrubber ────────────────────────────────────────────────── */

.event-chart-body {
    cursor: ew-resize;
}

.event-chart-body.chart-scrubbing {
    cursor: grabbing;
    user-select: none;
}

/* ── Event class pill filter strip ──────────────────────────────────────── */

/* Single-line scrollable pill container; expands to wrap when toggled */
.pill-strip {
    display: flex;
    flex-wrap: nowrap;
    overflow: hidden;
    gap: 0.25rem;
    align-items: center;
    min-width: 0;
    flex: 1;
}

.pill-strip--expanded {
    flex-wrap: wrap;
}

.event-class-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 50rem;
    padding: 2px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
    border: 2px solid transparent;
    transition: opacity 0.15s, background-color 0.15s;
    font-weight: 500;
}

.event-class-pill--off {
    background-color: transparent;
    opacity: 0.65;
}

/* Blur state: solid fill like --on but with reduced opacity and a dashed border
   to signal that the class is counted in the chart but blurred in the player. */
.event-class-pill--blur {
    opacity: 0.80;
    border-style: dashed !important;
}

.event-class-count {
    font-weight: 400;
    opacity: 0.85;
}

/* Blur radius slider — appears inline next to the pill strip when blur is active */
.blur-radius-control {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    white-space: nowrap;
}

.blur-radius-slider {
    width: 70px;
    padding: 0;
    cursor: pointer;
}
