/* ============================================
   Mobile Safari Dialog Fix
   Ensures dialog actions aren't covered by
   browser navigation (address bar, home indicator)

   GitHub Issue: https://github.com/MudBlazor/MudBlazor/issues/8153
   ============================================ */

/* Use dynamic viewport height for dialog max-height */
@supports (height: 100dvh) {
    .mud-dialog {
        max-height: calc(100dvh - 4rem) !important;
    }
}

/* Fallback for browsers without dvh support */
@supports not (height: 100dvh) {
    .mud-dialog {
        max-height: calc(100vh - 6rem) !important;
    }
}

/* Add safe area padding to dialog actions for notched devices */
.mud-dialog-actions {
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px)) !important;
}

/* Ensure dialog content is scrollable when needed */
.mud-dialog-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile-specific adjustments */
@media screen and (max-width: 599.95px) {
    .mud-dialog {
        margin-bottom: env(safe-area-inset-bottom, 0px);
    }

    .mud-dialog-actions {
        padding-bottom: max(16px, calc(env(safe-area-inset-bottom, 0px) + 8px)) !important;
        position: sticky;
        bottom: 0;
        background: inherit;
        z-index: 1;
    }
}
