/* ========================================================
 * 🧠 Deep Pulse Engine — Outside-Chat Insight Bubble
 * Elegant card-style overlay for insights shown outside chat
 * + shared visual effects (vignette, sparkles)
 * ======================================================== */

/* ── Insight Bubble ──────────────────────────────────────── */
.dp-engine-snackbar {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 400px;
    background: linear-gradient(135deg, rgba(22, 22, 38, 0.97) 0%, rgba(30, 28, 50, 0.97) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 1px 0 rgba(255, 255, 255, 0.06) inset;
    z-index: 9995;
    padding: 16px 18px 14px;
    animation: dpEngineSlideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

/* Subtle shimmer sweep */
.dp-engine-snackbar::before {
    content: '';
    position: absolute;
    top: -50%; left: -60%;
    width: 35%; height: 200%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    transform: skewX(-20deg);
    animation: dpEngineSweep 1.2s ease-out 0.5s forwards;
    pointer-events: none;
}

/* Auto-dismiss progress bar */
.dp-engine-snackbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 100%;
    background: linear-gradient(90deg, rgba(94,199,34,0.6), rgba(59,130,246,0.6));
    border-radius: 0 0 20px 20px;
    animation: dpProgressShrink var(--dp-dismiss-time, 25s) linear forwards;
    transform-origin: left;
}

/* Severity accent — subtle border */
.dp-engine-achievement { border-color: rgba(255, 215, 0, 0.2); }
.dp-engine-achievement::after { background: linear-gradient(90deg, rgba(255,215,0,0.7), rgba(255,215,0,0.3)); }
.dp-engine-warning     { border-color: rgba(255, 170, 0, 0.2); }
.dp-engine-warning::after { background: linear-gradient(90deg, rgba(255,170,0,0.7), rgba(255,170,0,0.3)); }
.dp-engine-health      { border-color: rgba(94, 199, 34, 0.15); }
.dp-engine-health::after { background: linear-gradient(90deg, rgba(94,199,34,0.7), rgba(94,199,34,0.3)); }
.dp-engine-suggestion  { border-color: rgba(59, 130, 246, 0.15); }
.dp-engine-suggestion::after { background: linear-gradient(90deg, rgba(59,130,246,0.7), rgba(59,130,246,0.3)); }
.dp-engine-discovery   { border-color: rgba(168, 85, 247, 0.15); }
.dp-engine-discovery::after { background: linear-gradient(90deg, rgba(168,85,247,0.7), rgba(168,85,247,0.3)); }

/* Header */
.dp-engine-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.dp-engine-emoji {
    font-size: 1.4rem;
    line-height: 1;
    animation: dpEngineIconPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

.dp-engine-type {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 8px;
    border-radius: 8px;
    flex: 1;
}
/* Type label color per severity */
.dp-engine-achievement .dp-engine-type { color: rgba(255, 215, 0, 0.9); background: rgba(255, 215, 0, 0.1); }
.dp-engine-warning .dp-engine-type     { color: rgba(255, 170, 0, 0.9); background: rgba(255, 170, 0, 0.1); }
.dp-engine-health .dp-engine-type      { color: rgba(94, 199, 34, 0.9); background: rgba(94, 199, 34, 0.1); }
.dp-engine-suggestion .dp-engine-type  { color: rgba(96, 165, 250, 0.9); background: rgba(59, 130, 246, 0.1); }
.dp-engine-discovery .dp-engine-type   { color: rgba(192, 132, 252, 0.9); background: rgba(168, 85, 247, 0.1); }

/* Health score badge (inline in header) */
.dp-engine-score {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 10px;
    white-space: nowrap;
    line-height: 1.4;
    color: rgba(255,255,255,0.9);
}
.dp-engine-score.score-good { background: rgba(94,199,34,0.15); color: #5ec722; }
.dp-engine-score.score-warn { background: rgba(255,170,0,0.15); color: #ffaa00; }
.dp-engine-score.score-low  { background: rgba(239,68,68,0.15); color: #ef4444; }

.dp-engine-close {
    background: rgba(255,255,255,0.06);
    border: none;
    color: rgba(255,255,255,0.35);
    font-size: 1rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}
.dp-engine-close:hover,
.dp-engine-close:active {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
}

/* Content */
.dp-engine-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: rgba(255,255,255,0.95);
    line-height: 1.3;
    margin-bottom: 4px;
}

.dp-engine-message {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.65);
    line-height: 1.45;
    margin-bottom: 8px;
}

.dp-engine-action {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    margin-bottom: 10px;
    line-height: 1.35;
}

/* CTA */
.dp-engine-cta {
    display: flex;
    justify-content: flex-end;
}

.dp-engine-chat-btn {
    background: rgba(94, 199, 34, 0.12);
    border: 1px solid rgba(94, 199, 34, 0.2);
    color: rgba(94, 199, 34, 0.95);
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.dp-engine-chat-btn:active {
    transform: scale(0.96);
    background: rgba(94, 199, 34, 0.25);
}

/* Exit */
.dp-engine-exit {
    animation: dpEngineSlideOut 0.5s ease-in forwards;
}
/* Prevent progress bar from showing during exit */
.dp-engine-exit::after {
    animation: none;
    opacity: 0;
}

/* ── Shared Visual Effects (vignette, sparkles) ────────── */

/* Golden vignette flash */
.deep-pulse-vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(255,170,0,0.25) 100%);
    animation: dpVignetteFlash 1.4s ease-out forwards;
}

/* Sparkle particles */
.dp-sparkle {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    font-size: 1.2rem;
    animation: dpSparkleFloat var(--dur, 2s) ease-out forwards;
}

/* ── Animations ──────────────────────────────────────────── */

@keyframes dpEngineSlideUp {
    0% { transform: translateX(-50%) translateY(80px) scale(0.85); opacity: 0; }
    100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}

@keyframes dpEngineSlideOut {
    0% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
    100% { transform: translateX(-50%) translateY(50px) scale(0.9); opacity: 0; }
}

@keyframes dpEngineSweep {
    0% { left: -60%; }
    100% { left: 130%; }
}

@keyframes dpEngineIconPop {
    0% { transform: scale(0) rotate(-20deg); }
    60% { transform: scale(1.4) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes dpVignetteFlash {
    0% { opacity: 0; }
    20% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes dpSparkleFloat {
    0% { transform: translateY(0) rotate(0deg) scale(0); opacity: 0; }
    15% { opacity: 1; transform: translateY(calc(var(--travel) * 0.15)) rotate(calc(var(--spin) * 0.15)) scale(1.2); }
    100% { transform: translateY(var(--travel)) rotate(var(--spin)) scale(0); opacity: 0; }
}

@keyframes dpProgressShrink {
    0% { transform: scaleX(1); }
    100% { transform: scaleX(0); }
}
