/* Chat Bubble */
#iaa-chat-bubble {
    position: fixed; bottom: 24px; right: 24px; z-index: 99998;
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff; display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 4px 20px rgba(5,150,105,.4);
    transition: transform .2s, box-shadow .2s;
}
#iaa-chat-bubble:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(5,150,105,.5); }
#iaa-chat-bubble.has-window { display: none; }

/* Chat Window */
#iaa-chat-window {
    position: fixed; bottom: 24px; right: 24px; z-index: 99999;
    width: 380px; height: 520px;
    background: #fff; border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.15);
    display: flex; flex-direction: column;
    overflow: hidden; border: 1px solid #e2e8f0;
}

/* Header */
#iaa-chat-header {
    background: linear-gradient(135deg, #059669, #047857);
    color: #fff; padding: 14px 16px;
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
#iaa-chat-close {
    background: none; border: none; color: rgba(255,255,255,.7);
    font-size: 24px; cursor: pointer; line-height: 1; padding: 0;
}
#iaa-chat-close:hover { color: #fff; }

/* Messages */
#iaa-chat-messages {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 10px;
    background: #f8fafc;
}
.iaa-msg { max-width: 85%; }
.iaa-msg-user { align-self: flex-end; }
.iaa-msg-assistant { align-self: flex-start; }
.iaa-msg-content {
    padding: 10px 14px; border-radius: 12px;
    font-size: 13px; line-height: 1.5; word-wrap: break-word;
    white-space: pre-wrap;
}
.iaa-msg-user .iaa-msg-content {
    background: #059669; color: #fff;
    border-bottom-right-radius: 4px;
}
.iaa-msg-assistant .iaa-msg-content {
    background: #fff; color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}
.iaa-msg-time {
    font-size: 10px; color: #94a3b8; margin-top: 2px;
    text-align: right;
}
.iaa-msg-assistant .iaa-msg-time { text-align: left; }

/* Typing indicator */
.iaa-typing .iaa-msg-content {
    display: flex; gap: 4px; align-items: center; padding: 12px 18px;
}
.iaa-typing-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #94a3b8;
    animation: iaaBounce .6s infinite alternate;
}
.iaa-typing-dot:nth-child(2) { animation-delay: .2s; }
.iaa-typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes iaaBounce { to { opacity: .3; transform: translateY(-4px); } }

/* Limit bar */
#iaa-chat-limit {
    padding: 6px 16px; background: #fef3c7; text-align: center;
    font-size: 11px; color: #92400e; flex-shrink: 0;
}

/* Input area */
#iaa-chat-input-area {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 12px; border-top: 1px solid #e2e8f0;
    background: #fff; flex-shrink: 0;
}
#iaa-chat-input {
    flex: 1; border: 1px solid #e2e8f0; border-radius: 10px;
    padding: 10px 12px; font-size: 13px; resize: none;
    max-height: 80px; font-family: inherit; outline: none;
    transition: border-color .15s;
}
#iaa-chat-input:focus { border-color: #10b981; }
#iaa-chat-send {
    width: 36px; height: 36px; border-radius: 50%;
    background: #059669; color: #fff; border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0; transition: background .15s;
}
#iaa-chat-send:hover { background: #047857; }
#iaa-chat-send:disabled { background: #94a3b8; cursor: not-allowed; }

/* Mobile */
@media (max-width: 500px) {
    #iaa-chat-window { width: calc(100% - 16px); height: calc(100% - 16px); bottom: 8px; right: 8px; border-radius: 12px; }
}
