/* Styles for AI widget */
.ai-widget-wrap{position:fixed;right:18px;bottom:18px;z-index:1200;display:flex;flex-direction:row;align-items:center;gap:18px}
/* keep backward compatibility: make #ai-widget a flex row as well */
.ai-open-btn{background:transparent;border:0;padding:0;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;position:relative}
.ai-avatar{width:72px;height:72px;border-radius:50%;object-fit:cover;border:3px solid rgba(255,255,255,0.06);box-shadow:0 8px 22px rgba(2,6,23,0.6);display:block}
@media (max-width:480px){.ai-avatar{width:60px;height:60px}}

/* label next to avatar */
.ai-label{margin-left:10px;color:white;font-weight:700;font-size:0.99rem;display:inline-block;vertical-align:middle}
@media (max-width:420px){.ai-label{display:none}}

/* unread badge */
.ai-badge{position:absolute;top:-4px;right:-4px;min-width:14px;height:14px;border-radius:50%;background:#ef4444;color:white;font-size:10px;display:flex;align-items:center;justify-content:center;box-shadow:0 6px 14px rgba(2,6,23,0.4);transform-origin:center;animation:none}
.ai-badge.pulse{animation:aiPulse 1.6s infinite}
@keyframes aiPulse{0%{transform:scale(1);opacity:1}50%{transform:scale(1.25);opacity:0.8}100%{transform:scale(1);opacity:1}}

/* modal tweaks */
#ai-modal{display:none;position:fixed;right:18px;bottom:18px;width:380px;height:520px;border-radius:12px;overflow:hidden;background:#071428;border:1px solid rgba(255,255,255,0.04);box-shadow:0 20px 60px rgba(2,6,23,0.6)}
#ai-modal .ai-header{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background:linear-gradient(90deg,rgba(6,8,23,0.9),rgba(8,18,34,0.85));color:white}
#ai-frame{width:100%;height:calc(100% - 44px);border:0;background:transparent}

/* small screen */
@media (max-width:450px){#ai-modal{right:12px;left:12px;width:auto;height:70vh;bottom:80px}}

/* Chat message bubbles */

/* Emoji picker */
.emoji-swatch{cursor:pointer;padding:6px;font-size:18px;display:inline-block}
.emoji-btn{background:transparent;border:none;color:white;cursor:pointer;font-size:18px}
/* active keyboard focus state */
.emoji-swatch.emoji-active{outline:2px solid rgba(96,165,250,0.9);border-radius:6px;background:rgba(96,165,250,0.06)}
.emoji-swatch:focus{outline:2px solid rgba(96,165,250,0.9);border-radius:6px}
 #emoji-picker{

display:none;

position:absolute;

bottom:60px;

left:45px;

background:#071428;

border-radius:12px;

padding:10px;

width:260px;

max-width:90vw;

z-index:2000;

box-shadow:0 10px 30px rgba(0,0,0,.5);

}
#chat-expand{
    background:transparent;

    border:none;

    color:white;

    font-size:22px;

    cursor:pointer;

    width:35px;

    height:35px;

    display:flex;

    align-items:center;

    justify-content:center;

    border-radius:50%;
}



#chat-close{

    background:transparent;

    border:none;

    color:white;

    font-size:22px;

    cursor:pointer;

    width:35px;

    height:35px;

    display:flex;

    align-items:center;

    justify-content:center;

    border-radius:50%;

}


#chat-expand:hover,
#chat-close:hover{

    background:rgba(255,255,255,0.15);

}

/* Ujumbe wangu */
#chat-modal.chat-fullscreen{

    position:fixed;

    inset:0;

    width:100vw;

    height:100vh;

    border-radius:0;

    display:flex;

}
html, body{

    overflow-x:hidden;

}
#chat-target:disabled {

    opacity: 0.5;
    cursor: not-allowed;

}

#chat-modal.chat-fullscreen .chat-content{

    width:100%;
    height:100%;

}
#chat-modal{
    z-index:99999;
}

#chat-open{
    z-index:99998;
}
.chat-background{

    position:absolute;

    top:0;
    left:0;

    width:100%;
    height:100%;

    background-size:cover;
    background-position:center;

    background-repeat:no-repeat;

    filter:blur(2px);

    transform:scale(1.1);

    opacity:1;

    z-index:0;

}
.chat-overlay{

    position:absolute;
    inset:0;

    background:rgba(0,0,0,0.45);

    z-index:1;

}
.chat-content{

    position:relative;

    z-index:3;

    display:flex;

    flex-direction:column;

    width:100%;

    height:100%;
    background: transparent;

}
/* kuhakikisha text ndefu haivunji screen */



