:root {
    --overlay-blur: 3px;
    --size-control-height: 1.75rem;
    --size-default-radius: 2px;
    --app-main-nav-width: 256px;
    --app-main-nav-width-collapsed: 52px;
    --app-max-width: 120rem;
    --app-panel-width: 14rem;
    --padding-x-tiny: 0.25rem;
    --padding-xx-tiny: 0.15rem;
    --padding-xxx-tiny: 0.05rem;
    --padding-tiny: 0.5rem;
    --padding-small: 0.75rem;
    --padding: 1rem;
    --padding-x-large: 1.5rem;
    --padding-large: 2rem;
    --padding-larger: 4rem;
    --size-text-small: 0.75rem;
    --size-text-medium: 0.875rem;
    /* Colors */
    /* =============================================================================================================== */
    /* !!!  SOME OF THE THEME COLORS USED FOR THE BlazorFluentUI COMPONENTS ARE DEFINED IN FluentDesignPalette.cs !!!  */
    /* =============================================================================================================== */

    --primary-50: #E9F5EE;
    --primary-100: #C4E1D1;
    --primary-200: #9FCDB3;
    --primary-300: #6EB38A;
    --primary-400: #4E9668;
    --primary-500: #3F8159;
    --primary-600: #217346;
    --primary-700: #0E5C2F;
    --primary-800: #075426;
    --primary-900: #004B1C;
    --white: #FFFFFF;
    --grey-25: #FAFAFA;
    --grey-50: #F5F5F5;
    --grey-100: #F0F0F0;
    --grey-150: #EBEBEB;
    --grey-200: #E0E0E0;
    --grey-250: #C7C7C7;
    --grey-300: #B3B3B3;
    --grey-350: #949494;
    --grey-400: #8A8A8A;
    --grey-450: #616161;
    --grey-500: #424242;
    --grey-550: #3D3D3D;
    --grey-600: #333333;
    --grey-700: #292929;
    --grey-800: #1F1F1F;
    --grey-900: #0F0F0F;
    --editableGrid-deleted-secondary: #ff9f9a;
    --editableGrid-deleted-primary: #ff726b;
    --editableGrid-edited-secondary: #ffffb3;
    --editableGrid-edited-primary: #ffff66;
    --black: #000000;
    --color-text: var(--grey-600);
    --color-text-muted: var(--grey-400);
    /* Z-index */
    --z-index-hidden: -1;
    --z-index-default: 1;
    --z-index-above-default: 2;
    --z-index-modal-overlay: 4;
    --z-index-modal: 5;
    --z-index-dialog: 10;
    --z-index-tooltip: 20;
    --z-index-max: 2147483647;
}

/* Global */
html {
    color: var(--color-text);
}


/* ========================================================================================= */
/* === Adjustmets for https://github.com/microsoft/fast-blazor components styling ========== */
/* ========================================================================================= */

fluent-design-system-provider {
    background-color: var(--grey-25);
    display: grid;
    /* Change base size to 14px */
    font-size: 0.875rem;
    grid-template-columns: max-content 1fr;
    margin: 0 auto;
    max-width: var(--app-max-width);
    min-height: 100vh;
    overflow: hidden;
    /* Override fluent design palette */
    --accent-fill-rest:   var(--primary-500) !important;
    --accent-fill-hover:  var(--primary-400) !important;
    --accent-fill-active: var(--primary-300) !important;
    --accent-fill-focus:  var(--primary-300) !important;
    --accent-foreground-rest:   var(--primary-500) !important;
    --accent-foreground-hover:  var(--primary-400) !important;
    --accent-foreground-active: var(--primary-300) !important;
    --accent-foreground-focus:  var(--primary-300) !important;
}


/* ========================================================================================== */
/* === Adjustmets for https://github.com/BlazorFluentUI/BlazorFluentUI components styling === */
/* ========================================================================================== */

.ms-Callout-container > .ms-Callout {
    width: max-content;
    min-width: 100px;
}

.ms-TextField.money .ms-TextField-fieldGroup > .ms-TextField-prefix {
    background: var(--white);
    padding: 0px 0px 0px 8px;
}

