﻿/* Container chung */
.toastx-stack {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2147483647;
    display: flex;
    flex-direction: column-reverse; /* toast mới lên trên */
    gap: 10px;
    pointer-events: none;
}

/* Toast item */
.toastx {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 320px;
    padding: 12px 14px;
    border-radius: 6px;
    color: #fff;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    opacity: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    position: relative;
    overflow: hidden;
    font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

    /* Trạng thái hiển thị/ẩn */
    .toastx.show {
        opacity: 1;
        transform: translateX(0);
    }

    .toastx.hide {
        opacity: 0;
        transform: translateY(12px);
    }

/* Màu theo loại */
.toastx-success {
    background: #28a745;
}

.toastx-error {
    background: #dc3545;
}

.toastx-warning {
    background: #ffc107;
    color: #212529;
}

.toastx-info {
    background: #17a2b8;
}

/* Nội dung */
.toastx-message {
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Nút đóng */
.toastx-close {
    appearance: none;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    padding: 2px 6px;
    cursor: pointer;
    opacity: 0.85;
}

    .toastx-close:hover {
        opacity: 1;
    }

/* Mobile spacing */
@media (max-width: 480px) {
    .toastx-stack {
        top: 12px;
        right: 12px;
        gap: 8px;
    }

    .toastx {
        max-width: calc(100vw - 24px);
    }
}
