/* toasts shown by toast.js */
.commodis-toasts {
    position: fixed;
    top: 20px;
    left: 50%;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 1em;
    width: min(800px, calc(100% - 32px));
    transform: translateX(-50%);
    pointer-events: none;
}

.commodis-toast {
    position: relative;
    padding: 10px 30px 11px 46px;
    border-radius: 5px;
    background-color: rgb(52 52 52 / 80%);
    color: #f8f8f8;
    font-weight: var(--commodis-medium-font-weight);
    opacity: 0;
    transform: translateY(-10px);

    /* fade-out, shorter than the fade-in so that closing feels immediate */
    transition: opacity 0.15s, transform 0.15s;
    pointer-events: auto;
}

.commodis-visible-toast {
    opacity: 1;
    transform: none;
    transition: opacity 0.3s, transform 0.3s;
}

/* the type icon: the glyph carries the type besides the color, the alternative text names it for screen readers */
.commodis-toast::before {
    position: absolute;
    top: 50%;
    left: 15px;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    border-radius: 50%;
    color: #222222;
    font-size: 12px;
    font-weight: var(--commodis-bold-font-weight);
    line-height: 18px;
    text-align: center;
}

.commodis-success-toast::before {
    background-color: #5fca4a;
    content: "✓" / "Erfolg:";
}

.commodis-info-toast::before {
    background-color: #61c4b8;
    content: "i" / "Hinweis:";
}

/* a triangle instead of a circle, so that a warning differs from an error by shape, too */
.commodis-warning-toast::before {
    left: 14px;
    width: 20px;
    margin-top: -10px;
    border-radius: 0;
    background-color: #eac85e;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    font-size: 11px;
    line-height: 22px;
    content: "!" / "Warnung:";
}

.commodis-error-toast::before {
    background-color: #dd6a45;
    content: "!" / "Fehler:";
}

.commodis-toast-message {
    margin: 0;
    overflow-wrap: anywhere;
}

/* reset, because the theme styles every button with a minimum height and a shadow */
.commodis-toast-close {
    position: absolute;
    top: 50%;
    right: 0;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 7px 10px 7px 7px;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #bbbbbb;
    font-size: 20px;
    font-weight: var(--commodis-bold-font-weight);
    line-height: 20px;
    cursor: pointer;
}

.commodis-toast-close:hover,
.commodis-toast-close:focus-visible {
    color: #f8f8f8;
}

@media (prefers-reduced-motion: reduce) {
    .commodis-toast,
    .commodis-visible-toast {
        transition: none;
    }
}
