/* ============================================
   MIRRORED PULSE - CSS
   Real-time KPI alert visual effects
   ============================================ */

/* ============================================
   PULSE OVERLAYS
   ============================================ */
.pulse-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.1s ease;
}

.pulse-overlay.active {
    opacity: 1;
}

/* --- DANGER OVERLAY (Red/Blood) --- */
.pulse-overlay.danger {
    background: 
        radial-gradient(ellipse at center, 
            transparent 0%, 
            transparent 40%,
            rgba(180, 0, 0, 0.1) 70%,
            rgba(120, 0, 0, 0.4) 85%,
            rgba(80, 0, 0, 0.7) 95%,
            rgba(40, 0, 0, 0.9) 100%
        ),
        linear-gradient(to bottom, 
            rgba(255, 0, 0, 0.6) 0%, 
            rgba(200, 0, 0, 0.3) 5%,
            transparent 20%
        ),
        linear-gradient(to top, 
            rgba(255, 0, 0, 0.5) 0%, 
            rgba(180, 0, 0, 0.2) 8%,
            transparent 25%
        ),
        linear-gradient(to right, 
            rgba(200, 0, 0, 0.7) 0%, 
            rgba(150, 0, 0, 0.3) 5%,
            transparent 15%
        ),
        linear-gradient(to left, 
            rgba(200, 0, 0, 0.7) 0%, 
            rgba(150, 0, 0, 0.3) 5%,
            transparent 15%
        );
    
    box-shadow: 
        inset 0 0 200px rgba(255, 0, 0, 0.3),
        inset 0 0 100px rgba(100, 0, 0, 0.5),
        inset 0 0 50px rgba(50, 0, 0, 0.7);
}

.pulse-overlay.danger.active {
    animation: pulseDangerBurst 0.8s ease-out forwards;
}

.pulse-overlay.danger.sustain {
    animation: pulseDangerSustain 1.5s ease-in-out infinite;
}

@keyframes pulseDangerBurst {
    0% {
        opacity: 0;
        filter: brightness(2) saturate(1.5);
    }
    15% {
        opacity: 1;
        filter: brightness(1.5) saturate(1.3);
    }
    30% {
        opacity: 0.9;
        filter: brightness(1) saturate(1);
    }
    50% {
        opacity: 1;
        filter: brightness(1.2) saturate(1.1);
    }
    70% {
        opacity: 0.85;
    }
    100% {
        opacity: 0.7;
    }
}

@keyframes pulseDangerSustain {
    0%, 100% {
        opacity: 0.5;
        filter: brightness(1) saturate(1);
    }
    50% {
        opacity: 0.8;
        filter: brightness(1.15) saturate(1.1);
    }
}

/* --- SUCCESS OVERLAY (Green) --- */
.pulse-overlay.success {
    background: 
        radial-gradient(ellipse at center, 
            transparent 0%, 
            transparent 50%,
            rgba(0, 255, 198, 0.05) 70%,
            rgba(0, 200, 150, 0.15) 85%,
            rgba(0, 150, 100, 0.3) 95%,
            rgba(0, 100, 80, 0.5) 100%
        ),
        linear-gradient(to bottom, 
            rgba(0, 255, 200, 0.4) 0%, 
            rgba(0, 255, 180, 0.1) 10%,
            transparent 30%
        ),
        linear-gradient(to top, 
            rgba(0, 255, 198, 0.3) 0%, 
            transparent 20%
        ),
        linear-gradient(to right, 
            rgba(0, 255, 198, 0.4) 0%, 
            transparent 10%
        ),
        linear-gradient(to left, 
            rgba(0, 255, 198, 0.4) 0%, 
            transparent 10%
        );
    
    box-shadow: 
        inset 0 0 200px rgba(0, 255, 198, 0.15),
        inset 0 0 100px rgba(0, 200, 150, 0.2);
}

.pulse-overlay.success.active {
    animation: pulseSuccessBurst 1s ease-out forwards;
}

.pulse-overlay.success.sustain {
    animation: pulseSuccessSustain 2s ease-in-out infinite;
}

@keyframes pulseSuccessBurst {
    0% {
        opacity: 0;
        filter: brightness(3) saturate(2);
    }
    20% {
        opacity: 1;
        filter: brightness(1.8) saturate(1.5);
    }
    40% {
        opacity: 0.8;
        filter: brightness(1.2) saturate(1.2);
    }
    60% {
        opacity: 0.9;
        filter: brightness(1.4) saturate(1.3);
    }
    100% {
        opacity: 0.6;
        filter: brightness(1) saturate(1);
    }
}

