/* css/pet_companion.css */

.pet-companion {
  position: fixed;
  right: 15px;
  bottom: 0;
  z-index: 9999; /* High enough to be over learning views but below top-level alerts */
  width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none; /* Let clicks pass through the container */
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.pet-companion.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.pet-bubble {
  position: absolute;
  bottom: 100%; /* Above the pet */
  right: 50%; /* Align relative to pet */
  transform: translateX(30%) translateY(-10px);
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  max-width: 220px;
  width: max-content;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
}

.pet-bubble.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(30%) translateY(0);
}

.pet-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 30px;
  border-width: 8px 8px 0;
  border-style: solid;
  border-color: white transparent transparent transparent;
  display: block;
  width: 0;
}

.pet-bubble::before {
  content: '';
  position: absolute;
  bottom: -11px;
  right: 28px;
  border-width: 10px 10px 0;
  border-style: solid;
  border-color: #e2e8f0 transparent transparent transparent;
  display: block;
  width: 0;
}

.pet-mini-icon {
  position: absolute;
  top: -15px;
  right: 20px;
  font-size: 24px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.5);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.pet-mini-icon.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.pet-image {
  width: 100%;
  height: auto;
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,0.15));
  transition: transform 0.3s ease;
}

/* Animations */
@keyframes pet-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes pet-bob {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-4px) scaleY(0.95); }
}

@keyframes pet-bounce {
  0%, 100% { transform: translateY(0); }
  20% { transform: translateY(-15px); }
  40% { transform: translateY(0); }
  60% { transform: translateY(-8px); }
  80% { transform: translateY(0); }
}

@keyframes pet-shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-4px) rotate(-5deg); }
  75% { transform: translateX(4px) rotate(5deg); }
}

@keyframes pet-sleep {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(2px) scale(1.02); }
}

@keyframes pet-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Mood Classes */
.pet-companion .pet-image {
  animation: none !important;
  transform: none !important;
}

.pet-companion.mood-idle .pet-image,
.pet-companion.mood-study .pet-image,
.pet-companion.mood-happy .pet-image,
.pet-companion.mood-worried .pet-image,
.pet-companion.mood-remind .pet-image {
  animation: none !important;
  transform: none !important;
}

.pet-companion.mood-sleep .pet-image {
  animation: none !important;
  transform: none !important;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1)) brightness(0.8);
}

@media (max-width: 1024px) {
  .pet-companion {
    display: none !important;
  }
}
