/* src/components/basic/XWUISeparator/XWUISeparator.css */
/**
 * XWUISeparator Component Styles
 * Structure and behavior only - colors come from CSS variables
 * 
 * Style Dependencies:
 * - Base: reset.css, typography.css, utilities.css
 * - Style: style/modern/spacing.css
 * - Theme: theme/colors/{selected-theme}.css (MANDATORY - provides all color variables)
 * - Lines: theme/lines/balanced.css (global border widths)
 * - Typography: theme/typography/*.css
 */

.xwui-separator {
    display: flex;
    align-items: center;
}

/* Horizontal separator */
.xwui-separator-horizontal {
    width: 100%;
    height: 1px;
    background: var(--border-color);
}

/* Vertical separator */
.xwui-separator-vertical {
    width: 1px;
    height: 100%;
    background: var(--border-color);
    min-height: 1rem;
}

/* Separator with label */
.xwui-separator-with-label {
    display: flex;
    align-items: center;
    width: 100%;
    gap: var(--spacing-md, 1rem);
}

.xwui-separator-line {
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.xwui-separator-label {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ── Resizable splitter ────────────────────────────────────────────────
   When `resizable: true` is set, the separator becomes a draggable
   handle (splitter / pane divider). Common pattern names: "splitter"
   (VS Code), "resizer" (Figma), "pane divider" (Chrome DevTools). Hit
   area widens to ~8px for easier grabbing; cursor flips to the right
   axis; hover bg tints to signal affordance. */
.xwui-separator--resizable {
    position: relative;
    background: transparent;
    -webkit-user-select: none;
            user-select: none;
    transition: background-color 0.15s ease;
}
.xwui-separator--resizable.xwui-separator-horizontal {
    height: 8px;
    cursor: row-resize;
}
.xwui-separator--resizable.xwui-separator-vertical {
    width: 8px;
    cursor: col-resize;
}
.xwui-separator--resizable::after {
    content: '';
    position: absolute;
    background: var(--border-color, rgba(0, 0, 0, 0.12));
    transition: background-color 0.15s ease;
}
.xwui-separator--resizable.xwui-separator-horizontal::after {
    top: 50%; left: 0; right: 0; height: 1px;
    transform: translateY(-50%);
}
.xwui-separator--resizable.xwui-separator-vertical::after {
    left: 50%; top: 0; bottom: 0; width: 1px;
    transform: translateX(-50%);
}
.xwui-separator--resizable:hover::after,
.xwui-separator--resizable:focus-visible::after,
.xwui-separator--resizable.xwui-separator--dragging::after {
    background: var(--accent-primary, #4f46e5);
    height: 2px;
}
.xwui-separator--resizable.xwui-separator-vertical:hover::after,
.xwui-separator--resizable.xwui-separator-vertical:focus-visible::after,
.xwui-separator--resizable.xwui-separator-vertical.xwui-separator--dragging::after {
    height: auto;
    width: 2px;
}
.xwui-separator--resizable:hover,
.xwui-separator--resizable.xwui-separator--dragging {
    background: color-mix(in srgb, var(--accent-primary, #4f46e5) 8%, transparent);
}
.xwui-separator--resizable:focus-visible {
    outline: 2px solid var(--accent-primary, #4f46e5);
    outline-offset: 0;
}

/* ── MUI Divider parity ─────────────────────────────────────────────────────
   variant (fullWidth default / inset / middle), flexItem, light, and textAlign
   for the labelled (text) divider. (A resizable divider delegates to
   XWUISplitter, which carries its own visible-handle styling.) */

/* A labelled divider is NOT a 1px line - the with-label row provides the lines. */
.xwui-separator-horizontal:has(.xwui-separator-with-label) {
    height: auto;
    background: transparent;
}

/* variant: inset (indent the start) / middle (indent both ends). */
.xwui-separator-horizontal.xwui-separator-inset  { width: auto; margin-inline-start: 72px; }
.xwui-separator-horizontal.xwui-separator-middle { width: auto; margin-inline: 16px; }
.xwui-separator-vertical.xwui-separator-inset    { height: auto; margin-block-start: 8px; }
.xwui-separator-vertical.xwui-separator-middle   { height: auto; margin-block: 8px; }

/* flexItem: a vertical divider that stretches to a flex row's height. */
.xwui-separator-vertical.xwui-separator-flex-item {
    align-self: stretch;
    height: auto;
    min-height: 0;
}
/* The separator sits in a wrapping host (its container), which is the REAL flex
   child - so make that host stretch + become a flex box, and the nested divider
   fills it. (Without this the host stays content-height = 0 and the divider is
   invisible.) Keep the :has subject anchored to owned hosts: a universal
   subject makes unrelated DOM updates invalidate ancestors across the page. */
.xwui-separator-host:has(> .xwui-separator-vertical.xwui-separator-flex-item) {
    align-self: stretch;
    display: flex;
}

/* light: a fainter divider colour. */
.xwui-separator-horizontal.xwui-separator-light,
.xwui-separator-vertical.xwui-separator-light {
    background: color-mix(in srgb, var(--border-color, #94a3b8) 50%, transparent);
}
.xwui-separator-light .xwui-separator-line {
    background: color-mix(in srgb, var(--border-color, #94a3b8) 50%, transparent);
}

/* textAlign: shift the label toward an end by shortening that side's line. */
.xwui-separator-align-left  .xwui-separator-line:first-child,
.xwui-separator-align-start .xwui-separator-line:first-child { flex: 0 0 24px; }
.xwui-separator-align-right .xwui-separator-line:last-child,
.xwui-separator-align-end   .xwui-separator-line:last-child { flex: 0 0 24px; }

