/* Styles for the ServerOps "Master of Mobs" environment group boxes and the maximised log overlay.
   This file lives at the wwwroot root (not under wwwroot/css) because the UI project excludes
   wwwroot/css/** from the build. Linked from index.html. */

/* ---- Group box ---------------------------------------------------------- */
.serverop-env {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    padding: 4px 14px 14px;
    margin: 0 0 16px 0;
    min-width: 0;
}

.serverop-env:last-child {
    margin-bottom: 0;
}

.serverop-env__legend {
    padding: 0 8px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--mud-palette-text-primary);
}

.serverop-env__buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Muted runtime stats sitting above the buttons; free to wrap on narrow screens. */
.serverop-env__stats {
    margin: 2px 2px 8px;
    font-size: 0.78rem;
    line-height: 1.3;
    color: var(--mud-palette-text-secondary);
}

/* ---- Shared log console -------------------------------------------------- */
.serverop-console {
    position: relative;
    margin-top: 12px;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-background-grey, #1e1e1e);
    overflow: hidden;
}

/* column-reverse keeps the newest lines pinned to the bottom of the viewport as content streams in,
   while the single <pre> child still reads oldest-to-newest top-to-bottom. */
.serverop-console__body {
    height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
}

.serverop-console__text {
    margin: 0;
    padding: 8px 12px;
    width: 100%;
    box-sizing: border-box;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Cascadia Code', 'Consolas', 'Ubuntu Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--mud-palette-text-primary);
}

/* Hover-reveal "maximize" button, top-right of the console. */
.serverop-console__fsbtn {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 2;
    opacity: 0;
    transition: opacity 120ms ease;
    background: var(--mud-palette-surface);
}

.serverop-console:hover .serverop-console__fsbtn,
.serverop-console__fsbtn:focus-visible {
    opacity: 0.9;
}

/* ---- Maximised overlay --------------------------------------------------- */
/* Fills the main content area. z-index sits just under MudDrawer (1100) and MudAppBar (1300) so the
   navbar and left drawer stay visible on top; top/left clear the app bar and the mini drawer. */
.serverop-overlay {
    position: fixed;
    top: var(--mud-appbar-height, 48px);
    left: 56px; /* mini-drawer width; the drawer's higher z-index covers anything further left */
    right: 0;
    bottom: 0;
    z-index: 1099;
    display: flex;
    flex-direction: column;
    background: var(--mud-palette-surface);
    box-shadow: var(--mud-elevation-8);
    transform-origin: center center;
    animation: serverop-zoom-in 150ms ease;
}

.serverop-overlay--closing {
    animation: serverop-zoom-out 150ms ease forwards;
}

.serverop-overlay__bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-background-grey, #1e1e1e);
}

.serverop-overlay__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
    background: var(--mud-palette-background-grey, #1e1e1e);
}

.serverop-live {
    color: var(--mud-palette-error);
    font-size: 0.8rem;
    font-weight: 600;
}

@keyframes serverop-zoom-in {
    from {
        opacity: 0;
        transform: scale(0.97);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes serverop-zoom-out {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.97);
    }
}
