/* Toast notifications (resources/views/partials/toasts.blade.php + public/js/toast.js).
   Self-contained: no Bootstrap needed. Desktop: top-right stack. Mobile: top, full width. */
.bal-toasts {
    position: fixed;
    top: 88px; /* just under the site navbar, so the user menu stays clickable */
    right: 20px;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    width: min(400px, calc(100vw - 32px));
    pointer-events: none;
}
.bal-toast {
    --t-accent: #4F46E5;
    --t-soft: #EEF2FF;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 14px 10px 16px 14px;
    background: rgba(255, 255, 255, .97);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid #ECECF3;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(20, 19, 43, .14), 0 2px 6px rgba(20, 19, 43, .06);
    color: #14132B;
    font-family: 'Hind Siliguri', 'Noto Sans Bengali', Inter, system-ui, -apple-system, sans-serif;
    font-size: 14.5px;
    line-height: 1.5;
    overflow: hidden;
    pointer-events: auto;
    animation: bal-toast-in .35s cubic-bezier(.21, 1.02, .73, 1) both;
    box-sizing: border-box;
}
.bal-toast *, .bal-toast *::before { box-sizing: border-box; }
.bal-toast.is-success { --t-accent: #10B981; --t-soft: #D1FAE5; }
.bal-toast.is-error   { --t-accent: #EF4444; --t-soft: #FEE2E2; }
.bal-toast.is-warning { --t-accent: #F59E0B; --t-soft: #FEF3C7; }
.bal-toast.is-info    { --t-accent: #4F46E5; --t-soft: #E0E7FF; }

.bal-toast-icon {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--t-soft);
    position: relative;
}
.bal-toast-icon::before {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 18px;
    height: 18px;
    background: var(--t-accent);
    -webkit-mask: var(--t-icon) center / contain no-repeat;
    mask: var(--t-icon) center / contain no-repeat;
}
.bal-toast.is-success { --t-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' 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"); }
.bal-toast.is-error   { --t-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5M12 16.5h.01'/%3E%3C/svg%3E"); }
.bal-toast.is-warning { --t-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5l9.5 17h-19z'/%3E%3Cpath d='M12 10v4.5M12 17.5h.01'/%3E%3C/svg%3E"); }
.bal-toast.is-info    { --t-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5.5M12 7.5h.01'/%3E%3C/svg%3E"); }

.bal-toast-body { flex: 1; min-width: 0; padding-top: 5px; font-weight: 500; overflow-wrap: anywhere; }
.bal-toast-body ul { margin: 0; padding-left: 18px; }
.bal-toast-body li + li { margin-top: 2px; }

.bal-toast-close {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    margin: -2px 0 0;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #8A89A6;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.bal-toast-close:hover { background: #F2F2F7; color: #14132B; }
.bal-toast-close:focus-visible { outline: 2px solid var(--t-accent); outline-offset: 1px; }

/* Countdown bar along the bottom edge (4s, paused on hover/focus) */
.bal-toast-timer {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: var(--t-accent);
    opacity: .85;
    transform-origin: left center;
    animation: bal-toast-timer var(--t-duration, 4s) linear forwards;
}
.bal-toast.is-paused .bal-toast-timer { animation-play-state: paused; }

.bal-toast.is-leaving { animation: bal-toast-out .25s ease forwards; }

@keyframes bal-toast-in {
    from { opacity: 0; transform: translateX(24px) scale(.97); }
    to   { opacity: 1; transform: none; }
}
@keyframes bal-toast-out {
    to { opacity: 0; transform: translateX(24px) scale(.97); }
}
@keyframes bal-toast-timer {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* Mobile: full-width stack at the top, slides down */
@media (max-width: 767.98px) {
    .bal-toasts {
        top: calc(10px + env(safe-area-inset-top));
        left: 12px;
        right: 12px;
        width: auto;
        align-items: stretch;
    }
    .bal-toast { font-size: 14px; padding: 12px 8px 14px 12px; border-radius: 14px; }
    @keyframes bal-toast-in {
        from { opacity: 0; transform: translateY(-16px) scale(.98); }
        to   { opacity: 1; transform: none; }
    }
    @keyframes bal-toast-out {
        to { opacity: 0; transform: translateY(-16px) scale(.98); }
    }
}

@media (prefers-reduced-motion: reduce) {
    .bal-toast, .bal-toast.is-leaving { animation-duration: .01s; }
}
