/*
 * nxlblazor-utils.css — Minimal layout utilities (Bootstrap-compatible naming).
 * Apps ship no Bootstrap: a Bootstrap class this file does not define is unstyled.
 * Uses margin-inline-* (logical properties) for correct RTL behaviour.
 * The utilities are intentionally !important so they reliably override component defaults
 * when applied to your own elements (e.g. <i class="ti ti-home me-1">). The grid is not:
 * it is a layout primitive, and a utility on a row or column must be able to override it.
 * Cards, tables and the like belong in components, not here.
 */

/* ── Design tokens ────────────────────────────────────────────────────────────
   One scale shared by these utilities and by every NxlBlazor component, so an application
   re-skins spacing, corners and elevation from one place. Radius and shadow follow the
   DevExpress theme tokens, so they track the theme; colours are the theme's own --dxds-*
   tokens and are not duplicated here. The spacing scale matches NxlSpacing (XSmall = 1 …). */
:root {
    --nxl-space-0: 0;
    --nxl-space-1: 0.25rem;
    --nxl-space-2: 0.5rem;
    --nxl-space-3: 0.75rem;
    --nxl-space-4: 1rem;
    --nxl-space-5: 1.5rem;
    --nxl-space-6: 2rem;

    --nxl-radius-sm: var(--dxds-border-radius-40);
    --nxl-radius-md: var(--dxds-border-radius-80);
    --nxl-radius-lg: var(--dxds-border-radius-120);

    --nxl-shadow-sm: var(--dxds-box-shadow-sm);
    --nxl-shadow-md: var(--dxds-box-shadow-md);
    --nxl-shadow-lg: var(--dxds-box-shadow-lg);

    --nxl-border-color: var(--dxds-color-border-neutral-default-rest);
    --nxl-surface: var(--dxds-color-surface-neutral-default-rest);
}

/* ── Grid ─────────────────────────────────────────────────────────────────────
   .row is a wrapping flex line; a child without a .col* class takes the full width,
   so it drops to its own line. Gutters are custom properties, set by .g-* / .gx-* / .gy-*:
   the row's negative margins cancel the children's padding, so content stays aligned
   with whatever is outside the row. */
.row {
    --nxl-gutter-x: var(--nxl-space-4);
    --nxl-gutter-y: 0;
    display: flex;
    flex-wrap: wrap;
    margin-top: calc(-1 * var(--nxl-gutter-y));
    margin-inline: calc(-0.5 * var(--nxl-gutter-x));
}

.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-inline: calc(0.5 * var(--nxl-gutter-x));
    margin-top: var(--nxl-gutter-y);
}

.col      { flex: 1 0 0%; }
.col-auto { flex: 0 0 auto; width: auto; }

.col-1  { flex: 0 0 auto; width:  8.33333333%; }
.col-2  { flex: 0 0 auto; width: 16.66666667%; }
.col-3  { flex: 0 0 auto; width: 25%; }
.col-4  { flex: 0 0 auto; width: 33.33333333%; }
.col-5  { flex: 0 0 auto; width: 41.66666667%; }
.col-6  { flex: 0 0 auto; width: 50%; }
.col-7  { flex: 0 0 auto; width: 58.33333333%; }
.col-8  { flex: 0 0 auto; width: 66.66666667%; }
.col-9  { flex: 0 0 auto; width: 75%; }
.col-10 { flex: 0 0 auto; width: 83.33333333%; }
.col-11 { flex: 0 0 auto; width: 91.66666667%; }
.col-12 { flex: 0 0 auto; width: 100%; }

/* gutters — same scale as the margins below */
.g-0, .gx-0 { --nxl-gutter-x: 0; }
.g-0, .gy-0 { --nxl-gutter-y: 0; }
.g-1, .gx-1 { --nxl-gutter-x: var(--nxl-space-1); }
.g-1, .gy-1 { --nxl-gutter-y: var(--nxl-space-1); }
.g-2, .gx-2 { --nxl-gutter-x: var(--nxl-space-2); }
.g-2, .gy-2 { --nxl-gutter-y: var(--nxl-space-2); }
.g-3, .gx-3 { --nxl-gutter-x: var(--nxl-space-3); }
.g-3, .gy-3 { --nxl-gutter-y: var(--nxl-space-3); }
.g-4, .gx-4 { --nxl-gutter-x: var(--nxl-space-4); }
.g-4, .gy-4 { --nxl-gutter-y: var(--nxl-space-4); }

/* trailing margin (right in LTR, left in RTL) */
.me-1 { margin-inline-end: var(--nxl-space-1) !important; }
.me-2 { margin-inline-end: var(--nxl-space-2) !important; }
.me-3 { margin-inline-end: var(--nxl-space-3) !important; }

