/* AIIG Chat Widget */
.aiig-chat-container {
    max-width: 680px;
    margin: 0 auto;
    border: 1px solid #ddd;
    border-radius: 12px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    background: #fff;
}

.aiig-chat-messages {
    min-height: 300px;
    max-height: 520px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.aiig-message {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    animation: aiig-fadein 0.25s ease;
}

@keyframes aiig-fadein {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.aiig-message-assistant { align-self: flex-start; }
.aiig-message-user      { align-self: flex-end; }

.aiig-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.55;
    font-size: 15px;
    white-space: pre-wrap;
    word-break: break-word;
}

.aiig-message-assistant .aiig-bubble {
    background: #f0f4ff;
    border-bottom-left-radius: 4px;
    color: #1a1a2e;
}

.aiig-message-user .aiig-bubble {
    background: #2271b1;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.aiig-message-label {
    font-size: 11px;
    color: #888;
    margin-bottom: 3px;
    padding: 0 4px;
}
.aiig-message-user .aiig-message-label { text-align: right; }

/* Typing indicator */
.aiig-typing {
    align-self: flex-start;
}
.aiig-typing-bubble {
    background: #f0f4ff;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    padding: 12px 16px;
    display: inline-flex;
    gap: 5px;
    align-items: center;
}
.aiig-typing-bubble span {
    width: 7px;
    height: 7px;
    background: #2271b1;
    border-radius: 50%;
    display: inline-block;
    animation: aiig-bounce 1.2s ease infinite;
}
.aiig-typing-bubble span:nth-child(2) { animation-delay: 0.15s; }
.aiig-typing-bubble span:nth-child(3) { animation-delay: 0.30s; }
@keyframes aiig-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-6px); }
}

/* Loading */
.aiig-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
}
.aiig-dots span {
    width: 8px;
    height: 8px;
    margin: 0 3px;
    background: #bbb;
    border-radius: 50%;
    display: inline-block;
    animation: aiig-bounce 1.2s ease infinite;
}
.aiig-dots span:nth-child(2) { animation-delay: 0.15s; }
.aiig-dots span:nth-child(3) { animation-delay: 0.30s; }

/* Input area */
.aiig-chat-input-area {
    display: flex;
    border-top: 1px solid #eee;
    padding: 12px;
    gap: 8px;
    align-items: flex-end;
    background: #fafafa;
}

.aiig-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    line-height: 1.5;
    transition: border-color 0.2s;
    min-height: 44px;
    max-height: 120px;
    overflow-y: auto;
}
.aiig-chat-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34,113,177,0.15);
}

.aiig-chat-send {
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 15px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: background 0.2s;
    white-space: nowrap;
    height: 44px;
}
.aiig-chat-send:hover  { background: #135e96; }
.aiig-chat-send:disabled { background: #aaa; cursor: not-allowed; }

.aiig-chat-ended {
    text-align: center;
    padding: 20px;
    color: #555;
    border-top: 1px solid #eee;
    background: #f9f9f9;
    font-style: italic;
}
