/* =============================================
   BC Storage Buddy Mascot - Chatbot Styles
   Brand Colors: #083350 (Navy) | #cb292b (Red)
   ============================================= */

/* --- Main Container --- */
#buddy-mascot-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --- Launcher (Buddy image + notification dot) --- */
#buddy-launcher {
    position: relative;
    cursor: pointer;
    display: inline-block;
}

#buddy-mascot-img {
    width: 110px;
    height: auto;
    display: block;
    filter: drop-shadow(0px 4px 8px rgba(0, 0, 0, 0.25));
    transition: transform 0.2s ease, filter 0.2s ease;
}

#buddy-launcher:hover #buddy-mascot-img {
    transform: scale(1.08) translateY(-3px);
    filter: drop-shadow(0px 6px 12px rgba(0, 0, 0, 0.3));
}

/* Notification dot — pulses to draw attention */
#buddy-notification-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    background: #cb292b;
    border-radius: 50%;
    border: 2px solid #fff;
    animation: buddy-pulse 2s infinite;
}

#buddy-notification-dot.hidden {
    display: none;
}

@keyframes buddy-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(203, 41, 43, 0.5); }
    70%  { box-shadow: 0 0 0 8px rgba(203, 41, 43, 0); }
    100% { box-shadow: 0 0 0 0 rgba(203, 41, 43, 0); }
}

/* --- Chat Window --- */
#buddy-chat-window {
    width: 340px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 12px;
    animation: buddy-slide-up 0.25s ease;
    border: 1px solid rgba(8, 51, 80, 0.15);
}

@keyframes buddy-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Header --- */
#buddy-chat-header {
    background: #083350;
    color: #ffffff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#buddy-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

#buddy-avatar-small {
    width: 36px;
    height: 36px;
    background: #cb292b;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
}

#buddy-chat-header strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

#buddy-status {
    display: block;
    font-size: 11px;
    opacity: 0.75;
    font-weight: 400;
}

#buddy-close-chat {
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
    padding: 2px 4px;
}

#buddy-close-chat:hover {
    opacity: 1;
}

/* --- Message Area --- */
#buddy-chat-messages {
    height: 280px;
    overflow-y: auto;
    padding: 16px;
    background: #f7f9fc;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

#buddy-chat-messages::-webkit-scrollbar { width: 4px; }
#buddy-chat-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* --- Messages --- */
.buddy-message {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    max-width: 88%;
    line-height: 1.5;
    word-wrap: break-word;
}

.buddy-ai {
    background: #ffffff;
    color: #083350;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid rgba(8,51,80,0.08);
}

.buddy-user {
    background: #083350;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* --- Typing Indicator --- */
#buddy-typing-indicator {
    padding: 10px 20px 4px;
    background: #f7f9fc;
    display: flex;
    align-items: center;
    gap: 4px;
}

#buddy-typing-indicator span {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #083350;
    border-radius: 50%;
    opacity: 0.5;
    animation: buddy-typing 1.2s infinite;
}

#buddy-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
#buddy-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes buddy-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%            { transform: translateY(-5px); opacity: 1; }
}

/* --- Input Area --- */
#buddy-chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #ffffff;
    border-top: 1px solid #eaeef2;
}

#buddy-user-input {
    flex: 1;
    padding: 9px 14px;
    border: 1.5px solid #d0d7de;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    color: #083350;
    transition: border-color 0.2s;
    background: #f7f9fc;
}

#buddy-user-input:focus {
    border-color: #083350;
    background: #fff;
}

#buddy-send-btn {
    background: #cb292b;
    color: #ffffff;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}

#buddy-send-btn:hover {
    background: #a82022;
    transform: scale(1.05);
}

#buddy-send-btn:active {
    transform: scale(0.97);
}

/* --- Quick-Reply Buttons --- */
#buddy-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
}

.buddy-quick-reply {
    background: #ffffff;
    color: #083350;
    border: 1.5px solid #083350;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-family: inherit;
    line-height: 1.3;
}

.buddy-quick-reply:hover {
    background: #083350;
    color: #ffffff;
}

/* --- Disclaimer --- */
#buddy-disclaimer {
    padding: 6px 16px 8px;
    font-size: 10px;
    color: #8b96a2;
    text-align: center;
    background: #ffffff;
    border-top: 1px solid #eaeef2;
    line-height: 1.4;
}

/* --- Speech Bubble --- */
#buddy-speech-bubble {
    position: relative;
    background: #ffffff;
    color: #083350;
    padding: 10px 14px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    border: 1px solid rgba(8, 51, 80, 0.12);
    white-space: nowrap;
}

#buddy-speech-bubble.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#buddy-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 24px;
    width: 12px;
    height: 12px;
    background: #ffffff;
    transform: rotate(45deg);
    border-right: 1px solid rgba(8, 51, 80, 0.12);
    border-bottom: 1px solid rgba(8, 51, 80, 0.12);
}

#buddy-bubble-close {
    cursor: pointer;
    font-size: 16px;
    opacity: 0.5;
    line-height: 1;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

#buddy-bubble-close:hover {
    opacity: 1;
}

/* --- Minimize Dot --- */
#buddy-minimize-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    background: #083350;
    border-radius: 50%;
    border: 2px solid #fff;
}

#buddy-minimize-dot.hidden {
    display: none;
}

/* --- Mobile --- */
@media (max-width: 600px) {
    #buddy-mascot-container {
        bottom: 12px;
        left: 12px;
    }

    #buddy-chat-window {
        width: calc(100vw - 24px);
        max-width: 340px;
    }

    #buddy-mascot-img {
        width: 88px;
    }

    #buddy-speech-bubble {
        font-size: 12px;
        padding: 8px 12px;
        white-space: normal;
    }

    .buddy-quick-reply {
        font-size: 11px;
        padding: 5px 10px;
    }

    #buddy-disclaimer {
        font-size: 9px;
    }
}