@keyframes pulseSuccessSustain {
    0%, 100% {
        opacity: 0.4;
        filter: brightness(1) saturate(1);
    }
    50% {
        opacity: 0.7;
        filter: brightness(1.3) saturate(1.2);
    }
}

/* ============================================
   CORNER SPLATTERS
   ============================================ */
.pulse-splatter {
    position: fixed;
    pointer-events: none;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Ambient state (pulse armed) */
.pulse-splatter.ambient {
    opacity: 0.35;
}

.pulse-splatter.active {
    opacity: 1;
    animation: splatterIn 0.3s ease-out forwards;
}

@keyframes splatterIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
        filter: brightness(2);
    }
    50% {
        opacity: 1;
        filter: brightness(1.5);
    }
    100% {
        opacity: 0.9;
        transform: scale(1);
        filter: brightness(1);
    }
}

/* Corner positions with clip-paths */
.pulse-splatter.top-left {
    top: 0;
    left: 0;
    width: 300px;
    height: 300px;
    background: radial-gradient(ellipse at top left,
        rgba(180, 0, 0, 0.8) 0%,
        rgba(120, 0, 0, 0.4) 30%,
        transparent 70%
    );
    clip-path: polygon(0 0, 100% 0, 60% 40%, 30% 70%, 0 100%);
}

.pulse-splatter.top-right {
    top: 0;
    right: 0;
    width: 350px;
    height: 280px;
    background: radial-gradient(ellipse at top right,
        rgba(200, 0, 0, 0.9) 0%,
        rgba(150, 0, 0, 0.5) 25%,
        transparent 65%
    );
    clip-path: polygon(40% 0, 100% 0, 100% 100%, 70% 60%, 50% 30%);
}

.pulse-splatter.bottom-left {
    bottom: 0;
    left: 0;
    width: 280px;
    height: 320px;
    background: radial-gradient(ellipse at bottom left,
        rgba(170, 0, 0, 0.85) 0%,
        rgba(100, 0, 0, 0.4) 35%,
        transparent 70%
    );
    clip-path: polygon(0 30%, 40% 50%, 60% 100%, 0 100%);
}

.pulse-splatter.bottom-right {
    bottom: 0;
    right: 0;
    width: 320px;
    height: 300px;
    background: radial-gradient(ellipse at bottom right,
        rgba(190, 0, 0, 0.9) 0%,
        rgba(130, 0, 0, 0.45) 30%,
        transparent 65%
    );
    clip-path: polygon(50% 40%, 100% 20%, 100% 100%, 30% 100%);
}

/* Success (green) splatter variants */
.pulse-splatter.success.top-left {
    background: radial-gradient(ellipse at top left,
        rgba(0, 255, 198, 0.6) 0%,
        rgba(0, 200, 150, 0.3) 30%,
        transparent 70%
    );
}

.pulse-splatter.success.top-right {
    background: radial-gradient(ellipse at top right,
        rgba(0, 255, 200, 0.7) 0%,
        rgba(0, 180, 140, 0.35) 25%,
        transparent 65%
    );
}

.pulse-splatter.success.bottom-left {
    background: radial-gradient(ellipse at bottom left,
        rgba(0, 255, 180, 0.65) 0%,
        rgba(0, 160, 120, 0.3) 35%,
        transparent 70%
    );
}

.pulse-splatter.success.bottom-right {
    background: radial-gradient(ellipse at bottom right,
        rgba(0, 255, 198, 0.7) 0%,
        rgba(0, 190, 140, 0.35) 30%,
        transparent 65%
    );
}

/* ============================================
   SCREEN SHAKE
   ============================================ */
.pulse-shake {
    animation: pulseScreenShake 0.6s ease-out;
}

@keyframes pulseScreenShake {
    0%, 100% { transform: translate(0, 0); }
    8% { transform: translate(-4px, -3px); }
    16% { transform: translate(4px, 3px); }
    24% { transform: translate(-3px, 2px); }
    32% { transform: translate(3px, -2px); }
    40% { transform: translate(-2px, 3px); }
    48% { transform: translate(2px, -2px); }
    56% { transform: translate(-2px, 1px); }
    64% { transform: translate(2px, 2px); }
    72% { transform: translate(-1px, -1px); }
    80% { transform: translate(1px, 1px); }
    88% { transform: translate(-1px, 0); }
    94% { transform: translate(0, 1px); }
}

