/* NjBottomSheet presentation (NUI-3.3, F-05). Global on purpose: MudBlazor renders .mud-dialog in the dialog
   provider, outside the component's CSS isolation scope, so a scoped rule cannot reach it. Every selector here starts
   with .mud-dialog.nj-bottom-sheet or .nj-bottom-sheet, so nothing else is affected. The component is
   Kit/NjBottomSheet.razor, and its scoped file holds the handle, header and title. Colours and spacing use palette and
   --nj-* values only. */

/* Both presentations: kit spacing for content and actions. */
.mud-dialog.nj-bottom-sheet .nj-bottom-sheet__content {
    padding: 0 var(--nj-space-5);
}

.mud-dialog.nj-bottom-sheet .nj-bottom-sheet__actions-bar {
    padding: var(--nj-space-3) var(--nj-space-5) var(--nj-space-4);
}

/* A caller whose actions show only in some states passes an Actions fragment that renders nothing in the others:
   MudDialog reads its actions only when it opens, so the bar must exist from the first open. An empty bar takes no
   space. */
.mud-dialog.nj-bottom-sheet .nj-bottom-sheet__actions-bar:has(> .nj-bottom-sheet__actions:empty) {
    display: none;
}

/* Below 960px (NUI-2.1's breakpoint): a bottom sheet over the tab bar, chosen by CSS so it is right on first paint. */
@media (max-width: 959.98px) {
    .mud-dialog.nj-bottom-sheet {
        position: absolute;
        inset: auto 0 0 0;
        margin-inline: auto;
        margin-bottom: 0;
        width: 100%;
        max-width: 600px;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: var(--nj-radius-lg) var(--nj-radius-lg) 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        animation: nj-bottom-sheet-rise 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
    }
}

@keyframes nj-bottom-sheet-rise {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mud-dialog.nj-bottom-sheet {
        animation: none;
    }
}
