/* ==========================================================================
   SILEO TOAST SYSTEM — Physics-based Dynamic Island & SVG Morphing Toasts
   Inspired by https://sileo.aaryan.design/
   Engineered for We All Run 2026 (60-120 FPS Composited Performance)
   ========================================================================== */

:root {
    --sileo-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --sileo-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --sileo-ease-snap: cubic-bezier(0.25, 1, 0.5, 1);
}

/* Toast Container: Top-Center Dynamic Island Viewport Anchor */
#sileo-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    width: auto;
    max-width: 92vw;
}

/* Sileo Pill Item */
.sileo-toast {
    pointer-events: auto;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px 9px 12px;
    background: rgba(14, 20, 24, 0.94);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 9999px;
    box-shadow:
        0 14px 34px -8px rgba(0, 0, 0, 0.75),
        0 2px 6px rgba(0, 0, 0, 0.4),
        0 0 16px rgba(128, 239, 128, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    color: #f3f4f6;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: -0.01em;
    cursor: pointer;
    will-change: transform, opacity, width;
    transition:
        transform 380ms var(--sileo-ease-spring),
        opacity 240ms var(--sileo-ease-out),
        background-color 220ms ease,
        border-color 220ms ease,
        box-shadow 260ms ease;
}

/* State: Entering */
.sileo-toast.sileo-enter {
    transform: translateY(-26px) scale(0.85);
    opacity: 0;
}

/* State: Visible */
.sileo-toast.sileo-visible {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* State: Exiting */
.sileo-toast.sileo-exit {
    transform: translateY(-20px) scale(0.88);
    opacity: 0;
    pointer-events: none;
}

/* Hover tactile sensation */
.sileo-toast:hover {
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow:
        0 18px 40px -8px rgba(0, 0, 0, 0.85),
        0 0 22px rgba(128, 239, 128, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.sileo-toast:active {
    transform: scale(0.97) translateY(1px);
}

/* Types */
.sileo-toast.sileo-success {
    border-color: rgba(128, 239, 128, 0.35);
}
.sileo-toast.sileo-error {
    border-color: rgba(248, 113, 113, 0.4);
}
.sileo-toast.sileo-warning {
    border-color: rgba(251, 191, 36, 0.4);
}
.sileo-toast.sileo-info {
    border-color: rgba(56, 189, 248, 0.35);
}
.sileo-toast.sileo-loading {
    border-color: rgba(128, 239, 128, 0.25);
}

/* Icon Shell */
.sileo-icon-wrapper {
    position: relative;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sileo-icon-svg {
    width: 20px;
    height: 20px;
    overflow: visible;
}

/* SVG Morphing / Stroke Drawing Animations */
.sileo-check-path {
    stroke-dasharray: 22;
    stroke-dashoffset: 22;
    animation: sileoStrokeDraw 360ms var(--sileo-ease-spring) forwards 80ms;
}

.sileo-cross-path-1 {
    stroke-dasharray: 18;
    stroke-dashoffset: 18;
    animation: sileoStrokeDraw 240ms var(--sileo-ease-out) forwards 60ms;
}

.sileo-cross-path-2 {
    stroke-dasharray: 18;
    stroke-dashoffset: 18;
    animation: sileoStrokeDraw 240ms var(--sileo-ease-out) forwards 140ms;
}

@keyframes sileoStrokeDraw {
    to {
        stroke-dashoffset: 0;
    }
}

/* Spring Pulse on Icon Arrival */
.sileo-spring-pop {
    animation: sileoPop 420ms var(--sileo-ease-spring) forwards;
}

@keyframes sileoPop {
    0% {
        transform: scale(0.4);
        opacity: 0;
    }
    60% {
        transform: scale(1.18);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Spinner for Loading / Promise */
.sileo-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(128, 239, 128, 0.2);
    border-top-color: #80EF80;
    animation: sileoSpin 650ms linear infinite;
    flex-shrink: 0;
}

@keyframes sileoSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Content Area */
.sileo-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sileo-title {
    font-weight: 600;
    color: #ffffff;
    font-size: 13px;
    line-height: 1.25;
}

.sileo-description {
    font-size: 11.5px;
    color: #9ca3af;
    margin-top: 1px;
    line-height: 1.25;
}

/* Interactive Action Button */
.sileo-action-btn {
    appearance: none;
    background: rgba(128, 239, 128, 0.14);
    color: #80EF80;
    border: 1px solid rgba(128, 239, 128, 0.35);
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    margin-left: 6px;
    transition: transform 120ms ease, background-color 150ms ease, color 150ms ease;
    white-space: nowrap;
}

.sileo-action-btn:hover {
    background: #80EF80;
    color: #05080a;
}

.sileo-action-btn:active {
    transform: scale(0.92);
}

/* Stacked Multi-Toast Stagger */
#sileo-container > .sileo-toast:nth-child(n+4) {
    display: none;
}

