/* =====================================================================
   Taskify — glass toasts (restyles every toastr toast; load after toastr.min.css)
   Behaviour (timer, progress bar, stacking) lives in assets/js/toast-glass.js.
===================================================================== */
#toast-container {
    --tg-bg: rgba(255, 255, 255, .78);
    --tg-border: rgba(23, 20, 42, .08);
    --tg-shadow: 0 18px 40px -16px rgba(40, 28, 90, .35), 0 2px 8px -2px rgba(40, 28, 90, .12);
    --tg-title: #17142a;
    --tg-text: #4b4763;
    --tg-close: #6b6784;
    --tg-close-hover-bg: rgba(23, 20, 42, .06);
    --tg-track: rgba(23, 20, 42, .06);
    --tg-c: #7c3aed;
    --tg-tint: rgba(124, 58, 237, .12);
    --tg-icon: none;

    position: fixed;
    z-index: 200000 !important;          /* above modals (1055), sidebar, navbar, FABs */
    top: 16px !important;
    right: 16px !important;
    bottom: auto !important;
    left: auto !important;
    width: 360px;
    max-width: calc(100vw - 32px);
    margin: 0 !important;
    pointer-events: none;
}
html[data-app-theme="dark"] #toast-container {
    --tg-bg: rgba(28, 22, 46, .78);
    --tg-border: rgba(196, 181, 253, .14);
    --tg-shadow: 0 20px 44px -16px rgba(0, 0, 0, .8), 0 0 0 1px rgba(0, 0, 0, .2);
    --tg-title: #f4f1ff;
    --tg-text: #c9c3e0;
    --tg-close: #a9a3c4;
    --tg-close-hover-bg: rgba(255, 255, 255, .08);
    --tg-track: rgba(255, 255, 255, .06);
}

/* ---------- card ---------- */
html #toast-container > div.toast {
    position: relative;
    display: grid;
    grid-template-columns: 34px 1fr;
    column-gap: 12px;
    align-items: start;
    width: 100%;
    margin: 0 0 10px !important;
    padding: 14px 40px 16px 14px !important;
    overflow: hidden;
    border: 1px solid var(--tg-border);
    border-radius: 12px !important;
    color: var(--tg-text) !important;
    background: var(--tg-bg) !important;           /* kills toastr's colour + icon image */
    background-image: none !important;
    box-shadow: var(--tg-shadow) !important;
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
    opacity: 1 !important;
    font-size: .875rem;
    line-height: 1.45;
    pointer-events: auto;
    cursor: pointer;
    animation: tg-in .22s cubic-bezier(.2, .8, .2, 1) both;
}
html #toast-container > div.toast:hover { box-shadow: var(--tg-shadow) !important; opacity: 1 !important; }

/* type colours + icons */
#toast-container > .toast-success { --tg-c: #16a34a; --tg-tint: rgba(22, 163, 74, .13);
    --tg-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316a34a' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
#toast-container > .toast-error { --tg-c: #dc2626; --tg-tint: rgba(220, 38, 38, .12);
    --tg-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M7 7l10 10M17 7L7 17'/%3E%3C/svg%3E"); }
#toast-container > .toast-warning { --tg-c: #d97706; --tg-tint: rgba(217, 119, 6, .14);
    --tg-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d97706' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4l9 16H3z'/%3E%3Cpath d='M12 10v4.5M12 17.5v.01'/%3E%3C/svg%3E"); }
#toast-container > .toast-info { --tg-c: #7c3aed; --tg-tint: rgba(124, 58, 237, .13);
    --tg-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c3aed' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 11v5.5M12 7.8v.01'/%3E%3C/svg%3E"); }
html[data-app-theme="dark"] #toast-container > .toast-success { --tg-tint: rgba(34, 197, 94, .18); }
html[data-app-theme="dark"] #toast-container > .toast-error { --tg-tint: rgba(248, 113, 113, .18); }
html[data-app-theme="dark"] #toast-container > .toast-warning { --tg-tint: rgba(251, 191, 36, .18); }
html[data-app-theme="dark"] #toast-container > .toast-info { --tg-tint: rgba(167, 139, 250, .2); }

/* icon in a tinted circle */
#toast-container > div.toast::before {
    content: "";
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--tg-icon) center / 18px 18px no-repeat, var(--tg-tint);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tg-c) 22%, transparent);
}

/* text */
#toast-container > div.toast .toast-title,
#toast-container > div.toast .toast-message { grid-column: 2; min-width: 0; overflow-wrap: anywhere; word-break: normal; }
#toast-container > div.toast .toast-title {
    margin: 1px 0 2px;
    color: var(--tg-title);
    font-weight: 700;
    font-size: .9rem;
    line-height: 1.3;
}
#toast-container > div.toast .toast-message { color: var(--tg-text); align-self: center; min-height: 34px; display: flex; align-items: center; }
#toast-container > div.toast .toast-title + .toast-message { min-height: 0; display: block; }
#toast-container > div.toast .toast-message a,
#toast-container > div.toast .toast-message label { color: var(--tg-c); }
#toast-container > div.toast .toast-message a:hover { color: var(--tg-c); text-decoration: underline; }

/* close button: faint, clear on hover */
#toast-container > div.toast .toast-close-button {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    float: none;
    border: 0;
    border-radius: 7px;
    color: var(--tg-close) !important;
    background: transparent;
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    text-shadow: none !important;
    opacity: 0;
    transition: opacity .15s ease, background-color .15s ease;
}
#toast-container > div.toast:hover .toast-close-button,
#toast-container > div.toast:focus-within .toast-close-button { opacity: .75; }
#toast-container > div.toast .toast-close-button:hover,
#toast-container > div.toast .toast-close-button:focus-visible { opacity: 1 !important; background: var(--tg-close-hover-bg); outline: none; }
@media (hover: none) { #toast-container > div.toast .toast-close-button { opacity: .7; } }

/* progress bar (time left) */
#toast-container > div.toast .toast-progress { display: none !important; }   /* toastr's own bar is replaced */
#toast-container > div.toast .tg-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--tg-track);
}
#toast-container > div.toast .tg-bar > i {
    display: block;
    height: 100%;
    background: var(--tg-c);
    transform-origin: left center;
    animation: tg-time var(--tg-dur, 5s) linear forwards;
}
#toast-container > div.toast.tg-paused .tg-bar > i { animation-play-state: paused; }
[dir="rtl"] #toast-container > div.toast .tg-bar > i { transform-origin: right center; }

@keyframes tg-in { from { opacity: 0; transform: translateX(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes tg-time { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* no blur support / lite mode: opaque card */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    #toast-container { --tg-bg: rgba(255, 255, 255, .97); }
    html[data-app-theme="dark"] #toast-container { --tg-bg: rgba(28, 22, 46, .97); }
}
html.perf-lite #toast-container { --tg-bg: rgba(255, 255, 255, .97); }
html.perf-lite[data-app-theme="dark"] #toast-container { --tg-bg: rgba(28, 22, 46, .97); }

/* mobile: top-centre, full width with side margins */
@media (max-width: 575.98px) {
    #toast-container {
        top: 12px !important;
        right: 12px !important;
        left: 12px !important;
        width: auto;
        max-width: none;
    }
    @keyframes tg-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
}

@media (prefers-reduced-motion: reduce) {
    html #toast-container > div.toast { animation: none; }
    #toast-container > div.toast .toast-close-button { transition: none; }
}
