/* ========================================================
 * 🫀 Ambient Pulse — Proactive Alert Snackbars
 * Candy Crush–inspired toast notifications for contextual alerts
 * ======================================================== */

/* Container positions at bottom, above footer */
.ambient-pulse-snackbar {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    width: calc(100% - 32px);
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(30, 30, 40, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    z-index: 9990;
    animation: ambientSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ambient-pulse-snackbar:active {
    transform: translateX(-50%) scale(0.98);
}

/* Severity glow variants */
.ambient-pulse-info {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(59, 130, 246, 0.15);
}

.ambient-pulse-warning {
    border-color: rgba(255, 170, 0, 0.35);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 170, 0, 0.2);
}

.ambient-pulse-error {
    border-color: rgba(239, 68, 68, 0.35);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(239, 68, 68, 0.2);
    animation: ambientSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), ambientUrgentPulse 2s ease-in-out 0.5s 2;
}

.ambient-pulse-success {
    border-color: rgba(94, 199, 34, 0.35);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(94, 199, 34, 0.2);
}

/* Icon */
.ambient-pulse-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
    animation: ambientIconBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

/* Content */
.ambient-pulse-content {
    flex: 1;
    min-width: 0;
}

.ambient-pulse-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.2;
    margin-bottom: 2px;
}

.ambient-pulse-message {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Close button */
.ambient-pulse-close {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.ambient-pulse-close:hover,
.ambient-pulse-close:active {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

/* NutriBot mini avatar (optional, appended by JS) */
.ambient-pulse-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

/* === Animations === */

@keyframes ambientSlideUp {
    0% {
        transform: translateX(-50%) translateY(60px) scale(0.85);
        opacity: 0;
    }
    100% {
        transform: translateX(-50%) translateY(0) scale(1);
        opacity: 1;
    }
}

/* Exit animation — added by JS */
.ambient-pulse-exit {
    animation: ambientSlideOut 0.4s ease-in forwards;
}

@keyframes ambientSlideOut {
    0% {
        transform: translateX(-50%) translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) translateY(40px) scale(0.9);
        opacity: 0;
    }
}

@keyframes ambientIconBounce {
    0% { transform: scale(0); }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes ambientUrgentPulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 20px rgba(239,68,68,0.2); }
    50% { box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 35px rgba(239,68,68,0.4); }
}

/* Shimmer sweep on the snackbar (Candy Crush feel) */
.ambient-pulse-snackbar::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 35%;
    height: 200%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    transform: skewX(-20deg);
    animation: ambientSweep 1s ease-out 0.6s forwards;
    pointer-events: none;
}

@keyframes ambientSweep {
    0% { left: -60%; }
    100% { left: 130%; }
}
