/**
 * Pet Companion Styles
 * Styling for pet display, animations, reactions, and selection
 */

/* ===== PET SELECTION MODAL ===== */
.pet-selection-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.pet-selection-modal {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 20px;
  padding: 30px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(100, 100, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.pet-selection-title {
  text-align: center;
  color: #fff;
  font-size: 2rem;
  margin-bottom: 10px;
  text-shadow: 0 0 20px rgba(255, 200, 100, 0.5);
}

.pet-selection-subtitle {
  text-align: center;
  color: #aaa;
  font-size: 1.1rem;
  margin-bottom: 30px;
}

.pet-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.pet-option-card {
  background: rgba(255, 255, 255, 0.05);
  border: 3px solid transparent;
  border-radius: 15px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pet-option-card:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.pet-option-card.selected {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.pet-option-emoji {
  font-size: 4rem;
  margin-bottom: 10px;
  display: block;
  animation: petBounce 2s ease-in-out infinite;
}

.pet-option-card:nth-child(2) .pet-option-emoji {
  animation-delay: 0.2s;
}
.pet-option-card:nth-child(3) .pet-option-emoji {
  animation-delay: 0.4s;
}
.pet-option-card:nth-child(4) .pet-option-emoji {
  animation-delay: 0.6s;
}

.pet-option-name {
  font-size: 1.3rem;
  color: #fff;
  font-weight: bold;
  margin-bottom: 5px;
}

.pet-option-type {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 10px;
}

.pet-option-ability {
  font-size: 0.85rem;
  color: #4ecdc4;
  background: rgba(78, 205, 196, 0.1);
  padding: 8px;
  border-radius: 8px;
  margin-top: 10px;
}

.pet-name-input-container {
  text-align: center;
  margin-bottom: 20px;
}

.pet-name-input {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 1.2rem;
  color: #fff;
  text-align: center;
  width: 60%;
  max-width: 300px;
  transition: all 0.3s ease;
}

.pet-name-input:focus {
  outline: none;
  border-color: #ffd700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.pet-name-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.pet-select-btn {
  display: block;
  margin: 0 auto;
  padding: 15px 50px;
  font-size: 1.3rem;
  background: linear-gradient(135deg, #ffd700 0%, #ff9500 100%);
  border: none;
  border-radius: 30px;
  color: #1a1a2e;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.pet-select-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(255, 215, 0, 0.6);
}

.pet-select-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== PET DISPLAY COMPONENT ===== */
.pet-display {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pet-container {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pet-emoji {
  font-size: 4rem;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.pet-emoji:hover {
  transform: scale(1.1);
}

.pet-emoji.celebrating {
  animation: petCelebrate 0.5s ease-in-out;
}

.pet-emoji.sad {
  filter: grayscale(30%);
  animation: petSad 2s ease-in-out infinite;
}

.pet-accessories {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pet-accessory-hat {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.5rem;
}

.pet-accessory-collar {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1rem;
}

.pet-accessory-wings {
  position: absolute;
  top: 30%;
  left: -20px;
  font-size: 1.2rem;
}

/* ===== PET INFO BAR ===== */
.pet-info-bar {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 20px;
  border-radius: 50px;
  margin: 10px 0;
}

.pet-info-mini-emoji {
  font-size: 2rem;
}

.pet-info-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pet-info-name {
  font-weight: bold;
  color: #fff;
  font-size: 1rem;
}

.pet-info-level {
  font-size: 0.85rem;
  color: #aaa;
}

/* ===== PET XP BAR ===== */
.pet-xp-container {
  width: 100%;
  max-width: 200px;
  margin-top: 10px;
}

.pet-xp-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.pet-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ecdc4 0%, #44a8a0 100%);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.pet-xp-text {
  font-size: 0.75rem;
  color: #888;
  text-align: center;
  margin-top: 3px;
}

/* ===== PET HAPPINESS ===== */
.pet-happiness-container {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
}

.pet-happiness-icon {
  font-size: 1rem;
}

.pet-happiness-bar {
  width: 60px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.pet-happiness-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease, background 0.5s ease;
}

.pet-happiness-fill.ecstatic { background: #4caf50; }
.pet-happiness-fill.happy { background: #8bc34a; }
.pet-happiness-fill.content { background: #ffc107; }
.pet-happiness-fill.tired { background: #ff9800; }
.pet-happiness-fill.sad { background: #f44336; }

/* ===== PET REACTION BUBBLE ===== */
.pet-reaction-bubble {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  padding: 10px 15px;
  border-radius: 15px;
  font-size: 0.9rem;
  max-width: 200px;
  text-align: center;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  animation: bubbleAppear 0.3s ease-out;
  z-index: 100;
}

.pet-reaction-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid rgba(255, 255, 255, 0.95);
}

.pet-reaction-bubble.correct {
  background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
  color: #fff;
}

.pet-reaction-bubble.correct::after {
  border-top-color: #4caf50;
}

.pet-reaction-bubble.wrong {
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  color: #fff;
}

.pet-reaction-bubble.wrong::after {
  border-top-color: #ff9800;
}

/* ===== PET EVOLUTION OVERLAY ===== */
.pet-evolution-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.5s ease-out;
}

.pet-evolution-content {
  text-align: center;
}

.pet-evolution-title {
  font-size: 2.5rem;
  color: #ffd700;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
  margin-bottom: 30px;
  animation: pulse 1s ease-in-out infinite;
}

.pet-evolution-stages {
  display: flex;
  align-items: center;
  gap: 30px;
  margin-bottom: 30px;
}

.pet-evolution-old {
  font-size: 5rem;
  opacity: 0.5;
  animation: fadeOutLeft 2s ease-in-out forwards;
  animation-delay: 1s;
}

.pet-evolution-arrow {
  font-size: 3rem;
  color: #ffd700;
  animation: arrowGlow 1s ease-in-out infinite;
}

.pet-evolution-new {
  font-size: 5rem;
  animation: evolutionAppear 1s ease-out forwards;
  animation-delay: 1.5s;
  opacity: 0;
  transform: scale(0.5);
}

.pet-evolution-name {
  font-size: 1.5rem;
  color: #fff;
  margin-top: 20px;
  animation: fadeIn 1s ease-out forwards;
  animation-delay: 2.5s;
  opacity: 0;
}

.pet-evolution-close {
  margin-top: 30px;
  padding: 15px 40px;
  font-size: 1.2rem;
  background: linear-gradient(135deg, #ffd700 0%, #ff9500 100%);
  border: none;
  border-radius: 25px;
  color: #1a1a2e;
  font-weight: bold;
  cursor: pointer;
  animation: fadeIn 1s ease-out forwards;
  animation-delay: 3s;
  opacity: 0;
}

/* ===== PET LEVEL UP NOTIFICATION ===== */
.pet-levelup-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 30px 50px;
  border-radius: 20px;
  text-align: center;
  z-index: 1500;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 50px rgba(102, 126, 234, 0.5);
  animation: levelUpAppear 0.5s ease-out;
}

.pet-levelup-emoji {
  font-size: 4rem;
  margin-bottom: 15px;
  animation: petBounce 0.5s ease-in-out infinite;
}

.pet-levelup-text {
  font-size: 1.5rem;
  color: #fff;
  font-weight: bold;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.pet-levelup-level {
  font-size: 2.5rem;
  color: #ffd700;
  font-weight: bold;
  margin-top: 10px;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

/* ===== QUEST PET DISPLAY ===== */
.quest-pet-display {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 100;
}

.quest-pet-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.quest-pet-emoji {
  font-size: 3rem;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.quest-pet-emoji:hover {
  transform: scale(1.1);
}

.quest-pet-name {
  font-size: 0.8rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 10px;
  border-radius: 10px;
  margin-top: 5px;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes petBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes petCelebrate {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.2) rotate(-10deg); }
  50% { transform: scale(1.2) rotate(10deg); }
  75% { transform: scale(1.2) rotate(-5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes petSad {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

@keyframes bubbleAppear {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes arrowGlow {
  0%, 100% { text-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
  50% { text-shadow: 0 0 40px rgba(255, 215, 0, 1); }
}

@keyframes fadeOutLeft {
  to {
    opacity: 0;
    transform: translateX(-50px);
  }
}

@keyframes evolutionAppear {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes levelUpAppear {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ===== MINI PET COMPANION (during gameplay) ===== */
.mini-pet-companion {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #e8e0ff;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.mini-pet-emoji {
  font-size: 2rem;
  line-height: 1;
}

.mini-pet-companion.celebrate {
  animation: miniPetBounce 0.6s ease;
}

@keyframes miniPetBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.3) translateY(-12px); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* ===== XP FLOAT ANIMATION ===== */
.mini-pet-xp-float {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  color: #7B1FA2;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  pointer-events: none;
}

.mini-pet-xp-float.show {
  animation: xpFloat 1.5s ease-out forwards;
}

@keyframes xpFloat {
  0% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-40px); }
}

/* ===== PET REWARDS CARD (completion screens) ===== */
.pet-rewards-completion {
  margin: 12px 0;
}

.pet-rewards-completion:empty {
  display: none;
}

.pet-reward-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #f0e6ff, #e8f4ff);
  border-radius: 16px;
  padding: 14px 18px;
}

.pet-reward-emoji {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.pet-reward-details {
  flex: 1;
}

.pet-reward-text {
  color: #5a3e8e;
  font-weight: 600;
  font-size: 0.95rem;
}

.pet-reward-levelup {
  color: #7B1FA2;
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ===== PET VICTORY DANCE (perfect score celebration) ===== */
.pet-victory-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease-out;
}

.pet-victory-content {
  text-align: center;
}

.pet-victory-dancer {
  font-size: 4rem;
  display: inline-block;
  animation: petDance 2.5s ease-in-out;
}

.pet-victory-sparkles {
  font-size: 2rem;
  display: inline-block;
  animation: petBounce 1s ease-in-out infinite;
}

@keyframes petDance {
  0% { transform: scale(1); }
  15% { transform: scale(1.3) translateY(-30px); }
  30% { transform: scale(1) rotate(15deg); }
  45% { transform: rotate(-15deg); }
  60% { transform: scale(1.2) translateY(-20px) rotate(0); }
  75% { transform: scale(1) rotate(360deg); }
  90% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.pet-victory-message {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  color: #fff;
  margin-top: 16px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.5s ease-out 0.5s both;
}

/* ===== PET INFO PANEL (tappable roadmap overlay) ===== */
.pet-info-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease-out;
}

.pet-info-panel {
  background: #fff;
  max-width: 380px;
  width: 90%;
  border-radius: 20px;
  padding: 24px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.pet-info-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: #999;
  cursor: pointer;
  line-height: 1;
}

.pet-info-close:hover {
  color: #333;
}

.pet-info-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.pet-info-emoji {
  font-size: 3rem;
}

.pet-info-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #333;
}

.pet-info-level-text {
  font-size: 0.9rem;
  color: #888;
}

.pet-info-section {
  margin-bottom: 18px;
}

.pet-info-section-title {
  font-weight: 700;
  color: #5a3e8e;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

/* Evolution timeline */
.pet-evolution-timeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  overflow-x: auto;
  padding: 8px 0;
}

.pet-stage-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.pet-stage-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.4rem;
  border: 3px solid #e0e0e0;
  background: #f9f9f9;
  transition: all 0.3s ease;
}

.pet-stage-circle.current {
  border-color: #7B1FA2;
  box-shadow: 0 0 15px rgba(123, 31, 162, 0.4);
  background: #f3e5f5;
}

.pet-stage-circle.future {
  opacity: 0.5;
}

.pet-stage-circle.past {
  border-color: #4caf50;
  background: #e8f5e9;
}

.pet-stage-label {
  font-size: 0.65rem;
  color: #888;
  margin-top: 4px;
  text-align: center;
}

.pet-stage-line {
  width: 20px;
  height: 3px;
  background: #e0e0e0;
  margin: 0 2px;
  align-self: center;
  margin-bottom: 20px;
}

.pet-next-evolution {
  font-size: 0.6rem;
  color: #7B1FA2;
  font-weight: 700;
  margin-top: 2px;
}

.pet-next-evolution-text {
  text-align: center;
  font-size: 0.85rem;
  color: #7B1FA2;
  font-weight: 600;
  margin-top: 6px;
}

/* Stats */
.pet-info-stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 6px;
}

.pet-info-xp-bar {
  flex: 1;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}

.pet-info-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ecdc4, #44a8a0);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* Ability */
.pet-ability-info {
  background: #f3e5f5;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  color: #5a3e8e;
}

/* Growth tips */
.pet-growth-tips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pet-growth-tip {
  font-size: 0.85rem;
  color: #555;
  padding: 6px 10px;
  background: #f5f5f5;
  border-radius: 8px;
}

/* Tappable hint */
.pet-tappable {
  cursor: pointer;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .pet-selection-modal {
    padding: 20px;
  }

  .pet-selection-title {
    font-size: 1.5rem;
  }

  .pet-options-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .pet-option-emoji {
    font-size: 3rem;
  }

  .pet-option-name {
    font-size: 1.1rem;
  }

  .pet-name-input {
    width: 80%;
  }

  .quest-pet-display {
    bottom: 10px;
    left: 10px;
  }

  .quest-pet-emoji {
    font-size: 2.5rem;
  }

  .mini-pet-companion {
    width: 48px;
    height: 48px;
    bottom: 12px;
    left: 12px;
  }

  .mini-pet-emoji {
    font-size: 1.5rem;
  }

  .pet-info-panel {
    max-width: 95vw;
    padding: 18px;
  }

  .pet-stage-circle {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  .pet-victory-dancer {
    font-size: 3rem;
  }
}
