/* =============================================
   Mascot Buddy Styles for mimBo
   ============================================= */

#mascotContainer {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    transition: all 0.3s ease;
    pointer-events: auto;
}

/* Hide on mobile */
@media (max-width: 767px) {
    #mascotContainer {
        display: none !important;
    }
}

/* Closed state - hide speech bubble */
#mascotContainer.closed #mascotBubbleWrapper {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    max-height: 0;
    overflow: hidden;
}

/* Open state - show speech bubble */
#mascotContainer.open #mascotBubbleWrapper {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    max-height: 500px;
}

/* Character container */
#mascotCharacter {
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

/* Mascot image - BIGGER */
#mascotImage {
    width: 240px;
    height: 240px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25));
    transition: all 0.2s ease;
}

/* Talking animation */
#mascotImage.talking {
    animation: mascotTalk 0.3s ease-in-out infinite;
}

@keyframes mascotTalk {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-4px) scale(1.02);
    }
}

/* Hover effect on character */
#mascotCharacter:hover #mascotImage {
    transform: scale(1.05);
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.3));
}

#mascotCharacter:active #mascotImage {
    transform: scale(0.98);
}

/* Speech bubble wrapper */
#mascotBubbleWrapper {
    position: relative;
    max-width: 350px;
    transition: all 0.3s ease;
}

/* Speech bubble container - match dropdown style */
#mascotSpeechBubbleContainer {
    position: relative;
    background: var(--white, #ffffff);
    border: none;
    border-radius: 20px;
    box-shadow: 0 10px 40px var(--soft-shadow, rgba(0, 0, 0, 0.15));
}

/* Close button (X) */
#mascotCloseBtn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(114, 137, 218, 0.1);
    color: var(--text-primary, #2c2f33);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    padding: 0;
}

#mascotCloseBtn:hover {
    background: #ff4444;
    color: white;
    transform: scale(1.1);
}

#mascotCloseBtn:active {
    transform: scale(0.95);
}

/* Speech bubble content */
#mascotSpeechBubble {
    padding: 15px 18px;
    padding-right: 40px; /* Space for close button */
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary, #2c2f33);
    min-height: 50px;
    word-wrap: break-word;
}

/* Speech bubble tail */
#mascotSpeechBubbleContainer::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 30px;
    width: 16px;
    height: 16px;
    background: var(--white, #ffffff);
    transform: rotate(45deg);
    box-shadow: 2px 2px 8px var(--soft-shadow, rgba(0, 0, 0, 0.1));
    z-index: -1;
}

/* Links in speech bubble */
#mascotSpeechBubble a {
    color: var(--primary-color, #7289da);
    text-decoration: underline;
    font-weight: 600;
}

#mascotSpeechBubble a:hover {
    color: var(--primary-hover, #5b6eae);
}

/* Code in speech bubble */
#mascotSpeechBubble code {
    background: rgba(114, 137, 218, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--primary-color, #7289da);
}

/* Navigation controls */
#mascotNavigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    gap: 10px;
}

/* Navigation buttons - match site button style */
#mascotPrevBtn,
#mascotNextBtn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--white, #ffffff);
    color: var(--dark-text, #2c2f33);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    box-shadow: 0 4px 15px var(--soft-shadow, rgba(0, 0, 0, 0.1));
    outline: none;
}

#mascotPrevBtn svg,
#mascotNextBtn svg {
    display: block;
    flex-shrink: 0;
}

#mascotPrevBtn:hover:not(:disabled),
#mascotNextBtn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 6px 20px var(--soft-shadow, rgba(0, 0, 0, 0.15));
}

#mascotPrevBtn:active:not(:disabled),
#mascotNextBtn:active:not(:disabled) {
    transform: scale(0.95);
}

#mascotPrevBtn:disabled,
#mascotNextBtn:disabled {
    cursor: not-allowed;
    opacity: 0.3;
    box-shadow: 0 2px 8px var(--soft-shadow, rgba(0, 0, 0, 0.05));
}

#mascotPrevBtn:disabled svg,
#mascotNextBtn:disabled svg {
    opacity: 0.5;
}

#mascotPrevBtn:focus,
#mascotNextBtn:focus {
    outline: none;
}

/* Counter */
#mascotCounter {
    font-size: 13px;
    color: var(--text-secondary, #666);
    font-weight: 600;
    flex: 1;
    text-align: center;
    user-select: none;
}

/* Dark mode support */
body.dark-mode #mascotSpeechBubbleContainer {
    background: var(--dark-bg, #2c2f33);
}

body.dark-mode #mascotSpeechBubbleContainer::after {
    background: var(--dark-bg, #2c2f33);
}

body.dark-mode #mascotSpeechBubble {
    color: #ffffff;
}

body.dark-mode #mascotCloseBtn {
    background: rgba(114, 137, 218, 0.2);
    color: #ffffff;
}

body.dark-mode #mascotPrevBtn,
body.dark-mode #mascotNextBtn {
    background: var(--dark-bg, #2c2f33);
    color: #ffffff;
}

body.dark-mode #mascotCounter {
    color: #aaa;
}

/* Tablet adjustments */
@media (max-width: 1024px) {
    #mascotContainer {
        bottom: 15px;
        left: 15px;
    }

    #mascotImage {
        width: 160px;
        height: 160px;
    }

    #mascotBubbleWrapper {
        max-width: 280px;
    }

    #mascotSpeechBubble {
        font-size: 13px;
        padding: 12px 15px;
        padding-right: 38px;
    }
}

/* Animation when mascot appears */
@keyframes mascotAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#mascotContainer {
    animation: mascotAppear 0.5s ease-out;
}

/* Pulse animation for attention (when first appears) */
@keyframes mascotPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

#mascotCharacter {
    animation: mascotPulse 2s ease-in-out 3;
}
