/*
 * Lila maskotu — sağ alttaki orb'un yerine robot karakter.
 * Görsel iki katman: gövde (lila_body.webp) + sağ kol (lila_arm.webp).
 * Kol omuzdan döner (el sallama), gövde yavaşça süzülür.
 * Kaynak: static/img/lila/lila.png (1275×1234, şeffaf). Kol kutusu ve omuz
 * pivotu bu kaynaktan hesaplandı; görsel değişirse yüzdeler yeniden ölçülmeli.
 * lila_orb.css + lila_skin_calm.css'teki orb kurallarını #lila-orb.lila-mascot ile ezer.
 */

#lila-orb.lila-mascot {
    width: 64px;
    height: 75px; /* 240×282 oranı */
    right: 16px !important;
    bottom: 24px !important; /* Geri bildirim tetiği kaldırıldı, köşe boş */
    border-radius: 14px;
    background: none !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    animation: none;
    transform: none;
}

#lila-orb.lila-mascot.hidden {
    display: none;
}

#lila-orb.lila-mascot::before,
#lila-orb.lila-mascot::after {
    content: none;
    display: none;
}

#lila-orb.lila-mascot:hover,
#lila-orb.lila-mascot:active {
    transform: none;
    box-shadow: none !important;
    animation: none;
}

#lila-orb.lila-mascot:focus-visible {
    outline: 2px solid #8b5cf6;
    outline-offset: 4px;
}

.lila-mascot-figure {
    position: absolute;
    inset: 0;
    animation: lila-mascot-float 3.6s ease-in-out infinite;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

#lila-orb.lila-mascot:hover .lila-mascot-figure {
    transform: scale(1.06);
}

#lila-orb.lila-mascot:active .lila-mascot-figure {
    transform: scale(0.94);
    transition-duration: 0.1s;
}

/* critical_head.css tüm img'lere #f8f9fa yükleme zemini veriyor — şeffaf PNG'de kutu olarak görünür */
.lila-mascot-body,
.lila-mascot-arm {
    background: none;
}

.lila-mascot-body {
    display: block;
    width: 100%;
    height: 100%;
    user-select: none;
    -webkit-user-drag: none;
}

.lila-mascot-arm {
    position: absolute;
    left: 73.75%;
    top: 57.8%;
    width: 24.58%;
    height: 34.04%;
    transform-origin: 11.7% 9.6%; /* omuz eklemi */
    user-select: none;
    -webkit-user-drag: none;
}

#lila-orb.lila-mascot.is-waving .lila-mascot-arm {
    animation: lila-mascot-wave 2.4s cubic-bezier(0.45, 0, 0.35, 1);
}

/* Zemin gölgesi — süzülmeyle birlikte daralır */
.lila-mascot-shadow {
    position: absolute;
    left: 22%;
    right: 22%;
    bottom: -6px;
    height: 7px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(76, 29, 149, 0.22) 0%, rgba(76, 29, 149, 0) 70%);
    animation: lila-mascot-shadow 3.6s ease-in-out infinite;
    pointer-events: none;
}

/* Düşünme / yanıt parlaması: alev orb'unun box-shadow halkası yerine gövde nabzı */
#lila-orb.lila-mascot.lila-thinking,
#lila-orb.lila-mascot.lila-flash {
    animation: none !important;
    filter: none !important;
}

#lila-orb.lila-mascot.lila-thinking .lila-mascot-figure {
    animation: lila-mascot-think 1.1s ease-in-out infinite;
}

@keyframes lila-mascot-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes lila-mascot-shadow {
    0%, 100% { transform: scaleX(1); opacity: 1; }
    50% { transform: scaleX(0.82); opacity: 0.7; }
}

@keyframes lila-mascot-think {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.04); }
}

/* Negatif açı = saat yönünün tersi → kol yukarı kalkar */
@keyframes lila-mascot-wave {
    0% { transform: rotate(0deg); }
    16% { transform: rotate(-104deg); }
    27% { transform: rotate(-82deg); }
    38% { transform: rotate(-108deg); }
    49% { transform: rotate(-82deg); }
    60% { transform: rotate(-104deg); }
    70% { transform: rotate(-92deg); }
    86%, 100% { transform: rotate(0deg); }
}

/* ─── Karşılama balonu ─────────────────────────────────────── */
.lila-mascot-bubble {
    position: fixed;
    right: 90px;
    bottom: 58px;
    z-index: var(--lila-z-orb, 1035);
    display: flex;
    align-items: flex-start;
    gap: 2px;
    max-width: 230px;
    padding: 10px 6px 10px 14px;
    background: #ffffff;
    border: 1px solid rgba(139, 92, 246, 0.22);
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 10px 30px rgba(49, 46, 129, 0.14), 0 2px 6px rgba(49, 46, 129, 0.06);
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.lila-mascot-bubble[hidden] {
    display: none;
}

.lila-mascot-bubble.is-visible {
    opacity: 1;
    transform: none;
}

/* Kuyruk — robota doğru */
.lila-mascot-bubble::after {
    content: '';
    position: absolute;
    right: -6px;
    bottom: 10px;
    width: 11px;
    height: 11px;
    background: #ffffff;
    border-right: 1px solid rgba(139, 92, 246, 0.22);
    border-bottom: 1px solid rgba(139, 92, 246, 0.22);
    transform: rotate(-45deg);
}

.lila-mascot-bubble-text {
    flex: 1;
    padding: 0;
    border: 0;
    background: none;
    color: #312e81;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
}

.lila-mascot-bubble-text span {
    display: block;
    margin-top: 2px;
    color: #6b7280;
    font-size: 12.5px;
    font-weight: 500;
}

.lila-mascot-bubble-close {
    flex: none;
    width: 22px;
    height: 22px;
    margin-top: -4px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: #9ca3af;
    font-size: 18px;
    line-height: 22px;
    cursor: pointer;
}

.lila-mascot-bubble-close:hover {
    background: #f3f4f6;
    color: #4b5563;
}

#lila-orb.hidden ~ .lila-mascot-bubble,
body.lila-panel-open .lila-mascot-bubble {
    display: none;
}

/* ─── Mobil/tablet: bottom_nav.css <992px'te orb'u gizliyor (Lila alt menüde) — balon da çıkmasın ── */
@media (max-width: 991.98px) {
    .lila-mascot-bubble {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lila-mascot-figure,
    .lila-mascot-shadow,
    #lila-orb.lila-mascot.is-waving .lila-mascot-arm,
    #lila-orb.lila-mascot.lila-thinking .lila-mascot-figure {
        animation: none;
    }

    .lila-mascot-bubble {
        transition: none;
    }
}
