﻿/* ============================= */
/* VNC Dialog Shell              */
/* ============================= */

.vnc-content {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    height: 100%;
    background: #111;
    overflow: hidden;
}

.vnc-screen {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

/* Do not force width/height here */
.vnc-screen canvas {
    display: block;
}

.vnc-dialog-shell {
    width: min(96vw, 1800px) !important;
    max-width: 96vw !important;
}

.mud-dialog.vnc-dialog-shell {
    width: min(96vw, 1800px) !important;
    max-width: 96vw !important;
}

/* Helps if MudBlazor wraps content internally */
.vnc-dialog-shell .mud-dialog-content {
    overflow: hidden;
}

.vnc-dialog-titlebar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.vnc-dialog-content {
    height: calc(100vh - 190px);
    min-height: 720px;
    overflow: hidden;
}


/* ============================= */
/* Main Dialog Layout            */
/* ============================= */

.vnc-dialog-workspace {
    height: 100%;
    min-height: 0;
    display: grid;
    gap: 16px;
}

.vnc-dialog-workspace-right {
    grid-template-columns: minmax(0, 1fr) 390px;
}

.vnc-dialog-workspace-left {
    grid-template-columns: 390px minmax(0, 1fr);
}


/* ============================= */
/* VNC Area                      */
/* ============================= */

.vnc-main-panel {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
}

.vnc-content {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    height: 100%;
    background: #111;
    overflow: hidden;
}

.vnc-screen {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

    /*
   Important:
   Do NOT force noVNC canvas width/height here.

   Bad:
   width: 100% !important;
   height: 100% !important;
   object-fit: contain;

   Let noVNC handle scaling with:
   rfb.scaleViewport = true;
*/
    .vnc-screen canvas {
        display: block;
    }


/* ============================= */
/* VNC Overlay                   */
/* ============================= */

.vnc-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
}

.vnc-status-alert {
    max-width: 520px;
}


/* ============================= */
/* Log Panel                     */
/* ============================= */

.vnc-log-panel {
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.vnc-log-card {
    height: 100%;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    overflow: hidden;
}

    .vnc-log-card > .mud-stack {
        height: 100%;
        min-height: 0;
    }

.vnc-log-history {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.vnc-log-entry {
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-background);
}


/* ============================= */
/* Small Helpers                 */
/* ============================= */

.vnc-updated {
    opacity: 0.8;
}


/* ============================= */
/* Responsive                    */
/* ============================= */

@media (max-width: 1200px) {
    .vnc-dialog-content {
        height: calc(100vh - 150px);
        min-height: unset;
        overflow-y: auto;
    }

    .vnc-dialog-workspace,
    .vnc-dialog-workspace-right,
    .vnc-dialog-workspace-left {
        grid-template-columns: 1fr;
    }

    .vnc-content {
        min-height: 600px;
    }

    .vnc-log-card {
        min-height: 420px;
    }
}