/* ============================================
   DASHBOARD BLUR STATES
   ============================================ */
.grid.pulse-blurred .mod {
    filter: blur(4px) brightness(0.5);
    transition: filter 0.3s ease, transform 0.3s ease;
    transform: scale(0.98);
}

/* Danger: red tint */
.grid.pulse-blurred.pulse-danger-state .mod:not(.pulse-highlight) {
    filter: blur(4px) brightness(0.4) sepia(0.5) hue-rotate(-30deg) saturate(2);
}

/* Success: green tint */
.grid.pulse-blurred.pulse-success-state .mod:not(.pulse-highlight) {
    filter: blur(4px) brightness(0.5) sepia(0.3) hue-rotate(100deg) saturate(1.5);
}

/* Focused widget escapes blur */
.grid.pulse-blurred .mod.pulse-highlight {
    filter: none !important;
    transform: scale(1);
}

/* ============================================
   FOCUSED WIDGET HIGHLIGHT
   ============================================ */
.mod.pulse-highlight {
    z-index: 200;
    filter: none !important;
    transform: scale(1.05);
    box-shadow: 
        0 0 60px rgba(255, 255, 255, 0.25),
        0 0 100px rgba(0, 255, 198, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    position: relative;
}

/* Glow ring */
.mod.pulse-highlight::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 18px;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.2) 0%, 
        rgba(0, 255, 198, 0.1) 50%,
        rgba(255, 255, 255, 0.2) 100%
    );
    z-index: -1;
    animation: pulseFocusGlow 2s ease-in-out infinite;
}

@keyframes pulseFocusGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Danger focus */
.mod.pulse-highlight.pulse-danger-focus {
    box-shadow: 
        0 0 60px rgba(255, 50, 50, 0.3),
        0 0 100px rgba(255, 0, 0, 0.2);
}

.mod.pulse-highlight.pulse-danger-focus::before {
    background: linear-gradient(135deg, 
        rgba(255, 100, 100, 0.3) 0%, 
        rgba(255, 50, 50, 0.15) 50%,
        rgba(255, 100, 100, 0.3) 100%
    );
}

/* Success focus */
.mod.pulse-highlight.pulse-success-focus {
    box-shadow: 
        0 0 60px rgba(0, 255, 198, 0.3),
        0 0 100px rgba(0, 255, 150, 0.2);
}

.mod.pulse-highlight.pulse-success-focus::before {
    background: linear-gradient(135deg, 
        rgba(0, 255, 198, 0.3) 0%, 
        rgba(0, 255, 150, 0.15) 50%,
        rgba(0, 255, 198, 0.3) 100%
    );
}

/* ============================================
   PULSE TOGGLE BUTTON (Top Bar)
   ============================================ */
.pulse-toggle {
    display: none; /* Hidden until Pro */
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    margin-right: 8px;
}

.pulse-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.pulse-toggle:focus {
    outline: none;
}

.pulse-toggle:focus-visible {
    outline: 2px solid rgba(0, 255, 198, 0.5);
    outline-offset: 2px;
}

.pulse-toggle .pulse-icon {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

/* Off state */
.pulse-toggle.off {
    opacity: 0.6;
}

/* On state */
.pulse-toggle.on {
    background: rgba(0, 255, 198, 0.1);
    border-color: rgba(0, 255, 198, 0.3);
}

.pulse-toggle.on .pulse-icon {
    animation: pulseIconBeat 2s ease-in-out infinite;
}

@keyframes pulseIconBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Active alert state */
.pulse-toggle.active {
    background: rgba(255, 100, 100, 0.2);
    border-color: rgba(255, 100, 100, 0.5);
    animation: pulseToggleAlert 0.5s ease-in-out infinite alternate;
}

@keyframes pulseToggleAlert {
    0% { box-shadow: 0 0 5px rgba(255, 0, 0, 0.3); }
    100% { box-shadow: 0 0 15px rgba(255, 0, 0, 0.6); }
}

/* Tooltip (Settings hint) */
.pulse-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 8px 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

.pulse-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.pulse-tooltip button {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.pulse-tooltip button:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ============================================
   PULSE MODULE CARD (Add Modal)
   ============================================ */
.mod-card[data-add="pulse"].locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.mod-card[data-add="pulse"].locked::after {
    content: 'Ã°Å¸â€â€™';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 14px;
}

.mod-card[data-add="pulse"].unlocked {
    opacity: 1;
    cursor: pointer;
    border-color: rgba(0, 255, 198, 0.3);
}

.mod-card[data-add="pulse"].unlocked:hover {
    border-color: rgba(0, 255, 198, 0.6);
    box-shadow: 0 0 20px rgba(0, 255, 198, 0.15);
}

.mod-card[data-add="pulse"].unlocked::after {
    display: none;
}

.mod-card[data-add="pulse"].unlocked .upgrade-cta {
    display: none;
}

/* ============================================
   PULSE SETTINGS MODAL
   ============================================ */
#pulseModal .modal {
    max-width: 480px;
}

.pulse-settings-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--tileBorder);
}

