/*
   Global overrides loaded last.
   Keep narrow and intentional: cross-cutting fixes that must win the final cascade.
*/

/* MudTabs surface: transparent background behind tab labels. */
html body .mud-tabs,
html body .mud-tabs.mud-paper,
html body .mud-tabs-toolbar,
html body .mud-tabs-toolbar-wrapper,
html body .mud-tabs-toolbar-content,
html body .mud-tabs-tabbar-content,
html body .mud-slide-group,
html body .mud-slide-group-content,
html body .mud-tabs-panels {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
}

html body .mud-tabs .mud-tab,
html body .mud-tabs .mud-button-root.mud-tab,
html body .mud-tabs .mud-button-root.mud-button-text.mud-tab,
html body .mud-tabs .mud-button-root.mud-button-text-primary.mud-tab,
html body .mud-tabs .mud-button-root.mud-button-text-secondary.mud-tab,
html body .mud-tabs .mud-tab:hover,
html body .mud-tabs .mud-tab:focus,
html body .mud-tabs .mud-tab:active,
html body .mud-tabs .mud-tab.mud-tab-active {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    border-color: transparent !important;
    border-bottom: 0 !important;
    border-bottom-color: transparent !important;
    box-shadow: none !important;
}

html body .mud-tabs .mud-tab::before,
html body .mud-tabs .mud-tab::after,
html body .mud-tabs .mud-button-root.mud-tab::before,
html body .mud-tabs .mud-button-root.mud-tab::after,
html body .mud-tabs-toolbar::before,
html body .mud-tabs-toolbar::after,
html body .mud-tabs-toolbar-content::before,
html body .mud-tabs-toolbar-content::after {
    content: none !important;
    display: none !important;
}

/* Active tab underline/slider off globally. */
html body .mud-tabs .mud-tab-indicator,
html body .mud-tabs .mud-tab-slider,
html body .mud-tabs-toolbar .mud-tab-indicator {
    display: none !important;
    opacity: 0 !important;
    height: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* Final motion cleanup: no global hover-lift on button-like controls.
   Preserve color and border hover feedback, but suppress translateY/scale nudges. */
html body :is(
    button,
    [role='button'],
    .mud-button-root,
    .mud-tab,
    .app-item,
    .update-ready,
    [class*='btn'],
    [class*='button']
):not(.mud-switch-base) {
    transition-property: background-color, border-color, color, box-shadow, opacity !important;
}

html body :is(
    button,
    [role='button'],
    .mud-button-root,
    .mud-tab,
    .app-item,
    .update-ready,
    [class*='btn'],
    [class*='button']
):not(.mud-switch-base):is(:hover, :focus, :focus-visible) {
    transform: none !important;
}

/* Snackbars, one owner on desktop and mobile. A message has to stand out from panels and dialogs without leaving the
   HYSEC OS look: the panel surface tinted with its severity, a severity edge on the left, the icon in that colour,
   stronger text and more elevation than a dialog, and a short slide in next to MudBlazor's fade. Normal messages use
   the accent. Stacking above every dimming layer: HysecTheme.ZIndex. */
.mud-snackbar {
    --snackbar-tone: var(--accent-color-rgb);
    background:
        linear-gradient(90deg, rgba(var(--snackbar-tone), 0.16), rgba(var(--snackbar-tone), 0.04) 60%),
        var(--panel-bg-solid);
    border: 1px solid rgba(var(--snackbar-tone), 0.4);
    border-left: 4px solid rgb(var(--snackbar-tone));
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl), 0 6px 28px rgba(var(--snackbar-tone), 0.16);
    color: var(--primary-text-strong);
    font-family: 'Jura', sans-serif;
    font-weight: 600;
    transition: translate var(--duration-slow) var(--ease-out);
}

@starting-style {
    .mud-snackbar {
        translate: 0 -10px;
    }
}

.mud-snackbar.mud-alert-filled-info { --snackbar-tone: var(--info-rgb); }
.mud-snackbar.mud-alert-filled-success { --snackbar-tone: var(--success-rgb); }
.mud-snackbar.mud-alert-filled-warning { --snackbar-tone: var(--warning-rgb); }
.mud-snackbar.mud-alert-filled-error { --snackbar-tone: var(--error-rgb); }

.mud-snackbar .mud-snackbar-content-message {
    color: var(--primary-text-strong);
}

.mud-snackbar .mud-snackbar-icon {
    color: rgb(var(--snackbar-tone));
}

.mud-snackbar .mud-snackbar-content-action .mud-icon-button {
    color: rgba(var(--primary-text-rgb), 0.72);
}

.mud-snackbar .mud-snackbar-content-action .mud-icon-button:hover,
.mud-snackbar .mud-snackbar-content-action .mud-icon-button:focus-visible {
    color: var(--primary-text-strong);
}

@media (prefers-reduced-motion: reduce) {
    .mud-snackbar {
        transition: none;
    }
}

/* Toasts appear top centre everywhere (Program.cs). The first one starts 56px down, below the 48px
   header of a window pushed to the top on a narrow screen; on mobile below the titlebar. On a wide
   desktop it starts 8px down, in the strip above the windows (they cascade from y=50), and on a
   maximised window lies in the empty middle of its header. Narrow screens keep a side margin. */
.mud-snackbar-location-top-center {
    top: 40px;
    width: max-content;
    max-width: calc(100vw - 24px);
}

@media (min-width: 900px) {
    #desktop-env .mud-snackbar-location-top-center {
        top: -8px;
    }
}

.mobile-root .mud-snackbar-location-top-center {
    top: calc(60px + env(safe-area-inset-top, 0px));
}

.mud-snackbar-location-top-center .mud-snackbar {
    min-width: min(288px, calc(100vw - 24px));
}
