@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('./fonts/InterVariable.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url('./fonts/InterVariable-Italic.woff2') format('woff2');
}

:root,
html:root,
[data-bs-theme=light],
[data-bs-theme=dark] {
    --app-font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --app-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    --bs-font-sans-serif: var(--app-font-sans);
    --bs-body-font-family: var(--app-font-sans);
    --bs-font-monospace: var(--app-font-mono);
    --bs-body-font-size: 0.9375rem;
    --bs-body-line-height: 1.5;
    --panel-color: rgb(247, 250, 249);
    --primary-color: #025DA3;
    --primary-color-light: #3484c4;
    --primary-color-lighter: #66a8d6;
    --primary-text-color: #ffffff;
    --primary-color-accent: #d1e6f5;
    --secondary-color: #9e9e9e;
    --secondary-text-color: #000000;
    --rz-primary: #025DA3;
    --rz-primary-dark: #003c6a;
    --rz-primary-darker: #53131b;
    --rz-secondary: #9e9e9e;
    --rz-secondary-light: #bec2c5;
    --rz-secondary-lighter: #cfd1d4;
    --rz-secondary-dark: #343a40;
    --rz-secondary-darker: #23272b;
    --rz-on-secondary: #000;
    --rz-link-color: #942330;
    --rz-link-hover-color: #942330;
    --rz-on-primary-lighter: #025DA3;
    --rz-checkbox-checked-hover-background-color: #9e9e9e;
    --rz-dropdown-item-padding: 0.25rem 1rem;
    --rz-on-secondary-lighter: #025DA3;
    --rz-text-font-family: var(--app-font-sans);
    --rz-body-font-family: var(--app-font-sans);
    --rz-font-family-monospace: var(--app-font-mono);
    --rz-body-font-size: 0.9375rem;
    --rz-body-line-height: 1.5;
    --rz-text-color: #1e293b;
    --rz-text-secondary-color: #475569;
    --rz-text-tertiary-color: #64748b;
    --rz-text-title-color: #0f172a;
    --rz-text-body1-font-size: 0.9375rem;
    --rz-text-body1-line-height: 1.5;
    --rz-text-body2-font-size: 0.875rem;
    --rz-text-body2-line-height: 1.45;
    --rz-text-subtitle1-font-size: 1rem;
    --rz-text-subtitle1-font-weight: 600;
    --rz-text-subtitle1-line-height: 1.4;
    --rz-text-subtitle2-font-size: 0.875rem;
    --rz-text-subtitle2-font-weight: 600;
    --rz-text-subtitle2-line-height: 1.35;
    --rz-text-caption-font-size: 0.8125rem;
    --rz-text-caption-line-height: 1.4;
    --rz-text-caption-color: #475569;
    --rz-input-font-size: 0.9375rem;
    --rz-input-line-height: 1.4;
    --rz-grid-cell-font-size: 0.875rem;
    --rz-grid-cell-line-height: 1.45;
    --rz-grid-header-font-size: 0.8125rem;
    --rz-grid-header-font-weight: 600;
    --menu-shadow: rgba(0, 0, 0, 0.19) 0 10px 20px, rgba(0, 0, 0, 0.23) 0 6px 6px;
    --panel-shadow: 0px 1px 1px rgba(0, 0, 0, 0.14), 0px 2px 1px rgba(0, 0, 0, 0.12), 0px 1px 3px rgba(0, 0, 0, 0.14);
    --rz-icon-font-family: 'Material Symbols Rounded';
}

html,
body,
:root:has(.rz-layout) body {
    font-family: var(--app-font-sans);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    line-height: 1.5;
    letter-spacing: -0.006em;
    height: 100%;
    background-color: #262626;
    scrollbar-width: thin;
}

a, .btn-link {
    color: #006bb7;
}