.pulse-settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.pulse-settings-section h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.75rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pulse-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.pulse-setting-row label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.pulse-setting-row label span {
    font-size: 1.2rem;
}

/* Toggle Switch */
.pulse-switch {
    position: relative;
    width: 48px;
    height: 26px;
}

.pulse-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.pulse-switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    transition: 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pulse-switch .slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.pulse-switch input:checked + .slider {
    background: rgba(0, 255, 198, 0.3);
    border-color: rgba(0, 255, 198, 0.5);
}

.pulse-switch input:checked + .slider::before {
    transform: translateX(22px);
    background: #00ffc6;
}

/* Test buttons in modal */
.pulse-test-buttons {
    display: flex;
    gap: 10px;
    margin-top: 1rem;
}

.pulse-test-buttons .btn {
    flex: 1;
    padding: 12px;
    font-weight: 600;
}

.pulse-test-buttons .btn.danger {
    background: rgba(255, 68, 68, 0.2);
    border-color: rgba(255, 68, 68, 0.4);
    color: #ff6363;
}

.pulse-test-buttons .btn.danger:hover {
    background: rgba(255, 68, 68, 0.3);
}

.pulse-test-buttons .btn.success {
    background: rgba(0, 255, 198, 0.15);
    border-color: rgba(0, 255, 198, 0.3);
    color: #00ffc6;
}

.pulse-test-buttons .btn.success:hover {
    background: rgba(0, 255, 198, 0.25);
}

/* Info text */
.pulse-info {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.5rem;
    line-height: 1.5;
}

/* ============================================
   PULSE HIGHLIGHT - Animate existing widget content
   Focus on the CHANGE value - that's what shows something happened
   ============================================ */

/* Base highlight state */
.pulse-highlight {
    z-index: 10;
}

/* ============================================
   DANGER STATE (Red) - Value dropped
   ============================================ */

/* The change percentage/amount gets the main effect */
.pulse-danger-focus .change,
.pulse-danger-focus [style*="color:#ff6363"],
.pulse-danger-focus [style*="color: #ff6363"],
.pulse-danger-focus .ticker-item span:last-child {
    color: #ff4444 !important;
    text-shadow: 
        0 0 10px #ff4444,
        0 0 20px #ff4444,
        0 0 40px rgba(255, 68, 68, 0.6);
    animation: pulse-change-glow-danger 0.5s ease-in-out infinite alternate;
    font-weight: 700 !important;
    transform-origin: center;
}

/* Price gets subtle highlight but not the main focus */
.pulse-danger-focus .stock-price,
.pulse-danger-focus .price,
.pulse-danger-focus [data-pulse-value] {
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.4);
}

@keyframes pulse-change-glow-danger {
    from {
        text-shadow: 
            0 0 10px #ff4444,
            0 0 20px #ff4444,
            0 0 40px rgba(255, 68, 68, 0.6);
        transform: scale(1);
    }
    to {
        text-shadow: 
            0 0 20px #ff4444,
            0 0 40px #ff4444,
            0 0 60px rgba(255, 68, 68, 0.9);
        transform: scale(1.2);
    }
}

/* ============================================
   SUCCESS STATE (Green) - Value up
   ============================================ */

/* The change percentage/amount gets the main effect */
.pulse-success-focus .change,
.pulse-success-focus [style*="color:#00ffc6"],
.pulse-success-focus [style*="color: #00ffc6"],
.pulse-success-focus .ticker-item span:last-child {
    color: #00ffc6 !important;
    text-shadow: 
        0 0 10px #00ffc6,
        0 0 20px #00ffc6,
        0 0 40px rgba(0, 255, 198, 0.6);
    animation: pulse-change-glow-success 0.5s ease-in-out infinite alternate;
    font-weight: 700 !important;
    transform-origin: center;
}

