/* ========================================
   FLUENT UI IMPORTS & BASE STYLES
   ======================================== */
@import '/_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css';

/* ========================================
   FLUENT UI V5 TOKEN-BRO (#1639)
   V4 (FAST) design-tokens finnes ikke i V5. Variablene under brukes i inline-
   styles over hele løsningen; her pekes de til Fluent 2-ekvivalentene slik at
   lys/mørk modus følger med. Fjernes etter hvert som bruksstedene skrives om
   til --color*-tokens direkte (fase 8, #1645).
   ======================================== */
:root {
    --neutral-foreground-rest: var(--colorNeutralForeground1);
    --neutral-foreground-hint: var(--colorNeutralForeground3);
    --neutral-foreground-secondary: var(--colorNeutralForeground2);
    --accent-fill-rest: var(--colorBrandBackground);
    --accent-fill-hover: var(--colorBrandBackgroundHover);
    --accent-fill-active: var(--colorBrandBackgroundPressed);
    --accent-foreground-rest: var(--colorBrandForeground1);
    --accent-layer-1: var(--colorBrandBackground2);
    --neutral-stroke-rest: var(--colorNeutralStroke1);
    --neutral-stroke-divider-rest: var(--colorNeutralStroke2);
    --neutral-stroke-divider: var(--colorNeutralStroke2);
    --neutral-layer-1: var(--colorNeutralBackground1);
    --neutral-layer-2: var(--colorNeutralBackground2);
    --neutral-layer-3: var(--colorNeutralBackground3);
    --neutral-layer-4: var(--colorNeutralBackground4);
    --neutral-fill-rest: var(--colorNeutralBackground1);
    --neutral-fill-hover: var(--colorNeutralBackground1Hover);
    --neutral-fill-active: var(--colorNeutralBackground1Pressed);
    --neutral-fill-stealth-rest: var(--colorSubtleBackground);
    --neutral-fill-secondary-rest: var(--colorNeutralBackground2);
    --neutral-fill-strong-rest: var(--colorNeutralForeground2);
    --fill-color: var(--colorNeutralBackground1);
    --type-ramp-base-font-size: var(--fontSizeBase300);
    --type-ramp-base-line-height: var(--lineHeightBase300);

    /* Statusfarger som tidligere var udefinerte i løsningen */
    --error: var(--colorStatusDangerForeground1);
    --error-color: var(--colorStatusDangerForeground1);
    --error-bg: var(--colorStatusDangerBackground1);
    --warning: var(--colorStatusWarningForeground1);
    --warning-color: var(--colorStatusWarningForeground1);
    --warning-bg: var(--colorStatusWarningBackground1);
    --success: var(--colorStatusSuccessForeground1);
    --success-color: var(--colorStatusSuccessForeground1);
    --success-bg: var(--colorStatusSuccessBackground1);
    --info: var(--colorPaletteBlueForeground2);
    --info-color: var(--colorPaletteBlueForeground2);
    --info-bg: var(--colorPaletteBlueBackground2);
    --highlight-bg: var(--colorBrandBackground2);
}

/* Base body styling */
body {
    --body-font: "Segoe UI Variable", "Segoe UI", sans-serif;
    font-family: var(--body-font);
    font-size: var(--type-ramp-base-font-size);
    line-height: var(--type-ramp-base-line-height);
    margin: 0;
}

/* V5: FluentHeader brukt som seksjonsoverskrift inne i sidene er erstattet med div.section-header */
.section-header {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 12px;
    font-size: var(--fontSizeBase500);
    line-height: var(--lineHeightBase500);
    font-weight: var(--fontWeightSemibold);
    color: var(--colorNeutralForeground1);
    background-color: var(--colorNeutralBackground2);
    border-radius: var(--borderRadiusMedium);
}

/* V5: FluentPopover har ikke lenger Header/Body/Footer-slots */
.popover-header { display: flex; align-items: center; gap: 8px; font-weight: var(--fontWeightSemibold); margin-bottom: 8px; }
.popover-body { }
.popover-footer { margin-top: 8px; }

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

/* Main content area */
.main {
    height: calc(100dvh - 96px);
    color: var(--neutral-foreground-rest);
    overflow-y: scroll;
}

/* Content wrapper */
.content {
    margin: 0 10px;
}

/* Body layout with help sidebar */
.bodymain {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    padding-right: 15px;
    margin-right: 20px;
}

.bodyhelp {
    width: 400px;
    float: right;
    /* #942: pin to the viewport and scroll internally so long help content
       (e.g. the GSI field map) no longer overflows off the bottom. */
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    margin-left: 10px;
    padding-bottom: 24px;
    box-sizing: border-box;
    background-color: var(--neutral-fill-hover);
    border-left: 1px solid var(--neutral-fill-active);
}