.ms-TextField.money .ms-TextField-fieldGroup input[type='number'] {
    padding: 0px 2px;
}

section.filters .ms-TextField-fieldGroup,
section.filters .ms-Dropdown,
 .ms-Dropdown-title {
    border: 1px solid var(--grey-150);
}

section.filters .ms-Dropdown-title {
    border-width: 0px;
}

section.filters .ms-DatePicker {
    padding-top: 5px;
}

fluent-badge {
    cursor: pointer;
    margin: var(--padding-tiny);
    width: 100%;
    line-break: loose;
    line-height: 2em;
    text-align: center;
    border-width: 0.2em;
    border-radius: var(--padding-tiny);
    background: var(--white);
    box-shadow: 0 0 0.3rem var(--grey-200);
}

/* ========================================================================================= */
/* ========================================================================================= */
h1,
h2,
ul {
    margin: 0;
    padding: 0;
}

h1 {
    font-size: 1.75rem;
    font-weight: 600;
}

h2 {
    font-size: 1rem;
    font-weight: 600;
    padding-bottom: var(--padding-tiny);
}

ul {
    list-style: none;
}

path {
    fill: var(--color-text);
}

/* Layout */
main,
.content,
.details {
    box-shadow: 0 0.2rem 0.45rem 0 rgba(0, 0, 0, 0.13),
    0 0.038rem 0.113rem 0 rgba(0, 0, 0, 0.11);
    z-index:  var(--z-index-default);
}

main {
    display: grid;
    grid-template-columns: max-content 1fr;
    overflow: hidden;
}

h1 {
    font-size: 28px;
    line-height: 32px;
    font-weight: 300;
    color: var(--grey-500);
    padding: 0 0.5rem;
    margin: 0.5rem 0;
}

h2 {
    font-size: 18px;
    line-height: 36px;
    font-weight: 400;
}

fluent-button {
    border-radius: var(--size-default-radius);
}

fluent-button[appearance='accent'] .button-content-wrap {
    font-weight: 600
}

fluent-button[appearance='accent'] svg > path {
    fill: white;
    stroke-width: 0.3px;
}

.panel {
    background-color: var(--grey-50);
    transition: width .3s;
    width: var(--app-panel-width);
}

.panel.panel--opened {
    width: var(--app-panel-width);
}

.panel.panel--closed {
    width: 0;
}

.panel.panel--closed >.filters {
    display: none;
}

.modal {
    position: relative;
    min-height: calc(100% - 52px);
}
 
.modal-dialog-actions {
    position: absolute;
    bottom: 0;  
    left: 0;
    right: 0;
    display: flex;
    justify-content: flex-start;
    margin-left: auto;
}

.modal-dialog-actions button {
    margin-right: 8px;
} 
.content {
    background: var(--white);
    height: 100%;
    min-height: 100vh;
    padding: var(--padding);
    position: relative;
}

.content-main {
    display: grid;
    grid-template-rows: max-content 1fr max-content;
}

.content-details {
    background: var(--grey-50);
    grid-column-end: span 2;
}

.content footer {
    display: flex;
    justify-content: flex-end;
    padding-top: var(--padding);
}


.content .block {
    box-shadow: 0 0.2rem 0.45rem 0 rgba(0, 0, 0, 0.13), 0 0.038rem 0.113rem 0 rgba(0, 0, 0, 0.11);
    z-index: var(--z-index-default);
    background: var(--white);
    display: block;
    padding: var(--padding-large);
    position: relative;
    margin-bottom: var(--padding-large);
}

.block > .title {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    width: auto;
    height: auto;
    box-sizing: border-box;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 1px solid var(--grey-150);
    margin-bottom: 1rem;
    width: 100%;
    font-size: 1rem;
    font-weight: 600;
    user-select: none;
}

.block .validation-errors {
    padding-bottom: 1rem;
}

.date-picker-container {
    display: flex;
    flex-direction: column;
}

.date-picker-container .validation-message {
    color: #a4262c !important;
    font-size: 12px !important;
    font-weight: 400 !important;
    margin-top: 5px !important;
    line-height: 1.2 !important;
    display: block !important;
}

