html {
    border: 0;
    padding: 0;
    margin: 0;

    font-family: sans-serif;

    --blazar-theme-primary: #00b4ff;
    --blazar-theme-secondary: #26a69a;
    --blazar-theme-background: #ffffff;
    --blazar-theme-on-primary: #ffffff;
    --blazar-theme-on-secondary: #000000;
    --blazar-theme-on-background: #000000;
    --blazar-theme-success: #4caf50;
    --blazar-theme-warning: #ff9800;
    --blazar-theme-info: #2196f3;
    --blazar-theme-error: #f44336;
    --blazar-theme-on-success: #ffffff;
    --blazar-theme-on-warning: #ffffff;
    --blazar-theme-on-info: #ffffff;
    --blazar-theme-on-error: #ffffff;

    --blazar-button-margin: 0.2em;
    --blazar-button-padding: 0.5em;

    --blazar-page-margin-bottom: 3em;
}

body {
    border: 0;
    padding: 0;
    margin: 0;
}

@function --contrast-color(--bg-color, --threshold: 0.8, --light-tweak: #ffffff, --dark-tweak: #111111) {
    /* 
        Extract the lightness channel from the background color.
        If the background lightness is less than the threshold (dark background), 
        return the light text color.
    */
    @container (style(--bg-color: oklch(from var(--bg-color) l c h))) {
        /* CSS conditional logic or relative color channel extractions */
    }

    /* Inline evaluation using inline relative color math or media/style queries */
    result: oklch(from var(--bg-color) 
        calc(1 - round(down, l, var(--threshold))) 
        0 
        0
    );
}  

.blazar-full-screen {
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
    width: 100vw;
    min-width: 100vw;
    max-width: 100vw;

    @media print {
        height: auto;
        min-height: auto;
        max-height: auto;
        width: auto;
        min-width: auto;
        max-width: auto;
    }
}

.blazar-no-print {
    @media print {
        display: none !important;
    }
}

.blazar-app-bar {
    display: flex;
    gap: 0.5em;
    justify-content: space-between;
    align-items: left;
    width: 100%;
    box-sizing: border-box;
    padding: 0.5em;
    background-color: var(--blazar-theme-primary);
    color: var(--blazar-theme-on-primary);
    font-size: 1.5em;

    .blazar-app-bar__icon {
        display: flex;
        justify-content: center;
    }

    .blazar-app-bar__icon {
        .blazar-icon {
            cursor: pointer;
        }
    }

    .blazar-app-bar__content {
        flex: 1;
    }

    .blazar-app-bar__headline {
        font-weight: bold;
    }

    .blazar-app-bar__headline-text {
    }

    .blazar-app-bar__subtitle {
        font-size: 0.8em;
    }

    .blazar-app-bar__subtitle-text {
        font-size: 1em;
        font-weight: normal;
    }

    .blazar-app-bar__trailer {
    }
}

.blazar-button {
    --color: var(--blazar-theme-primary);

    display: inline-block;
    border-radius: 0.5em;
    border: 1px solid transparent;
    background-color: var(--color);
    color: --contrast-color(var(--color));
    cursor: pointer;

    margin: var(--blazar-button-margin);

    user-select: none;

    a, a:hover, a:active, a:visited {
        text-decoration: none !important;
        color: inherit !important;
    }

    &:hover:not(.blazar-button--disabled) {
        opacity: 0.7;
    }

    &.blazar-button--flat {
        background-color: transparent;
        color: var(--color);
    }

    &.blazar-button--flat:hover:not(.blazar-button--disabled) {
        background-color: color-mix(in srgb, var(--color) 10%, transparent);
    }

    &.blazar-button--outline {
        background-color: transparent;
        color: var(--color);
        border-color: var(--color);
    }

    &.blazar-button--outline:hover:not(.blazar-button--disabled) {
        background-color: color-mix(in srgb, var(--color) 10%, transparent);
    }

    &.blazar-button--round {
        border-radius: 50%;
    }

    &.blazar-button--disabled {
        filter: opacity(0.3);
        cursor: default !important;
        user-select: none !important;
    }

    &.blazar-button--disabled a {
        cursor: not-allowed !important;
        user-select: none !important;
    }

    .blazar-button__icon {
        margin-left: auto;
        margin-right: auto;
        width: 1em;
        height: 1em;
    }

    .blazar-button__content {
        margin-top: auto;
        margin-bottom: auto;
        display: flex;
        flex-direction: row;
        padding: var(--blazar-button-padding);
        gap: 0.5em;
        /* TODO: Add this back when we create an IconButton component. min-height: 1lh; */
    }
}

