﻿@import '/_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css';

/* ===== HTML ROOT ELEMENT ===== */
html {
    height: 100%;
    overflow-x: hidden; /* Prevent horizontal overflow */
    overflow-y: auto; /* Allow vertical scroll when needed */
}

body {
    height: 100vh; /* Fixed height for proper flex layout */
    overflow: hidden; /* Prevent body scroll, let layout handle it */
    margin: 0;
    padding: 0;
}

fluent-design-system-provider {
    display: contents;
}

/* ===== LAYOUT STRUCTURE ===== */

/* Ensure FluentLayout takes full height and uses flex layout */
fluent-layout {
    height: 100vh !important; /* Force full height */
    display: flex !important;
    flex-direction: column !important;
}

/* Header stays at top */
fluent-header {
    flex-shrink: 0 !important;
}

/* Main content area - grows to fill available space */
.main {
    -webkit-flex-grow: 1;
    flex-grow: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden; /* Prevent main area overflow */
    min-height: 0; /* Allow flex children to shrink */
}

/* FluentStack with class main should fill height */
fluent-stack.main {
    height: 100% !important;
    flex-grow: 1 !important;
}

/* Main body content should be scrollable and fill space */
fluent-body-content.main {
    overflow-y: auto !important; /* Allow scrolling within content area */
    flex-grow: 1 !important;
    min-height: 0 !important; /* Allow content to shrink */
    height: 100% !important;
}

/* Footer stays at bottom - force proper positioning */
fluent-footer {
    flex-shrink: 0 !important;
    margin-top: auto !important; /* Push footer to bottom when content is short */
    position: relative !important; /* Ensure proper positioning context */
}

.do-theme, .do-theme * {
    font-family: "Raleway", sans-serif !important;
    font-optical-sizing: auto;
    font-style: normal;
    font-variation-settings: unset !important;
    --font-color: #121929;
    --accent-fill-rest: #084AD9;
    --accent-fill-hover: #0951EC;
    --neutral-foreground-rest: #031B4D;
    --neutral-foreground-hover: #06369D;
    --neutral-fill-hover: #F8F9FC;
    --neutral-fill-stealth-rest: #FCFCFE;
    --neutral-fill-stealth-hover: #F1F3F9;
    --neutral-fill-secondary-rest: #F1F3F9;
    --neutral-fill-inverse-rest: #A9B8DB;
    --neutral-layer-4: #E2E7F3;
    --datagrid-hover-color: var(--neutral-fill-stealth-rest);
    --success: #2CAB2C;
    --error: #dc2626;
    --warning: #f59e0b;
    --design-unit: 5;
    --bar-h: 300px;
    --col-w: 110px; /* a hair wider */
    --tooltip-w: 130px;
    --tooltip-bg: #fff;
    --tooltip-border: #c9ced6;
    --tooltip-text: #223;
    --grid: #e8ebf0; /* grid‑line colour */
}

    .do-theme .fluent-input-label span[aria-label='required'] {
        font-size: var(--type-ramp-plus-3-font-size);
    }

.fluent-typography {
    color: var( --font-color) !important;
}

        .fluent-typography[bold] {
            font-weight: 500 !important;
        }

.fluent-toast {
    height: 4rem;
    display: flex;
    justify-content: center;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    padding-top: 0.8rem !important;
    padding-bottom: 0.8rem !important
}

        .fluent-toast > div {
            column-gap: 1rem !important;
        }

            .fluent-toast > div > svg {
                min-width: 1.2rem !important;
            }

.fluent-toast-title {
    font-size: 0.90rem;
}

.fluent-toast-action {
    position: absolute;
    right: 1rem;
    top: 0.8rem;
}

.fluent-autocomplete-multiselect > fluent-text-field
{
    min-height: 3rem;
}

.fluent-autocomplete-multiselect fluent-badge > span {
    height: 1.5rem;
    padding: 0.5rem;
}

.header {
    background-color: var(--neutral-foreground-rest) !important;
}

    .header .header-gutters {
        justify-content: space-between;
    }

.fluent-grid[spacing="1"] > div {
    padding: 0px;
}

.visibility-anchor {
    display: none;
}

    .visibility-anchor.hidden + * {
        opacity: 0;
        transition: opacity 200ms ease-out;
    }

    .visibility-anchor.visible + * {
        opacity: 1;
        transition: opacity 200ms ease-in;
    }

.fluent-input-label {
    width: fit-content;
    width: -moz-fit-content;
}

form {
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    flex-grow: 1;
    height: 100%;
}

.fluent-grid {
    height: inherit;
}

.navmenu-icon {
    display: none;
}

.module-menu {
    background-color: transparent;
}

.organization-menu {
    max-height: 200px;
    overflow-y: auto
}

