/* TraderMap — TMAlert (modal bloqueante) + TMToast (notificacao nao
   bloqueante). Documento 09, secao 6. Substitui SweetAlert por completo.
   Depende de tokens.css. */

/* ===== TMAlert ===== */

.tm-alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.tm-alert-overlay.is-visible {
    opacity: 1;
}

.tm-alert-modal {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-elevated);
    padding: var(--space-3);
    max-width: 420px;
    width: 100%;
    transform: translateY(8px);
    transition: transform 0.15s ease;
}

.tm-alert-overlay.is-visible .tm-alert-modal {
    transform: translateY(0);
}

.tm-alert-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-2);
}

.tm-alert-icon svg {
    width: 20px;
    height: 20px;
}

.tm-alert-modal[data-type="confirm"] .tm-alert-icon,
.tm-alert-modal[data-type="info"] .tm-alert-icon {
    background: var(--color-accent-tag-bg);
    color: var(--color-accent);
}

.tm-alert-modal[data-type="danger"] .tm-alert-icon {
    background: color-mix(in srgb, var(--color-negative) 15%, transparent);
    color: var(--color-negative);
}

.tm-alert-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 8px;
}

.tm-alert-message {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-3);
    line-height: 1.5;
}

.tm-alert-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-1);
}

/* ===== TMToast ===== */

.tm-toast-container {
    position: fixed;
    top: var(--space-2);
    right: var(--space-2);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
    width: calc(100% - var(--space-3));
}

@media (max-width: 640px) {
    .tm-toast-container {
        top: var(--space-1);
        right: var(--space-1);
        left: var(--space-1);
        max-width: none;
        width: auto;
    }
}

.tm-toast {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left-width: 3px;
    border-radius: var(--radius-control);
    box-shadow: var(--shadow-elevated);
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--color-text);
    opacity: 0;
    transform: translateX(16px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

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

.tm-toast[data-type="success"] { border-left-color: var(--color-positive); }
.tm-toast[data-type="error"] { border-left-color: var(--color-negative); }
.tm-toast[data-type="warning"] { border-left-color: var(--color-warning); }
.tm-toast[data-type="info"] { border-left-color: var(--color-accent); }

.tm-toast-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

.tm-toast[data-type="success"] .tm-toast-icon { color: var(--color-positive); }
.tm-toast[data-type="error"] .tm-toast-icon { color: var(--color-negative); }
.tm-toast[data-type="warning"] .tm-toast-icon { color: var(--color-warning); }
.tm-toast[data-type="info"] .tm-toast-icon { color: var(--color-accent); }

.tm-toast-message {
    flex: 1;
    line-height: 1.4;
}

.tm-toast-close {
    background: none;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.tm-toast-close:hover {
    color: var(--color-text);
}
