/* Global GiAI Floating Chat Widget */

/* Trigger Button */
#giai-global-chat-btn {
    position: fixed;
    bottom: 25px;
    right: 85px; /* next to the back to top button */
    height: 44px;
    z-index: 9999;
    background-color: #008c38;
    color: white;
    border: none;
    border-radius: 22px;
    padding: 0 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#giai-global-chat-btn:hover {
    background-color: #006d2c;
    transform: translateY(-2px);
}

#giai-global-chat-btn .fa-comment {
    font-size: 18px;
}

/* Chat Widget Container */
#giai-global-chat-widget {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 350px;
    max-width: 90vw;
    height: 500px;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    border: 1px solid rgba(0, 128, 0, 0.1);
}

#giai-global-chat-widget.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Header */
.giai-chat-header {
    background: linear-gradient(135deg, #2e8b57, #1f633d);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.giai-chat-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.giai-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.giai-chat-close:hover {
    transform: rotate(90deg);
}

/* Messages Area */
.giai-chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9f9f9;
}

.giai-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.giai-msg-user {
    align-self: flex-end;
    background-color: #2e8b57;
    color: white;
    border-bottom-right-radius: 4px;
}

.giai-msg-assistant {
    align-self: flex-start;
    background-color: #e5e5ea;
    color: #333;
    border-bottom-left-radius: 4px;
}

/* Composer */
.giai-chat-composer {
    display: flex;
    padding: 12px;
    background: white;
    border-top: 1px solid #eee;
    gap: 8px;
}

.giai-chat-composer textarea {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    resize: none;
    outline: none;
    font-family: inherit;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    transition: border-color 0.2s ease;
}

.giai-chat-composer textarea:focus {
    border-color: #2e8b57;
}

.giai-chat-send {
    background: #2e8b57;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.giai-chat-send:hover {
    background: #246b43;
}

/* Loading indicator */
.giai-chat-typing {
    display: none;
    align-self: flex-start;
    background-color: #e5e5ea;
    padding: 10px 14px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    font-size: 12px;
    color: #666;
}

.giai-chat-typing.active {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dot {
    width: 6px;
    height: 6px;
    background: #888;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}
