*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Inter", sans-serif;
}

/* Chat bt toogle or not */
/*  */
#chatbot-tooggle{
    position: fixed;
    bottom: 30px;
    right: 35px;
    border: none;
    height: 50px;
    cursor: pointer;
    width: 50px;
    border-radius: 50%;
    background-color: #5350C4;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
#chatbot-tooggle i{
    color: #fff;
    font-size: 1.5rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

body.show-chatbot #chatbot-tooggle{
    transform: rotate(90deg);
}

body.show-chatbot #chatbot-tooggle i:first-child{
    opacity: 0;
}

#chatbot-tooggle i:last-child{
    opacity: 0;
}

body.show-chatbot #chatbot-tooggle i:last-child{
    opacity: 1;
}
.chatbot-popup{
    position: fixed;
    right: 35px;
    bottom: 90px;
    pointer-events: none;
    opacity: 0;
    max-width: 337px;   
    background-color: #fff;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 0 128px 0 rgba(0,0,0,0.1),
                0 32px 64px -48px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    transform: scale(0.2);
    transform-origin: bottom right;
    height: 385px;
    transition: all 0.3s ease;
}
body.show-chatbot .chatbot-popup{
    pointer-events: auto;
    opacity: 1;
    transform: scale(1);
}
/* HEADER */

.chat-header{
    display: flex;
    align-items: center;
    background-color: #5350c4;
    padding: 15px 22px;
    justify-content: space-between;
}

.chat-header .header-info{
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-info .chatbot-logo{
    height: 35px;
    width: 35px;
    background-color: #fff;
    border-radius: 50%;
}

.header-info .logo-text{
    color: #fff;   
    font-size: 1.31rem;
    font-weight: 600;
}

.chat-header #close-chatbot{
    border: none;
    color: #fff;
    height: 40px;
    width: 40px;
    font-size: 1.9rem;
    margin-right: -10px;
    padding-top: 2px;
    cursor: pointer;
    background: none;
    border-radius: 50%;
    transition: 0.2s ease;
}

.chat-header #close-chatbot:hover{
    background-color: #3d39ac;
}

/* BODY */

.chat-body{
    padding: 15px 20px;
    display: flex;
    flex-wrap: nowrap;
    width: 373px;
    gap: 20px;
    flex: 1;
    overflow-x: auto;
    overflow-y: auto;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: #ccccf5 transparent;
}


.chat-body .message{
    display: flex;
    gap: 11px;
    align-items: flex-end;
    margin-bottom: 12px; 
    width: fit-content;   /* 🔥 important */
    max-width: 100%;
}
.chat-body .message .message-text{
    padding: 12px 33px;
    font-size: 0.95rem;
    background: #F3F2FF;
    width: fit-content;      
    max-width: 75%;    
        border-radius: 18px 18px 18px 6px;       
    word-wrap: break-word;
}
/* BOT */

.chat-body .bot-message .bot-avatar{
    height: 35px;
    width: 35px;
    padding: 6px;
    fill: #fff;
    flex-shrink: 0;
    margin-bottom: 2px;
    background: #5350C4;
    border-radius: 50%;
}

.chat-body .bot-message pre {
    background: #1e1e1e;
    color: #fff;
    padding: 12px;
    border-radius: 20px;
    overflow-x: auto;   
    white-space: pre;   
    max-width: 100%;
}

/* USER */

.chat-body .user-message{
    align-self: flex-end;
}

.chat-body .user-message .message-text{
    background-color: #5350C4;
    color: #fff;
    border-radius: 13px 13px 3px 13px;
}

/* FOOTER */

.chat-footer{
    padding: 15px;
    border-top: 1px solid #eee;
}

.chat-footer .chat-form{
    display: flex;
    align-items: center;
    position: relative;
    gap: 10px;
    background-color: #fff;
    border-radius: 32px;
    outline: 1px solid #CCCCE5;
}

.chat-form .message-input{
    height: 47px;
    width: 100%;
    max-height: 180px;
    white-space: pre-line;
    padding: 14px 0 13px 18px;
    font-size: 0.95rem;
    resize: none;
    border-radius: inherit;
    border: none;
    overflow-y: hidden;
    outline: none;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}
.chat-form .message-input:hover{
scrollbar-color: #ccccf5 transparent;
}
/* CONTROLS */

.chat-form .chat-controls{
    display: flex;
    gap: 3px;
    height: 47px;
    align-items: center;
    align-self: flex-end;
    padding-right: 6px;
}

.chat-form .chat-controls button{
    height: 35px;
    width: 35px;
    border: none;
    background: #f1f1f1;
    font-size: 1.15rem;
    cursor: pointer;
    color: #706DB0;
    border-radius: 50%;
}

.chat-form .chat-controls button:hover{
    background: #f1f1ff;
}

/* SEND BUTTON */

.chat-form .chat-controls #send-message{
    color: #fff;   
    display: none;
    background-color: #5350C4;
}

.chat-form .message-input:valid ~ .chat-controls #send-message{
    display: block;
}

.chat-form .message-input::-webkit-scrollbar{
    display: none;
}

/* FILE UPLOAD FIXED */

.chat-form .file-upload-wrapper{
    height: 35px;
    width: 35px;
    position: relative;
}

.chat-form .file-upload-wrapper img{
    position: absolute;
    width: 10%;
    height:20%;
    display: none;
    object-fit: cover;
    border-radius: 50%;
}

/* FIXED SELECTORS */
.chat-form .file-upload-wrapper.file-upload img,
.chat-form .file-upload-wrapper.file-upload:hover .file-cancel{
    display: block;
}

.chat-form .file-upload-wrapper :where(img,.file-cancel),
.chat-form .file-upload-wrapper.file-upload #file-upload{
    display: none;
}

.chat-form .file-upload-wrapper :where(img,button){
    position: absolute;
}

.chat-form .file-upload-wrapper .file-cancel{
    color: #ff0000;
    background: #fff;
}

/* THINKING ANIMATION */

.chat-body .bot-message .thinking-indicator{
    display: flex;
    gap: 4px;
    padding-block: 15px;
}

.chat-body .bot-message .thinking-indicator .dot{
    height: 7px;
    width: 7px;
    opacity: 0.7;
    background-color: #6F68C2;
    border-radius: 50%;
    animation: dotPulse 1.5s ease-in-out infinite;
}

.chat-body .bot-message .thinking-indicator .dot:nth-child(1){ animation-delay: 0.2s; }
.chat-body .bot-message .thinking-indicator .dot:nth-child(2){ animation-delay: 0.4s; }
.chat-body .bot-message .thinking-indicator .dot:nth-child(3){ animation-delay: 0.6s; }

@keyframes dotPulse{
    0%, 44%{ transform: translateY(0); opacity: 0.7; }
    28%{ transform: translateY(-4px); opacity: 0.4; }
    44%{ opacity: 0.2; }
}

@keyframes messageFade{
    from{ opacity: 0; transform: translateY(10px); }
    to{ opacity: 1; transform: translateY(0); }
}

em-emoji-picker{
    position: absolute;
    left: 199px;
    top: -350px;
    width: 100%;
    max-width: 350px;
    max-height: 330px;
    visibility: hidden;
    transform: translateX(-50%);
}
body.show-emoji-picker em-emoji-picker{
    visibility: visible;
}