/* Price gets subtle highlight but not the main focus */
.pulse-success-focus .stock-price,
.pulse-success-focus .price,
.pulse-success-focus [data-pulse-value] {
    text-shadow: 0 0 10px rgba(0, 255, 198, 0.4);
}

@keyframes pulse-change-glow-success {
    from {
        text-shadow: 
            0 0 10px #00ffc6,
            0 0 20px #00ffc6,
            0 0 40px rgba(0, 255, 198, 0.6);
        transform: scale(1);
    }
    to {
        text-shadow: 
            0 0 20px #00ffc6,
            0 0 40px #00ffc6,
            0 0 60px rgba(0, 255, 198, 0.9);
        transform: scale(1.2);
    }
}

/* ============================================
   WIDGET BORDER GLOW
   ============================================ */

.pulse-danger-focus {
    box-shadow: 
        0 0 20px rgba(255, 68, 68, 0.4),
        0 0 40px rgba(255, 68, 68, 0.2),
        inset 0 0 20px rgba(255, 68, 68, 0.1) !important;
    border-color: rgba(255, 68, 68, 0.6) !important;
}

.pulse-success-focus {
    box-shadow: 
        0 0 20px rgba(0, 255, 198, 0.4),
        0 0 40px rgba(0, 255, 198, 0.2),
        inset 0 0 20px rgba(0, 255, 198, 0.1) !important;
    border-color: rgba(0, 255, 198, 0.6) !important;
}

/* ============================================
   SINGLE ITEM CARD VIEW (large centered display)
   Target the change line specifically
   ============================================ */

.pulse-danger-focus [style*="font-size: 1.1rem"],
.pulse-danger-focus [style*="font-size:1.1rem"] {
    color: #ff4444 !important;
    animation: pulse-change-glow-danger 0.5s ease-in-out infinite alternate;
}

.pulse-success-focus [style*="font-size: 1.1rem"],
.pulse-success-focus [style*="font-size:1.1rem"] {
    color: #00ffc6 !important;
    animation: pulse-change-glow-success 0.5s ease-in-out infinite alternate;
}

/* ============================================
   TICKER VIEW - Make the change % glow
   ============================================ */

.pulse-danger-focus .marquee .ticker-item [style*="color:#ff6363"],
.pulse-danger-focus .marquee .ticker-item [style*="color: #ff6363"] {
    text-shadow: 0 0 15px #ff4444, 0 0 30px #ff4444;
    animation: pulse-change-glow-danger 0.5s ease-in-out infinite alternate;
}

.pulse-success-focus .marquee .ticker-item [style*="color:#00ffc6"],
.pulse-success-focus .marquee .ticker-item [style*="color: #00ffc6"] {
    text-shadow: 0 0 15px #00ffc6, 0 0 30px #00ffc6;
    animation: pulse-change-glow-success 0.5s ease-in-out infinite alternate;
}

/* ============================================
   PULSE ACTIVATION MODAL
   Shown when user enables Pulse - blue "armed" state
   ============================================ */

/* --- Blue Activation Overlay --- */
.pulse-activation-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    opacity: 0;
    background: 
        radial-gradient(ellipse at center, 
            transparent 0%, 
            transparent 40%,
            rgba(0, 100, 255, 0.08) 60%,
            rgba(0, 80, 200, 0.2) 75%,
            rgba(0, 60, 180, 0.4) 88%,
            rgba(0, 40, 140, 0.6) 100%
        ),
        linear-gradient(to bottom, 
            rgba(0, 150, 255, 0.3) 0%, 
            rgba(0, 100, 200, 0.1) 8%,
            transparent 25%
        ),
        linear-gradient(to top, 
            rgba(0, 150, 255, 0.25) 0%, 
            transparent 20%
        ),
        linear-gradient(to right, 
            rgba(0, 120, 255, 0.35) 0%, 
            transparent 12%
        ),
        linear-gradient(to left, 
            rgba(0, 120, 255, 0.35) 0%, 
            transparent 12%
        );
    box-shadow: 
        inset 0 0 200px rgba(0, 150, 255, 0.15),
        inset 0 0 100px rgba(0, 100, 200, 0.2);
}

.pulse-activation-overlay.active {
    opacity: 1;
    animation: pulseActivationBurst 0.8s ease-out forwards;
}