/* Fix the order of the confirm buttons */
div.rz-dialog-confirm-buttons {
    flex-direction: row-reverse;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.blazor-error-boundary {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #ef4444;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    color: #991b1b;
    font-weight: 500;
    margin: 1rem 0;
}

.blazor-error-boundary::after {
    content: "An error has occurred while rendering this component.";
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.mud-input-control.mud-input-required>.mud-input-control-input-container>.mud-input-label::after {
    color: red;
}

.form-field-label {
    font-weight: 500;
}

.form-field-label.required::after {
    content: ' *';
    color: red;
}

.rz-message-popup {
    z-index: 10;
}

.no-scroll {
    padding-inline-end: 0;
}

.counter {
    color: #64748b;
    font-style: italic;
    font-size: 0.8125rem;
}

.back-link {
    color: #0f172a;
    font-weight: 500;
    font-size: 1.1em;
}

.material-symbols-rounded {
    'wght' 400,
    'GRAD' 0,
    'opsz' 24
}

.report-container {
    padding: 10px;
    margin-top: 10px;
}

.report-heading,
.report-panel > .rz-panel-titlebar > div > span {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.text-muted {
    color: #64748b !important;
}

.section-header {
    color: var(--primary-color);
}

.rzi.filled-icon {
    font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}

.field-character-counter {
    font-size: 0.75rem;
    color: #475569;
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
    position: absolute;
    right: 8px;
    z-index: 2;
    opacity: 0;
    
    transition: opacity 0.15s ease-in-out;
}

.has-character-counter:focus-within > .field-character-counter,
.field-counter-wrapper:focus-within > .field-character-counter,
.rz-textbox:focus-within > .field-character-counter,
.rz-textarea:focus-within > .field-character-counter,
.rz-password:focus-within > .field-character-counter,
.rz-html-editor:focus-within > .field-character-counter {
    opacity: 1;
}

.rz-textbox > .field-character-counter, 
.rz-password > .field-character-counter {
    top: 50%;
    transform: translateY(-50%);
}

.rz-textarea > .field-character-counter {
    bottom: 4px;
}

textarea::-webkit-resizer {
    display: none;
}

.rz-html-editor > .field-character-counter {
    bottom: 4px;
}

.rz-state-disabled > .field-character-counter,
.rz-state-disabled:focus-within > .field-character-counter {
    display: none !important;
}

.field-counter-wrapper > .field-character-counter {
    bottom: 4px;
    top: auto;
    transform: none;
}

.field-counter-wrapper > input + .field-character-counter {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
}

.rz-textbox, .rz-textarea, .rz-password {
    position: relative;
    display: flex !important;
    align-items: center;
    width: 100%;
}

.field-counter-wrapper input,
.field-counter-wrapper textarea {
    width: 100%;
}

.rz-textbox input, 
.rz-password input {
    padding-right: 45px !important;
}

.field-counter-wrapper input {
    padding-right: 50px;
}

.rz-textarea.has-character-counter textarea,
.field-counter-wrapper.has-character-counter textarea {
    padding-bottom: 24px !important;
}

.rz-html-editor.has-character-counter .rz-html-editor-content {
    padding-bottom: 24px !important;
}

textarea + span.character-counter {
    position: absolute;
    right: 0;
    bottom: 0;
    transform: translateY(-50%);
    pointer-events: none;
    display: none;
}

input + span.character-counter {
    position: absolute;
    right: 0;
    transform: translateY(-35%);
    pointer-events: none;
    display: none;
}

textarea:focus + span.character-counter,
input:focus + span.character-counter {
    display: inline;
}

/* Compact chips/badges styling */
.rz-multiselect-chips-wrapper,
.rz-dropdown .rz-chips {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 0 4px !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
}

.rz-multiselect-token,
.rz-dropdown .rz-chip,
.rz-badge {
    border-radius: 2px !important; /* Square shape */
    min-height: 0 !important;
    margin: 0 !important;
}

.rz-multiselect-token,
.rz-dropdown .rz-chip {
    padding: 0 0.5rem !important;
    height: 24px !important;
    line-height: 24px !important;
    font-size: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
}

.rz-badge {
    padding: 0.25rem 0.5rem !important;
    font-weight: 500;
}

/* Individual System Grey Styling - applied to both badges and dropdown chips */
.rz-multiselect-token,
.rz-dropdown .rz-chip,
.rz-badge.badge {
    background-color: #E0E0E0 !important;
    color: black !important;
}

.rz-multiselect-token .rz-multiselect-token-icon,
.rz-dropdown .rz-chip .rz-chip-icon {
    font-size: 14px !important;
    line-height: 24px !important;
    display: flex !important;
    align-items: center !important;
    min-height: 0 !important;
}

.rz-multiselect-token-label,
.rz-dropdown .rz-chip-text {
    line-height: 24px !important;
    min-height: 0 !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

.dark-glass {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.5));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.18);
    box-shadow: rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px;
}

.glass {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.5));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px;
}

