/* Animation specific styles */
.cursor-element {
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  z-index: 1000;
  pointer-events: none;
  will-change: left, top;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.3));
  transition: transform 0.1s ease, filter 0.3s ease;
}

.cursor-element.drawing svg path {
  fill: rgba(99, 102, 241, 0.7);
}

.cursor-element.clicking svg {
  transform: scale(0.7);
  transition: transform 0.1s ease;
}

.element-highlight {
  animation: pulse-highlight 2s infinite ease-in-out;
  border-radius: 8px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.dark-mode .element-highlight {
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
  animation: pulse-highlight-dark 2s infinite ease-in-out;
}

.dark-mode .element-highlight.selection-flash {
  animation: flash-selection-dark 0.6s ease;
}

.element-highlight.selection-flash {
  animation: flash-selection 0.6s ease;
}

@keyframes flash-selection {
  0% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    background-color: rgba(99, 102, 241, 0.3);
    transform: scale(0.97);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(99, 102, 241, 0.4);
    background-color: rgba(99, 102, 241, 0.15);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background-color: rgba(99, 102, 241, 0.05);
    transform: scale(1);
  }
}

@keyframes flash-selection-dark {
  0% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    background-color: rgba(99, 102, 241, 0.4);
    transform: scale(0.97);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(99, 102, 241, 0.5);
    background-color: rgba(99, 102, 241, 0.25);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    background-color: rgba(99, 102, 241, 0.1);
    transform: scale(1);
  }
}

.mode-label {
  position: absolute;
  bottom: 15px;
  left: 15px;
  transform: translateY(10px);
  background-color: var(--color-primary);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  z-index: 30;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
  opacity: 0;
  transition: all 0.4s ease;
  text-align: left;
  width: auto;
  white-space: nowrap;
}

.click-ripple {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(99, 102, 241, 0.4);
  transform: translate(-50%, -50%);
  z-index: 16;
  pointer-events: none;
  animation: ripple 0.6s ease-out forwards;
}

@keyframes ripple {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

@keyframes pulse-highlight {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.2);
  }
}

@keyframes pulse-highlight-dark {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.3);
  }
}

/* Style for the charts to make blurring more noticeable */
.chart-svg {
  transition: filter 0.3s ease;
}

.hover-highlight {
  pointer-events: none;
  animation: hover-pulse 1.5s infinite ease-in-out;
}

@keyframes hover-pulse {
  0%, 100% {
    border-color: rgba(99, 102, 241, 0.5);
  }
  50% {
    border-color: rgba(99, 102, 241, 1);
  }
}

.blur-overlay {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease, width 0.5s cubic-bezier(0.19, 1, 0.22, 1), height 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  border-radius: 8px;
  /* Ensure no existing transformations or backdrop filters */
  transform: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 0 0 rgba(99, 102, 241, 0);
}

.blur-overlay.selection-active {
  opacity: 1;
  visibility: visible;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3), 0 0 20px rgba(99, 102, 241, 0.15);
  animation: selection-glow 2s infinite ease-in-out;
}

.blur-overlay.selection-complete {
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3), 0 4px 12px rgba(99, 102, 241, 0.2);
  animation: selection-complete-pulse 3s infinite ease-in-out;
}

.dark-mode .blur-overlay.selection-complete {
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.4), 0 4px 12px rgba(99, 102, 241, 0.3);
}

.blur-overlay.selection-complete .blur-handle {
  opacity: 1;
  animation: pulse-handle 2s infinite ease-in-out;
  transform: scale(1);
}

.blur-action-button.active {
  transform: scale(0.95);
}

@keyframes pulse-handle {
  0%, 100% {
    transform: scale(1);
    background-color: white;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 8px rgba(99, 102, 241, 0.5);
  }
  50% {
    transform: scale(1.3);
    background-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 0 12px rgba(99, 102, 241, 0.8);
  }
}

.dark-mode .blur-handle {
  background-color: var(--color-bg-alt);
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 0 8px rgba(99, 102, 241, 0.6);
}

.dark-mode .blur-overlay.selection-complete .blur-handle {
  animation: pulse-handle-dark 1.5s infinite ease-in-out;
}

@keyframes pulse-handle-dark {
  0%, 100% {
    transform: scale(1);
    background-color: var(--color-bg-alt);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 0 8px rgba(99, 102, 241, 0.6);
  }
  50% {
    transform: scale(1.3);
    background-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 12px rgba(99, 102, 241, 0.9);
  }
}

@keyframes slide-down {
  from {
    bottom: -64px;
    opacity: 1;
  }
  to {
    bottom: -120px;
    opacity: 0;
  }
}

@keyframes slide-up {
  from {
    bottom: -120px;
    opacity: 0;
  }
  to {
    bottom: -64px;
    opacity: 1;
  }
}

/* Responsive adjustments for animations */
@media (max-width: 768px) {
  .cursor-element {
    width: 20px;
    height: 20px;
  }
  
  .mode-label {
    bottom: 10px;
    left: 10px;
    padding: 4px 10px;
    font-size: 11px;
  }
  
  .click-ripple {
    width: 30px;
    height: 30px;
  }
  
  @keyframes ripple {
    0% {
      transform: translate(-50%, -50%) scale(0);
      opacity: 1;
    }
    100% {
      transform: translate(-50%, -50%) scale(1.5);
      opacity: 0;
    }
  }
}

@media (max-width: 576px) {
  .cursor-element {
    width: 16px;
    height: 16px;
  }
  
  .mode-label {
    bottom: 8px;
    left: 8px;
    padding: 3px 8px;
    font-size: 10px;
    border-radius: 16px;
  }
  
  .click-ripple {
    width: 24px;
    height: 24px;
  }
  
  .element-highlight {
    animation-duration: 2.5s;
  }
  
  /* Adjust blur overlay animations for small screens */
  @keyframes slide-up {
    from {
      bottom: -100px;
      opacity: 0;
    }
    to {
      bottom: -90px;
      opacity: 1;
    }
  }
  
  @keyframes slide-down {
    from {
      bottom: -90px;
      opacity: 1;
    }
    to {
      bottom: -100px;
      opacity: 0;
    }
  }
  
  /* Adjust animation elements for mobile */
  .mode-label {
    font-size: 9px;
    padding: 2px 6px;
    bottom: 5px;
    left: 5px;
  }
}