
/* ========================
   CLOUD ZERO - TOAST
======================== */

/* ========================
   CONTAINER
======================== */

.toast-container {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9999;

    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;

    width: min(340px, calc(100vw - 32px));

    pointer-events: none;
}

/* ========================
   TOAST BASE
======================== */

.toast {
    --toast-color: var(--accent);
    --toast-bg: var(--bg-surface);
    --toast-border: var(--border);

    position: relative;

    display: flex;
    align-items: center;
    gap: 10px;

    width: 100%;
    min-height: 56px;

    padding: 11px 13px;

    overflow: hidden;

    background: var(--toast-bg);
    border: 1px solid var(--toast-border);
    border-radius: 9px;

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.25);

    pointer-events: auto;

    animation: toast-enter 0.25s ease-out both;
}

/* ========================
   SUCCESS
======================== */

.toast-success {
    --toast-color: #5be0a8;
    --toast-bg: #15352b;
    --toast-border: #28664d;
}

/* ========================
   ERROR
======================== */

.toast-error {
    --toast-color: #ff7383;
    --toast-bg: #421c27;
    --toast-border: #873747;
}

/* ========================
   ICON
======================== */

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;
    flex-shrink: 0;

    background: rgba(0, 0, 0, 0.12);
    border-radius: 7px;

    color: var(--toast-color);
}

.toast-icon svg {
    width: 16px;
    height: 16px;
}

/* ========================
   CONTENT
======================== */

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    margin: 0 0 2px;

    color: #ffffff;

    font-size: 12px;
    font-weight: 650;
    line-height: 1.3;
}

.toast-message {
    margin: 0;

    color: rgba(255, 255, 255, 0.78);

    font-size: 11px;
    line-height: 1.4;

    overflow-wrap: anywhere;
}

/* ========================
   CLOSE BUTTON
======================== */

.toast-close {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 22px;
    height: 22px;
    flex-shrink: 0;

    padding: 0;

    background: transparent;
    border: none;
    border-radius: 5px;

    color: rgba(255, 255, 255, 0.55);

    cursor: pointer;

    transition:
        background var(--transition),
        color var(--transition);
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
}

.toast-close svg {
    width: 13px;
    height: 13px;
}

/* ========================
   PROGRESS BAR
======================== */

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;

    width: 100%;
    height: 2px;

    background: var(--toast-color);

    transform-origin: left;

    animation:
        toast-progress
        var(--toast-duration, 3000ms)
        linear forwards;
}

/* ========================
   ANIMATIONS
======================== */

@keyframes toast-enter {

    from {
        opacity: 0;
        transform: translateX(15px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }

}

@keyframes toast-exit {

    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(15px);
    }

}

@keyframes toast-progress {

    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }

}

.toast.is-leaving {
    animation: toast-exit 0.18s ease forwards;
}

/* ========================
   RESPONSIVE
======================== */

@media (max-width: 600px) {

    .toast-container {
        right: 12px;
        bottom: 12px;

        width: calc(100vw - 24px);
    }

    .toast {
        min-height: 52px;
        padding: 10px 12px;
    }

}

/* ========================
   REDUCED MOTION
======================== */

@media (prefers-reduced-motion: reduce) {

    .toast,
    .toast.is-leaving,
    .toast-progress {
        animation: none;
    }

}