/* IBG Chat Widget Styles */

#ibg-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* Toggle Button */
#ibg-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #2E7D32;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: background-color 0.2s ease, transform 0.2s ease;
    position: absolute;
    bottom: 0;
    right: 0;
}

#ibg-chat-toggle:hover {
    background: #1B5E20;
    transform: scale(1.05);
}

#ibg-chat-toggle:focus {
    outline: 2px solid #81C784;
    outline-offset: 2px;
}

/* Chat Window */
#ibg-chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 370px;
    max-height: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
#ibg-chat-header {
    background: #2E7D32;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

#ibg-chat-header-info {
    display: flex;
    flex-direction: column;
}

#ibg-chat-header-title {
    font-size: 16px;
    font-weight: 600;
}

#ibg-chat-header-status {
    font-size: 12px;
    opacity: 0.85;
}

#ibg-chat-header-status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #81C784;
    margin-right: 5px;
    vertical-align: middle;
}

#ibg-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

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

/* Messages Area */
#ibg-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 300px;
    max-height: 360px;
    background: #f5f5f5;
}

.ibg-chat-message {
    margin-bottom: 12px;
    display: flex;
    animation: ibg-chat-fade-in 0.3s ease;
}

@keyframes ibg-chat-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ibg-chat-message-bot {
    justify-content: flex-start;
}

.ibg-chat-message-user {
    justify-content: flex-end;
}

.ibg-chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.ibg-chat-message-bot .ibg-chat-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.ibg-chat-message-user .ibg-chat-bubble {
    background: #2E7D32;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ibg-chat-bubble a {
    color: inherit;
    text-decoration: underline;
}

.ibg-chat-message-user .ibg-chat-bubble a {
    color: #C8E6C9;
}

/* Typing Indicator */
.ibg-chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    max-width: 70px;
}

.ibg-chat-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: ibg-chat-typing-bounce 1.4s infinite;
}

.ibg-chat-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ibg-chat-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes ibg-chat-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Input Area */
#ibg-chat-input-area {
    display: flex;
    align-items: flex-end;
    padding: 12px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
    flex-shrink: 0;
}

#ibg-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 80px;
    line-height: 1.4;
    transition: border-color 0.2s;
}

#ibg-chat-input:focus {
    border-color: #2E7D32;
}

#ibg-chat-input::placeholder {
    color: #999;
}

#ibg-chat-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #2E7D32;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    flex-shrink: 0;
    transition: background-color 0.2s;
}

#ibg-chat-send:hover {
    background: #1B5E20;
}

#ibg-chat-send:disabled {
    background: #a5d6a7;
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #ibg-chat-window {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 100px);
        bottom: 70px;
        right: -10px;
        border-radius: 12px;
    }

    #ibg-chat-messages {
        min-height: 250px;
        max-height: calc(100vh - 250px);
    }

    #ibg-chat-widget {
        bottom: 10px;
        right: 10px;
    }
}