.date-picker-container:has(.validation-message:not(:empty)) .ms-DatePicker .ms-TextField-fieldGroup {
    border: 1px solid #a4262c !important;
    border-bottom: 1px solid #a4262c !important;
}

.date-picker-container:has(.validation-message:not(:empty)) .ms-DatePicker .ms-TextField-fieldGroup:focus-within {
    border: 1px solid #a4262c !important;
    border-bottom: 1px solid #a4262c !important;
    box-shadow: none !important;
}

.date-picker-container:has(.validation-message:not(:empty)) .ms-DatePicker .ms-TextField-fieldGroup:hover {
    border: 1px solid #a4262c !important;
    border-bottom: 1px solid #a4262c !important;
}

.date-picker-container:has(.validation-message:not(:empty)) .ms-DatePicker input {
    border: none !important;
    outline: none !important;
}

.date-picker-container:has(.validation-message:not(:empty)) .ms-DatePicker .ms-TextField-fieldGroup::after {
    display: none !important;
}


.block-content-col-1 {
    padding: 1rem 0rem;
}

.block-content-col-2 {
    display: grid;
    grid-template-columns: repeat(2, 47%);
    gap: 1rem 6%;
}

.block-content-col-3 {
    display: grid;
    grid-template-columns: repeat(3, 30%);
    gap: 1rem 5%;
}

.block-content-col-4 {
    display: grid;
    grid-template-columns: repeat(4, 22%);
    gap: 0.8rem 4%;
    grid-template-rows: max-content;
}

.block-actions {
    display: flex;
    padding-top: 1.5rem;
    gap: 1rem;
    justify-content: flex-start;
}

.command-bar {
    display: flex;
    justify-content: flex-end;
    margin-left: auto;
}

.command-bar button { 
    margin-left: 8px;
}

.command-bar fluent-button:hover:not(.disabled) {
    border-color: var(--primary-500);

}

.command-bar fluent-button svg {
    width: 18px;
    height: 18px;
    margin-right: 0.25rem;
}