.blazar-card {
    padding: 1em;
    display: flex;
    flex-direction: column;
    gap: 0.5em;

    .blazar-card__icon {
        display: flex;
        justify-content: center;
    }

    .blazar-card__icon {
    }

    .blazar-card__content {
        flex: 1;

        gap: 0.5em;
    }

    .blazar-card__header {
        display: flex;
        flex-direction: row;
        gap: 0.5em;
        font-size: 1.1em;
    }

    .blazar-card__headline {
        font-weight: bold;
    }

    .blazar-card__headline-text {
    }

    .blazar-card__subtitle {
        font-size: 0.8em;
    }

    .blazar-card__subtitle-text {
        font-size: 1em;
        font-weight: normal;
    }

    .blazar-card__body {
    }
}

.blazar-checkbox.blazar-checkbox--disabled {
    filter: opacity(0.3);
}

.blazar-checkbox.checked .blazar-checkbox__icon {
    color: var(--blazar-theme-primary);
}

.blazar-collapse {
    &.closed {
        @media print {
            display: none !important;
        }
    }
}

.blazar-collapse__top {
    display: flex;
    flex-direction: row;
}

.blazar-collapse__summary-text {
    max-width: 40em;
    overflow-x: hidden;
    display: inline-block;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.blazar-collapse__label {
    font-weight: bold;
    margin-right: 1em;
}

.blazar-collapse__icon {
    @media print {
        display: none !important;
    }
}

.blazar-copy {
    cursor: copy;

    &.disabled {
        cursor: initial;
    }

    .blazar-copy__wrapper {
        display: flex;
        flex-direction: row;
        align-items: center;
    }

    .blazar-copy__icon {
        font-size: 0.8em;
        cursor: copy;
    }
}

.blazar-form {
    display: flex;
    flex-direction: column;
    gap: 1em;

    .blazar-form__actions {
        display: flex;
        flex-direction: row;
    
        @media print {
            display: none !important;
        }
    }    
}

.blazar-icon {
    width: 1em;
    height: 1em;

    i {
    }    
}

.blazar-input-wrapper {
    margin-top: 0.25em;
    margin-bottom: 0.25em;
    
    display: flex;
    flex-direction: column;
    gap: 0.5em;

    &.blazar-input-wrapper--disabled {
        filter: opacity(0.3);
    }
    
    .blazar-input-wrapper__label {
        font-size: 0.8em;
        font-weight: bold;
    }
    
    &:focus-within {
        .blazar-input-wrapper__label {
            color: var(--blazar-theme-primary);
        }
    }
    
    .blazar-input-wrapper__body {
        display: flex;
        flex-direction: row;
        align-items: center;
    
        gap: 0.5em;
    
        padding: 0.5em;
    
        border-radius: 0;
        border: 0;
    
        font-size: 0.9em;

        &:focus-within {
            border-color: var(--blazar-theme-primary);
        }
    }
    
    &.blazar-input-wrapper--outline .blazar-input-wrapper__body {
        border-radius: 0.25em;
        border: 1px solid #dddddd;
    }    
}

.blazar-input {
    .blazar-input__input {
        flex: 1;
    }

    &:focus {
        outline: none;
        border-color: var(--blazar-theme-primary);
    }

    &:hover {
        border-color: var(--blazar-theme-primary);
    }

    &:active {
        border-color: var(--blazar-theme-primary);
    }

    input.blazar-input__input {
        font-size: 1em;
        border: 0 !important;
        outline: none !important;
        background: transparent !important;
        width: 100%;
    }

    .blazar-input__clear-icon {
        cursor: pointer;
        opacity: 0.5;

        margin: 0;

        .blazar-button__content {
            padding: 0;
        }
    }
}

.blazar-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0.5em;
    cursor: pointer;

    &:hover {
        background-color: rgba(0, 0, 0, 0.1);
    }

    .blazar-item__icon {
        width: 1em;
        height: 1em;
        margin-right: 0.5em;
    }

    .blazar-item__name {
    }
}

