/* ================================================================
   UNİVERSİTEM MASKOT STİLLERİ — v2.1
   app.css dosyanızın EN SONUNA ekleyin
   ================================================================ */

/* ── ANA KONTEYNER ──────────────────────────────────────────── */
#uni-mascot {
  position: fixed;
  z-index: 8800;
  pointer-events: none;
  will-change: left, top, opacity;
  transform: translateZ(0);
}

/* ── İÇ SARICI ──────────────────────────────────────────────── */
.mascot-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── KONUŞMA BALONCUĞU ───────────────────────────────────────── */
.mascot-speech {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;

  background: #fff;
  border: 2.5px solid #7B2FBE;
  border-radius: 16px;
  padding: 10px 15px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: #2d2d2d;
  max-width: 210px;
  min-width: 130px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(123, 47, 190, 0.22);
  white-space: normal;
  word-break: keep-all;

  opacity: 0;
  transform: translateX(-50%) scale(0.78) translateY(6px);
  transform-origin: bottom center;
  transition: opacity 0.25s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  filter: drop-shadow(0 3px 8px rgba(123, 47, 190, 0.15));
}

/* Baloncuk kuyruğu */
.mascot-speech::after {
  content: '';
  position: absolute;
  bottom: -11px;
  left: 50%;
  transform: translateX(-50%);
  border-left:  9px solid transparent;
  border-right: 9px solid transparent;
  border-top:   11px solid #7B2FBE;
}

.mascot-speech::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-left:  7px solid transparent;
  border-right: 7px solid transparent;
  border-top:   9px solid #fff;
  z-index: 1;
}

/* Görünür durum */
.mascot-speech.show {
  opacity: 1;
  transform: translateX(-50%) scale(1) translateY(0);
}

/* Dark mode baloncuk */
html.dark-mode .mascot-speech {
  background: #1e1e2e;
  border-color: #9c4dcc;
  color: #e0e0e0;
  box-shadow: 0 6px 20px rgba(156, 77, 204, 0.3);
}

html.dark-mode .mascot-speech::before {
  border-top-color: #1e1e2e;
}

html.dark-mode .mascot-speech::after {
  border-top-color: #9c4dcc;
}

/* ── KUŞUN KENDİSİ ──────────────────────────────────────────── */
.mascot-bird {
  cursor: pointer;
  pointer-events: all;
  filter: drop-shadow(0 4px 10px rgba(74, 20, 140, 0.32));
  animation: mascot-breathe 3.5s ease-in-out infinite;
  will-change: transform;
  display: block;
}

.mascot-bird:hover {
  filter: drop-shadow(0 7px 18px rgba(74, 20, 140, 0.48)) brightness(1.06);
}

.mascot-bird:active {
  transform: scale(0.91) !important;
  animation: none !important;
}

/* ── NEFES ALMA ─────────────────────────────────────────────── */
@keyframes mascot-breathe {
  0%, 100% { transform: scale(1);      }
  50%       { transform: scale(1.028); }
}

/* ── GEÇİŞ ANİMASYONLARI ────────────────────────────────────── */

#uni-mascot.mascot-leave .mascot-bird {
  animation: mascot-leave-anim 0.35s ease-in forwards;
}

@keyframes mascot-leave-anim {
  0%   { transform: scale(1)    rotate(0deg);   opacity: 1; }
  40%  { transform: scale(1.12) rotate(8deg);   opacity: 0.7; }
  100% { transform: scale(0.25) rotate(-15deg); opacity: 0; }
}

#uni-mascot.mascot-enter .mascot-bird {
  animation: mascot-enter-anim 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes mascot-enter-anim {
  0%   { transform: scale(0)    rotate(18deg);  opacity: 0; }
  65%  { transform: scale(1.10) rotate(-4deg);  opacity: 1; }
  100% { transform: scale(1)    rotate(0deg);   opacity: 1; }
}

@keyframes mascot-first-appear {
  0%   { transform: scale(0) rotate(-25deg); opacity: 0; }
  70%  { transform: scale(1.08) rotate(4deg); opacity: 1; }
  100% { transform: scale(1)    rotate(0deg); opacity: 1; }
}

#uni-mascot.mascot-appearing .mascot-bird {
  animation: mascot-first-appear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── Z-INDEX: OVERLAY ARKALARI ──────────────────────────────────
 *
 * Aşağıdaki durumlarda maskot ilgili elemanların ARKASINA geçer:
 *
 * 1. body.popup-open        → Ana üniversite popup'ı  (z: 999–999999)
 * 2. body.search-active     → Search popup            (z: 1001–1002)
 * 3. #uni-mascot.mascot-behind → Canlı destek penceresi (z: 901)
 *                               Topluluk odası popup   (z: 1000)
 *    (maskot.js içindeki MutationObserver bu class'ı ekler/kaldırır)
 * ─────────────────────────────────────────────────────────────── */

/* Ana popup açık → tamamen arkaya */
body.popup-open #uni-mascot {
  z-index: 50;
}

/* Arama aktif → search-popup (1002) ve overlay (998) arkasında */
body.search-active #uni-mascot {
  z-index: 50;
}

/* Canlı destek / topluluk odası açık → arkaya */
#uni-mascot.mascot-behind {
  z-index: 50;
}

/* ── MOBİL AYARLAR ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .mascot-speech {
    font-size: 11.5px;
    max-width: 170px;
    padding: 8px 12px;
  }

  /* Mobilde kuş biraz küçülsün */
  #uni-mascot .mascot-bird svg {
    width: 60px;
    height: 70px;
  }
}

/* ── ERİŞİLEBİLİRLİK ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .mascot-bird {
    animation: none !important;
  }
  #uni-mascot.mascot-leave .mascot-bird,
  #uni-mascot.mascot-enter .mascot-bird,
  #uni-mascot.mascot-appearing .mascot-bird {
    animation: none !important;
  }
  .mascot-speech {
    transition: opacity 0.1s !important;
    transform: translateX(-50%) !important;
  }
}