/* Toast notifications (reutilizável, sem dependências).
   Container fixo não-bloqueante: não desloca o layout da página. */

.toast-container {
    position: fixed;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-container .toast {
    pointer-events: auto;
}

/* Desktop: canto inferior-direito. */
@media (min-width: 769px) {
    .toast-container {
        right: 20px;
        bottom: 20px;
        width: min(380px, calc(100vw - 40px));
    }
}

/* Mobile: faixa inferior empilhada acima da bottom-nav (64px + safe-area). */
@media (max-width: 768px) {
    .toast-container {
        left: 12px;
        right: 12px;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    }
}

.toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--card-background, #ffffff);
    border: 1px solid var(--border-color, #e5e5ea);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(28, 28, 30, 0.08));
    padding: 12px 14px 14px;
    overflow: hidden;
    animation: toast-in 0.28s ease;
}

.toast-leaving {
    animation: toast-out 0.22s ease forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
}

.toast-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    margin-top: 1px;
}

.toast-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.toast-success .toast-icon {
    color: #1f9d43;
    background: rgba(52, 199, 89, 0.14);
}

.toast-error .toast-icon {
    color: #d70015;
    background: rgba(255, 59, 48, 0.12);
}

.toast-info .toast-icon {
    color: #0056cc;
    background: rgba(0, 122, 255, 0.12);
}

.toast-warning .toast-icon {
    color: #b25a00;
    background: rgba(255, 149, 0, 0.14);
}

.toast-message {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-primary, #1c1c1e);
    overflow-wrap: anywhere;
}

.toast-close {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: -4px -6px -4px 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary, #8e8e93);
    cursor: pointer;
}

.toast-close:hover {
    background: rgba(142, 142, 147, 0.14);
    color: var(--text-primary, #1c1c1e);
}

.toast-close:focus-visible {
    outline: 2px solid var(--primary-color, #007aff);
    outline-offset: 1px;
}

.toast-close svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
}

.toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    transform-origin: left center;
    animation-name: toast-progress;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

.toast-success .toast-progress { background: #34c759; }
.toast-error .toast-progress { background: #ff3b30; }
.toast-info .toast-progress { background: #007aff; }
.toast-warning .toast-progress { background: #ff9500; }

@keyframes toast-progress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .toast,
    .toast-leaving {
        animation: none;
    }

    .toast-progress {
        animation: none;
        transform: scaleX(0);
    }
}