a.blazar-item {
    text-decoration: none;
    color: inherit;
}

.blazar-progress-bar {
    --percentage: 0;
    --height: 4px;

    height: var(--height);
    width: 100%;
    overflow: hidden;
  
    .blazar-progress-bar__bar {
        height: 100%;
        background-color: var(--blazar-theme-primary);
        width: calc(var(--percentage) * 1%);
        transform-origin: 0% 50%;

        &.blazar-progress-bar__bar--animated {
            background-image: linear-gradient(
                -45deg,
                rgba(255, 255, 255, 0.2) 25%,
                transparent 25%,
                transparent 50%,
                rgba(255, 255, 255, 0.2) 50%,
                rgba(255, 255, 255, 0.2) 75%,
                transparent 75%,
                transparent
            );
            background-size: 50px 50px;
            animation: blazar-progress-bar__move-animation 2s linear infinite;
        }

        &.blazar-progress-bar__bar--indeterminate {
            width: 100%;
            animation: blazar-progress-bar__indeterminate-animation 1s infinite linear;
        }
    }
}

@keyframes blazar-progress-bar__indeterminate-animation {
    0% {
        transform:  translateX(0) scaleX(0);
    }
    40% {
        transform:  translateX(0) scaleX(0.4);
    }
    100% {
        transform:  translateX(100%) scaleX(0.5);
    }
}

@keyframes blazar-progress-bar__move-animation {
    0% {
      background-position: 0 0;
    }
    100% {
      background-position: 50px 50px;
    }
  }
  

.blazar-main-layout {
    height: 100%;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    overflow-y: auto;

    @media print {
        height: auto;
        min-height: auto;
        max-height: auto;
        width: auto;
        min-width: auto;
        max-width: auto;
        overflow-y: initial;
    }

    .blazar-main-layout__drawer {
        display: none;
    }
    
    .blazar-main-layout__drawer.visible {
        display: block;
    }
    
    .blazar-main-layout__header {
        @media print {
            display: none !important;
        }
    }
    
    .blazar-main-layout__body {
        display: flex;
        justify-content: flex-start;
        max-width: 100%;
        overflow-x: auto;
    }
    
    .blazar-main-layout__drawer {
        padding: 1em;
        min-width: 150px;
    
        @media print {
            display: none !important;
        }
    }
    
    .blazar-main-layout__content {
        flex: 1;
        max-width: 100%;
    }    
}

.blazar-mixin-dropshadow {
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.08); /* Adds a modern elevation effect */
    box-sizing: border-box;

    @media print {
        box-shadow: none;
    }
}

.blazar-multiselect {
    display: flex;
    flex-direction: column;
    gap: 0.5em;

    .blazar-multiselect__select {
        flex: 1;
    }
    
    select.blazar-multiselect__select {
        border: 0 !important;
        outline: none !important;
        background: transparent !important;
    }    
}

.blazar-page {
    padding: 1em;
    background-color: var(--blazar-theme-background);
    color: var(--blazar-theme-on-background);
    margin-bottom: var(--blazar-page-margin-bottom);

    display: flex;
    flex-direction: column;
    gap: 1em;

    box-sizing: border-box;
    width: fit-content;
    min-width: 100%;

	@media print {
		padding: 0;
        margin: 0;
	}
}