/* Full screen responsive */

/* simu */
@media(max-width:600px){

    .chat-line{

        max-width:90%;

    }



}



/* ===== CHAT BACKGROUND ===== */
.ai-header{
    flex:0 0 70px;
    cursor: move;
    display:flex;
    justify-content:space-between;
    align-items:center;
    user-select: none;

    padding:12px 18px;

    background:rgba(0,0,0,.55);
}

.chat-user{

    display:flex;

    align-items:center;

    gap:12px;

}

#chat-avatar{

    width:48px;

    height:48px;

    border-radius:50%;

    object-fit:cover;

    border:2px solid white;

}

.online-status{

    color:#2d3b30;

    font-size:13px;

}

.chat-line{

    display:block;

    width:fit-content;

    max-width:70%;

    padding:12px 15px;

    border-radius:18px;

    word-break:break-word;

}
.chat-line.outgoing{

    align-self:flex-end;

    background:#4f46e5;

    color:white;

}

.chat-line.incoming{

    align-self:flex-start;

    background:#1f2937;

    color:white;

}
.chat-input-area{

    flex:0 0 90px;

    display:flex;
    align-items:center;

    gap:10px;

    padding:15px;

    background:rgba(0,0,0,.65);

}
#chat-input{

    flex:1;

    min-height:60px;

    max-height:150px;

    resize:none;

    overflow-y:auto;

    font-size:17px;

    line-height:24px;

    padding:16px 20px;

    border:none;

    outline:none;

    border-radius:30px;

    background:rgba(255,255,255,.12);

    color:white;

}
#chat-send{

    width:48px;

    height:48px;

    border:none;

    border-radius:50%;

    background:#7c3aed;

    color:white;

    cursor:pointer;

    transition:.25s;

}

#chat-send:hover{

    transform:scale(1.08);

}

#chat-messages::-webkit-scrollbar{

    width:8px;

}

#chat-messages::-webkit-scrollbar-thumb{

    background:#7c3aed;

    border-radius:10px;

}
.chat-controls{
    display:flex;
    align-items:center;
    gap:5px;
    flex-shrink:0;
}


#chat-scope{
    width:75px;
    height:30px;
    font-size:12px;
}


#chat-target{

width:120px;
height:32px;
font-size:13px;
border-radius:8px;
padding:5px;

background:white;
color:black;

}


#chat-expand,
#chat-close{

    width:32px;
    height:32px;

    flex-shrink:0;

}
@media (max-width:992px){

.chat-window{

    width:95%;
    height:90vh;

}

}
@media (max-width: 768px){

    .ai-open-btn {
        width: auto;
        min-width: 120px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .ai-label {
        display: inline-block;
        font-size: 14px;
    }


.chat-window{

    width:calc(100vw - 20px);
    height:85vh;

 }
}

#chat-input{

    min-height:50px;
    max-height:120px;
    font-size:16px;

}


.chat-line{

    max-width:85%;

}

.chat-input-area{

    padding:10px;

}

.chat-content{
    display:flex;
    flex-direction:column;
    height:100%;
}
/* =====================================
   FINAL RESPONSIVE CHAT WIDGET FIX
   Desktop / Tablet / Mobile
===================================== */


/* Main chat window */
/* FINAL POPUP POSITION CONTROL */

.chat-window{

    display:none;

    position:fixed;

    right:18px;

    bottom:18px;

    width:420px;

    height:min(700px,75dvh);

    max-width:calc(100vw - 20px);

    max-height:calc(100dvh - 20px);

    border-radius:18px;

    overflow:hidden;

    box-sizing:border-box;

}
/* Chat structure */

.chat-content{

    display:flex;

    flex-direction:column;

    height:100%;

}



/* Header */

.ai-header{

    flex:0 0 65px;

    display:flex;

    align-items:center;

    justify-content:space-between;

    padding:10px 15px;

    background:rgba(0,0,0,.65);

}



/* Messages */

#chat-messages{

    flex:1;

    overflow-y:auto;

    min-height:0;

    padding:15px;

    display:flex;

    flex-direction:column;

    gap:10px;

}



/* Input area WhatsApp style */

.chat-input-area{

    flex:0 0 auto;

    display:flex;

    align-items:center;

    gap:8px;

    padding:10px;

    background:rgba(0,0,0,.75);

}



/* Text box */

#chat-input{

    flex:1;

    min-height:42px;

    max-height:120px;

    resize:none;

    overflow-y:auto;

    border:none;

    outline:none;

    border-radius:25px;

    padding:10px 15px;

    font-size:16px;

    background:white;

    color:black;

}