.command-bar fluent-button .button-content-wrap {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.command-bar fluent-button[appearance='outline']:hover:not(.disabled) svg > path {
    fill: var(--primary-500);
}

.split-btn > .split-btn-main {
    display: flex;
}

.split-btn > .split-btn-main fluent-button:last-of-type {
    margin-left: -1px;
}


.split-btn {
    position: relative;
}

.split-btn-overlay {
    bottom: 0;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: var(--z-index-above-default);
}

.split-btn-options {
    position: absolute;
    display: flex;
    flex-direction: column;
    z-index: var(--z-index-above-default);
    background: white;
    align-items: flex-end;
    right: 0;
    width: max-content;
    box-shadow: 0 0.2rem 0.45rem 0 rgba(0, 0, 0, 0.2);
}

.split-btn-option {
    background: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    width: 100%;
    padding: 1rem 2.5rem 1rem 0.5rem;
    cursor: pointer;
}

.split-btn-option svg {
    height: 18px;
    width: 18px;
}

.split-btn-option:hover {
    background: var(--grey-100);
}

.grid-sort-icon {
    width: 1.5rem;
}

.panel,
.content header,
.content footer {
    user-select: none;
}

/* Form */
form.slim > div {
    display: flex;
    flex-flow: column;
    padding-top: var(--padding-tiny);
}

form.slim > div label,
form.slim > div span {
}

form.slim > button {
    margin-top: var(--padding-small);
}

/* Buttons */
button:not(.ms-Button) {
    background: none;
    border: none;
    border-radius: var(--size-default-radius);
    box-shadow: none;
    cursor: pointer;
    height: var(--size-control-height);
    transition: background-color, opacity 150ms ease-in-out;
}

button:not(.ms-Button):hover {
    background-color: var(--grey-50);
    opacity: 0.8;
}

button[type='submit']:not(.ms-Button) {
    background-color: var(--primary-500);
    color: var(--white);
    width: 6rem;
}

button:not(.ms-Button).close {
    height: 30px;
    padding: 0;
    width: 30px;
}

/* Input */
input,
select {
    border: 1px solid var(--grey-150);
    border-radius: var(--size-default-radius);
    cursor: pointer;
    height: var(--size-control-height);
    padding-left: 0.25rem;
}

input[type='checkbox'],
input[type='radio'] {
    width: initial;
}

/* Segmented radio */
.segmented-radio {
    background-color: var(--white); 
    border: 1px solid var(--grey-150);
    border-radius: var(--size-default-radius);
    display: flex;
}

.segmented-radio.slim {
    margin-top: var(--padding-x-tiny);
}

.segmented-radio label {
    cursor: pointer;
    flex: 3;
    min-width:50px;
    height: var(--size-control-height);
    line-height: var(--size-control-height);
    text-align: center;
    transition: background-color 150ms ease-in-out;
    display: inline-table;
    padding: 0 var(--padding-tiny);
}

.segmented-radio label:hover {
    background-color: var(--grey-50);
}

.segmented-radio input {
    opacity: 0;
    position: absolute;
    z-index:  var(--z-index-hidden);
}

.segmented-radio input:checked + label {
    background-color: var(--primary-500);
    color: var(--white);
    font-weight: 600;
}

/* Description list */
.description > div {
    align-items: center;
    border-top: 1px solid var(--grey-25);
    display: flex;
    flex-flow: row;
    padding: var(--padding-tiny);
    transition: background-color 150ms ease-in-out;
}

.description > div:hover {
    background-color: var(--grey-25);
    cursor: default;
}

.description span:first-child {
    color: var(--color-text-muted);
    font-size: var(--size-text-small);
    margin-right: var(--padding-tiny);
    width: 10rem;
}

.description span:last-child {
    flex: 1;
}

/* Entities panel */
.entities header {
    display: flex;
    justify-content: space-between;
    padding: var(--padding);
}

.entity {
    --avatar-size: 2.25rem;

    align-items: center;
    display: flex;

    color: var(--color-text);
    text-decoration: none;

    padding: var(--padding-tiny) var(--padding);
}

.entity:hover, .entity.active {
    background-color: var(--grey-150);
}

.entity.active .info {
    font-weight: 500;
}

.entity :is(img, .initials-avatar) {
    border-radius: 50%;
    height: var(--avatar-size);
    user-select: none;
    width: var(--avatar-size);
}

.entity .initials-avatar {
    display: flex;
    justify-content: center;
    align-items: center;

    color: var(--white);
    background-color: var(--primary-400);
}

.entity .info {
    display: flex;
    flex-flow: column;
    padding-left: var(--padding-small);

    overflow: hidden;
}

.entity .info > span {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.entity .info > span:last-child {
    color: var(--color-text-muted);
    font-size: var(--size-text-small);
    line-height: 1.1rem;
}


/* Content form */
.content > form > div {
    max-width: 20rem;
}

/* Table */
.table-container {
    overflow: auto;
}

.loading {
    padding: 1rem 0;
    text-align: center;
}

.loading svg {
    fill: var(--primary-500);
    width: 3rem;
}

table {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
}

tr {
    animation: fadein 150ms;
    border-bottom: 1px solid var(--grey-25);
    height: 2.25rem;
    transition: opacity 100ms ease-in-out;
}

@keyframes fadein {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

thead > tr {
    border-color: var(--grey-150);
}

td {
    white-space: nowrap;
}

td a {
    color: var(--primary-500);
    font-weight: 600;
    text-decoration: none;
}

tbody:hover > tr {
    opacity: 0.5;
}

th:hover,
tbody > tr:hover,
tbody > tr:hover .sticky {
    background-color: var(--grey-50);
    cursor: default;
    opacity: 1;
}

th svg {
    flex-shrink: 0;
}

th:hover svg {
    opacity: 0.7;
}

th,
td {
    padding: 0 var(--padding-tiny) 0 var(--padding-small);
}

th span,
td {
    overflow: hidden;
    text-overflow: ellipsis;
}

th {
    background: var(--white);
    font-size: var(--size-text-small);
    font-weight: 600;
    position: sticky;
    text-align: left;
    top: 0;
    z-index: var(--z-index-default);
}

th > div {
    align-items: center;
    display: flex;
}

th span {
    margin: 0.25rem 0.25rem 0.25rem 0;
}

th.sticky {
    z-index: var(--z-index-above-default);
}

.sticky {
    background: var(--white);
    left: 0;
    position: sticky;
}

th.asc path:first-of-type,
th.desc path:last-of-type {
    fill: var(--grey-150);
}

.grid-sort-icon svg {
    height: 18px;
    width: 18px;
    margin: 0;
}

.grid-sort-icon svg:hover {
    fill: var(--primary-500);
}

/* Pager */
.pager {
    align-items: center;
    display: flex;
}

.pager span {
    font-size: var(--size-text-small);
    padding: 0 var(--padding-tiny);
}

/* Details panel */
.details {
    background: var(--white);
    bottom: 0;
    cursor: default;
    padding: 1rem;
    position: fixed;
    right: 0;
    overflow: auto;
    top: 0;
    transform: translateX(110%);
    transition: transform 150ms ease-in-out;
    width: 30rem;
    z-index: var(--z-index-modal);
}

.details.grid {
    align-content: flex-start;
    display: grid;
    grid-template-rows: max-content 1fr max-content;
}

.details.grid {
    align-content: flex-start;
    display: grid;
    grid-template-rows: max-content 1fr max-content;
}

.details.open {
    transform: translateX(0);
}

.details .header {
    display: flex;
    justify-content: space-between;
    padding-bottom: var(--padding-tiny);
}

.details ul {
    display: flex;
}

.details li {
    color: var(--color-text-muted);
    padding: 0 var(--padding-tiny) var(--padding) 0;
}

.details.open + .overlay {
    background-color: rgba(255, 255, 255, 0.8);
    bottom: 0;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    transition: background-color 100ms ease-in-out;
    z-index: var(--z-index-modal-overlay);
}

.checkbox-control svg {
    height: 28px;
    width: 28px;
    fill: var(--grey-100);
}

.checkbox-filter-label {
    padding-top: var(--padding-xx-tiny);
    padding-left: var(--padding-x-tiny);
}

@supports (backdrop-filter: blur(var(--overlay-blur))) {
    .details.open + .overlay {
        backdrop-filter: blur(var(--overlay-blur)) saturate(125%);
        background-color: rgba(255, 255, 255, 0.3);
    }
}

.filter-label {
    -webkit-font-smoothing: antialiased;
    font-size: var(--fontSize-Medium);
    font-weight: var(--fontWeight-SemiBold);
    color: var(--semanticTextColors-BodyText);
    box-sizing: border-box;
    box-shadow: none;
    margin: 0;
    display: block;
    padding: 5px 0px;
    word-wrap: break-word;
    overflow-wrap: break-word;
} 

.inactive-entity {
    color: var(--grey-300);  
}

/* Blazor styling */
#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: var(--z-index-max);
}

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

.dropdown-options-container {
    font-weight: 400;
    z-index: var(--z-index-max) !important;
    top: 0px;
    bottom: auto; 
    right: 0px;
    background: var(--white);
}

.dropdown-options {
    position: absolute;
    cursor: pointer;
    background: var(--white);
    box-shadow: 0 0.2rem 0.45rem 0 rgba(0, 0, 0, 0.13), 0 0.038rem 0.113rem 0 rgba(0, 0, 0, 0.11);
    border-radius: var(--size-default-radius);
    z-index: var(--z-index-max) !important;
} 

form div.filter-text > div.dropdown-options {
    padding-top: 0px; 
}

.dropdown-options li {
    align-items: center;
    color: var(--color-text);
    display: flex;
    text-decoration: none;
    width: 100%;
    height: 100%;
    min-width: 180px;
    gap: 0.5rem;
    padding: 0.5rem;  
}

.dropdown-options li:hover{
    background: var(--grey-100)
}

.modal-content-options {
    margin-top: 20px;
}

.modal-content-input {
    overflow: auto;
} 

.hide {
    display: none !important;
}

.main-container {
    background: var(--white);
    height: calc(100vh);
    grid-column: 1 / span 2;
}