.bodyStack {
    overflow: auto;
}

/* ========================================
   HEADER COMPONENTS
   ======================================== */

/* Header container */
.header {
    background-color: var(--fill-color) !important;
    color: var(--neutral-foreground-rest) !important;
}

.strigooheader {
    background-color: var(--neutral-layer-2) !important;
}

/* Header links and logo */
.headerlink {
    text-decoration: none;
    font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
}

.headerlogo {
    width: 200px;
}

/* Header navigation icons */
ul.headericons {
    /* Base list styling */
}

ul.headericons li {
    height: 50px;
    text-decoration: none;
    min-width: 35px;
    display: table-cell;
    text-align: center;
    vertical-align: middle;
    padding-top: 12px;
}

ul.headericons li:hover {
    background-color: var(--neutral-fill-hover);
    color: var(--var-neutral-fill-rest);
}

ul.headericons li svg {
    /* SVG icon styling */
}

/* Commented out alternative header icon styling
ul.headericons li a {
    color: var(--accent-foreground-rest);
}
ul.headericons li a:focus {
    outline: 1px dashed;
    outline-offset: 3px;
}
ul.headericons li a:hover {
    text-decoration: underline;
}
*/

.headericon {
    color: var(--accent-foreground-rest);
}

.headertext {
    /* Header text styling */
}

/* Header user profile section */
.headerperson {
    height: 50px;
    padding-top: 6px;
    width: 250px;
    color: var(--info);
    cursor: pointer;
}

.headerperson:hover {
    background-color: var(--neutral-fill-hover);
}

.headerpersontext {
    margin-right: 10px;
}

.headerpersontext span {
    height: 12px;
    display: block;
    margin: 0 0;
    padding: 0 0;
    text-align: left;
}

.headerpersontextemail {
    font-size: 0.8em;
}

.headerpersontextorganization {
    font-size: 0.7em;
}

.headerpersona {
    width: 28px;
    display: block;
    float: left;
    padding-top: 5px;
    margin-left: 15px;
}

/* Header popover styling */
.headerpopover {
    background-color: var(--fill-color) !important;
    color: var(--neutral-foreground-rest) !important;
    min-width: 300px;
    min-height: 500px;
}

/* ========================================
   FOOTER COMPONENTS
   ======================================== */

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

footer .left {
    grid-column: 2;
    justify-content: start;
}

footer .right {
    grid-column: 3;
    justify-self: end;
}

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;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Alignment utilities */
.left {
    text-align: left;
}

/* Size utilities */
.small {
    font-size: 0.7em;
}

/* Spacing utilities - Right margin */
.spaceRight50 {
    margin-right: 50px;
}

.spaceRight30 {
    margin-right: 30px;
}

.spaceRight20 {
    margin-right: 20px;
}

.spaceRight10 {
    margin-right: 10px;
}

.spaceRight5 {
    margin-right: 5px;
}

/* Spacing utilities - Top margin */
.spaceTop10 {
    margin-top: 10px;
}

.spaceTopAndBottom10 {
    margin-top: 10px;
    margin-bottom: 10px;
}

.spaceBottom10 {
    margin-bottom: 10px;
}

/* Width utilities with margins */
.fullwidthMargin10 {
    width: 100%;
    margin: 10px;
}

.fullwidthMargin20 {
    width: 100%;
    margin: 20px;
}

/* ========================================
   TABLE COMPONENTS
   ======================================== */

table {
    /* Base table styling */
}

table .formInputText {
    padding-right: 5px;
}

/* #900: layout-neutral Report* input fields (Strigoo.Web.Common.UI.Components/InputFields).
   Standalone, a .report-field is a label-left flex row. Inside a .report-form grid the
   field uses display:contents so its label/control become grid items in shared columns —
   the same cross-row label alignment the old <table><tr><td> layout gave, without
   requiring a table ancestor. .report-field-full spans both columns (old colspan=2).
   Responsive (parity with the old tables, which compressed on narrow screens): the label
   column wraps under pressure (fit-content, not max-content), controls may shrink
   (min-width:0; the inputs themselves are width:100% capped at their Width), and below
   640px fields stack label-above-control. */
.report-form {
    display: grid;
    grid-template-columns: fit-content(45%) 1fr;
    column-gap: 5px; /* replaces table .formInputText padding-right */
    row-gap: 6px;
    align-items: center;
    width: fit-content;
    max-width: 100%;
}

.report-field {
    display: flex;
    align-items: center;
    gap: 5px;
}

.report-field-control {
    min-width: 0; /* let grid/flex shrink the control below its content width */
}

/* OmittLabel renders an empty label slot for grid-column parity; outside a grid it is
   just dead width (flex gap) — hide it there, keep it as a grid item inside .report-form. */
