/**
 * 1.3.0 R3: KM.toast() (km-undo.js) and the "restored" highlight.
 *
 * @package KrystalMeble
 */

.km-toast-region {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 100000;
    width: max-content;
    max-width: calc(100vw - 32px);
    pointer-events: none;
}

.km-toast-region:empty {
    display: none;
}

.km-toast {
    /* only the buttons take clicks: the toast never blocks the form underneath */
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 4px;
    box-sizing: border-box;
    max-width: 100%;
    padding: 10px 8px 10px 16px;
    border-radius: 8px;
    background: #1f2937;
    color: #f9fafb;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.28);
    animation: km-toast-in 0.18s ease-out;
}

.km-toast--success {
    background: #14532d;
}

.km-toast--error {
    background: #7f1d1d;
}

.km-toast__message {
    overflow-wrap: anywhere;
}

.km-toast__sep {
    color: #9ca3af;
    white-space: pre;
}

.km-toast .km-toast__action,
.km-toast .km-toast__close {
    pointer-events: auto;
    margin: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font: inherit;
    cursor: pointer;
    min-height: 32px;
}

.km-toast .km-toast__action {
    padding: 4px 10px;
    color: #93c5fd;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.km-toast .km-toast__action:hover {
    background: rgba(255, 255, 255, 0.1);
}

.km-toast .km-toast__close {
    min-width: 32px;
    padding: 0 6px;
    color: #d1d5db;
    font-size: 18px;
    line-height: 1;
}

.km-toast .km-toast__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.km-toast .km-toast__action:focus-visible,
.km-toast .km-toast__close:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 1px;
}

.km-undo-restored {
    animation: km-undo-flash 1.6s ease-out;
}

/* table view rows: box-shadow does not paint on <tr> */
tr.km-undo-restored > td {
    animation: km-undo-flash-bg 1.6s ease-out;
}

.km-undo-restored:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

@keyframes km-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@keyframes km-undo-flash {
    0%, 40% { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.45); }
    100% { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0); }
}

@keyframes km-undo-flash-bg {
    0%, 40% { background-color: #dbeafe; }
    100% { background-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .km-toast,
    .km-undo-restored,
    tr.km-undo-restored > td {
        animation: none;
    }
}

@media (max-width: 480px) {
    .km-toast-region {
        bottom: 16px;
        width: calc(100vw - 32px);
    }
}
