/* =====================================================
   4TH AI AGENT - CHAT WIDGET STYLES (OHLALA MUTUELLE BRANDING)
   ===================================================== */
#fourth-ai-widget {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
}

#fourth-ai-widget * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Floating Trigger Button */
#chatButton {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, #FF5A43 0%, #FF8A65 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 999px;
    padding: 13px 22px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255, 90, 67, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 99999;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

#chatButton:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 28px rgba(255, 90, 67, 0.55);
}

#chatIcon {
    font-size: 15px;
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

#chatButton:hover #chatIcon {
    transform: translateX(3px);
}

#chatButtonText {
    white-space: nowrap;
}

/* Chat Window Container */
#chatContainer {
    display: none;
    position: fixed;
    bottom: 86px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 110px);
    background: #0F172A;
    border: 1px solid #334155;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    flex-direction: column;
    z-index: 99999;
    animation: chatSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes chatSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
#chatHeader {
    background: linear-gradient(135deg, #FF5A43 0%, #FF8A65 100%);
    color: #FFFFFF;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.chat-header-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 15px;
    cursor: pointer;
    line-height: 1;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.2s, transform 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.08);
}

.chat-header-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    border-radius: 6px;
    transition: background 0.2s, transform 0.2s;
}

.chat-header-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.08);
}

/* Window message list */
#chatWindow {
    flex: 1;
    padding: 16px;
    background: #0F172A;
    overflow-y: auto;
    font-size: 13.5px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

#chatWindow::-webkit-scrollbar {
    width: 6px;
}
#chatWindow::-webkit-scrollbar-track {
    background: #0F172A;
}
#chatWindow::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

.bot-welcome-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 14px;
    font-size: 13.5px;
    line-height: 1.55;
    color: #E2E8F0;
}

#chatWindow .user {
    align-self: flex-end;
    background: linear-gradient(135deg, #FF5A43 0%, #E04832 100%);
    color: #FFFFFF;
    padding: 10px 16px;
    border-radius: 16px 16px 2px 16px;
    max-width: 84%;
    word-wrap: break-word;
    font-weight: 600;
    font-size: 13.5px;
    box-shadow: 0 4px 12px rgba(255, 90, 67, 0.25);
}

#chatWindow .bot {
    align-self: flex-start;
    background: #1E293B;
    border: 1px solid #334155;
    color: #F8FAFC;
    padding: 12px 16px;
    border-radius: 16px 16px 16px 2px;
    max-width: 88%;
    word-wrap: break-word;
    font-size: 13.5px;
    line-height: 1.55;
}

#chatWindow .bot.prewrap {
    white-space: pre-wrap;
}

#chatWindow a {
    color: #38BDF8;
    font-weight: 700;
    text-decoration: underline;
}

#chatWindow a:hover {
    color: #7DD3FC;
}

/* Typing indicator */
.typing-indicator-box {
    align-self: flex-start;
    background: #1E293B;
    border: 1px solid #334155;
    color: #94A3B8;
    padding: 10px 16px;
    border-radius: 16px 16px 16px 2px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Input Area */
#chatInputContainer {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #1E293B;
    border-top: 1px solid #334155;
    gap: 8px;
}

#chatInput {
    flex: 1;
    background: #0F172A;
    border: 1px solid #334155;
    color: #FFFFFF;
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 999px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

#chatInput:focus {
    border-color: #FF5A43;
}

#sendButton {
    background: #FF5A43;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}

#sendButton:hover {
    background: #E04832;
    transform: scale(1.05);
}

@media (max-width: 480px) {
    #chatContainer {
        right: 16px;
        left: 16px;
        width: auto;
        bottom: 80px;
        height: 480px;
    }
    #chatButton {
        right: 16px;
        bottom: 16px;
        padding: 11px 18px;
        font-size: 13px;
    }
}
