/* =============================================================
   FLOWLY — TOAST SYSTEM
   ============================================================= */

.flowly-toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: calc(100vw - 32px);
    width: 360px;
    pointer-events: none;
}

.flowly-toast {
    /* O toast cobria botões do cabeçalho por ~3s e engolia o clique. Só os controles
       dele recebem ponteiro; o resto passa pro conteúdo abaixo. */
    pointer-events: none;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: linear-gradient(180deg,
        rgba(28, 30, 38, 0.92) 0%,
        rgba(20, 22, 28, 0.92) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: calc(10px * var(--flowly-radius-k));
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--flowly-text-primary, #f8fafc);
    font-size: calc(13px * var(--flowly-text-k));
    line-height: 1.45;
    transform: translateX(calc(100% + 32px));
    opacity: 0;
    transition: transform 320ms var(--flowly-ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
                opacity 240ms ease;
    position: relative;
    overflow: hidden;
}

.flowly-toast.is-visible {
    transform: translateX(0);
    opacity: 1;
}

.flowly-toast.is-leaving {
    transform: translateX(calc(100% + 32px));
    opacity: 0;
}

/* Progress bar — barra que encolhe pra indicar auto-dismiss */

/* Accent bar on left */
.flowly-toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--flowly-accent-info, #0A84FF);
    box-shadow: 0 0 8px var(--flowly-accent-info, #0A84FF);
}
.flowly-toast--success::before {
    background: var(--flowly-accent-success, #22c55e);
    box-shadow: 0 0 8px var(--flowly-accent-success, #22c55e);
}
.flowly-toast--warning::before {
    background: var(--flowly-accent-warning, #FF9F0A);
    box-shadow: 0 0 8px var(--flowly-accent-warning, #FF9F0A);
}
.flowly-toast--error::before {
    background: var(--flowly-accent-danger, #FF5C4D);
    box-shadow: 0 0 8px var(--flowly-accent-danger, #FF5C4D);
}

.flowly-toast__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}
.flowly-toast--info .flowly-toast__icon { color: var(--flowly-accent-info, #0A84FF); }
.flowly-toast--success .flowly-toast__icon { color: var(--flowly-accent-success, #22c55e); }
.flowly-toast--warning .flowly-toast__icon { color: var(--flowly-accent-warning, #FF9F0A); }
.flowly-toast--error .flowly-toast__icon { color: var(--flowly-accent-danger, #FF5C4D); }

.flowly-toast__body {
    flex: 1;
    min-width: 0;
}
.flowly-toast__title {
    font-size: calc(13px * var(--flowly-text-k));
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--flowly-text-primary);
}
.flowly-toast__message {
    color: var(--flowly-text-secondary, rgba(255, 255, 255, 0.78));
    word-wrap: break-word;
}

.flowly-toast__action {
    flex-shrink: 0;
    align-self: center;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: calc(6px * var(--flowly-radius-k));
    color: var(--flowly-text-primary);
    font-size: calc(12px * var(--flowly-text-k));
    font-weight: 600;
    cursor: pointer;
    transition: background 180ms ease, transform 180ms var(--flowly-ease-out, ease);
}
.flowly-toast__action:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}
.flowly-toast__action:active {
    transform: translateY(0) scale(0.97);
}

.flowly-toast__close {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: calc(4px * var(--flowly-radius-k));
    color: var(--flowly-text-tertiary, rgba(255, 255, 255, 0.4));
    cursor: pointer;
    transition: background 140ms, color 140ms;
}
.flowly-toast__close i {
    width: 14px;
    height: 14px;
}
.flowly-toast__close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--flowly-text-primary);
}

@media (max-width: 480px) {
    .flowly-toast-container {
        top: auto;
        /* fica acima da bottom nav + FAB, respeitando o notch */
        bottom: calc(var(--flowly-mobile-nav-height, 64px) + env(safe-area-inset-bottom, 0px) + 12px);
        right: 12px;
        left: 12px;
        width: auto;
    }
    .flowly-toast {
        transform: translateY(120%);
    }
    .flowly-toast.is-visible {
        transform: translateY(0);
    }
    .flowly-toast.is-leaving {
        transform: translateY(120%);
    }
}

.flowly-toast__close,
.flowly-toast__action { pointer-events: auto; }

/* Claro: o fundo escuro fixo deixava o título (texto escuro) ilegível. */
[data-theme="light"] .flowly-toast {
    background: var(--flowly-bg-overlay);
    border-color: var(--flowly-border-muted);
    box-shadow: var(--flowly-shadow-lg);
}