.light-glass {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px;
}

.panel {
    background: var(--panel-color);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px;
}

.raised {
    box-shadow: 7px 7px 11px #c5c5c5,
    -7px -7px 11px #fbfbfb !important;
}

.line {
    height: 1px;
    min-width: 10px;
    flex-shrink: 1;
    border-top: 1px solid gray;
    position: relative;
    top: 47px;
}

/* Radzen dialog header */
div.rz-dialog-wrapper {
    & .rz-dialog-content {
        height: 100%;
    }

    & .rz-dialog-titlebar {
        padding: 16px;
        background-color: var(--primary-color-light);

        & * {
            color: white;
        }

        & .rz-dialog-titlebar-close:hover .rzi-times, .rz-dialog-side-titlebar-close:hover .rzi-times {
            color: white;
        }
    }
}

.select-wip-wrapper {
    top: 135px;
    
    & .rz-dialog-mask {
        top: 135px;
    }
}

.select-wip-dialog {
    top: 50%;
    transform: translateY(calc(-50% - 136px));
}

body:has(#env-bar) .select-wip-wrapper {
    top: 156px;

    & .rz-dialog-mask {
        top: 156px;
    }
}

body:has(#env-bar) .select-wip-dialog {
    top: 50%;
    transform: translateY(calc(-50% - 157px));
}