/* auto margins — push an item to the far end of a flex line */
.ms-auto { margin-inline-start: auto !important; }
.me-auto { margin-inline-end: auto   !important; }

/* leading margin (left in LTR, right in RTL) */
.ms-1 { margin-inline-start: var(--nxl-space-1) !important; }
.ms-2 { margin-inline-start: var(--nxl-space-2) !important; }
.ms-3 { margin-inline-start: var(--nxl-space-3) !important; }

/* top margin */
.mt-1 { margin-top: var(--nxl-space-1) !important; }
.mt-2 { margin-top: var(--nxl-space-2) !important; }
.mt-3 { margin-top: var(--nxl-space-3) !important; }
.mt-4 { margin-top: var(--nxl-space-4) !important; }

/* bottom margin */
.mb-1 { margin-bottom: var(--nxl-space-1) !important; }
.mb-2 { margin-bottom: var(--nxl-space-2) !important; }
.mb-3 { margin-bottom: var(--nxl-space-3) !important; }
.mb-4 { margin-bottom: var(--nxl-space-4) !important; }

/* top padding */
.pt-1 { padding-top: var(--nxl-space-1) !important; }
.pt-2 { padding-top: var(--nxl-space-2) !important; }
.pt-3 { padding-top: var(--nxl-space-3) !important; }
.pt-4 { padding-top: var(--nxl-space-4) !important; }

/* bottom padding */
.pb-1 { padding-bottom: var(--nxl-space-1) !important; }
.pb-2 { padding-bottom: var(--nxl-space-2) !important; }
.pb-3 { padding-bottom: var(--nxl-space-3) !important; }
.pb-4 { padding-bottom: var(--nxl-space-4) !important; }

/* padding, all sides */
.p-0 { padding: 0       !important; }
.p-1 { padding: var(--nxl-space-1) !important; }
.p-2 { padding: var(--nxl-space-2) !important; }
.p-3 { padding: var(--nxl-space-3) !important; }
.p-4 { padding: var(--nxl-space-4) !important; }

/* vertical padding */
.py-1 { padding-block: var(--nxl-space-1) !important; }
.py-2 { padding-block: var(--nxl-space-2) !important; }
.py-3 { padding-block: var(--nxl-space-3) !important; }
.py-4 { padding-block: var(--nxl-space-4) !important; }

/* horizontal padding */
.px-1 { padding-inline: var(--nxl-space-1) !important; }
.px-2 { padding-inline: var(--nxl-space-2) !important; }
.px-3 { padding-inline: var(--nxl-space-3) !important; }
.px-4 { padding-inline: var(--nxl-space-4) !important; }

/* width */
.w-25  { width: 25%  !important; }
.w-50  { width: 50%  !important; }
.w-75  { width: 75%  !important; }
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }

/* gap (flex / grid) */
.gap-1 { gap: var(--nxl-space-1) !important; }
.gap-2 { gap: var(--nxl-space-2) !important; }
.gap-3 { gap: var(--nxl-space-4) !important; }
.gap-4 { gap: var(--nxl-space-5) !important; }

/* display */
.d-flex        { display: flex        !important; }
.d-inline-flex { display: inline-flex !important; }
.d-block       { display: block       !important; }
.d-none        { display: none        !important; }

/* flex direction */
.flex-column { flex-direction: column !important; }
.flex-row    { flex-direction: row    !important; }

/* flex alignment */
.align-items-start   { align-items: flex-start !important; }
.align-items-center  { align-items: center     !important; }
.align-items-end     { align-items: flex-end   !important; }

/* flex justification */
.justify-content-start   { justify-content: flex-start    !important; }
.justify-content-center  { justify-content: center        !important; }
.justify-content-end     { justify-content: flex-end      !important; }
.justify-content-between { justify-content: space-between !important; }

/* flex grow / shrink */
.flex-grow-1   { flex-grow: 1   !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.flex-fill     { flex: 1 1 auto !important; }

/* flex wrap */
.flex-wrap   { flex-wrap: wrap   !important; }
.flex-nowrap { flex-wrap: nowrap !important; }

/* text colour — the DevExpress theme's content tokens, so they follow the theme mode */
.text-muted   { color: var(--dxds-color-content-neutral-deep-rest)     !important; }
.text-danger  { color: var(--dxds-color-content-danger-default-rest)   !important; }
.text-success { color: var(--dxds-color-content-success-default-rest)  !important; }
.text-warning { color: var(--dxds-color-content-warning-default-rest)  !important; }
