/* src/components/basic/XWUISplitter/XWUISplitter.css */
/**
 * XWUISplitter Component Styles
 * A draggable resize bar between two panes. Structure + affordance only - * colours come from theme CSS variables.
 */

.xwui-splitter {
    position: relative;
    flex: 0 0 auto;
    z-index: 4;
    background: transparent;
    align-self: stretch;
    /* Stops the browser from scrolling the page on a touch-drag. */
    touch-action: none;
    box-sizing: border-box;
}
.xwui-splitter-vertical {
    width: 8px;
    height: 100%;
    cursor: col-resize;
}
.xwui-splitter-horizontal {
    height: 8px;
    width: 100%;
    cursor: row-resize;
}

/* A VISIBLE divider line centered in the 8px grab strip, so it's obvious the
   bar is draggable. Bolds to the accent colour (plus a soft ring) on hover /
   while dragging. */
.xwui-splitter::before {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    border-radius: 2px;
    background: color-mix(in srgb, var(--text-primary, #64748b) 32%, transparent);
    opacity: var(--xwui-splitter-handle-opacity, 1);
    transition: opacity var(--transition-fast, 120ms) ease, background-color 120ms ease, box-shadow 120ms ease;
}
.xwui-splitter-vertical::before { width: 2px; height: var(--xwui-splitter-handle-length, 100%); }
.xwui-splitter-horizontal::before { width: var(--xwui-splitter-handle-length, 100%); height: 2px; }

.xwui-splitter:hover::before,
.xwui-splitter--dragging::before,
.xwui-splitter:focus-visible::before {
    opacity: 1;
    background: var(--accent-primary, #3b82f6);
    box-shadow: 0 0 0 1px var(--accent-primary, #3b82f6);
}
.xwui-splitter:focus-visible {
    outline: 2px solid var(--accent-primary, #3b82f6);
    outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
    .xwui-splitter::before { transition: none; }
}

/* Forced colors (Windows high contrast): the divider is a background, which
   the user agent replaces with the canvas colour, so the bar vanished. System
   colours are honoured there, which keeps the line visible and marks hover,
   drag and keyboard focus. */
@media (forced-colors: active) {
    .xwui-splitter::before { background: ButtonText; }
    .xwui-splitter:hover::before,
    .xwui-splitter--dragging::before,
.xwui-splitter:focus-visible::before {
    opacity: 1; background: Highlight; box-shadow: none; }
    .xwui-splitter:focus-visible { outline-color: Highlight; }
}

/* ---------------------------------------------------------------------------
   Group mode (conf_comp.panes). The container itself becomes the flex track;
   panes are sized in px by the adapter, so the only job here is the axis, the
   overflow discipline, and the collapsed state.
   --------------------------------------------------------------------------- */
.xwui-splitter-group {
    display: flex;
    box-sizing: border-box;
    /* A pane sized larger than its share must scroll INSIDE its own box; a
       group that lets a pane push the track wide breaks every sibling's size. */
    overflow: hidden;
}
.xwui-splitter-group-vertical { flex-direction: row; }
.xwui-splitter-group-horizontal { flex-direction: column; }

.xwui-splitter-pane {
    box-sizing: border-box;
    overflow: auto;
    min-width: 0;
    min-height: 0;
}

/* A single editor surface fills its pane. Scope this to the constrained track:
   stacked panes must retain natural content height and scroll as one column. */
.xwui-splitter-group:not(.xwui-splitter-group--stacked) > .xwui-splitter-pane > :only-child {
    height: 100%;
    min-height: 0;
    min-width: 0;
}

/* A collapsed pane keeps its box in the flow (index-stable for the gutters)
   but takes no space and is out of the accessibility tree. aria-hidden alone
   would leave any focusable content inside it reachable by Tab, a focus ring
   on nothing and a control a screen reader is told is not there, so the pane
   is also visibility:hidden, which removes it from the tab order as well. */
.xwui-splitter-pane--collapsed {
    overflow: hidden;
    padding: 0;
    border: 0;
    visibility: hidden;
}

/* Stacked (conf_comp.stackBelow, container narrower than it). The adapter
   writes no pane sizes in this state, so each pane is a full-width block at
   its natural height. `flex: none` stops a fixed-height host from squeezing
   every pane into its own little scroll box; the group scrolls as one
   instead of clipping what no longer fits. Gutters carry `hidden`. A
   collapsed pane has no size to hold it at zero here, so it is removed. */
.xwui-splitter-group--stacked {
    flex-direction: column;
    overflow: auto;
}
.xwui-splitter-group--stacked > .xwui-splitter-pane {
    flex: none;
}
.xwui-splitter-group--stacked > .xwui-splitter-pane--collapsed {
    display: none;
}