.tooltip-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.tooltip-box {
    position: fixed;
    text-align: center;
    border-radius: 4px;
    padding: 3px 6px;
    z-index: 9999;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    pointer-events: none;
    max-width: 90vw;
    max-height: 80vh;
    word-wrap: normal;
    /* Initial position off-screen to avoid flash */
    top: -9999px;
    left: -9999px;

    background-color: var(--tooltip-bg, #45494f);
    color: var(--tooltip-color, #fff);

    /* Ensure Radzen components inside the tooltip use the tooltip's text color */
    --rz-text-color: var(--tooltip-color);
    --rz-text-secondary-color: var(--tooltip-color);
    --rz-text-tertiary-color: var(--tooltip-color);
    --rz-text-title-color: var(--tooltip-color);
}

.tooltip-box * {
    color: inherit;
}

.tooltip-box .rz-text {
    color: inherit !important;
}

.tooltip-arrow {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: var(--tooltip-bg, #45494f);
}

/* Position-specific styles */
/* These are now handled by JS for fixed positioning, 
   but we keep them for arrow alignment relative to the tooltip box */

/* Top */
.tooltip-top .tooltip-arrow {
    top: 100%;
    left: 50%;
    transform: translateX(calc(-50% + 1px)) translateY(-50%) rotate(45deg);
}

/* Right */
.tooltip-right .tooltip-arrow {
    right: 100%;
    top: 50%;
    transform: translateX(calc(50% - 1px)) translateY(-50%) rotate(45deg);
}

/* Bottom */
.tooltip-bottom .tooltip-arrow {
    bottom: 100%;
    left: 50%;
    transform: translateX(Calc(-50% + 1px)) translateY(50%) rotate(45deg);
}

/* Left */
.tooltip-left .tooltip-arrow {
    left: 100%;
    top: 50%;
    transform: translateX(calc(-50% + 1px)) translateY(-50%) rotate(45deg);
}

/* Tooltip Styles */
.tooltip-base { --tooltip-main: #45494f; --tooltip-on-main: #ffffff; --tooltip-lighter: #e9ecef; --tooltip-on-lighter: #212529; }
.tooltip-primary { --tooltip-main: var(--rz-primary); --tooltip-on-main: var(--rz-on-primary); --tooltip-lighter: var(--rz-primary-lighter); --tooltip-on-lighter: var(--rz-on-primary-lighter); }
.tooltip-secondary { --tooltip-main: var(--rz-secondary); --tooltip-on-main: var(--rz-on-secondary); --tooltip-lighter: var(--rz-secondary-lighter); --tooltip-on-lighter: var(--rz-on-secondary-lighter); }
.tooltip-info { --tooltip-main: var(--rz-info); --tooltip-on-main: var(--rz-on-info); --tooltip-lighter: var(--rz-info-lighter); --tooltip-on-lighter: var(--rz-on-info-lighter); }
.tooltip-success { --tooltip-main: var(--rz-success); --tooltip-on-main: var(--rz-on-success); --tooltip-lighter: var(--rz-success-lighter); --tooltip-on-lighter: var(--rz-on-success-lighter); }
.tooltip-warning { --tooltip-main: var(--rz-warning); --tooltip-on-main: var(--rz-on-warning); --tooltip-lighter: var(--rz-warning-lighter); --tooltip-on-lighter: var(--rz-on-warning-lighter); }
.tooltip-danger { --tooltip-main: var(--rz-danger); --tooltip-on-main: var(--rz-on-danger); --tooltip-lighter: var(--rz-danger-lighter); --tooltip-on-lighter: var(--rz-on-danger-lighter); }
.tooltip-light { --tooltip-main: var(--rz-light); --tooltip-on-main: var(--rz-on-light); --tooltip-lighter: var(--rz-light-lighter); --tooltip-on-lighter: var(--rz-on-light-lighter); }
.tooltip-dark { --tooltip-main: var(--rz-dark); --tooltip-on-main: var(--rz-on-dark); --tooltip-lighter: var(--rz-dark-lighter); --tooltip-on-lighter: var(--rz-on-dark-lighter); }

.tooltip-variant-filled {
    --tooltip-bg: var(--tooltip-main);
    --tooltip-color: var(--tooltip-on-main);
}

.tooltip-variant-flat {
    --tooltip-bg: var(--tooltip-lighter);
    --tooltip-color: var(--tooltip-on-lighter);
}

.tooltip-variant-outlined {
    --tooltip-bg: var(--rz-base-background-color, #ffffff);
    --tooltip-color: var(--tooltip-main);
    border: 1px solid var(--tooltip-main);
}

.tooltip-variant-outlined .tooltip-arrow {
    border: 1px solid var(--tooltip-main);
}

.tooltip-variant-outlined.tooltip-top .tooltip-arrow {
    border-top: none;
    border-left: none;
}

.tooltip-variant-outlined.tooltip-bottom .tooltip-arrow {
    border-bottom: none;
    border-right: none;
}

.tooltip-variant-outlined.tooltip-left .tooltip-arrow {
    border-bottom: none;
    border-left: none;
}

.tooltip-variant-outlined.tooltip-right .tooltip-arrow {
    border-top: none;
    border-right: none;
}

/* restyle radzen switch */
.rz-switch {
    width: 40px !important;   /* was 60px */
    height: 20px !important;  /* was 30px */
    border-radius: 12px !important;
    background-color: #ddd !important;
    outline: none !important;
    position: relative;
    transition: background-color 0.18s ease;
    overflow: hidden;
    box-shadow:
            inset 0 1px 4px rgb(0 0 0 / 50%),
            inset 0 -1px 1px rgb(255 255 255 / 65%);
}

/* ON State */
.rz-switch.rz-switch-checked {
    background-color: var(--primary-color-light) !important;
}

/* Thumb (circle) */
.rz-switch .rz-switch-circle {
    width: 16px !important;   /* was 26px */
    height: 16px !important;
    top: 2px !important;
    left: 2px !important;
    border-radius: 50% !important;
    background-color: #fff !important;
    transform: translateX(0);
    transition: transform 180ms ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.26) !important;
}

/* Move the circle fully across when ON */
.rz-switch.rz-switch-checked .rz-switch-circle {
    transform: translateX(20px) !important;  /* was 30px */
}

/* Remove blue dot / ripple */
.rz-switch:focus,
.rz-switch:focus-visible,
.rz-switch .rz-switch-circle:focus,
.rz-switch .rz-switch-circle:focus-visible,
.rz-switch .rz-ripple,
.rz-switch .rz-ripple-element {
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    display: none !important;
}

/* Kill Radzen ripple & pseudo-elements that cause blue circle */
.rz-switch .rz-ripple,
.rz-switch .rz-ripple-element,
.rz-switch .rz-switch-circle::before,
.rz-switch .rz-switch-circle::after,
.rz-switch::before,
.rz-switch::after {
    display: none !important;
    content: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

div.rz-notification {
    inset-block-start: 1rem;
}

/* Notification Indicator Badges */
.notification-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #ffffff, 0 1px 3px rgba(239, 68, 68, 0.4);
    pointer-events: none;
    z-index: 2;
    animation: badgePulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    
    &.warning {
        background-color: #f59e0b;
    }
}