﻿/* =========================================================================
   Toast notifications (site-wide)
   - Namespaced as `gz-toast` to avoid Bootstrap `.toast` collision
     (Bootstrap _toast.scss applies `.toast:not(.show){display:none}`)
   - Slide-in from top-right on desktop, top-stretched on mobile
   - Severity variants: error, success, warning, info
   - Auto-dismiss + manual close + accessible (aria-live region)
   - Respects prefers-reduced-motion
   ========================================================================= */

.gz-toast-host {
    position: fixed;
    top: var(--brand-space-3);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    z-index: 1080; /* above Bootstrap modals/dropdowns */
    display: flex;
    flex-direction: column;
    gap: var(--brand-space-2);
    width: min(420px, calc(100vw - 2 * var(--brand-space-3)));
    pointer-events: none;
}

.gz-toast {
    position: relative;
    pointer-events: auto;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: flex-start;
    gap: var(--brand-space-3);
    padding: var(--brand-space-3) var(--brand-space-3);
    background: #ffffff;
    color: #111111;
    border-radius: var(--brand-radius-lg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.25);
    border-left: 6px solid var(--brand-accent);
    transform: translateY(-120%);
    opacity: 0;
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
                opacity 220ms ease-out;
    will-change: transform, opacity;
    overflow: hidden;
}

.gz-toast--visible {
    transform: translateY(0);
    opacity: 1;
}

.gz-toast--leaving {
    transform: translateY(-120%);
    opacity: 0;
}

.gz-toast__icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-accent);
}

.gz-toast__icon svg {
    width: 100%;
    height: 100%;
}

.gz-toast__body {
    min-width: 0;
    line-height: 1.4;
}

.gz-toast__title {
    margin: 0 0 var(--brand-space-1);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.gz-toast__message {
    margin: 0;
    font-size: 0.85rem;
    color: #4a4a4a;
    word-wrap: break-word;
}

.gz-toast__close {
    appearance: none;
    background: transparent;
    border: 0;
    padding: 0;
    width: 1.25rem;
    height: 1.25rem;
    color: #6a6a6a;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--brand-radius-sm);
    transition: color 150ms ease, background-color 150ms ease;
}

.gz-toast__close:hover,
.gz-toast__close:focus-visible {
    color: #111111;
    background-color: rgba(0, 0, 0, 0.06);
    outline: none;
}

.gz-toast__close svg {
    width: 0.85rem;
    height: 0.85rem;
}

.gz-toast__progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 100%;
    background: var(--brand-accent);
    transform-origin: left center;
    animation: gz-toast-progress linear forwards;
}

@keyframes gz-toast-progress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* --- Severity variants --- */

.gz-toast--error                 { border-left-color: var(--brand-danger); }
.gz-toast--error .gz-toast__icon,
.gz-toast--error .gz-toast__progress { color: var(--brand-danger); background: var(--brand-danger); }
.gz-toast--error .gz-toast__icon { background: transparent; }

.gz-toast--success                 { border-left-color: #1ecb81; }
.gz-toast--success .gz-toast__icon,
.gz-toast--success .gz-toast__progress { color: #1ecb81; background: #1ecb81; }
.gz-toast--success .gz-toast__icon { background: transparent; }

.gz-toast--warning                 { border-left-color: #f6b73c; }
.gz-toast--warning .gz-toast__icon,
.gz-toast--warning .gz-toast__progress { color: #f6b73c; background: #f6b73c; }
.gz-toast--warning .gz-toast__icon { background: transparent; }

.gz-toast--info { border-left-color: var(--brand-accent); }

/* --- Mobile: pin to top edge, full width --- */

@media (max-width: 575.98px) {
    .gz-toast-host {
        top: var(--brand-space-2);
        left: var(--brand-space-2);
        right: var(--brand-space-2);
        transform: none;
        width: auto;
    }
}

/* --- Reduced motion --- */

@media (prefers-reduced-motion: reduce) {
    .gz-toast {
        transition: opacity 150ms ease;
        transform: none !important;
    }

    .gz-toast__progress {
        animation: none;
        display: none;
    }
}
