/* <Toast /> — default styling, lm-toast-* convention.
   The host is a fixed corner stack; each toast is a dark Snackbar pill
   unless data-severity applies one of the alert-family palettes. */

.lm-toast {
    position: fixed;
    z-index: 1400;
    left: 0;
    bottom: 0; /* default corner: bottom-left */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 16px;
    box-sizing: border-box;
    max-width: 100vw;
    pointer-events: none; /* only the toasts themselves catch clicks */
}

.lm-toast[data-position='bottom-right'] {
    left: auto;
    right: 0;
    align-items: flex-end;
}

/* Top corners: newest toast (last in DOM) sits nearest the corner */
.lm-toast[data-position='top-left'] {
    bottom: auto;
    top: 0;
    flex-direction: column-reverse;
}

.lm-toast[data-position='top-right'] {
    bottom: auto;
    top: 0;
    left: auto;
    right: 0;
    flex-direction: column-reverse;
    align-items: flex-end;
}

/* One toast */
.lm-toast-item {
    /* neutral — the no-severity Snackbar look */
    --lm-toast-main: #90caf9;
    --lm-toast-bg: #323232;
    --lm-toast-text: #fff;

    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 240px;
    max-width: 344px;
    padding: 10px 16px;
    border-radius: var(--lm-radius, 6px);
    font: 14px/1.45 system-ui, sans-serif;
    background: var(--lm-toast-bg);
    color: var(--lm-toast-text);
    box-shadow:
        0 3px 5px -1px rgba(0, 0, 0, 0.2),
        0 6px 10px 0 rgba(0, 0, 0, 0.14);
    box-sizing: border-box;
    animation: lm-toast-in 225ms cubic-bezier(0, 0, 0.2, 1);
}

/* Severity palettes — the alert block's visual language, self-contained */
.lm-toast-item[data-severity='info'] {
    --lm-toast-main: #0288d1;
    --lm-toast-bg: #e5f6fd;
    --lm-toast-text: #014361;
}

.lm-toast-item[data-severity='success'] {
    --lm-toast-main: #2e7d32;
    --lm-toast-bg: #edf7ed;
    --lm-toast-text: #1e4620;
}

.lm-toast-item[data-severity='warning'] {
    --lm-toast-main: #ed6c02;
    --lm-toast-bg: #fff4e5;
    --lm-toast-text: #663c00;
}

.lm-toast-item[data-severity='error'] {
    --lm-toast-main: #d32f2f;
    --lm-toast-bg: #fdeded;
    --lm-toast-text: #5f2120;
}

.lm-toast-message {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: break-word;
}

/* Action button */
.lm-toast-action {
    flex: 0 0 auto;
    appearance: none;
    background: transparent;
    border: 0;
    padding: 4px 8px;
    margin: -4px -8px -4px 0;
    border-radius: var(--lm-radius, 6px);
    font: 600 13px/1 system-ui, sans-serif;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--lm-toast-main);
    cursor: pointer;
    opacity: 0.9;
}

.lm-toast-action:hover {
    opacity: 1;
}

.lm-toast-action:focus-visible {
    outline: 2px solid var(--lm-toast-main);
    outline-offset: 1px;
    opacity: 1;
}

/* Close button */
.lm-toast-close {
    flex: 0 0 auto;
    appearance: none;
    background: transparent;
    border: 0;
    margin: -2px -6px -2px 0;
    padding: 2px 6px;
    border-radius: var(--lm-radius, 6px);
    font: 18px/1 system-ui, sans-serif;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
}

.lm-toast-close:hover {
    opacity: 1;
}

.lm-toast-close:focus-visible {
    outline: 2px solid var(--lm-toast-main);
    outline-offset: 1px;
    opacity: 1;
}

/* Entering / leaving */
@keyframes lm-toast-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* Top corners enter from above instead */
.lm-toast[data-position='top-left'] .lm-toast-item,
.lm-toast[data-position='top-right'] .lm-toast-item {
    animation-name: lm-toast-in-top;
}

@keyframes lm-toast-in-top {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* data-leaving runs for the 200ms the component waits before removal */
.lm-toast-item[data-leaving] {
    animation: lm-toast-out 200ms cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes lm-toast-out {
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}
