/* grid-canvas.css
 *
 * Static styles for the workspace widget canvas. Per-cell *dynamic* state
 * (live drag transform, FLIP animation transforms) is applied via a JS-owned
 * <style> tag in grid-canvas-interop.js using [data-grid-item-id="..."]
 * selectors with !important — that path is the one that survives Blazor's
 * inline-style diff. Anything that lives here is static / global.
 */

/* Break out of XAF / DevExpress form-layout column widths so the canvas
   spans 100% of the DetailView's available width. The form-layout default
   wraps each LayoutItem in a Bootstrap-style dxbl-col-md-* track which caps
   the canvas to a fraction of the row. Walking up from .grid-canvas with
   :has(), we force every ancestor in the chain (item, row, group, column
   wrapper) to flex-basis 100% with no max-width. */
.dxbl-fl-item:has(.grid-canvas),
.dxbl-fl-group:has(.grid-canvas),
.dxbl-col:has(.grid-canvas),
.dxbl-row:has(.grid-canvas) {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    width: 100% !important;
}

.grid-canvas-cell {
    will-change: transform;
}

/* Design-mode slot guides — painted as a CSS background gradient on the
   canvas root using the --grid-cols / --grid-row-h / --grid-gap / --grid-pad
   CSS variables set by GridCanvas.razor. Replaces the SlotRowCount × ColumnCount
   inline-styled <div>s we used to emit (up to ~480 DOM nodes at 40×12) — the
   browser now composites the guides directly. The column step is
   (100% - 2 * pad + gap) / cols, which is the algebraic identity of
   (col-width + gap) once gaps and padding are accounted for. */
.grid-canvas--design {
    background-image:
        linear-gradient(to right, #eee 1px, transparent 1px),
        linear-gradient(to bottom, #eee 1px, transparent 1px);
    background-size:
        calc((100% - var(--grid-pad) * 2 + var(--grid-gap)) / var(--grid-cols)) 100%,
        100% calc(var(--grid-row-h) + var(--grid-gap));
    background-position: var(--grid-pad) 0, 0 var(--grid-pad);
    background-origin: padding-box;
    background-clip: padding-box;
    background-repeat: repeat;
}

.grid-canvas--design .grid-canvas-cell {
    user-select: none;
    cursor: move;
}

/* Edit / Delete overlay — rendered as a sibling of the cells (NOT a child),
   so it never sits under a data-grid-role ancestor and the JS interop's
   closest('[data-grid-role]') returns null on a button click. The overlay
   shares the cell's grid placement and pins to the top-right corner via
   align-self:start + justify-self:end (set inline). */
.grid-canvas-cell-controls {
    cursor: default;
    user-select: none;
}

.grid-canvas-cell-controls button {
    transition: background-color 80ms ease;
}

.grid-canvas-cell-controls button:hover {
    background-color: rgba(0, 0, 0, 0.08) !important;
}

.grid-canvas__resize-handle {
    touch-action: none;
}

.grid-canvas__drop-preview {
    position: fixed;
    pointer-events: none;
    border: 2px dashed #1ba1ff;
    background: rgba(27, 161, 255, 0.10);
    border-radius: 4px;
    z-index: 9999;
    box-sizing: border-box;
    transition: left 60ms linear,
                top 60ms linear,
                width 60ms linear,
                height 60ms linear,
                opacity 80ms ease,
                border-color 80ms ease,
                background-color 80ms ease;
}

.grid-canvas__drop-preview--invalid {
    border-color: #d33;
    background: rgba(211, 51, 51, 0.10);
}

/* Widget shell state cells — WidgetShell<TData> renders one of these
   instead of the concrete widget body while loading, empty, or errored.
   The loading state hosts <DxLoadingIndicator>; the flex centering here
   positions the DevExpress indicator inside the grid cell. */
.widget-state {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #868e96;
    font-size: 0.875rem;
    user-select: none;
}

.widget-state--error {
    color: #c92a2a;
}

/* KPI widget icons are monochrome black source images. Adding `.theicon`
   flips them to white via the global --icon-filter-white variable (defined
   in site.css). Used by the KPI badge when the user picks a light font
   colour — the icon needs to follow the text. */
.theicon {
    filter: var(--icon-filter-white);
}