.report-field > .report-field-label:empty {
    display: none;
}

.report-form > .report-field > .report-field-label:empty {
    display: block;
}

.report-form > .report-field {
    display: contents;
}

.report-form > .report-field.report-field-full,
.report-field-full {
    display: block;
    grid-column: 1 / -1;
}

/* Narrow screens: stack label above control instead of forcing two columns. */
@media (max-width: 640px) {
    .report-form {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .report-form > .report-field {
        display: block;
    }

    .report-field {
        flex-wrap: wrap;
    }
}

tr.tablerow {
    height: 35px;
}

table tr.separator {
    height: 35px;
}

.paddingBetweenCols td {
    padding: 0 15px;
}

.summary-row {
    font-weight: bold;
    background-color: var(--neutral-fill-hover);
    margin-bottom: 5px;
    border-top: 1px solid var(--accent-fill-rest);
    border-bottom: 2px double var(--accent-fill-rest);
}
/* ========================================
   SPECIALIZED COMPONENTS
   ======================================== */
/* Alert component */
.alert {
    border: 1px dashed var(--accent-fill-rest);
    padding: 5px;
}

/* Product popover - Not Authorized page */
.productpopover {
    max-width: 300px;
}

/* Help accordion component */
.helpaccordian {
    /* background-color: var(--neutral-fill-hover); */
}

/* Meldingsbokser: linjeskift i teksten (\n) vises som linjeskift, slik de gjorde før V5. */
.fluent-message-box .message {
    white-space: pre-line;
}

/* Datatabeller med lange kolonneoverskrifter: overskriften får gå over to linjer
   i stedet for å presse de andre kolonnene sammen. Brukes med Class="grid-wrap-headers". */
table.grid-wrap-headers th fluent-button[col-sort-button] {
    white-space: normal;
    height: auto;
    min-width: 0;
    text-align: start;
}

table.grid-wrap-headers th [col-title-text] {
    white-space: normal;
}

/* Overskriftsraden vokser når en overskrift går over flere linjer, og overskriftene
   har litt mindre luft på sidene slik at de sjeldnere må deles. */
table.grid-wrap-headers th {
    height: auto !important;
    min-height: 46px !important;
    align-self: stretch; /* alle overskriftscellene like høye, så linjen under blir rett */
}

table.grid-wrap-headers th fluent-button[col-sort-button] {
    padding: 0 8px;
}

table.grid-wrap-headers th [col-title] {
    padding: 6px 8px;
}

/* Sticky calculation panel */
.sticky-calculation-panel {
    position: sticky !important;
    top: 20px !important;
   /* z-index: 100 !important;*/
    max-height: calc(100vh - 40px) !important;
    overflow-y: auto !important;
}

/* ========================================
   BLAZOR ERROR HANDLING & LOADING
   ======================================== */

/* Blazor error UI */
#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 */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI26My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA9NC4wODE1IDI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em 3.7rem;
    color: white;
}

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

/* Loading progress indicator */
.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");
}

/* ========================================
   PREVIEW / TEST FEATURE
   ======================================== */

/*fluent-card {
    border-left: 4px solid var(--accent-fill-rest);
}
*/
/* ========================================
   CODE STYLING
   ======================================== */

code {
    color: #c02d76;
}

/* Help component styling for Workplanner */

.helpaccordian {
    margin: 8px 0;
    border: 1px solid var(--neutral-stroke-divider-rest);
    border-radius: 4px;
}

.helpaccordian fluent-accordion-item {
    border: none;
}

    .helpaccordian fluent-accordion-item::part(button) {
        background: var(--neutral-layer-1);
        color: var(--neutral-foreground-rest);
        font-size: 14px;
        padding: 12px 16px;
    }

        .helpaccordian fluent-accordion-item::part(button):hover {
            background: var(--neutral-layer-2);
        }

    /* V5 låser overskriften til 44px. En innledning som går over to linjer ble dermed kuttet. */
    .helpaccordian fluent-accordion-item::part(heading),
    .helpaccordian fluent-accordion-item::part(button) {
        height: auto;
        min-height: 44px;
    }

    .helpaccordian fluent-accordion-item[expanded]::part(button) {
        background: var(--accent-fill-rest);
        color: var(--accent-foreground-rest);
    }

    .helpaccordian fluent-accordion-item::part(region) {
        padding: 16px;
        background: var(--neutral-layer-1);
        border-top: 1px solid var(--neutral-stroke-divider-rest);
    }

    .helpaccordian fluent-accordion-item p {
        margin: 0 0 12px 0;
        line-height: 1.5;
    }

        .helpaccordian fluent-accordion-item p:last-child {
            margin-bottom: 0;
        }