/* ========================================================
   FLOATING AI & CHAT WINDOW
======================================================== */
.floating-ai {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1050;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.floating-ai:hover {
    transform: scale(1.05);
}
.floating-ai__avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
}
.floating-ai__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.floating-ai__message {
    border-radius: 12px 12px 0 12px;
    padding: 12px 16px;
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    max-width: 250px;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    animation: slideInRight 0.5s forwards 1s; /* Auto show after 1s */
    background: #7008E7;
    color: #FFF;
    bottom: 22px;
}
.floating-ai__message::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    border-width: 8px 0 0 8px;
    border-style: solid;
    border-color: transparent transparent transparent #7008E7;
}
.floating-ai__message p {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #FFF;
    line-height: 20px;
}
@keyframes slideInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
.floating-ai.is-hidden {
    display: none !important;
}

/* Chat Popup Window */
.floating-chat-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    height: 560px;
    background: #FFF;
    border-radius: 24px;
    box-shadow: 0px 0px 8px rgba(0, 39, 38, 0.12), 0px 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1060;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                width 0.4s ease, height 0.4s ease, border-radius 0.4s ease;
}
.floating-chat-window.is-active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.floating-chat-window.is-expanded {
    width: calc(100vw - 48px);
    height: calc(100vh - 48px);
    border-radius: 12px;
}
@media (max-width: 575px) {
    .floating-chat-window.is-expanded {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
}

/* Chat Header */
.fcw-header {
    background: #FFF;
    box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px 12px 24px;
    height: 64px;
    z-index: 2;
}
.fcw-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.fcw-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}
.fcw-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.fcw-header-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 16px;
    color: #212529;
    margin: 0;
}
.fcw-header-actions {
    display: flex;
    align-items: center;
}
.fcw-header-btn {
    background: none;
    border: none;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    color: #4D5154;
    transition: background 0.2s;
}
.fcw-header-btn:hover {
    background: #F3F4F6;
}

/* Chat Body (Messages) */
.fcw-body {
    flex: 1;
    background: #FFF;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@keyframes chatMsgFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
}

.typing-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #6C757D;
    border-radius: 50%;
    animation: typingBounce 1.2s infinite ease-in-out both;
}

.fcw-msg-row {
    display: flex;
    width: 100%;
    gap: 8px;
    animation: chatMsgFadeIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.fcw-msg-row.ai-msg {
    justify-content: flex-start;
    padding-right: 24px;
}
.fcw-msg-row.user-msg {
    justify-content: flex-end;
    padding-left: 24px;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.fcw-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}
.fcw-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.fcw-msg-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}
.fcw-bubble {
    padding: 6px 12px;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    line-height: 24px;
    letter-spacing: 0.5px;
    width: fit-content;
}
.ai-msg .fcw-bubble {
    background: #FFF;
    border: 1px solid #E5E7EB;
    color: #212529;
    border-radius: 4px 16px 16px 16px;
}
.user-msg .fcw-bubble {
    background: #7008E7;
    color: #FFF;
    border-radius: 16px 16px 4px 16px;
}
.user-msg .fcw-bubble.middle {
    border-radius: 16px 4px 4px 16px; /* If there are middle messages */
}

/* Chat Footer (Input) */
.fcw-footer {
    height: auto;
    border-top: 1px solid #E5E7EB;
    background: #FFF;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.fcw-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    border-radius: 8px;
}
.fcw-input {
    width: 100%;
    border: none;
    outline: none;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    color: #212529;
    padding: 8px 0;
}
.fcw-input::placeholder {
    color: #A6A8A9;
}
.fcw-send-btn {
    background: none;
    border: none;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #4D5154;
    transition: color 0.2s;
}
.fcw-send-btn:hover {
    color: #7008E7;
}

@media (max-width: 767.98px) {
    .floating-chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
}

