/* ==========================================================================
   BODY ALIGN — GLOBAL UI STABILITY & LAYOUT SHIFT PREVENTION SYSTEM
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. GLOBAL SCROLLBAR & PAGE LAYOUT STABILITY
   -------------------------------------------------------------------------- */
html {
    scrollbar-gutter: stable !important;
    overflow-y: scroll !important;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    overflow-x: hidden !important;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Prevent horizontal page shift when modals, sidebars, or backdrops lock scroll */
body.modal-open,
body.overflow-y-hidden,
body.g-sidenav-pinned,
body.g-sidenav-show {
    padding-right: 0 !important;
}

/* --------------------------------------------------------------------------
   2. MAIN LAYOUT, SIDEBAR & CONTAINER ISOLATION
   -------------------------------------------------------------------------- */
@media (min-width: 1200px) {
    .g-sidenav-show:not(.g-sidenav-hidden) .sidenav {
        flex-shrink: 0 !important;
        width: 250px !important;
    }

    /* Desktop Sidebar Brand & Logo Alignment */
    .sidenav .sidenav-header {
        height: 4.25rem !important;
        min-height: 4.25rem !important;
        max-height: 4.25rem !important;
        display: flex !important;
        align-items: center !important;
        padding: 0 1rem !important;
    }

    .sidenav .navbar-brand {
        padding: 0 !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        white-space: nowrap !important;
    }

    .sidenav .navbar-brand .navbar-brand-img {
        height: 34px !important;
        max-height: 34px !important;
        width: auto !important;
        object-fit: contain !important;
        flex-shrink: 0 !important;
    }

    .sidenav .navbar-brand .brand-text {
        font-size: 0.95rem !important;
        font-weight: 700 !important;
        line-height: 1.2 !important;
        color: #252f40 !important;
        white-space: nowrap !important;
    }

    /* Sidebar Collapsed State (Desktop) */
    body.g-sidenav-hidden .sidenav {
        width: 6rem !important;
        max-width: 6rem !important;
    }

    body.g-sidenav-hidden .sidenav .sidenav-header {
        justify-content: center !important;
        padding: 0 !important;
    }

    body.g-sidenav-hidden .sidenav .navbar-brand {
        justify-content: center !important;
        width: 100% !important;
        padding: 0 !important;
    }

    body.g-sidenav-hidden .sidenav .navbar-brand .brand-text {
        display: none !important;
    }

    body.g-sidenav-hidden .sidenav .navbar-brand .navbar-brand-img {
        margin: 0 auto !important;
        height: 28px !important;
        max-height: 28px !important;
    }
}

.main-content {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.main-content > footer,
footer.footer {
    margin-top: auto !important;
}

/* Stable Containers to prevent height collapse */
.ui-stable-container {
    position: relative;
    min-height: 120px;
    box-sizing: border-box;
}

.ui-page-content {
    min-height: calc(100vh - 120px);
}

/* --------------------------------------------------------------------------
   3. GLOBAL RIGID BUTTON & DIMENSIONAL STABILITY ARCHITECTURE
   -------------------------------------------------------------------------- */

/* Target ALL button elements project-wide */
.btn,
button,
a.btn,
input[type="submit"],
input[type="button"],
.ui-stable-button,
[role="button"]:not(.nav-link) {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    touch-action: manipulation !important;
    transform: none !important;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, color 0.15s ease-in-out, opacity 0.15s ease-in-out !important;
    backface-visibility: hidden !important;
    -webkit-font-smoothing: antialiased !important;
}

/* Strictly disable transform, scale, zoom, movement, outline shifts on all interaction states */
.btn:hover, .btn:active, .btn:focus, .btn:focus-visible, .btn:focus-within, .btn:active:focus, .btn:active:hover,
button:hover, button:active, button:focus, button:focus-visible, button:focus-within,
a.btn:hover, a.btn:active, a.btn:focus, a.btn:focus-visible, a.btn:focus-within,
input[type="submit"]:hover, input[type="submit"]:active, input[type="submit"]:focus,
input[type="button"]:hover, input[type="button"]:active, input[type="button"]:focus,
.ui-stable-button:hover, .ui-stable-button:active, .ui-stable-button:focus,
[role="button"]:not(.nav-link):hover, [role="button"]:not(.nav-link):active, [role="button"]:not(.nav-link):focus {
    transform: none !important;
    zoom: 1 !important;
    outline: none !important;
    outline-offset: 0 !important;
}

/* Neutralize icon animations or position shifts inside buttons */
.btn i, button i, a.btn i, .ui-btn-content i,
.icon-move-right i, .icon-move-left i {
    transform: none !important;
    transition: none !important;
}

.icon-move-right:hover i, .icon-move-right:focus i,
.icon-move-left:hover i, .icon-move-left:focus i {
    transform: none !important;
}

/* Global Button Size Definitions — Locked Dimensions */
.btn-xs, a.btn-xs, button.btn-xs {
    min-height: 28px !important;
    height: 28px !important;
    max-height: 28px !important;
    padding: 0 0.5rem !important;
    font-size: 0.75rem !important;
    line-height: 1.2 !important;
}

.btn-sm, a.btn-sm, button.btn-sm {
    min-height: 34px !important;
    height: 34px !important;
    max-height: 34px !important;
    padding: 0 0.75rem !important;
    font-size: 0.75rem !important;
    line-height: 1.2 !important;
}

.btn-md, a.btn-md, button.btn-md {
    min-height: 38px !important;
    height: 38px !important;
    max-height: 38px !important;
    padding: 0 1rem !important;
    font-size: 0.875rem !important;
    line-height: 1.3 !important;
}

.btn-lg, a.btn-lg, button.btn-lg {
    min-height: 44px !important;
    height: 44px !important;
    max-height: 44px !important;
    padding: 0 1.25rem !important;
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
}

.btn-icon-only, a.btn-icon-only, button.btn-icon-only {
    width: 2.375rem !important;
    height: 2.375rem !important;
    min-width: 2.375rem !important;
    min-height: 2.375rem !important;
    max-width: 2.375rem !important;
    max-height: 2.375rem !important;
    padding: 0 !important;
}

.btn-sm.btn-icon-only, a.btn-sm.btn-icon-only {
    width: 1.75rem !important;
    height: 1.75rem !important;
    min-width: 1.75rem !important;
    min-height: 1.75rem !important;
    max-width: 1.75rem !important;
    max-height: 1.75rem !important;
    padding: 0 !important;
}

/* Neutralize unstyled ripple elements completely */
.ripple {
    position: absolute !important;
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
    z-index: -9999 !important;
}

/* Content wrapper inside buttons */
.ui-btn-content {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.35rem !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
}

/* Livewire loading dimension stability */
.btn[wire\:loading],
button[wire\:loading],
.ui-stable-button[wire\:loading] {
    pointer-events: none !important;
    cursor: wait !important;
    user-select: none !important;
}



/* Center inline spinners without pushing text or resizing button */
.btn .spinner-border-sm,
button .spinner-border-sm {
    vertical-align: middle;
}

/* --------------------------------------------------------------------------
   4. TABLE STABILITY & COLUMN LAYOUT PRESERVATION
   -------------------------------------------------------------------------- */
.ui-stable-table-wrapper,
.table-responsive {
    min-height: 180px;
    position: relative;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.ui-stable-table-wrapper::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.ui-stable-table-wrapper::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 9999px;
}

.table.ui-stable-table {
    table-layout: auto;
    width: 100%;
}

.ui-table-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
    border-radius: inherit;
    transition: opacity 0.2s ease;
}

/* --------------------------------------------------------------------------
   5. CARD & WIDGET DIMENSION STABILITY
   -------------------------------------------------------------------------- */
.ui-stable-card,
.card {
    position: relative;
    min-height: 60px;
}

.card-body {
    position: relative;
}

/* --------------------------------------------------------------------------
   6. MODAL STABILITY & BACKDROP OVERLAY
   -------------------------------------------------------------------------- */
.modal {
    scrollbar-gutter: auto;
}

.modal.show {
    display: block !important;
}

.modal-backdrop {
    background-color: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25) !important;
    border: none !important;
}

