/* ── Global ── */
html, body {
    height: 100%;
}

/* ── Page content scroll ──
   Make the main content region the scroll container instead of the whole
   document. The app bar and drawer are position:fixed and stay outside
   this scroll context, so only the page body scrolls and its scrollbar
   tracks the content column — not the full viewport width across the
   drawer. Chrome places an element's scrollbar per its `direction`, so
   this lands the bar on the correct side automatically: the right edge
   of the content in LTR, the left edge in RTL.

   MudBlazor clears the fixed app bar with `padding-top` on .mud-main-content,
   which would leave the scroll viewport (and its scrollbar) starting behind
   the bar. Convert that reserved space into `margin-top` + a matching height
   reduction so the scrollport begins right below the app bar and beside the
   drawer. `--content-offset` mirrors MudBlazor's own responsive app-bar
   height expressions (0.875h portrait / 0.75h landscape-phone / h ≥600px).

   `.mud-layout` needs `display: flow-root` so .mud-main-content's top margin
   is contained instead of collapsing out through the layout to <body> (which
   would push the whole document down by the app-bar height and reintroduce a
   viewport scrollbar). */
.mud-layout {
    display: flow-root;
}

.mud-main-content {
    --content-offset: calc(var(--mud-appbar-height) - var(--mud-appbar-height) / 8);
    padding-top: 0;
    margin-top: var(--content-offset);
    height: calc(100vh - var(--content-offset));
    height: calc(100dvh - var(--content-offset));
    overflow-y: auto;
    overflow-x: auto;
}

@media (min-width: 0px) and (orientation: landscape) {
    .mud-main-content {
        --content-offset: calc(var(--mud-appbar-height) - var(--mud-appbar-height) / 4);
    }
}

@media (min-width: 600px) {
    .mud-main-content {
        --content-offset: var(--mud-appbar-height);
    }
}

/* ── Sticky filter toolbar ──
   Pins a page's search/filter bar to the top of the scroll container while
   its data grid scrolls underneath. `.mud-main-content` above is the actual
   scroll context (not the document), so `top: 0` sticks right below the app
   bar - handy on mobile where a long unprocessed-lines list would otherwise
   scroll the filters out of reach. */
.sticky-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
}

/* ── Numeric / Latin-script fields inside an RTL form ──
   Value stays left-to-right and right-aligned so digits read naturally
   next to an Arabic label, per convention documented in CLAUDE.md.
   Scoped to [dir="rtl"] (set on <html> before Blazor boots) so the class
   is a no-op in LTR — components can apply it unconditionally. */
[dir="rtl"] .numeric-input input {
    direction: ltr;
    text-align: right;
}

/* ── Utility ── */
.reading-ltr {
    direction: ltr !important;
    text-align: left !important;
}

.reading-rtl {
    direction: rtl !important;
    text-align: right !important;
}

/* ── Blazor error UI ── */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "حدث خطأ غير متوقع.";
    }

/* ── Loading screen ── */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "جارٍ التحميل...");
    }

code {
    color: #c02d76;
}
.app-loading {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

.app-loading-logo {
    width: 320px;
    height: 320px;
    object-fit: contain;
}

.app-loading-text {
    margin-top: 12px;
    color: #6b7280;
    font-family: Arial, sans-serif;
    font-size: 14px;
    letter-spacing: 0.08em;
}