/* ============================================= */
/* HUDHUD ANIMATED CHARACTER - الهدهد المتحرك */
/* ============================================= */

#hudhud-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  pointer-events: none;
}

#hudhud-character {
  width: 120px;
  height: 140px;
  position: relative;
  transition: all 0.3s ease;
}

.hudhud-body {
  width: 100%;
  height: 100%;
  position: relative;
}

.hudhud-head {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #f4a261 0%, #e76f51 100%);
  border-radius: 50% 50% 45% 45%;
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.hudhud-beak {
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 25px solid #ff6b35;
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
}

.hudhud-eyes {
  position: absolute;
  top: 25px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
}

.eye {
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  position: relative;
}

.eye::after {
  content: '';
  width: 10px;
  height: 10px;
  background: #2d3748;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: eyeMove 3s infinite;
}

.hudhud-crest {
  width: 40px;
  height: 35px;
  background: linear-gradient(135deg, #ff6b35 0%, #f4a261 100%);
  border-radius: 50% 50% 0 0;
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  clip-path: polygon(50% 0%, 60% 30%, 70% 10%, 80% 35%, 90% 15%, 100% 100%, 0% 100%, 10% 15%, 20% 35%, 30% 10%, 40% 30%);
  animation: crestWiggle 2s infinite;
}

.hudhud-wings {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
}

.wing {
  width: 45px;
  height: 60px;
  background: linear-gradient(135deg, #e76f51 0%, #f4a261 100%);
  border-radius: 50% 50% 50% 0;
  position: absolute;
  top: 0;
}

.wing.left {
  left: -10px;
  transform: rotate(-20deg);
  transform-origin: right center;
  animation: wingFlap 1s infinite;
}

.wing.right {
  right: -10px;
  transform: rotate(20deg) scaleX(-1);
  transform-origin: left center;
  animation: wingFlap 1s infinite 0.1s;
}

.speech-bubble {
  position: absolute;
  bottom: 150px;
  right: -20px;
  background: white;
  padding: 15px 20px;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  max-width: 250px;
  min-width: 180px;
  opacity: 0;
  transform: scale(0.8) translateY(10px);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: auto;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  right: 40px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 12px solid white;
}

.speech-bubble.show {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.speech-bubble.hidden {
  opacity: 0;
  transform: scale(0.8) translateY(10px);
  pointer-events: none;
}

.bubble-content {
  font-size: 15px;
  color: #2d3748;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
}

/* ANIMATIONS */
@keyframes eyeMove {
  0%, 100% { transform: translate(-50%, -50%); }
  25% { transform: translate(-40%, -50%); }
  75% { transform: translate(-60%, -50%); }
}

@keyframes crestWiggle {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  50% { transform: translateX(-50%) rotate(5deg); }
}

@keyframes wingFlap {
  0%, 100% { transform: rotate(-20deg); }
  50% { transform: rotate(-35deg); }
}

.hudhud-idle.bounce {
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

.hudhud-correct.jump {
  animation: jump 0.8s ease;
}

@keyframes jump {
  0%, 100% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-30px) scale(1.1); }
  50% { transform: translateY(-40px) scale(1.15) rotate(10deg); }
  70% { transform: translateY(-20px) scale(1.05) rotate(-5deg); }
}

.hudhud-wrong.shake {
  animation: shake 0.6s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
  20%, 40%, 60%, 80% { transform: translateX(8px); }
}

.hudhud-greeting.wave {
  animation: wave 1s ease;
}

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  25%, 75% { transform: rotate(-10deg); }
  50% { transform: rotate(10deg); }
}

.hudhud-encourage.cheer {
  animation: cheer 1s ease;
}

@keyframes cheer {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.1) rotate(-5deg); }
  75% { transform: scale(1.1) rotate(5deg); }
}

.hudhud-reward.celebrate {
  animation: celebrate 1.5s ease;
}

@keyframes celebrate {
  0%, 100% { transform: scale(1) rotate(0deg); }
  15% { transform: scale(1.2) rotate(-15deg); }
  30% { transform: scale(1.2) rotate(15deg); }
  45% { transform: scale(1.15) rotate(-10deg); }
  60% { transform: scale(1.15) rotate(10deg); }
  75% { transform: scale(1.1) rotate(-5deg); }
}

.hudhud-correct .hudhud-head {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  animation: glow 0.5s ease;
}

.hudhud-wrong .hudhud-head {
  background: linear-gradient(135deg, #fc8181 0%, #f56565 100%);
}

.hudhud-reward .hudhud-head {
  background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
  animation: glow 1s ease infinite;
}

@keyframes glow {
  0%, 100% { box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
  50% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.8); }
}

.hudhud-sad .eye::after {
  animation: none;
  transform: translate(-50%, -30%);
}

.hudhud-sad .hudhud-head {
  background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
}

@media (max-width: 768px) {
  #hudhud-container {
    bottom: 10px;
    right: 10px;
  }
  
  #hudhud-character {
    width: 90px;
    height: 105px;
  }
  
  .hudhud-head {
    width: 60px;
    height: 60px;
  }
  
  .speech-bubble {
    max-width: 200px;
    font-size: 13px;
    bottom: 120px;
  }
}
