/* Viewport-capped, touch-friendly scrolling for all app modals.
   Mirrors Edit Staff: body scrolls, header/footer stay put; EditForm wrappers don't break flex. */
.modal .modal-dialog:not(.modal-fullscreen):not(.modal-fullscreen-lg-down) {
    max-height: calc(100dvh - 1rem);
    margin: 0.5rem auto;
}

.modal .modal-dialog:not(.modal-fullscreen):not(.modal-fullscreen-lg-down) .modal-content {
    max-height: calc(100dvh - 1rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal .modal-dialog:not(.modal-fullscreen):not(.modal-fullscreen-lg-down) .modal-header,
.modal .modal-dialog:not(.modal-fullscreen):not(.modal-fullscreen-lg-down) .modal-footer {
    flex: 0 0 auto;
}

/* EditForm / form between modal-content and modal-body breaks Bootstrap scrollable flex */
.modal .modal-content > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.modal .modal-dialog:not(.modal-fullscreen):not(.modal-fullscreen-lg-down) .modal-body,
.modal .modal-content > form .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

/* Responsive fullscreen behavior for ModalDialog component */
@media (min-width: 992px) {
    .modal-fullscreen-lg-down {
        width: auto !important;
        max-width: var(--bs-modal-width) !important;
        height: auto !important;
        margin: var(--bs-modal-margin) !important;
    }
    
    .modal-fullscreen-lg-down .modal-content {
        height: auto !important;
        border: var(--bs-modal-border-width) solid var(--bs-modal-border-color) !important;
        border-radius: var(--bs-modal-border-radius) !important;
    }
    
    .modal-fullscreen-lg-down .modal-footer,
    .modal-fullscreen-lg-down .modal-header {
        border-radius: var(--bs-modal-inner-border-radius) !important;
    }
}

/* User Management specific styles */
.user-table .badge {
    font-size: 0.8em;
}

.user-actions .btn-group {
    gap: 0.25rem;
}

.modal-backdrop {
    z-index: 1040;
}

.modal {
    z-index: 1050;
}

/* Responsive table adjustments */
@media (max-width: 768px) {
    .user-table {
        font-size: 0.9em;
    }
    
    .user-actions .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8em;
    }
}