/* --------------------------------------------------------------------------
   7. FORM VALIDATION LAYOUT STABILITY
   -------------------------------------------------------------------------- */
.invalid-feedback,
.text-danger.text-xs {
    min-height: 18px;
    line-height: 1.25;
    margin-top: 4px;
}

/* --------------------------------------------------------------------------
   8. BUTTON GROUP & BADGE PRESERVATION
   -------------------------------------------------------------------------- */
.btn-group .btn {
    flex: 1 1 auto;
}

.btn-group-sm > .btn, .btn-sm {
    font-size: 0.75rem;
}

/* --------------------------------------------------------------------------
   9. CUSTOM CHECKMARK CHECKBOX SYSTEM
   -------------------------------------------------------------------------- */
.ba-custom-checkbox,
.participant-checkbox,
.form-check-input.participant-checkbox,
.form-check-input.ba-custom-checkbox {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    width: 19px !important;
    height: 19px !important;
    min-width: 19px !important;
    min-height: 19px !important;
    border: 1.5px solid #d2d6da !important;
    border-radius: 4px !important;
    background-color: #ffffff !important;
    cursor: pointer !important;
    margin: 0 !important;
    margin-right: 12px !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
    position: relative !important;
    float: none !important;
    box-sizing: border-box !important;
    transition: all 0.15s ease-in-out !important;
}

.ba-custom-checkbox:hover,
.participant-checkbox:hover,
.form-check-input.participant-checkbox:hover,
.form-check-input.ba-custom-checkbox:hover {
    border-color: #f97316 !important;
}

.ba-custom-checkbox:checked,
.participant-checkbox:checked,
.form-check-input.participant-checkbox:checked,
.form-check-input.ba-custom-checkbox:checked {
    background-color: #f97316 !important;
    border-color: #f97316 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpolyline points='4 11 8 15 16 6' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 13px 13px !important;
}

.ba-custom-checkbox:focus,
.participant-checkbox:focus,
.form-check-input.participant-checkbox:focus,
.form-check-input.ba-custom-checkbox:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.25) !important;
}

.ba-custom-checkbox:after,
.participant-checkbox:after,
.form-check-input.participant-checkbox:after,
.form-check-input.ba-custom-checkbox:after {
    display: none !important;
    content: none !important;
}