@keyframes pulseActivationBurst {
    0% {
        opacity: 0;
        filter: brightness(2.5) saturate(1.5);
    }
    20% {
        opacity: 1;
        filter: brightness(1.8) saturate(1.3);
    }
    40% {
        opacity: 0.9;
        filter: brightness(1.2) saturate(1.1);
    }
    60% {
        opacity: 1;
        filter: brightness(1.4) saturate(1.2);
    }
    100% {
        opacity: 0.7;
        filter: brightness(1) saturate(1);
        animation: pulseActivationSustain 2s ease-in-out infinite;
    }
}

@keyframes pulseActivationSustain {
    0%, 100% {
        opacity: 0.5;
        filter: brightness(1) saturate(1);
    }
    50% {
        opacity: 0.7;
        filter: brightness(1.2) saturate(1.1);
    }
}

.pulse-activation-overlay.active.sustain {
    animation: pulseActivationSustain 2s ease-in-out infinite;
}

/* --- Activation Modal --- */
.pulse-activation-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    text-align: center;
    padding: 3rem 4rem;
    background: rgba(10, 20, 40, 0.85);
    border: 1px solid rgba(0, 150, 255, 0.3);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    box-shadow: 
        0 0 60px rgba(0, 120, 255, 0.3),
        0 0 120px rgba(0, 100, 200, 0.15),
        inset 0 0 30px rgba(0, 150, 255, 0.05);
    transition: opacity 0.3s ease, transform 0.3s ease;
    min-width: 280px;
}

.pulse-activation-modal.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.pulse-activation-modal.fade-out {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
    pointer-events: none;
}

/* --- Activated View Content --- */
.pulse-activation-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.pulse-activation-content.hidden {
    display: none;
}

.pulse-activation-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: #4da6ff;
    text-shadow: 
        0 0 20px rgba(0, 150, 255, 0.8),
        0 0 40px rgba(0, 120, 255, 0.5),
        0 0 60px rgba(0, 100, 255, 0.3);
    animation: pulseActivationTitleGlow 1.5s ease-in-out infinite alternate;
}

@keyframes pulseActivationTitleGlow {
    0% {
        text-shadow: 
            0 0 20px rgba(0, 150, 255, 0.8),
            0 0 40px rgba(0, 120, 255, 0.5),
            0 0 60px rgba(0, 100, 255, 0.3);
    }
    100% {
        text-shadow: 
            0 0 30px rgba(0, 180, 255, 1),
            0 0 60px rgba(0, 150, 255, 0.7),
            0 0 90px rgba(0, 120, 255, 0.5);
    }
}

.pulse-activation-subtitle {
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(150, 200, 255, 0.9);
    margin-bottom: 1.5rem;
}

.pulse-activation-settings-link {
    background: transparent;
    border: 1px solid rgba(0, 150, 255, 0.3);
    color: rgba(150, 200, 255, 0.8);
    padding: 0.6rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pulse-activation-settings-link:hover {
    background: rgba(0, 150, 255, 0.1);
    border-color: rgba(0, 150, 255, 0.5);
    color: #4da6ff;
}

/* --- Settings View --- */
.pulse-activation-settings {
    display: none;
    flex-direction: column;
    gap: 1rem;
    min-width: 240px;
}

.pulse-activation-settings.visible {
    display: flex;
}

.pulse-activation-settings-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #4da6ff;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px rgba(0, 150, 255, 0.5);
}

.pulse-activation-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 150, 255, 0.1);
}

.pulse-activation-setting-row:last-child {
    border-bottom: none;
}

.pulse-activation-setting-row label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: rgba(200, 220, 255, 0.85);
}

.pulse-activation-setting-row label span {
    font-size: 1.1rem;
}

/* Blue-tinted toggle switch for activation modal */
.pulse-activation-settings .pulse-switch input:checked + .slider {
    background: rgba(0, 150, 255, 0.3);
    border-color: rgba(0, 150, 255, 0.5);
}

.pulse-activation-settings .pulse-switch input:checked + .slider::before {
    background: #4da6ff;
}

/* ============================================
   PULSE DEACTIVATION OVERLAY
   Brief dim/fade when turning off
   ============================================ */

.pulse-deactivation-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9997;
    opacity: 0;
    background: radial-gradient(ellipse at center,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.5) 50%,
        rgba(0, 0, 0, 0.7) 100%
    );
}

.pulse-deactivation-overlay.active {
    animation: pulseDeactivationFade 0.6s ease-out forwards;
}

@keyframes pulseDeactivationFade {
    0% {
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}