/* ── Toast Variables ── */
:root {
    --toast-success: #10b981;
    --toast-info: #6366f1;
    --toast-warning: #f59e0b;
    --toast-danger: #ef4444;
}

/* ── Container ── */
.insight-toast-container {
    position: fixed;
    top: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 420px;
    width: calc(100% - 40px);
    pointer-events: none;
}
.insight-toast-container.ltr-toast { right: 20px; }
.insight-toast-container.rtl-toast { left: 20px; }

/* ── Toast Card ── */
.insight-toast {
    position: relative;
    pointer-events: auto;
    border-radius: 12px;
    overflow: hidden;
    opacity: 0;
    transform: translateX(40px) scale(0.96);
    transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);

    /* Glass light */
    background: var(--mt-surface-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 8px 32px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--mt-border);
}

.insight-toast.show {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.insight-toast.hiding {
    opacity: 0;
    transform: translateX(40px) scale(0.92);
    max-height: 0;
    margin-bottom: -10px;
    padding-top: 0;
    padding-bottom: 0;
    transition: opacity 0.3s ease, transform 0.3s ease,
                max-height 0.3s 0.1s ease, margin-bottom 0.3s 0.1s ease;
}

/* ── Accent bar ── */
.toast-accent {
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
    border-radius: 4px 0 0 4px;
}
.rtl-toast .toast-accent {
    left: auto;
    right: 0;
    border-radius: 0 4px 4px 0;
}

/* ── Body layout ── */
.toast-body {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px 14px 20px;
}

/* ── Icon ── */
.toast-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* ── Text ── */
.toast-text {
    flex: 1;
    font-family: var(--mt-font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--mt-text);
    padding-top: 3px;
}

/* ── Dismiss button ── */
.toast-dismiss {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--mt-text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    opacity: 0.5;
    transition: all 0.2s ease;
    margin-top: 2px;
}
.toast-dismiss:hover {
    opacity: 1;
    background: rgba(0,0,0,0.06);
    transform: rotate(90deg);
}
[data-theme="dark"] .toast-dismiss:hover {
    background: rgba(255,255,255,0.08);
}

/* ── Timer progress ── */
.toast-timer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    opacity: 0.5;
    transform-origin: left;
    animation: toast-shrink 6s linear forwards;
}
.rtl-toast .toast-timer {
    transform-origin: right;
}

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

/* ── Mobile ── */
@media (max-width: 576px) {
    .insight-toast-container {
        top: 12px;
        left: 12px !important;
        right: 12px !important;
        max-width: calc(100% - 24px);
    }
    .insight-toast {
        transform: translateY(-20px) scale(0.96);
    }
    .insight-toast.show {
        transform: translateY(0) scale(1);
    }
    .insight-toast.hiding {
        transform: translateY(-20px) scale(0.92);
    }
}
