html,
html.-light {
    --color-modal-error-message-bg: #ffe5e5;
}

html.-dark {
    --color-modal-error-message-bg: #430000;
}

@media (prefers-color-scheme: dark) {
    html:not(.-light) {
        --color-modal-error-message-bg: #430000;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.modal .spinner {
    animation: spin 1s infinite linear;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 6;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(.25rem);
    -webkit-backdrop-filter: blur(.25rem);
    align-items: start;
    justify-content: center;
    overflow: hidden;
}

@media screen and (min-width: 800px) {
    .modal {
        padding: 14vh .5rem 0 .5rem;
    }
}

.modal.open {
    display: flex;
}

.modal-body {
    position: relative;
    max-width: 67.5rem;
    width: 100%;
    height: 100%;
    background: var(--color-surface-container) 0% 0% no-repeat padding-box;
    overflow: hidden;
}

@media screen and (min-width: 800px) {
    .modal-body {
        height: auto;
        border-radius: 22px;
        box-shadow: 0px 5px 50px 0px var(--color-shadow);
    }
}

.modal-body.placeholder {
    min-height: 300px;
}

.modal-body.loading .modal-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1;
    background-color: rgba(0, 0, 0, 0.5);
}

.loader-spinner-container {
    display: inline-flex;
}

.modal-loader {
    display: none;
}

.modal-loader span {
    animation: spin 1s infinite linear;
    color: white;
}

.modal-body.w-max {
    width: 100%;
}

.modal-body .modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem max(8vw, 1rem);
    min-height: unset;
    max-height: unset;
    height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #F0F1F1 rgba(0, 0, 0, 0.25);
}

@media screen and (min-width: 800px) {
    .modal-body .modal-content {
        padding: 0;
        min-height: 20rem;
        max-height: 75vh;
        height: auto;
    }
}

/* Error views */

.error-views-container,
.error-view {
    display: none;
}

.error-views-container {
    background-color: var(--color-surface-container);
    padding: 3rem;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    justify-content: center;
}
.error-views-container.show {
    display: flex;
}

.modal:has(.error-views-container.show) .tabpanel,
.modal:has(.error-views-container.show) .modal-footer
{
    display:none;
}

.error-view.show {
    display: block
}

.close-error-view-button {
    display: none;
    font-size: 1rem;
    border: unset;
    cursor: pointer;
    padding: 0.25rem 3rem;
    margin-top: 1rem;
    align-items: center;
    justify-content: center;
    background-color: var(--color-surface);
}

.close-error-view-button:hover {
    background-color: var(--color-surface-variant);
}
.close-error-view-button.show {
    display: flex;
}

.error-message {
    text-align: center;
}

.modal .error-message-container {
    display: none;
    flex-direction: row;
    align-items: center;
    justify-self: center;
    column-gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: var(--color-modal-error-message-bg);
    border-radius: 0.25rem;
}

.modal .error-message-container button {
    display: none;
}

.modal .error-message-container button.show {
    display: flex;
}

.modal .error-message-container:has(.message-sub-text:not(:empty)) {
    display: flex;
}