/* Toastr: thẻ gọn ở góc phải trên, icon tròn đặc theo loại — nạp ở mọi layout admin kể cả trang đăng nhập (account.tpl).
   Options ở main.js, màu tối ở dark.css */
#toast-container {
    --nh-toast-bg: #fff;
    --nh-toast-text: #1f2130;
    --nh-toast-border: rgba(20, 22, 40, .08);
    --nh-toast-shadow: 0 12px 32px -10px rgba(20, 22, 40, .25), 0 4px 10px -4px rgba(20, 22, 40, .08);
    --nh-toast-close: #a3a6b7;
    --nh-toast-close-hover: rgba(20, 22, 40, .06);
}
#toast-container.toast-top-right { top: 18px; right: 18px; }

/* thêm .toast để thắng #toast-container > .toast-info { background-image: ... !important } của toastr gốc */
#toast-container>div.toast,
#toast-container>div.toast:hover {
    display: flex;
    align-items: center;
    gap: 10px;
    width: -moz-fit-content;
    width: fit-content;
    min-width: 240px;
    max-width: min(440px, calc(100vw - 32px));
    margin: 0 0 10px auto;
    padding: 13px 40px 13px 14px;
    border: 1px solid var(--nh-toast-border);
    border-radius: 14px;
    /* phủ nhẹ màu theo loại ở phía icon */
    background: linear-gradient(100deg, color-mix(in srgb, var(--nh-toast-color) 10%, transparent) 0%, transparent 42%), var(--nh-toast-bg) !important;
    color: var(--nh-toast-text);
    box-shadow: var(--nh-toast-shadow);
    opacity: 1;
    cursor: default;
    animation: nhToastIn .28s cubic-bezier(.21, 1.02, .73, 1);
}

/* Icon: hình tròn màu đặc, ký hiệu trắng */
#toast-container>div::before {
    content: "";
    flex: 0 0 24px;
    height: 24px;
    margin-right: 2px;
    border-radius: 50%;
    background: var(--nh-toast-icon) center / 14px no-repeat, var(--nh-toast-color);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--nh-toast-color) 16%, transparent), 0 2px 6px -1px color-mix(in srgb, var(--nh-toast-color) 55%, transparent);
}

#toast-container .toast-title { font-size: 14px; font-weight: 600; margin: 0; }
#toast-container .toast-message { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; line-height: 1.4; word-wrap: break-word; }
#toast-container .toast-message a { color: inherit; text-decoration: underline; }

/* Nút đóng: ẩn ký tự gốc và icon LineAwesome của theme, vẽ lại bằng SVG */
#toast-container .toast-close-button {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 24px;
    height: 24px;
    margin-top: -12px;
    border-radius: 6px;
    font-size: 0;
    text-shadow: none;
    opacity: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3a6b7' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M7 7l10 10M17 7L7 17'/%3E%3C/svg%3E") center / 14px no-repeat;
    transition: opacity .15s, background-color .15s;
}
#toast-container .toast-close-button:before { content: none; }
#toast-container>div:hover .toast-close-button { opacity: 1; }
#toast-container .toast-close-button:hover { background-color: var(--nh-toast-close-hover); opacity: 1; }

#toast-container .toast-progress { display: none; }

#toast-container>.toast-success,
#toast-container>.toast-info { --nh-toast-color: #0abb87; --nh-toast-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
#toast-container>.toast-warning { --nh-toast-color: #f5a623; --nh-toast-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M12 6.5v7'/%3E%3Cpath d='M12 17.5v.1'/%3E%3C/svg%3E"); }
#toast-container>.toast-error { --nh-toast-color: #f1416c; --nh-toast-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M7.5 7.5l9 9M16.5 7.5l-9 9'/%3E%3C/svg%3E"); }

@keyframes nhToastIn {
    from { opacity: 0; transform: translate3d(28px, 0, 0) scale(.97); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    #toast-container>div { animation: none; }
}
