/* === شيتافوكس - المساعد التعليمي === */
#cheetahfox-container {
    position: fixed;
    bottom: 0px;
    right: 0px;
    z-index: 9999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#cheetahfox {
    width: 80px;
    height: 100px;
    cursor: grab;
    transition: transform 0.3s ease;
    pointer-events: auto;
    position: relative;
    user-select: none;
    -webkit-user-drag: none;
}

/* --- START: NEW STYLE FOR DRAGGING STATE --- */
#cheetahfox.dragging {
    cursor: grabbing;
    transform: scale(1.05);
}
/* --- END: NEW STYLE FOR DRAGGING STATE --- */

#cheetahfox:hover {
    transform: scale(1.1) rotate(5deg);
}

#cheetahfox img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.2));
    pointer-events: none;
}

.cheetahfox-name-tag {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #8e44ad, #3498db);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    display: none;
}

#cheetahfox-speech-bubble {
    background: linear-gradient(135deg, #8e44ad, #3498db);
    color: white;
    padding: 15px 20px;
    border-radius: 25px;
    font-size: 16px;
    max-width: 280px;
    margin-top: 30px;
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.4s ease-in-out;
    pointer-events: none;
    text-align: center;
    font-weight: bold;
    border: 3px solid #fff;
    position: relative;
    display: none;
}

#cheetahfox-speech-bubble::before,
.bubble-tail {
    content: '';
    position: absolute;
    bottom: -12px;
    right: 60px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #8e44ad;
    display: none;
}

.hidden {
    display: none !important;
}

/* تأثيرات الحركة */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

#cheetahfox.bounce { animation: bounce 0.8s ease-in-out; }
#cheetahfox.talking img { animation: wiggle 1.2s infinite; }
#cheetahfox.happy { animation: pulse 0.5s ease-in-out 3; }
#cheetahfox.excited { animation: float 1s ease-in-out infinite; }

/* عناصر عائمة للخلفية */
.floating-star, .floating-heart {
    position: fixed;
    width: 20px;
    height: 20px;
    background-size: contain;
    z-index: 9990;
    animation: float 3s ease-in-out infinite;
    pointer-events: none;
}

/* تأثيرات للأجهزة المحمولة */
@media (max-width: 768px) {
    #cheetahfox { width: 100px; height: 120px; }
    #cheetahfox-speech-bubble { max-width: 220px; font-size: 14px; padding: 12px 16px; }
    .cheetahfox-name-tag { font-size: 12px; padding: 3px 10px; bottom: -22px; }
}

/* --- START: CRITICAL FIX --- */
/* هذه القاعدة تنطبق على جميع الصفحات بما في ذلك exams و learning */
@media (max-width: 768px) and (orientation: landscape) {
    #cheetahfox-container {
        bottom: 10px;
        right: 10px;
        transform: scale(0.8);
        transform-origin: bottom right;
    }
    
    #cheetahfox { width: 80px; height: 100px; }
    #cheetahfox-speech-bubble { max-width: 200px; font-size: 12px; padding: 10px 14px; margin-bottom: 5px; }
    .cheetahfox-name-tag { font-size: 11px; padding: 2px 8px; bottom: -18px; }
}
/* --- END: CRITICAL FIX --- */

/* تحسينات إضافية للوصول */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

[aria-live="polite"] {
    position: relative;
    z-index: 10000;
}