/**
 * UNIMART live notification popups — memorable, branded toasts.
 */

.um-notif-popup-stack {
    position: fixed;
    z-index: 11050;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    pointer-events: none;
    padding: 0.75rem;
    bottom: calc(var(--mobile-bottom-nav-height, 70px) + 0.5rem);
    right: 0;
    left: auto;
    max-width: 100%;
}

/* Sit above install / push opt-in banners when those are open */
body.pwa-banner-open .um-notif-popup-stack {
    bottom: calc(var(--mobile-bottom-nav-height, 70px) + 7.5rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
    .um-notif-popup-stack {
        bottom: 1rem;
        right: 1rem;
        max-width: 400px;
        padding: 0;
    }
}

.um-notif-popup {
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow:
        0 4px 6px rgba(15, 23, 42, 0.04),
        0 16px 40px rgba(15, 23, 42, 0.14);
    transform: translateX(110%);
    opacity: 0;
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
    cursor: pointer;
}

.um-notif-popup.is-visible {
    transform: translateX(0);
    opacity: 1;
}

.um-notif-popup.is-leaving {
    transform: translateX(110%);
    opacity: 0;
    transition-duration: 0.28s;
}

@media (max-width: 767px) {
    .um-notif-popup {
        transform: translateY(110%);
    }
    .um-notif-popup.is-visible {
        transform: translateY(0);
    }
    .um-notif-popup.is-leaving {
        transform: translateY(110%);
    }
}

.um-notif-popup__progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, #f68b1e, #e96703);
    transform-origin: left center;
    transform: scaleX(1);
    z-index: 2;
}

.um-notif-popup--critical .um-notif-popup__progress {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.um-notif-popup__inner {
    padding: 0.85rem 0.95rem 0.95rem;
    padding-top: 0.7rem;
}

.um-notif-popup__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}

.um-notif-popup__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.um-notif-popup__logo {
    flex-shrink: 0;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 6px;
    object-fit: cover;
    background: #fff7ed;
    display: block;
}

.um-notif-popup__from {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.um-notif-popup__pill {
    flex-shrink: 0;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: #fff7ed;
    color: #c2410c;
}

.um-notif-popup--opportunities .um-notif-popup__pill {
    background: #eff6ff;
    color: #1d4ed8;
}

.um-notif-popup--commerce .um-notif-popup__pill {
    background: #fff7ed;
    color: #c2410c;
}

.um-notif-popup--services .um-notif-popup__pill {
    background: #f0fdfa;
    color: #0f766e;
}

.um-notif-popup--entrepreneurship .um-notif-popup__pill {
    background: #fdf2f8;
    color: #9d174d;
}

.um-notif-popup--agent .um-notif-popup__pill {
    background: #f5f3ff;
    color: #5b21b6;
}

.um-notif-popup__close {
    flex-shrink: 0;
    width: 1.65rem;
    height: 1.65rem;
    border: none;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: #64748b;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.um-notif-popup__close:hover {
    background: rgba(15, 23, 42, 0.1);
    color: #1e293b;
}

.um-notif-popup__content {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
}

.um-notif-popup__emoji {
    flex-shrink: 0;
    font-size: 1.55rem;
    line-height: 1;
    margin-top: 0.1rem;
}

.um-notif-popup__text {
    min-width: 0;
    flex: 1;
}

.um-notif-popup__headline {
    margin: 0 0 0.25rem;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
    color: #0f172a;
}

.um-notif-popup__body {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #64748b;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.um-notif-popup__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #e96703;
    text-decoration: none;
}

.um-notif-popup__cta:hover {
    color: #c2410c;
    text-decoration: underline;
}

.um-notif-popup--critical {
    border-color: rgba(239, 68, 68, 0.25);
    box-shadow:
        0 4px 6px rgba(239, 68, 68, 0.08),
        0 16px 40px rgba(239, 68, 68, 0.12);
}

.um-notif-popup--critical .um-notif-popup__headline {
    color: #991b1b;
}

/* Bell pulse when new notification arrives */
@keyframes umNotifBellPulse {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.12) rotate(-8deg); }
    50% { transform: scale(1.08) rotate(8deg); }
    75% { transform: scale(1.1) rotate(-4deg); }
}

.um-notif-bell--pulse,
.top-nav-notif-bell.um-notif-bell--pulse,
.home-intel__bell.um-notif-bell--pulse {
    animation: umNotifBellPulse 0.65s ease-in-out 2;
}

.top-nav-notif-bell__badge.is-new,
.home-intel__bell-badge.is-new {
    animation: umNotifBadgePop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes umNotifBadgePop {
    0% { transform: scale(0.4); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.home-intel__bell-badge.is-hidden,
.top-nav-notif-bell__badge.is-hidden {
    display: none !important;
}

/* Legacy toast stack — keep above nav but below new popups */
#toast-container.um-notif-toast-stack {
    z-index: 11000;
}

/* Agent PWA — popups above bottom nav */
body.agent-pwa-mode .um-notif-popup-stack {
    bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 0.65rem);
    left: 0.65rem;
    right: 0.65rem;
    max-width: none;
}

@media (min-width: 768px) {
    body.agent-pwa-mode .um-notif-popup-stack {
        left: auto;
        right: 1rem;
        max-width: 400px;
    }
}

body.agent-pwa-mode.pwa-standalone .um-notif-popup-stack,
body.agent-pwa-mode.agent-pwa-standalone .um-notif-popup-stack {
    bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 0.75rem);
}
