/* ================================================================
   GOEY TOAST — Pure CSS/JS Pill-Blob Morphing Toast
   Inspired by anl331/goey-toast (React) — vanilla implementation
   ================================================================ */

#goey-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100vw - 48px);
}

.goey-toast {
    pointer-events: all;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 100px;
    font-family: -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: white;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.12);
    cursor: pointer;
    overflow: hidden;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transform: translateY(0) scale(1);
    transition: transform 0.2s cubic-bezier(.34,1.56,.64,1);

    /* Blob entry animation */
    animation: goey-in 0.45s cubic-bezier(.34,1.56,.64,1) both;
}

.goey-toast:hover {
    transform: scale(1.03);
    box-shadow: 0 12px 40px rgba(0,0,0,0.28), 0 4px 12px rgba(0,0,0,0.15);
}

/* === TYPE COLORS === */
.goey-toast.goey-success {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border: 1.5px solid rgba(255,255,255,0.2);
}
.goey-toast.goey-error {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    border: 1.5px solid rgba(255,255,255,0.2);
}
.goey-toast.goey-warning {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    border: 1.5px solid rgba(255,255,255,0.2);
}
.goey-toast.goey-info {
    background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
    border: 1.5px solid rgba(255,255,255,0.2);
}
.goey-toast.goey-default {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border: 1.5px solid rgba(255,255,255,0.15);
}

/* === ICON === */
.goey-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    animation: goey-icon-pop 0.45s cubic-bezier(.34,1.56,.64,1) 0.1s both;
}

@keyframes goey-icon-pop {
    0% { transform: scale(0) rotate(-30deg); opacity: 0; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* === BODY === */
.goey-body { flex: 1; min-width: 0; }
.goey-title {
    font-weight: 700;
    font-size: 13.5px;
    line-height: 1.2;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.goey-desc {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 3px;
    line-height: 1.4;
}

/* === PROGRESS BAR === */
.goey-progress {
    position: absolute;
    bottom: 0; left: 0;
    height: 3px;
    background: rgba(255,255,255,0.5);
    border-radius: 0 0 100px 100px;
    transform-origin: left;
    animation: none;
}
.goey-progress.running {
    animation: goey-shrink linear forwards;
}

@keyframes goey-shrink {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* === CLOSE BTN === */
.goey-close {
    flex-shrink: 0;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 13px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0.7;
    transition: opacity 0.15s, background 0.15s;
    line-height: 1;
    padding: 0;
}
.goey-close:hover { opacity: 1; background: rgba(255,255,255,0.35); }

/* === ENTRY ANIMATION (pill → blob squish → pill) === */
@keyframes goey-in {
    0%   { transform: translateY(20px) scale(0.7) scaleX(0.6); opacity: 0; border-radius: 100px; }
    35%  { transform: translateY(-6px) scale(1.06) scaleX(1.04); opacity: 1; border-radius: 40px; }
    60%  { transform: translateY(2px)  scale(0.98) scaleX(1.01); border-radius: 80px; }
    80%  { transform: translateY(-1px) scale(1.01) scaleX(1); border-radius: 100px; }
    100% { transform: translateY(0)    scale(1)    scaleX(1); border-radius: 100px; opacity: 1; }
}

/* === EXIT ANIMATION === */
@keyframes goey-out {
    0%   { transform: translateY(0) scale(1) scaleX(1); opacity: 1; max-height: 80px; margin-bottom: 0; }
    40%  { transform: translateY(4px) scale(1.02) scaleX(0.96); opacity: 0.6; border-radius: 40px; }
    100% { transform: translateY(16px) scale(0.7) scaleX(0.5); opacity: 0; max-height: 0; margin-bottom: 0; border-radius: 100px; }
}
.goey-toast.goey-out {
    animation: goey-out 0.38s cubic-bezier(.55,0,.1,1) forwards;
}

/* === SHAKE ANIMATION (for errors) === */
@keyframes goey-shake {
    0%,100% { transform: translateX(0) scale(1); }
    15%  { transform: translateX(-6px) scale(1.02) scaleX(0.97); }
    30%  { transform: translateX(5px) scale(1); }
    45%  { transform: translateX(-4px) scale(1.01) scaleX(0.99); }
    60%  { transform: translateX(3px); }
    75%  { transform: translateX(-2px); }
}
.goey-toast.goey-error {
    animation: goey-in 0.45s cubic-bezier(.34,1.56,.64,1) both,
               goey-shake 0.5s cubic-bezier(.36,.07,.19,.97) 0.45s both;
}

/* Mobile tweaks */
@media (max-width: 480px) {
    #goey-toast-container {
        bottom: 80px; /* above mobile bottom nav */
        right: 12px;
        left: 12px;
        width: auto;
        max-width: 100%;
    }
}