footer {
    background: var(--neutral-layer-4);
    color: var(--neutral-foreground-rest);
    align-items: center;
    padding: 10px 10px;
}

    footer a {
        color: var(--neutral-foreground-rest);
        text-decoration: none;
    }

        footer a:focus {
            outline: 1px dashed;
            outline-offset: 3px;
        }

        footer a:hover {
            text-decoration: underline;
        }

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    margin: 20px 0;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA9NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::before {
        content: "An error has occurred. "
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

@media (max-width: 640px) {
    .do-theme, .do-theme * {      
        --design-unit: 5;
    }

    .header-gutters {
        margin: 0.5rem 3rem 0.5rem 1.5rem !important;
    }

    [dir="rtl"] .header-gutters {
        margin: 0.5rem 1.5rem 0.5rem 3rem !important;
    }

    .main {
        flex-direction: column !important;
        row-gap: 0 !important;
    }

    /* Mobile navigation */
    nav.sitenav {
        width: 100%;
        height: 100%;
    }

    #main-menu {
        width: 100% !important;
    }

        #main-menu > div:first-child:is(.expander) {
            display: none;
        }

    .navmenu {
        width: 100%;
    }

    #navmenu-toggle {
        appearance: none;
    }

        #navmenu-toggle ~ nav {
            display: none;
        }

        #navmenu-toggle:checked ~ nav {
            display: block;
        }

    .navmenu-icon {
        cursor: pointer;
        z-index: 10;
        display: block;
        position: absolute;
        top: 15px;
        left: unset;
        right: 20px;
        width: 20px;
        height: 20px;
        border: none;
    }

    [dir="rtl"] .navmenu-icon {
        left: 20px;
        right: unset;
    }   

    fluent-dialog::part(control) {
        width: 100vh !important;
        height: 100vh !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0;
    }

    fluent-dialog .fluent-dialog-header,
    fluent-dialog .fluent-dialog-body {
        padding: 1rem !important;
    }

    fluent-dialog .fluent-dialog-footer {
        padding: 2rem !important;
        justify-content: space-between !important;
    }
}

/* ===== DRAG AND DROP GRID STYLES ===== */

/* Drag handle column */
.drag-handle-column {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    padding: 0 !important;
    text-align: center !important;
}

/* Drag handle row wrapper */
.drag-handle-row {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Drag handle cell */
.drag-handle-cell {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    padding: 8px !important;
    cursor: grab !important;
    user-select: none !important;
    opacity: 0.5 !important;
    transition: opacity 0.2s ease !important;
}

.drag-handle-cell:hover {
    opacity: 1 !important;
}

.drag-handle-cell:active {
    cursor: grabbing !important;
}

/* Row being dragged */
.drag-handle-row.dragging {
    opacity: 0.5 !important;
}

.drag-handle-row.dragging .drag-handle-cell {
    cursor: grabbing !important;
}

/* Row being dragged over (drop target) */
.drag-handle-row.drag-over {
    border-top: 2px solid var(--accent-fill-rest) !important;
    border-bottom: 2px solid var(--accent-fill-rest) !important;
}

/* ===== ROW SPANNING GRID STYLES ===== */

/* Content within the spanning row */
.row-span-content {
    padding: 0.75rem 1rem !important;
    min-height: 2.5rem !important;
    display: block !important;
    width: 100% !important;
    white-space: normal !important; /* Allow text to wrap */
    word-wrap: break-word !important; /* Break long words if needed */
    line-height: 1.5 !important; /* Comfortable line spacing */
}

/* The cell containing row-span-content spans from its natural position to before the actions column */
td:has(.row-span-content),
fluent-data-grid-row td:has(.row-span-content) {
    grid-column-end: -2 !important; /* End before actions column */
    padding: 0 !important;
    height: auto !important;
}

/* Allow the entire row to expand in height when it contains spanning content */
tr:has(.row-span-content),
fluent-data-grid-row:has(.row-span-content) {
    height: auto !important;
    min-height: 58px !important;
}

/* Ensure all cells in the row (drag handle, actions) match the row height */
tr:has(.row-span-content) td,
fluent-data-grid-row:has(.row-span-content) td {
    height: 100% !important;
    align-self: stretch !important;
}

/* Enable hover effect on rows with spanning content */
tr:has(.row-span-content):hover,
fluent-data-grid-row:has(.row-span-content):hover {
    background-color: var(--datagrid-hover-color) !important;
}

/* Ensure the spanning cell also inherits the hover background */
tr:has(.row-span-content):hover td:has(.row-span-content),
fluent-data-grid-row:has(.row-span-content):hover td:has(.row-span-content) {
    background-color: var(--datagrid-hover-color) !important;
}

/* Hide columns that come AFTER the row-span column (but before actions) */
tr:has(.row-span-content) td:has(.row-span-content) ~ td:not(.actions-column),
fluent-data-grid-row:has(.row-span-content) td:has(.row-span-content) ~ td:not(.actions-column) {
    display: none !important;
}

/* Hide duplicate content in the spanning cell itself */
td:has(.row-span-content) *:not(.row-span-content) {
    display: none !important;
}