/* Buttons */

#plus-btn,
#emoji-btn,
#voice-record,
#chat-send{

    width:42px;

    height:42px;

    border-radius:50%;

    border:none;

    cursor:pointer;

    display:flex;

    align-items:center;

    justify-content:center;

    font-size:20px;

    flex-shrink:0;

}


#plus-btn,
#emoji-btn,
#voice-record{

    background:#0ea5a2;

    color:white;

}


#chat-send{

    background:#22c55e;

    color:white;

}



/* Upload popup */

.plus-container{

    position:relative;

}


#upload-menu{

    position:absolute;

    bottom:55px;

    left:0;

    width:150px;

    background:#071428;

    border-radius:12px;

    display:none;

    overflow:hidden;

    box-shadow:0 10px 30px rgba(0,0,0,.5);

}


#upload-menu.show{

    display:block;

}


#upload-menu label{

    display:block;

    padding:12px;

    color:white;

    cursor:pointer;

}


/* ===========================
        TABLET
=========================== */


@media(max-width:992px){


.chat-window{

    width:95%;

    height:85dvh;

    right:2.5%;

    bottom:20px;

}


}



/* ===========================
        MOBILE
=========================== */


@media(max-width:600px){

#emoji-picker{

left:0;

bottom:55px;

width:240px;

}


#upload-menu{

bottom:55px;

left:0;

}

}



/* header isiingie navbar */

.ai-header{

    flex:0 0 58px;

    padding:8px 10px;

}



#chat-avatar{

    width:40px;

    height:40px;

}



/* messages */

#chat-messages{

    padding:10px;

}



/* input */

.chat-input-area{

    padding:8px;

    padding-bottom: calc(8px + env(safe-area-inset-bottom));

}



#chat-input{

    font-size:15px;

    min-height:40px;

}



#plus-btn,
#emoji-btn,
#voice-record,
#chat-send{

    width:38px;

    height:38px;

    font-size:18px;

}






/* ===========================
     SMALL MOBILE
=========================== */


@media(max-width:380px){


#emoji-btn{

    display:none;

}


.chat-input-area{

    gap:5px;

}


}
#chat-open{

    touch-action:none;

}


#chat-widget{

    max-width:100vw;
    max-height:100vh;

}
/* ===============================
   RESPONSIVE FINAL OVERRIDE
================================*/


@media(max-width:992px){

    .chat-window{

        width:95vw;

        max-width:95vw;

        height:85dvh;

        left:50% !important;

        transform:translateX(-50%);

        right:auto !important;

    }

}



@media(max-width:600px){

    .chat-window{

        width:100vw;

        height:calc(100dvh - 60px);

        max-width:100vw;

        left:0 !important;

        right:0 !important;

        bottom:0;

        top:60px !important;

        border-radius:0;

        transform:none;

    }


    .ai-header{

        flex:0 0 55px;

    }


}
#ai-widget{
    position:fixed;
    left:auto;
    right:18px;
    bottom:18px;
    z-index:1200;
}
#emoji-picker{

    position:absolute;

    bottom:75px;

    left:50px;

    width:260px;

    max-width:90vw;

    padding:10px;

    background:#111b21;

    border-radius:12px;

    display:none;

    grid-template-columns:repeat(6,1fr);

    gap:8px;

    z-index:99999;

    box-shadow:0 10px 30px rgba(0,0,0,.5);

}


#emoji-picker.show{

    display:grid;

}


.emoji-swatch{

    cursor:pointer;

    font-size:22px;

    width:35px;

    height:35px;

    display:flex;

    align-items:center;

    justify-content:center;

}
.quick-widgets{

position:fixed;

left:18px;

bottom:160px;

z-index:1100;

display:flex;

flex-direction:column;

gap:15px;

}



.quick-widget{

width:100px;

height:50px;

border-radius:30px;

display:flex;

align-items:center;

gap:15px;

padding:12px;

text-decoration:none;

color:white;

background:#111;

box-shadow:0 5px 20px rgba(0,0,0,.5);

transition:.3s;

}



.quick-widget:hover{

transform:translateX(-10px);

}



.widget-icon{

font-size:15px;

}



.widget-info h4{

margin:0;

font-size:12px;

}



.widget-info p{

margin:3px 0;

font-size:12px;

color:#ccc;

}



/* LIVE COLOR */

.live-widget{

border-left:5px solid red;

}



/* MOVIE COLOR */

.movie-widget{

border-left:5px solid #00ff66;

}
