/* ══════════════════════════════════════════════════════════
   GLOBAL STYLES — MudBlazor internals & shared utilities
   (Scoped .razor.css cannot target MudBlazor component
   internals because MudBlazor does not forward Blazor's
   CSS scope attribute to its rendered HTML elements.)
   ══════════════════════════════════════════════════════════ */


/* ── Base / Flash prevention ─────────────────────────────
   What:    Prevents white browser background from showing
            during navigation transitions before MudBlazor's
            CSS variables are applied. Falls back to dark
            theme color on frames where --mud-palette-background
            is not yet set.                                  */
html, body {
    background-color: var(--mud-palette-background, #1a1a27);
}

/* ── Authenticated application shell ────────────────────
   MainLayout owns the page gutters so individual pages do
   not need to invent their own top/side spacing. */
.gv-page {
    width: 100%;
    padding: 24px;
}

/* ThemeService already supplies an rgba app-bar background.
   This adds only the requested frost effect; palette colors,
   border and elevation continue to come from MudBlazor. */
.gv-appbar-blur {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

@media (max-width: 600px) {
    .gv-page {
        padding: 16px;
    }
}


/* ── Shared / Dialogs ────────────────────────────────────
   Used by: all pages that open a MudDialog or MudMessageBox
   What:    frosted-glass backdrop behind modal overlays     */
.blur_background_class {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ── AdminsPage — row action menu ───────────────────────
   Used by: Features/Admin/AdminsPage.razor
   What:    removes the border/shadow from the MoreVert
            icon button that activates the per-row menu    */
.settings-menu .mud-menu-icon-button-activator {
    border: none;
    box-shadow: none;
}

/* ── AdminsPage — row action menu popover ───────────────
   Used by: Features/Admin/AdminsPage.razor
   What:    tightens the padding inside the floating
            dropdown list of the per-row action menu.
   Note:    MudBlazor popovers render outside the component
            tree (appended to <body>), so scoped CSS never
            reaches them — must live here.                 */
.SettingsMenuPopover .mud-menu-list {
    padding-inline: 4px;
    padding-block: 4px;
}


/* ── TwoFactorPage & TwoFactorSetupPage — code input ────
   Used by: Features/Auth/TwoFactorPage.razor
            Features/Auth/TwoFactorSetupPage.razor
   What:    makes the 6-digit MudCodeInput (MudExtensions)
            fill the container width evenly with no gaps,
            and caps each individual digit box at 42 px    */
.mud-code-input-inner {
    justify-content: space-between !important;
    gap: 0 !important;
}

.mud-code-input-inner > * {
    flex: 1 !important;
    max-width: 42px;
}

/* ── Dialog header gradient — color variants ─────────────
   Used by: TitleClass on all MudDialog components
   What:    subtle gradient accent on the dialog title bar,
            color-matched to the action context (primary,
            warning, error, success, info).
   How:     set TitleClass="custom-header-bg[-variant]"      */
.custom-header-bg,
.custom-header-bg-warning,
.custom-header-bg-error,
.custom-header-bg-success,
.custom-header-bg-info {
    border-bottom: 1px solid var(--mud-palette-lines-default);
    padding: 20px 24px;
}
.custom-header-bg         { background: linear-gradient(90deg, color-mix(in srgb, var(--mud-palette-primary) 18%, transparent) 0%, transparent 100%) !important; }
.custom-header-bg-warning { background: linear-gradient(90deg, color-mix(in srgb, var(--mud-palette-warning) 18%, transparent) 0%, transparent 100%) !important; }
.custom-header-bg-error   { background: linear-gradient(90deg, color-mix(in srgb, var(--mud-palette-error)   18%, transparent) 0%, transparent 100%) !important; }
.custom-header-bg-success { background: linear-gradient(90deg, color-mix(in srgb, var(--mud-palette-success) 18%, transparent) 0%, transparent 100%) !important; }
.custom-header-bg-info    { background: linear-gradient(90deg, color-mix(in srgb, var(--mud-palette-info)    18%, transparent) 0%, transparent 100%) !important; }

/* ── Shared dialog/form rhythm ─────────────────────────── */
.mud-dialog-content {
    padding: 24px !important;
}

.mud-dialog-content > .mud-stack {
    gap: 16px;
}

.mud-dialog-content .mud-input-control {
    width: 100%;
}

.mud-dialog-actions {
    gap: 8px;
    padding: 12px 24px 20px !important;
}

/* ── Shared entity-detail structure ────────────────────── */
.gv-detail-header {
    margin-bottom: 16px;
}

.gv-detail-header-layout {
    gap: 16px;
}

.gv-detail-actions {
    margin-left: auto;
}

.gv-detail-tabs {
    overflow: hidden;
}

.gv-detail-section {
    height: 100%;
    border: 1px solid var(--mud-palette-lines-default);
    background-color: color-mix(in srgb, var(--mud-palette-surface) 96%, var(--mud-palette-primary) 4%);
}

@media (max-width: 600px) {
    .gv-detail-header-layout,
    .gv-detail-actions {
        width: 100%;
    }

    .gv-detail-actions {
        justify-content: flex-end;
    }

    .mud-dialog-content {
        padding: 20px 16px !important;
    }

    .mud-dialog-actions {
        padding: 12px 16px 16px !important;
    }
}

/* ── File dropzone — shared box for every file upload ────
   Used by: every page/dialog in the Dashboard that lets the
            user pick a file (onboarding ID, ban evidence,
            asset/tool/DLL/manifest uploads).
   What:    dashed-border clickable box that also accepts a
            native HTML5 drag-and-drop, replacing the old mix
            of plain "Choose File" outline buttons and readonly
            textfield+adornment-icon triggers. JS side lives in
            js/fileDropzone.js (gvFileDropzone.init).
   Why not MudFileUpload: its internal <InputFile> gets a NEW,
   private, auto-generated id after every selection (so the
   same file can be re-picked twice) -- our direct-to-S3 upload
   JS (gvUploadXxxDirect) needs a FIXED id to read
   input.files[i] straight from the DOM without ever bringing
   the bytes into the Blazor Server circuit. This box is a thin
   wrapper around that same fixed-id hidden <InputFile>, not a
   replacement for it -- keep it that way.                     */
.gv-dropzone {
    border: 2px dashed var(--mud-palette-lines-default);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}
.gv-dropzone:hover,
.gv-dropzone.gv-dropzone-active {
    border-color: var(--mud-palette-primary);
    background-color: color-mix(in srgb, var(--mud-palette-primary) 6%, transparent);
}

/* Compact row variant — for dialogs that pack several file
   fields alongside other inputs (DLLs, jars, manifests) where
   a full vertical box per field would make the form too tall. */
.gv-dropzone-compact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-align: left;
}

/* ── Avatar edit overlay — click-to-change avatar on a profile
   header (MyProfilePage, StaffDetailPage). The avatar itself
   stays plain; a dark circular layer + centered camera icon
   only appears on hover, matching a normal "edit this image"
   affordance instead of a permanently-visible badge button. */
.gv-avatar-edit {
    position: relative;
    display: inline-block;
    border-radius: 50%;
    cursor: pointer;
}
.gv-avatar-edit-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    opacity: 0;
    transition: opacity .15s ease;
    pointer-events: none;
}
.gv-avatar-edit:hover .gv-avatar-edit-overlay {
    opacity: 1;
}

/* ── Toolbar row — uniform 40px controls ─────────────────
   Used by: every page-top action bar (Refresh/Create/Export,
   search fields, MudSelect/MudDatePicker filters) -- add
   Class="gv-toolbar" to that MudStack. Without this, Outlined
   Dense inputs render ~43-44px tall while default MudButtons
   render ~36-38px, so the row looks jagged (each control's
   height comes from its own padding+line-height, MudBlazor
   never hard-sets one). Both .mud-input and .mud-button-root
   are already `display:inline-flex; align-items:center` in
   MudBlazor's own CSS, so forcing height+border-box here just
   re-centers their content -- no clipping, no need to touch
   internal padding.                                          */
.gv-toolbar .mud-button-root,
.gv-toolbar .mud-input.mud-input-outlined {
    height: 40px;
    box-sizing: border-box;
}


/* ── ReconnectModal ──────────────────────────────────────
   Moved from ReconnectModal.razor.css to avoid Blazor CSS
   isolation scope mismatch (b-xxxxx) breaking visibility  */
#components-reconnect-modal {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1400;
    overflow: hidden;
    background-color: transparent;
    border: none;
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    padding: 0;
}

    #components-reconnect-modal::backdrop {
        background: rgba(10, 16, 28, 0.5);
    }

    #components-reconnect-modal.components-reconnect-show,
    #components-reconnect-modal[open],
    #components-reconnect-modal.components-reconnect-failed,
    #components-reconnect-modal.components-reconnect-repeated-attempt,
    #components-reconnect-modal.components-reconnect-paused,
    #components-reconnect-modal.components-reconnect-resume-failed,
    #components-reconnect-modal.components-pause,
    #components-reconnect-modal.components-resume-failed {
        display: flex;
        align-items: center;
        justify-content: center;
    }

