/* Clippy - Windows Assistant */

.clippy-container {
  position: absolute;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.clippy-container.visible {
  opacity: 1;
}

/* Character wrapper */
.clippy-character {
  width: 60px;
  height: 75px;
  transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.clippy-svg {
  width: 100%;
  height: 100%;
}

/* Peek from left */
.clippy-container.peek-from-left {
  transform: translateX(-100%);
}

.clippy-container.peek-from-left .clippy-character {
  transform: translateX(-60px);
}

.clippy-container.peek-from-left.visible .clippy-character {
  transform: translateX(0);
}

.clippy-container.peek-from-left .clippy-speech-bubble {
  left: 70px;
  right: auto;
}

.clippy-container.peek-from-left .clippy-speech-bubble::before {
  left: -8px;
  right: auto;
  border-width: 8px 8px 8px 0;
  border-color: transparent #ffffe1 transparent transparent;
}

/* Peek from right */
.clippy-container.peek-from-right {
  transform: translateX(100%);
}

.clippy-container.peek-from-right .clippy-character {
  transform: translateX(60px) scaleX(-1);
}

.clippy-container.peek-from-right.visible .clippy-character {
  transform: translateX(0) scaleX(-1);
}

.clippy-container.peek-from-right .clippy-speech-bubble {
  right: 70px;
  left: auto;
}

.clippy-container.peek-from-right .clippy-speech-bubble::before {
  right: -8px;
  left: auto;
  border-width: 8px 0 8px 8px;
  border-color: transparent transparent transparent #ffffe1;
}

/* Speech bubble */
.clippy-speech-bubble {
  position: absolute;
  top: -10px;
  background: #ffffe1;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'MS Sans Serif', 'Segoe UI', Tahoma, sans-serif;
  font-size: 12px;
  color: #000;
  white-space: nowrap;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.3s ease 0.5s;
}

.clippy-container.visible .clippy-speech-bubble {
  opacity: 1;
}

.clippy-speech-bubble::before {
  content: '';
  position: absolute;
  top: 20px;
  width: 0;
  height: 0;
  border-style: solid;
}

/* Clippy body styling */
.clippy-body {
  transition: stroke 0.3s ease;
}

/* Eye animations */
.clippy-eyes {
  transition: transform 0.1s ease-out;
}

.clippy-pupil-left,
.clippy-pupil-right {
  transition: cx 0.1s ease-out, cy 0.1s ease-out;
}

/* Eyebrow raise on hover */
.clippy-container:hover .clippy-eyebrows {
  transform: translateY(-2px);
  transition: transform 0.2s ease;
}

/* Subtle idle animation */
@keyframes clippy-idle {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.clippy-container.visible .clippy-character {
  animation: clippy-idle 2s ease-in-out infinite;
}

.clippy-container.peek-from-right.visible .clippy-character {
  animation: clippy-idle 2s ease-in-out infinite;
  /* Keep the scaleX transform while animating */
}

/* Blink animation */
@keyframes clippy-blink {
  0%, 90%, 100% {
    transform: scaleY(1);
  }
  95% {
    transform: scaleY(0.1);
  }
}

.clippy-container.visible .clippy-eyes {
  animation: clippy-blink 4s ease-in-out infinite;
  transform-origin: center;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .clippy-character {
    width: 50px;
    height: 62px;
  }

  .clippy-speech-bubble {
    font-size: 11px;
    padding: 6px 10px;
  }

  .clippy-container.peek-from-left .clippy-speech-bubble {
    left: 55px;
  }

  .clippy-container.peek-from-right .clippy-speech-bubble {
    right: 55px;
  }
}
