/**
 * WOMM Toast / Snackbar — variantes reutilizáveis
 * Demo: /demo/toast-snackbar.php
 */

:root {
    --womm-toast-success: #16a34a;
    --womm-toast-success-dark: #15803d;
    --womm-toast-error: #dc2626;
    --womm-toast-error-dark: #b91c1c;
    --womm-toast-primary: #006FFF;
    --womm-toast-radius: 12px;
    --womm-toast-z: 10002;
}

.womm-toast-legacy-stub {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    padding: 0 !important;
    margin: -1px !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* ---- Regiões ---- */
.womm-toast-region {
    position: fixed;
    z-index: var(--womm-toast-z);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.womm-toast-region--material,
.womm-toast-region--linear,
.womm-toast-region--glass,
.womm-toast-region--womm {
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    align-items: center;
    width: min(420px, calc(100vw - 32px));
}

.womm-toast-region--sonner {
    right: 20px;
    bottom: 20px;
    align-items: flex-end;
    width: min(380px, calc(100vw - 32px));
}

/* ---- Toast base ---- */
.womm-toast {
    pointer-events: auto;
    width: 100%;
    border-radius: var(--womm-toast-radius);
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    transition: opacity 0.35s ease, transform 0.35s ease;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.18);
}

.womm-toast.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.womm-toast.is-leaving {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    transition-duration: 0.25s;
}

.womm-toast--static {
    opacity: 1 !important;
    transform: none !important;
}

.womm-toast__body {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px 14px 16px;
    min-height: 52px;
}

.womm-toast__icon {
    flex-shrink: 0;
    font-size: 1.15rem;
    line-height: 1;
    display: flex;
}

.womm-toast__message {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
}

.womm-toast__close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    opacity: 0.75;
    transition: opacity 0.15s, background 0.15s;
}

.womm-toast__close:hover,
.womm-toast__close:focus-visible {
    opacity: 1;
    outline: none;
}