.components-reconnect-backdrop {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(90% 60% at 80% 0%, color-mix(in srgb, var(--mud-palette-primary, #594AE2) 12%, transparent), transparent 60%), radial-gradient(80% 55% at 0% 100%, color-mix(in srgb, var(--mud-palette-info, #2196f3) 16%, transparent), transparent 62%), rgba(8, 12, 20, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.components-reconnect-surface {
    width: min(480px, 100%);
    border-radius: var(--mud-default-borderradius, 12px);
    border: 1px solid color-mix(in srgb, var(--mud-palette-lines-default, #e0e0e0) 70%, transparent);
    background: var(--mud-palette-surface, #fff);
    box-shadow: var(--mud-elevation-24, 0 16px 30px rgba(0, 0, 0, 0.28));
    color: var(--mud-palette-text-primary, #1f2937);
    padding: 20px 20px 18px;
}

.components-reconnect-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

    .components-reconnect-header h2 {
        margin: 0;
        font-size: 1.05rem;
        font-weight: 600;
        line-height: 1.3;
    }

.components-reconnect-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--mud-palette-warning, #f59e0b);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--mud-palette-warning, #f59e0b) 25%, transparent);
}

.components-reconnect-supporting,
.components-reconnect-message {
    margin: 0;
    line-height: 1.45;
    font-size: 0.95rem;
}

.components-reconnect-supporting {
    color: var(--mud-palette-text-secondary, #52607a);
    margin-bottom: 14px;
}

.components-reconnect-message {
    font-weight: 500;
}

.components-reconnect-danger {
    color: var(--mud-palette-error, #b00020);
}

.components-reconnect-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.components-reconnect-first-attempt-visible,
.components-reconnect-repeated-attempt-visible,
.components-reconnect-failed-visible,
.components-pause-visible,
.components-resume-failed-visible {
    display: none;
}

dialog[open].components-reconnect-show .components-reconnect-first-attempt-visible {
    display: block;
}

dialog[open].components-reconnect-show .components-rejoin-loader {
    display: inline-flex;
}

dialog[open].components-reconnect-failed .components-reconnect-failed-visible {
    display: block;
}

dialog[open].components-reconnect-failed #components-reconnect-button {
    display: block;
}

dialog[open].components-reconnect-repeated-attempt .components-reconnect-repeated-attempt-visible {
    display: block;
}

dialog[open].components-reconnect-repeated-attempt .components-rejoin-loader {
    display: inline-flex;
}

dialog[open].components-reconnect-paused .components-pause-visible,
dialog[open].components-pause .components-pause-visible {
    display: block;
}

dialog[open].components-reconnect-paused #components-resume-button,
dialog[open].components-pause #components-resume-button,
dialog[open].components-reconnect-resume-failed #components-resume-button,
dialog[open].components-resume-failed #components-resume-button {
    display: block;
}

dialog[open].components-reconnect-resume-failed .components-resume-failed-visible,
dialog[open].components-resume-failed .components-resume-failed-visible {
    display: block;
}

.components-rejoin-loader {
    display: none;
    margin-bottom: 10px;
    gap: 8px;
}

    .components-rejoin-loader div {
        width: 9px;
        height: 9px;
        border-radius: 50%;
        background-color: var(--mud-palette-primary, #594AE2);
        animation: reconnect-pulse 1.2s infinite ease-in-out both;
    }

        .components-rejoin-loader div:nth-child(1) {
            animation-delay: -0.24s;
        }

        .components-rejoin-loader div:nth-child(2) {
            animation-delay: -0.12s;
        }

@keyframes reconnect-pulse {
    0%, 80%, 100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

#components-reconnect-button,
#components-resume-button {
    display: none;
    min-width: 92px;
    cursor: pointer;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 999px;
    background-color: var(--mud-palette-primary, #594AE2);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    transition: filter 140ms ease, transform 140ms ease;
}

    #components-reconnect-button:hover,
    #components-resume-button:hover {
        filter: brightness(0.95);
    }

    #components-reconnect-button:active,
    #components-resume-button:active {
        transform: translateY(1px);
    }

@media (max-width: 600px) {
    .components-reconnect-backdrop {
        padding: 14px;
    }

    .components-reconnect-surface {
        padding: 16px;
    }
}

/* -- Gestor de archivos del server (ServerFilesPanel / ServerFileEditor) -- */

/* Archivo abierto en el editor: se marca en la lista con el primario de la paleta. */
.gv-file-row-selected,
.gv-file-row-selected:hover {
    background-color: color-mix(in srgb, var(--mud-palette-primary) 14%, transparent) !important;
}

/* Barra de ruta a todo el ancho, con el mismo borde de los paneles de abajo. */
.gv-path-bar {
    padding: 8px 16px;
}

/* Dos paneles del MISMO tamano: cada columna es 1fr y ninguna baja de 440px. Si no caben dos, se apilan (auto-fit + minmax).
   align-items: stretch iguala el alto de ambos al del mas alto, sea la lista o el editor. */
.gv-files-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
    gap: 16px;
    align-items: stretch;
}

/* Cada panel es una columna flex: el contenido crece y el pie (paginador) queda pegado al fondo. min-width: 0 evita que
   una tabla ancha empuje la columna mas alla de su 1fr. */
.gv-files-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 520px;
    overflow: hidden;
}

/* Estructura comun de los DOS paneles: encabezado y pie de alto FIJO e igual en ambos (asi quedan simetricos lado a lado), y un
   cuerpo que crece. Los pies quedan dentro de la tarjeta, no flotando debajo. */
.gv-pane-header,
.gv-pane-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
    box-sizing: border-box;
    padding: 0 16px;
}

.gv-pane-header {
    height: 64px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.gv-pane-footer {
    height: 48px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.gv-pane-body {
    flex: 1 1 auto;
    min-height: 0;
}

.gv-files-empty {
    height: 100%;
}

/* La lista va sin borde propio: el borde lo pone el panel. */
.gv-files-grid.mud-table {
    border: 0;
    background: transparent;
}

/* La fila Name / Size / Actions es el encabezado del panel izquierdo y mide lo mismo que el del editor (64px), para que los dos
   queden a la misma altura lado a lado. */
.gv-files-grid .mud-table-head .mud-table-cell {
    height: 64px;
    box-sizing: border-box;
    padding-top: 0;
    padding-bottom: 0;
}

/* Filas mas compactas: con 15 por pagina y dos lineas por fila (nombre + fecha) el alto por defecto de MudBlazor alarga el panel. */
.gv-files-grid .mud-table-body .mud-table-cell {
    padding-top: 6px;
    padding-bottom: 6px;
}

/* La tabla llena el panel y el paginador (MudDataGridPager, el mismo de Admins y Users) queda pegado al fondo con el alto del pie
   del editor (48px), aunque la carpeta tenga pocas filas. */
.gv-files-grid.mud-table {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gv-files-grid .mud-table-container {
    flex: 1 1 auto;
}

.gv-files-grid .mud-table-pagination {
    flex: 0 0 auto;
    min-height: 48px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.gv-files-grid .mud-table-pagination .mud-toolbar {
    min-height: 48px;
}

/* El editor es el hijo directo del panel (que ya es una columna flex) y reparte igual: encabezado, Monaco, pie. */
.gv-file-editor {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

/* Monaco mide su contenedor (AutomaticLayout): crece hasta llenar el panel y nunca baja de un alto usable. */
.gv-server-editor {
    flex: 1 1 auto;
    width: 100%;
    min-height: 420px;
}
