/* Hammy AI Chatbot v2.0 - Glassar Projects */

/* ===== Chat Window ===== */
#hammy-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#hammy-chat-window {
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

#hammy-chat-window.hammy-hidden {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
    height: 0;
}

/* ===== Header ===== */
#hammy-chat-header {
    background: linear-gradient(135deg, #f79520 0%, #e8850f 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.hammy-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hammy-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    object-fit: cover;
}

.hammy-header-name {
    display: block;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.3px;
}

.hammy-header-status {
    display: block;
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

#hammy-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}

#hammy-close-btn:hover {
    background: rgba(255,255,255,0.35);
}

/* ===== Messages Area ===== */
#hammy-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

.hammy-message {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: hammyFadeIn 0.3s ease;
}

@keyframes hammyFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.hammy-message.hammy-bot {
    align-self: flex-start;
}

.hammy-message.hammy-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.hammy-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    margin-top: 4px;
}

.hammy-message.hammy-user .hammy-msg-avatar {
    display: none;
}

.hammy-msg-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.hammy-bot .hammy-msg-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.hammy-user .hammy-msg-bubble {
    background: linear-gradient(135deg, #f79520, #e8850f);
    color: white;
    border-bottom-right-radius: 6px;
}

.hammy-msg-bubble strong {
    font-weight: 600;
}

/* Typing indicator */
.hammy-typing {
    display: flex;
    gap: 4px;
    padding: 12px 20px;
}

.hammy-typing span {
    width: 8px;
    height: 8px;
    background: #ccc;
    border-radius: 50%;
    animation: hammyBounce 1.4s infinite ease-in-out;
}

.hammy-typing span:nth-child(1) { animation-delay: -0.32s; }
.hammy-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes hammyBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ===== Quick Action Buttons ===== */
#hammy-quick-actions {
    padding: 8px 16px 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.hammy-quick-btn {
    background: white;
    border: 1.5px solid #f79520;
    color: #e8850f;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.hammy-quick-btn:hover {
    background: #f79520;
    color: white;
    transform: translateY(-1px);
}

/* ===== Input Area ===== */
#hammy-chat-input-area {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    background: white;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

#hammy-chat-input {
    flex: 1;
    border: 1.5px solid #e0e0e0;
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

#hammy-chat-input:focus {
    border-color: #f79520;
}

#hammy-chat-input::placeholder {
    color: #aaa;
}

#hammy-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f79520, #e8850f);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

#hammy-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(247, 149, 32, 0.4);
}

#hammy-send-btn:active {
    transform: scale(0.95);
}

/* ===== Mascot Trigger ===== */
#hammy-mascot-trigger {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    margin-top: 12px;
}

#hammy-mascot-img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid #f79520;
    box-shadow: 0 4px 15px rgba(247, 149, 32, 0.35);
    transition: transform 0.3s, box-shadow 0.3s;
    object-fit: cover;
    background: #fff;
}

#hammy-mascot-img:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(247, 149, 32, 0.5);
}

/* Notification badge */
#hammy-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    animation: hammyPulse 2s infinite;
}

@keyframes hammyPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Speech bubble */
#hammy-speech-bubble {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: white;
    border-radius: 16px;
    padding: 12px 36px 12px 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    font-size: 13px;
    line-height: 1.4;
    color: #333;
    white-space: nowrap;
    animation: hammySlideUp 0.4s ease;
    min-width: 180px;
}

#hammy-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 30px;
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
    box-shadow: 3px 3px 5px rgba(0,0,0,0.05);
}

@keyframes hammySlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#hammy-bubble-close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
}

#hammy-bubble-close:hover {
    color: #333;
}

/* ===== Hide original Hammy elements ===== */
#glassar-mascot-btn,
#glassar-sticky-quote,
.glassar-mascot-notification {
    display: none !important;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    #hammy-chatbot-container {
        bottom: 10px;
        right: 10px;
    }
    
    #hammy-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        border-radius: 16px;
    }
    
    #hammy-mascot-img {
        width: 60px;
        height: 60px;
    }
    
    #hammy-speech-bubble {
        display: none;
    }
    
    .hammy-quick-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
}