.womm-toast__progress {
    height: 3px;
    width: 100%;
    background: rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.womm-toast__progress > span {
    display: block;
    height: 100%;
    width: 100%;
    transform-origin: left center;
    transform: scaleX(1);
}

.womm-toast.is-running .womm-toast__progress > span {
    animation: womm-toast-progress var(--womm-toast-duration, 5s) linear forwards;
}

.womm-toast.is-paused .womm-toast__progress > span {
    animation-play-state: paused;
}

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

/* ---- Variante: Material ---- */
.womm-toast--material {
    background: #1e293b;
    color: #f8fafc;
}

.womm-toast--material.womm-toast--success .womm-toast__icon { color: #4ade80; }
.womm-toast--material.womm-toast--error .womm-toast__icon { color: #f87171; }

.womm-toast--material .womm-toast__close {
    color: #cbd5e1;
}
.womm-toast--material .womm-toast__close:hover {
    background: rgba(255, 255, 255, 0.08);
}

.womm-toast--material.womm-toast--success .womm-toast__progress > span {
    background: #4ade80;
}
.womm-toast--material.womm-toast--error .womm-toast__progress > span {
    background: #f87171;
}

/* ---- Variante: Sonner ---- */
.womm-toast--sonner {
    background: #fff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.12);
}

.womm-toast--sonner.womm-toast--success .womm-toast__icon { color: var(--womm-toast-success); }
.womm-toast--sonner.womm-toast--error .womm-toast__icon { color: var(--womm-toast-error); }

.womm-toast--sonner .womm-toast__close {
    color: #64748b;
}
.womm-toast--sonner .womm-toast__close:hover {
    background: #f1f5f9;
}

.womm-toast--sonner .womm-toast__progress {
    background: #f1f5f9;
}
.womm-toast--sonner.womm-toast--success .womm-toast__progress > span {
    background: var(--womm-toast-success);
}
.womm-toast--sonner.womm-toast--error .womm-toast__progress > span {
    background: var(--womm-toast-error);
}

.womm-toast--sonner.womm-toast--warning .womm-toast__icon { color: #f59e0b; }
.womm-toast--sonner.womm-toast--warning .womm-toast__progress > span { background: #f59e0b; }

.womm-toast--sonner.womm-toast--info .womm-toast__icon { color: var(--womm-toast-primary); }
.womm-toast--sonner.womm-toast--info .womm-toast__progress > span { background: var(--womm-toast-primary); }

.womm-toast__action {
    flex-shrink: 0;
    border: none;
    border-radius: 8px;
    background: var(--womm-toast-primary);
    color: #fff;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.womm-toast__action:hover {
    filter: brightness(0.95);
}

.womm-toast__action:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.womm-toast--with-action .womm-toast__body {
    flex-wrap: wrap;
    row-gap: 8px;
}

/* ---- Variante: Linear ---- */
.womm-toast--linear {
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-left-width: 4px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.womm-toast--linear.womm-toast--success {
    border-left-color: var(--womm-toast-success);
}
.womm-toast--linear.womm-toast--error {
    border-left-color: var(--womm-toast-error);
}

.womm-toast--linear.womm-toast--success .womm-toast__icon { color: var(--womm-toast-success); }
.womm-toast--linear.womm-toast--error .womm-toast__icon { color: var(--womm-toast-error); }

.womm-toast--linear .womm-toast__close {
    color: #94a3b8;
}
.womm-toast--linear .womm-toast__close:hover {
    background: #f8fafc;
    color: #475569;
}

.womm-toast--linear .womm-toast__progress {
    background: #f1f5f9;
}
.womm-toast--linear.womm-toast--success .womm-toast__progress > span {
    background: var(--womm-toast-success);
}
.womm-toast--linear.womm-toast--error .womm-toast__progress > span {
    background: var(--womm-toast-error);
}

/* ---- Variante: Glass ---- */
.womm-toast--glass {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.womm-toast--glass.womm-toast--success .womm-toast__icon { color: var(--womm-toast-success); }
.womm-toast--glass.womm-toast--error .womm-toast__icon { color: var(--womm-toast-error); }

.womm-toast--glass .womm-toast__close {
    color: #64748b;
}
.womm-toast--glass .womm-toast__close:hover {
    background: rgba(0, 0, 0, 0.06);
}

.womm-toast--glass .womm-toast__progress {
    background: rgba(0, 0, 0, 0.06);
}
.womm-toast--glass.womm-toast--success .womm-toast__progress > span {
    background: linear-gradient(90deg, var(--womm-toast-success), #4ade80);
}
.womm-toast--glass.womm-toast--error .womm-toast__progress > span {
    background: linear-gradient(90deg, var(--womm-toast-error), #f87171);
}

/* ---- Variante: WOMM Gradient ---- */
.womm-toast--womm {
    color: #fff;
}

.womm-toast--womm.womm-toast--success {
    background: linear-gradient(135deg, var(--womm-toast-success) 0%, var(--womm-toast-success-dark) 100%);
}
.womm-toast--womm.womm-toast--error {
    background: linear-gradient(135deg, var(--womm-toast-error) 0%, var(--womm-toast-error-dark) 100%);
}

.womm-toast--womm .womm-toast__icon {
    color: rgba(255, 255, 255, 0.95);
}

.womm-toast--womm .womm-toast__close {
    color: rgba(255, 255, 255, 0.85);
}
.womm-toast--womm .womm-toast__close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.womm-toast--womm .womm-toast__progress {
    background: rgba(0, 0, 0, 0.15);
}
.womm-toast--womm .womm-toast__progress > span {
    background: rgba(255, 255, 255, 0.75);
}

@media (max-width: 480px) {
    .womm-toast-region--material,
    .womm-toast-region--linear,
    .womm-toast-region--glass,
    .womm-toast-region--womm {
        width: calc(100vw - 24px);
        bottom: 16px;
    }

    .womm-toast-region--sonner {
        right: 12px;
        left: 12px;
        width: auto;
        align-items: stretch;
    }

    .womm-toast__message {
        font-size: 0.875rem;
    }
}
