/*
This css fixes framework conflicts between MUI and Joomla (Bootstrap/Cassiopeia).
 */

/* MUI DataGrid cells get a top margin from Bootstrap's `p { margin-bottom: 1rem }` — reset it */
#nextboards-root .MuiDataGrid-mainContent p {
    margin: 0;
}

/* In admin, the component renders its own toolbar — hide Joomla's subhead */
body.com_nextboards #subhead-container {
    display: none;
}

/* Cassiopeia ships `[role="tooltip"]:not(.show) { display: none; ... }` (Bootstrap convention).
   MUI never adds Bootstrap's `.show` class to its poppers, so that rule would hide every MUI
   tooltip and overwrite its styling. We restore MUI's behaviour for popper portals only —
   the inner `.MuiTooltip-tooltip` keeps the dark pill from MUI's own emotion styles. */
.MuiPopper-root[role="tooltip"] {
    display: block !important;
    z-index: 1500 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    color: inherit !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    right: auto !important;
    max-width: none !important;
    text-align: inherit !important;
}

/* Native controls (scrollbars, date inputs, autofill) follow the colour scheme the SPA runs in:
   Atum declares it for the admin, but the site lane and templates without a colour scheme of
   their own leave dark mode with light scrollbars. The selectors cover the root carrying
   data-bs-theme, a nested element carrying it, and <html> carrying it above the root. */
#nextboards-root[data-bs-theme='dark'],
#nextboards-root [data-bs-theme='dark'],
[data-bs-theme='dark'] #nextboards-root {
    color-scheme: dark;
}

#nextboards-root[data-bs-theme='light'],
#nextboards-root [data-bs-theme='light'],
[data-bs-theme='light'] #nextboards-root {
    color-scheme: light;
}
