/**
 * ==============================================================================
 * Universidad Libre - Seccional Cartagena
 * Cartilla Interactiva PEP - Administración de Empresas
 * mascot.css — Floating Uli Mascot Guide Widget & Speech Bubble Styles
 * ==============================================================================
 */

/* ------------------------------------------------------------------------------
   1. Floating Companion Widget Container
   ------------------------------------------------------------------------------ */
.mascot-guide,
.uli-guide-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none; /* Allows clicks through container padding */
  max-width: 360px;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
}

/* ------------------------------------------------------------------------------
   2. Speech Bubble (Globos de diálogo según manual de marca)
   ------------------------------------------------------------------------------ */
.mascot-speech-bubble,
.uli-speech {
  position: relative;
  background-color: var(--color-unilibre-white, #FFFFFF);
  color: var(--color-unilibre-gray-dark, #2B2B2B);
  font-family: var(--font-primary, 'Montserrat', sans-serif);
  font-size: 0.875rem;
  line-height: 1.45;
  font-weight: 500;
  padding: 14px 18px;
  border-radius: 18px;
  border: 2px solid var(--color-unilibre-red, #D02E28);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 3px 8px rgba(208, 46, 40, 0.12);
  margin-bottom: 12px;
  pointer-events: auto;
  cursor: pointer;
  max-width: 320px;
  width: auto;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow: visible;
  animation: bubble-appear 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.mascot-speech-bubble strong,
.uli-speech strong {
  color: var(--color-unilibre-red, #D02E28);
  font-weight: 700;
}

/* Speech Arrow Pointer (Points down toward Uli's head) */
.mascot-speech-bubble::before,
.uli-speech::before {
  content: '';
  position: absolute;
  bottom: -11px;
  right: 48px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 11px solid var(--color-unilibre-red, #D02E28);
  pointer-events: none;
}

.mascot-speech-bubble::after,
.uli-speech::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 49px;
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 9px solid var(--color-unilibre-white, #FFFFFF);
  pointer-events: none;
}

/* Bubble fade-in animation */
@keyframes bubble-appear {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.mascot-speech-bubble.bubble-pulse {
  animation: bubble-appear 0.3s ease-out;
}

/* ------------------------------------------------------------------------------
   3. Mascot Image Wrapper & Floating Animation
   ------------------------------------------------------------------------------ */
.mascot-img-wrap {
  position: relative;
  width: 140px;
  height: auto;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
  border-radius: 50% 50% 12px 12px;
  animation: uli-float 4.2s ease-in-out infinite;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.mascot-img-wrap:hover {
  transform: scale(1.05) translateY(-4px);
  filter: brightness(1.03);
}

.mascot-img-wrap:focus-visible {
  outline: 3px solid var(--color-unilibre-gold, #BF9B34);
  outline-offset: 4px;
}

.mascot-img-wrap:active {
  transform: scale(0.96);
}

#uli-mascot-img {
  width: 100%;
  height: auto;
  max-height: 180px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.22));
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Subtle bobbing / floating animation */
@keyframes uli-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-9px);
  }
}

/* Emotion / Reaction Bounce */
@keyframes uli-bounce {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  30% {
    transform: translateY(-16px) scale(1.06, 0.94);
  }
  60% {
    transform: translateY(-4px) scale(0.96, 1.04);
  }
  80% {
    transform: translateY(-1px) scale(1.01, 0.99);
  }
}

@keyframes uli-wiggle {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-6deg);
  }
  75% {
    transform: rotate(6deg);
  }
}

.mascot-bounce {
  animation: uli-bounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.mascot-wiggle {
  animation: uli-wiggle 0.5s ease-in-out !important;
}

/* ------------------------------------------------------------------------------
   4. Interactive Tip Tag
   ------------------------------------------------------------------------------ */
.mascot-tip-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--color-unilibre-gold, #BF9B34);
  color: var(--color-unilibre-white, #FFFFFF);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 6px;
  margin-bottom: 6px;
}

/* ------------------------------------------------------------------------------
   5. Responsive Breakpoints & Mobile Docking
   ------------------------------------------------------------------------------ */
@media screen and (max-width: 900px) {
  .mascot-guide,
  .uli-guide-widget {
    bottom: 20px;
    right: 18px;
    max-width: 300px;
  }

  .mascot-img-wrap {
    width: 115px;
  }

  #uli-mascot-img {
    max-height: 145px;
  }

  .mascot-speech-bubble,
  .uli-speech {
    font-size: 0.8125rem;
    padding: 12px 15px;
    max-width: 270px;
  }

  .mascot-speech-bubble::before,
  .uli-speech::before {
    right: 40px;
  }
  .mascot-speech-bubble::after,
  .uli-speech::after {
    right: 41px;
  }
}

@media screen and (max-width: 768px) {
  /* Compact mobile docking so mascot doesn't block content */
  .mascot-guide,
  .uli-guide-widget {
    bottom: 74px; /* Sits cleanly above bottom footer bar */
    right: 12px;
    max-width: calc(100vw - 24px);
  }

  .mascot-img-wrap {
    width: 90px;
  }

  #uli-mascot-img {
    max-height: 115px;
  }

  .mascot-speech-bubble,
  .uli-speech {
    font-size: 0.775rem;
    padding: 9px 13px;
    max-width: calc(100vw - 110px);
    border-radius: 14px;
    border-width: 1.5px;
  }

  .mascot-speech-bubble::before,
  .uli-speech::before {
    bottom: -9px;
    right: 30px;
    border-top-width: 9px;
    border-left-width: 8px;
    border-right-width: 8px;
  }
  .mascot-speech-bubble::after,
  .uli-speech::after {
    bottom: -7px;
    right: 31px;
    border-top-width: 7px;
    border-left-width: 7px;
    border-right-width: 7px;
  }
}

@media screen and (max-width: 480px) {
  .mascot-guide,
  .uli-guide-widget {
    bottom: 70px;
    right: 8px;
  }

  .mascot-img-wrap {
    width: 78px;
  }

  #uli-mascot-img {
    max-height: 100px;
  }

  .mascot-speech-bubble,
  .uli-speech {
    max-width: 215px;
    font-size: 0.75rem;
    padding: 8px 11px;
  }
}

/* ------------------------------------------------------------------------------
   6. Accessibility & Print Overrides
   ------------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .mascot-img-wrap,
  .mascot-bounce,
  .mascot-wiggle,
  .mascot-speech-bubble,
  .uli-speech {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .mascot-guide,
  .uli-guide-widget {
    display: none !important;
    visibility: hidden !important;
  }
}
