/*
 * HCM toast: one modern look for every SweetAlert2 toast in the project (Toast.fire({...})),
 * whichever page or script defined its own Swal.mixin. Pure CSS, so no JavaScript changes.
 * Colours follow the theme variables (--kt-primary, --kt-success ...), light and dark.
 */

/* SweetAlert's toast container is 360px wide (border-box); make room for the card and its padding
   and keep the card inside the screen instead of spilling over the right edge */
body.swal2-toast-shown .swal2-container {
    width: 420px !important;
    max-width: 100vw !important;
    padding: 1rem 1.25rem !important;
    display: flex !important;
    flex-direction: column;
    align-items: flex-end;
    gap: .5rem;
    overflow: visible;
}

.swal2-popup.swal2-toast {
    --hcm-toast-accent: var(--kt-primary, #0b5ed7);
    --hcm-toast-soft: var(--kt-primary-light, #e7f0fd);
    display: flex !important;
    align-items: center;
    gap: .85rem;
    width: 100% !important;
    max-width: 380px !important;
    margin: 0 !important;
    box-sizing: border-box;
    padding: .9rem 1.1rem .9rem .95rem !important;
    border-radius: 14px !important;
    background: var(--kt-card-bg, #fff) !important;
    border: 1px solid var(--kt-gray-200, #eef0f4) !important;
    border-left: 4px solid var(--hcm-toast-accent) !important;
    box-shadow: 0 12px 32px -8px rgba(15, 23, 42, .22), 0 2px 6px rgba(15, 23, 42, .06) !important;
    overflow: hidden;
    font-family: inherit;
}

.swal2-popup.swal2-toast.swal2-icon-success { --hcm-toast-accent: var(--kt-success, #17c653); --hcm-toast-soft: var(--kt-success-light, #e8fff3); }
.swal2-popup.swal2-toast.swal2-icon-error   { --hcm-toast-accent: var(--kt-danger, #f1416c);  --hcm-toast-soft: var(--kt-danger-light, #fff5f8); }
.swal2-popup.swal2-toast.swal2-icon-warning { --hcm-toast-accent: var(--kt-warning, #f6b100); --hcm-toast-soft: var(--kt-warning-light, #fff8dd); }
.swal2-popup.swal2-toast.swal2-icon-info    { --hcm-toast-accent: var(--kt-primary, #0b5ed7); --hcm-toast-soft: var(--kt-primary-light, #e7f0fd); }
.swal2-popup.swal2-toast.swal2-icon-question{ --hcm-toast-accent: var(--kt-info, #7239ea);    --hcm-toast-soft: var(--kt-info-light, #f8f5ff); }

/* icon: a soft rounded tile with a Font Awesome glyph instead of the old animated circle */
.swal2-popup.swal2-toast .swal2-icon {
    position: relative;
    flex: 0 0 38px;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 11px !important;
    background: var(--hcm-toast-soft) !important;
    color: var(--hcm-toast-accent) !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    animation: hcm-toast-pop .35s cubic-bezier(.2, .9, .3, 1.4) both !important;
}
.swal2-popup.swal2-toast .swal2-icon > * { display: none !important; }
.swal2-popup.swal2-toast .swal2-icon::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1rem;
    line-height: 1;
    content: "\f05a";
}
.swal2-popup.swal2-toast.swal2-icon-success .swal2-icon::before { content: "\f00c"; }
.swal2-popup.swal2-toast.swal2-icon-error .swal2-icon::before   { content: "\f00d"; }
.swal2-popup.swal2-toast.swal2-icon-warning .swal2-icon::before { content: "\f071"; }
.swal2-popup.swal2-toast.swal2-icon-question .swal2-icon::before { content: "\3f"; }

/* text */
.swal2-popup.swal2-toast .swal2-title {
    flex: 1 1 auto;
    margin: 0 !important;
    padding: 0 !important;
    font-size: .92rem !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    color: var(--kt-gray-900, #181c32) !important;
    text-align: left !important;
}
.swal2-popup.swal2-toast .swal2-html-container {
    margin: .15rem 0 0 !important;
    padding: 0 !important;
    font-size: .82rem !important;
    color: var(--kt-gray-600, #78829d) !important;
    text-align: left !important;
}
.swal2-popup.swal2-toast .swal2-close {
    position: static;
    width: 1.6rem; height: 1.6rem;
    font-size: 1.2rem;
    color: var(--kt-gray-500, #99a1b7);
    border-radius: 8px;
}
.swal2-popup.swal2-toast .swal2-close:hover { background: var(--kt-gray-100, #f5f7fa); color: var(--kt-gray-800, #252f4a); }

/* thin accent progress bar along the bottom */
.swal2-popup.swal2-toast .swal2-timer-progress-bar-container {
    left: 0; right: 0; bottom: 0;
    height: 3px;
    border-radius: 0;
}
.swal2-popup.swal2-toast .swal2-timer-progress-bar {
    height: 3px !important;
    background: var(--hcm-toast-accent) !important;
    opacity: .55;
}

/* slide in from the right, fade out */
.swal2-popup.swal2-toast.swal2-show { animation: hcm-toast-in .38s cubic-bezier(.16, 1, .3, 1) both !important; }
.swal2-popup.swal2-toast.swal2-hide { animation: hcm-toast-out .22s ease-in both !important; }

@keyframes hcm-toast-in {
    from { opacity: 0; transform: translate3d(0, -10px, 0) scale(.97); }
    to   { opacity: 1; transform: none; }
}
@keyframes hcm-toast-out {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translate3d(0, -6px, 0) scale(.98); }
}
@keyframes hcm-toast-pop {
    from { transform: scale(.6); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .swal2-popup.swal2-toast.swal2-show,
    .swal2-popup.swal2-toast.swal2-hide,
    .swal2-popup.swal2-toast .swal2-icon { animation: none !important; }
}

/* dark theme */
[data-theme="dark"] .swal2-popup.swal2-toast,
[data-bs-theme="dark"] .swal2-popup.swal2-toast {
    background: var(--kt-card-bg, #1c1f26) !important;
    border-color: rgba(255, 255, 255, .08) !important;
    box-shadow: 0 14px 36px -10px rgba(0, 0, 0, .6) !important;
}
[data-theme="dark"] .swal2-popup.swal2-toast .swal2-title,
[data-bs-theme="dark"] .swal2-popup.swal2-toast .swal2-title { color: #eef0f5 !important; }

@media (max-width: 575.98px) {
    body.swal2-toast-shown .swal2-container { width: 100vw !important; padding: .75rem !important; }
    .swal2-popup.swal2-toast { max-width: 100% !important; }
}
