/* ==========================================================================
   Toast notifications (resources/views/components/notification.blade.php)
   Top centre, one solid brand-coloured card per message.
   success = emerald, error = oxblood, warning = gold, info = rose gold
   Each card has a white icon badge that draws itself, then a gesture of its own,
   and a large faded copy of the icon behind the text.
   ========================================================================== */

#app-toast-container {
    position: fixed;
    top: 16px;
    left: 50%;
    z-index: 9999999 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: min(420px, calc(100% - 24px));
    pointer-events: none;
    transform: translateX(-50%);
}

.app-toast {
    /* tone = card, fg = text on the card, icon = glyph inside the white badge */
    --toast-tone: #00132D;
    --toast-fg: #FFFFFF;
    --toast-fg-soft: rgba(255, 255, 255, .9);
    --toast-icon: var(--toast-tone);
    --toast-glow: rgba(255, 255, 255, .16);
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 13px 10px 15px 13px;
    overflow: hidden;
    font-family: var(--gf-body, 'Jost', system-ui, sans-serif);
    color: var(--toast-fg);
    background-color: var(--toast-tone);
    background-image: none;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(0, 19, 45, .18);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-22px) scale(.92);
    transition: opacity .25s ease, transform .5s cubic-bezier(.34, 1.56, .64, 1);
}

.app-toast.is-in { opacity: 1; transform: none; }
.app-toast.is-out { opacity: 0; transform: translateY(-12px) scale(.96); transition: opacity .22s ease, transform .22s ease; }

.app-toast--success { --toast-tone: #059669; }
.app-toast--error { --toast-tone: #DC2626; }
.app-toast--warning {
    --toast-tone: #D97706;
    --toast-fg: #FFFFFF;
    --toast-fg-soft: rgba(255, 255, 255, .92);
    --toast-icon: #D97706;
}
.app-toast--info { --toast-tone: #00132D; }

/* ---------- Icon badge ---------- */
.app-toast-icon {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    color: var(--toast-icon);
    background: #FFFFFF;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(21, 23, 28, .2);
}

/* A ring that spreads out once when the card lands */
.app-toast-icon::after {
    position: absolute;
    inset: 0;
    content: '';
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.app-toast.is-in .app-toast-icon::after { animation: app-toast-halo .9s ease-out .35s 2; }

.app-toast-icon svg { display: block; width: 22px; height: 22px; overflow: visible; }

/* Outline first, then the mark strokes in */
.app-toast-ring,
.app-toast-mark { stroke-dasharray: 1; stroke-dashoffset: 1; }

.app-toast.is-in .app-toast-ring { animation: app-toast-draw .5s cubic-bezier(.65, 0, .35, 1) .15s forwards; }
.app-toast.is-in .app-toast-mark { animation: app-toast-draw .35s cubic-bezier(.65, 0, .35, 1) .5s forwards; }
.app-toast--success.is-in .app-toast-mark,
.app-toast--error.is-in .app-toast-mark { animation-delay: .2s; animation-duration: .45s; }

.app-toast-dot { fill: currentColor; stroke: none; opacity: 0; transform-origin: center; transform-box: fill-box; }
.app-toast.is-in .app-toast-dot { animation: app-toast-pop .3s cubic-bezier(.34, 1.56, .64, 1) .75s forwards; }

/* Each tone gets its own finishing gesture */
.app-toast--success.is-in .app-toast-icon { animation: app-toast-bounce .5s cubic-bezier(.34, 1.56, .64, 1) .6s; }
.app-toast--error.is-in .app-toast-icon { animation: app-toast-shake .5s ease-in-out .6s; }
.app-toast--warning.is-in .app-toast-icon { animation: app-toast-bounce .7s ease-in-out .8s 2; }
.app-toast--info.is-in .app-toast-icon svg { transform-origin: 50% 12%; animation: app-toast-swing .9s ease-in-out .65s; }

/* Large faded copy of the icon, tucked into the right edge */
.app-toast-glyph {
    position: absolute;
    top: 50%;
    right: -12px;
    width: 96px;
    height: 96px;
    color: var(--toast-fg);
    opacity: .1;
    transform: translateY(-50%) rotate(-12deg);
    pointer-events: none;
}

.app-toast-glyph circle { fill: currentColor; stroke: none; }

@keyframes app-toast-draw { to { stroke-dashoffset: 0; } }

@keyframes app-toast-pop {
    from { opacity: 0; transform: scale(0); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes app-toast-bounce {
    0%, 100% { transform: scale(1); }
    45% { transform: scale(1.16); }
}

@keyframes app-toast-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

@keyframes app-toast-swing {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(16deg); }
    40% { transform: rotate(-13deg); }
    60% { transform: rotate(8deg); }
    80% { transform: rotate(-5deg); }
}

@keyframes app-toast-halo {
    0% { opacity: .75; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.65); }
}

/* ---------- Text ---------- */
.app-toast-body { position: relative; z-index: 1; flex: 1 1 auto; min-width: 0; padding-top: 1px; }

.app-toast-title {
    margin: 0 0 1px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--toast-fg);
}

.app-toast-content {
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.45;
    color: var(--toast-fg-soft);
    word-break: break-word;
}

.app-toast-content p,
.app-toast-content li,
.app-toast-content strong { color: inherit; }
.app-toast-content p { margin: 0 0 2px; }
.app-toast-content p:last-child { margin-bottom: 0; }
.app-toast-content h5 { margin: 0 0 4px; font-size: 13.5px; font-weight: 600; color: inherit; }
.app-toast-content ul { margin: 0; padding-left: 18px; }
.app-toast-content li { margin-bottom: 2px; }

/* ---------- Close + progress ---------- */
.app-toast-close {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 28px;
    height: 28px;
    padding: 0;
    color: var(--toast-fg);
    background: transparent;
    border: 0;
    border-radius: 8px;
    opacity: .75;
    cursor: pointer;
    transition: opacity .15s ease, background-color .15s ease;
}

.app-toast-close:hover { background: rgba(255, 255, 255, .2); opacity: 1; }
.app-toast-close:focus-visible { outline: 2px solid var(--toast-fg); outline-offset: 1px; opacity: 1; }
.app-toast-close svg { display: block; width: 15px; height: 15px; }

.app-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--toast-fg);
    opacity: .5;
    transform-origin: left center;
}

@media (max-width: 575.98px) {
    #app-toast-container { top: 10px; }
    .app-toast { padding: 11px 8px 13px 11px; gap: 10px; }
    .app-toast-icon { width: 36px; height: 36px; }
    .app-toast-title { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .app-toast { transition: opacity .2s linear; transform: none; }
    .app-toast-ring, .app-toast-mark { stroke-dashoffset: 0; animation: none !important; }
    .app-toast-dot { opacity: 1; animation: none !important; }
    .app-toast-icon, .app-toast-icon svg { animation: none !important; }
    .app-toast-icon::after { display: none; }
}
