/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    width: 380px;
    max-width: calc(100vw - 3rem);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    background: var(--popup-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--popup-border);
    border-left: 3px solid var(--toast-accent, var(--accent-color));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.2);
    color: var(--text-color);
    font-size: 0.875rem;
    line-height: 1.45;
    pointer-events: auto;
    animation: toastEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

@keyframes toastEnter {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Thin auto-dismiss progress bar — CSS-only, matches the 5s timer in mod.rs */
.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 100%;
    background: var(--toast-accent, var(--accent-color));
    opacity: 0.35;
    animation: toastProgress 5s linear forwards;
    transform-origin: left;
}

@keyframes toastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

.toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    margin-top: 1px;
    color: var(--toast-accent, var(--accent-color));
}

.toast-message {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    color: var(--text-secondary);
}

.toast-close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-muted);
    border: none;
    background: none;
    padding: 0;
    margin-top: 1px;
    opacity: 0.55;
    transition: opacity 0.15s;
    line-height: 1;
}

.toast-close:hover {
    opacity: 1;
}

/* Type accent colors — drives icon, border, and progress bar */
.toast-success { --toast-accent: var(--success-color); }
.toast-error   { --toast-accent: var(--danger-color);  }
.toast-warning { --toast-accent: var(--warning-color); }
.toast-info    { --toast-accent: var(--accent-color);  }

/* Mobile — move to top-center so it never blocks bottom navigation */
@media (max-width: 768px) {
    .toast-container {
        top: 0.75rem;
        bottom: auto;
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
        max-width: 100%;
        align-items: stretch;
    }

    .toast {
        animation-name: toastEnterMobile;
    }

    @keyframes toastEnterMobile {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}