.blazar-select {
    .blazar-select__select {
        flex: 1;
    }

    select.blazar-select__select {
        border: 0 !important;
        outline: none !important;
        background: transparent !important;
    }
}

.blazar-snackbar {
    visibility: hidden;
    min-width: 280px;
    text-align: left;
    position: fixed;
    z-index: 1000;
    left: 0;
    bottom: 0;
    margin-left: 1em;
    margin-right: 1em;
    margin-bottom: 1em;
    margin-top: 1em;

    .blazar-statusbar {
        box-shadow: 0 4px 6px rgba(0,0,0,0.4);
        opacity: 0;
        transition: opacity 0.5s ease, visibility 0s linear 0.5s;
    }

    &.blazar-snackbar--visible {
        visibility: visible;

        .blazar-statusbar {
            opacity: 1;
            transition: opacity 0.5s ease, visibility 0s linear 0s;
        }
    }

    .blazar-statusbar {
        .blazar-button {
            --blazar-button-margin: 0;
            --blazar-button-padding: 0;
        }
    }
  }


.blazar-statusbar {
    display: flex;
    align-items: center;
    gap: 0.5em;

    padding: 0.6em;
    border-radius: 0.5em;

    background-color: var(--blazar-theme-info);
    color: var(--blazar-theme-on-info);

    &.blazar-statusbar--good {
        background-color: var(--blazar-theme-success);
        color: var(--blazar-theme-on-success);
    }

    &.blazar-statusbar--bad {
        background-color: var(--blazar-theme-error);
        color: var(--blazar-theme-on-error);
    }

    .blazar-statusbar__icon {}

    .blazar-statusbar__text {}

    .blazar-statusbar__action {}
}

.blazar-table {
    font-family: sans-serif;

    .blazar-table__header {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
    }

    .blazar-table__header-menu {
        @media print {
            display: none !important;
        }
    }

    .blazar-table__title {
        padding: 0.5em;
        font-weight: bold;
        font-size: 1.1em;
    }

    .blazar-table__actions {
        padding: 0.5em;

        @media print {
            display: none !important;
        }
    }

    .blazar-table__multi-row-actions {
        padding: 0.5em;
        display: flex;
        flex-direction: row;
        align-items: center;

        @media print {
            display: none !important;
        }
    }

    table {
        border-collapse: collapse; /* Removes space between cell borders */
        font-size: 0.9em;
        width: 100%;
    }

    table thead tr {
        background-color: var(--blazar-theme-secondary);
        color: var(--blazar-theme-on-secondary); 
        text-align: left;
    }

    table th,
    table td {
        padding-top: 0.5em;
        padding-bottom: 0.5em;
        padding-left: 1em;
        padding-right: 1em;
    }

    table tbody tr {
        border-bottom: 1px solid #dddddd;
    }

    table tbody tr:nth-of-type(even) {
        background-color: #f7f7f7; /* Zebra-striping for easier scanning */
    }

    table tbody tr:last-of-type {
    }

    table tbody tr:hover {
        background-color: #f1f1f1; /* Visual cue when interacting with rows */
    }

    .blazar-table__empty-message {
        text-align: center;
        font-style: italic;
    }

    .blazar-table__pagination {
        padding: 0.5em;
        display: flex;

        @media print {
            display: none !important;
        }
    }

    .blazar-table__pagination-control {
        display: flex;
        gap: 0.5em;
    }

    [popover] {
        margin: unset;
        position-area: block-end span-inline-end;
        position-try-fallbacks: flip-inline;
        margin: initial;
        box-shadow: 0px 0px 20px 12px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
        border: 0;
    }

    .blazar-table__column__number {
        text-align: right;
    }

    .blazar-table__row-checkbox {
        @media print {
            display: none;
        }
    }

    .blazar-table__row-actions {
        display: flex;
        flex-direction: row;
        align-items: center;

        @media print {
            display: none;
        }
    }
}

