/* =========================================================
   NXTa3 AI — GLOBAL LEARNING COPILOT
   ========================================================= */

:root{
    --nx-ai-green:#387441;
    --nx-ai-green-dark:#285b32;
    --nx-ai-green-deep:#173b23;
    --nx-ai-green-soft:#eef7f0;
    --nx-ai-line:#d7e8da;
    --nx-ai-ink:#17231c;
    --nx-ai-muted:#68756d;
    --nx-ai-white:#fff;
    --nx-ai-shadow:0 24px 70px rgba(20,55,30,.20);
}


/* ROOT */

.nx-ai-root{
    position:relative;
    z-index:99999;
}


/* =========================================================
   FLOATING BUTTON
   ========================================================= */

.nx-ai-launcher{
    position:fixed;
    right:24px;
    bottom:24px;

    height:58px;
    min-width:58px;

    padding:0 19px;

    display:flex;
    align-items:center;
    justify-content:center;
    gap:9px;

    border:0;
    border-radius:30px;

    background:linear-gradient(
        135deg,
        var(--nx-ai-green),
        var(--nx-ai-green-dark)
    );

    color:#fff;

    box-shadow:
        0 12px 35px rgba(56,116,65,.35),
        0 4px 12px rgba(0,0,0,.10);

    cursor:pointer;

    font-family:inherit;

    transition:
        transform .2s ease,
        box-shadow .2s ease;
}

.nx-ai-launcher:hover{
    transform:translateY(-3px);

    box-shadow:
        0 18px 42px rgba(56,116,65,.40),
        0 5px 15px rgba(0,0,0,.12);
}

.nx-ai-launcher-icon{
    width:27px;
    height:27px;

    display:flex;
    align-items:center;
    justify-content:center;

    border-radius:50%;

    background:rgba(255,255,255,.15);

    font-size:16px;
}

.nx-ai-launcher-text{
    font-size:13px;
    font-weight:800;
    letter-spacing:.1px;
}


/* =========================================================
   CHAT PANEL
   ========================================================= */

.nx-ai-panel{
    position:fixed;

    right:24px;
    bottom:94px;

    width:390px;
    height:min(650px,calc(100vh - 125px));

    display:flex;
    flex-direction:column;

    overflow:hidden;

    background:#fff;

    border:1px solid rgba(56,116,65,.13);

    border-radius:22px;

    box-shadow:var(--nx-ai-shadow);

    opacity:0;
    visibility:hidden;

    transform:
        translateY(18px)
        scale(.97);

    transform-origin:bottom right;

    transition:
        opacity .2s ease,
        visibility .2s ease,
        transform .2s ease;
}

.nx-ai-panel.open{
    opacity:1;
    visibility:visible;

    transform:
        translateY(0)
        scale(1);
}


/* =========================================================
   HEADER
   ========================================================= */

.nx-ai-header{
    min-height:72px;

    display:flex;
    align-items:center;
    justify-content:space-between;

    padding:13px 15px;

    background:
        linear-gradient(
            135deg,
            #173b23,
            #285b32
        );

    color:#fff;
}

.nx-ai-brand{
    display:flex;
    align-items:center;
    gap:11px;
}

.nx-ai-avatar{
    width:42px;
    height:42px;

    display:flex;
    align-items:center;
    justify-content:center;

    border-radius:13px;

    background:rgba(255,255,255,.13);

    border:1px solid rgba(255,255,255,.16);

    font-size:20px;
}

.nx-ai-title{
    font-size:15px;
    font-weight:850;
}

.nx-ai-status{
    display:flex;
    align-items:center;
    gap:6px;

    margin-top:3px;

    font-size:10px;

    color:#cfe4d3;
}

.nx-ai-status span{
    width:6px;
    height:6px;

    border-radius:50%;

    background:#83d994;

    box-shadow:0 0 0 3px rgba(131,217,148,.10);
}

.nx-ai-header-actions{
    display:flex;
    gap:4px;
}

.nx-ai-header-btn{
    width:34px;
    height:34px;

    display:flex;
    align-items:center;
    justify-content:center;

    border:0;
    border-radius:9px;

    background:rgba(255,255,255,.09);

    color:#fff;

    cursor:pointer;

    transition:.18s;
}

.nx-ai-header-btn:hover{
    background:rgba(255,255,255,.18);
}


/* =========================================================
   CONTEXT BAR
   ========================================================= */

.nx-ai-context{
    min-height:34px;

    display:flex;
    align-items:center;

    padding:0 15px;

    background:#f7faf8;

    border-bottom:1px solid #edf1ee;

    color:var(--nx-ai-muted);

    font-size:10px;
    font-weight:700;
}

.nx-ai-context-icon{
    margin-right:7px;

    color:var(--nx-ai-green);

    font-size:12px;
}


/* =========================================================
   MESSAGES
   ========================================================= */

.nx-ai-messages{
    flex:1;

    overflow-y:auto;

    padding:18px 15px 12px;

    scroll-behavior:smooth;
}

.nx-ai-messages::-webkit-scrollbar{
    width:5px;
}

.nx-ai-messages::-webkit-scrollbar-thumb{
    background:#d8e4da;
    border-radius:10px;
}


/* WELCOME */

.nx-ai-welcome{
    text-align:center;

    padding:20px 13px 15px;
}

.nx-ai-welcome-icon{
    width:52px;
    height:52px;

    margin:0 auto 12px;

    display:flex;
    align-items:center;
    justify-content:center;

    border-radius:17px;

    background:var(--nx-ai-green-soft);

    color:var(--nx-ai-green);

    font-size:23px;

    border:1px solid var(--nx-ai-line);
}

.nx-ai-welcome h3{
    margin:0;

    color:var(--nx-ai-ink);

    font-size:18px;
    font-weight:850;
}

.nx-ai-welcome p{
    max-width:300px;

    margin:8px auto 0;

    color:var(--nx-ai-muted);

    font-size:12px;
    line-height:1.6;
}


/* =========================================================
   SUGGESTIONS
   ========================================================= */

.nx-ai-suggestions{
    display:grid;

    grid-template-columns:1fr 1fr;

    gap:8px;

    margin-top:5px;
}

.nx-ai-suggestions button{
    min-height:52px;

    display:flex;
    align-items:center;

    gap:8px;

    padding:10px 11px;

    border:1px solid #e2ebe4;

    border-radius:12px;

    background:#fff;

    color:#29352e;

    font-family:inherit;

    font-size:10.5px;
    font-weight:750;

    text-align:left;

    cursor:pointer;

    transition:
        border-color .18s,
        background .18s,
        transform .18s;
}

.nx-ai-suggestions button:hover{
    background:var(--nx-ai-green-soft);

    border-color:#b9d4bd;

    transform:translateY(-1px);
}

.nx-ai-suggestions button:last-child{
    grid-column:1 / -1;
}

.nx-ai-suggestions button span{
    font-size:16px;
}


/* =========================================================
   CHAT BUBBLES
   ========================================================= */

.nx-ai-message{
    display:flex;

    gap:8px;

    margin:12px 0;
}

.nx-ai-message.user{
    justify-content:flex-end;
}

.nx-ai-message-avatar{
    flex:0 0 28px;

    width:28px;
    height:28px;

    display:flex;
    align-items:center;
    justify-content:center;

    border-radius:9px;

    background:var(--nx-ai-green-soft);

    color:var(--nx-ai-green);

    font-size:12px;
    font-weight:800;
}

.nx-ai-bubble{
    max-width:78%;

    padding:10px 12px;

    border-radius:14px 14px 14px 4px;

    background:#f4f7f5;

    color:#26322b;

    font-size:12px;
    line-height:1.55;

    word-break:break-word;
}

.nx-ai-message.user .nx-ai-bubble{
    border-radius:14px 14px 4px 14px;

    background:var(--nx-ai-green);

    color:#fff;
}


/* =========================================================
   TYPING
   ========================================================= */

.nx-ai-typing{
    display:none;

    align-items:center;

    gap:8px;

    padding:0 15px 9px;
}

.nx-ai-typing.show{
    display:flex;
}

.nx-ai-typing-bubble{
    display:flex;
    align-items:center;
    gap:4px;

    padding:10px 12px;

    background:#f4f7f5;

    border-radius:14px;
}

.nx-ai-typing-bubble span{
    width:5px;
    height:5px;

    border-radius:50%;

    background:#79927e;

    animation:nxAiTyping 1.1s infinite ease-in-out;
}

.nx-ai-typing-bubble span:nth-child(2){
    animation-delay:.15s;
}

.nx-ai-typing-bubble span:nth-child(3){
    animation-delay:.3s;
}

@keyframes nxAiTyping{
    0%,60%,100%{
        transform:translateY(0);
        opacity:.4;
    }

    30%{
        transform:translateY(-4px);
        opacity:1;
    }
}


/* =========================================================
   INPUT
   ========================================================= */

.nx-ai-input-area{
    padding:10px 12px 11px;

    border-top:1px solid #edf1ee;

    background:#fff;
}

.nx-ai-input-wrap{
    display:flex;
    align-items:flex-end;

    gap:7px;

    padding:7px 7px 7px 12px;

    border:1px solid #dce6df;

    border-radius:15px;

    background:#fafcfb;

    transition:.18s;
}

.nx-ai-input-wrap:focus-within{
    border-color:#9fbea5;

    box-shadow:
        0 0 0 3px rgba(56,116,65,.07);
}

.nx-ai-input-wrap textarea{
    flex:1;

    min-height:22px;
    max-height:90px;

    resize:none;

    border:0;
    outline:0;

    background:transparent;

    color:var(--nx-ai-ink);

    font-family:inherit;

    font-size:12px;
    line-height:1.45;
}

.nx-ai-input-wrap textarea::placeholder{
    color:#8b9890;
}

.nx-ai-send{
    width:34px;
    height:34px;

    flex:0 0 34px;

    display:flex;
    align-items:center;
    justify-content:center;

    border:0;
    border-radius:10px;

    background:var(--nx-ai-green);

    color:#fff;

    cursor:pointer;

    transition:.18s;
}

.nx-ai-send:hover{
    background:var(--nx-ai-green-dark);

    transform:translateY(-1px);
}

.nx-ai-send:disabled{
    opacity:.5;

    cursor:not-allowed;

    transform:none;
}

.nx-ai-disclaimer{
    padding:6px 3px 0;

    color:#9aa69e;

    font-size:8.5px;

    text-align:center;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media(max-width:600px){

    .nx-ai-launcher{
        right:15px;
        bottom:15px;

        width:54px;
        min-width:54px;
        height:54px;

        padding:0;

        border-radius:50%;
    }

    .nx-ai-launcher-text{
        display:none;
    }

    .nx-ai-panel{
        right:10px;
        left:10px;
        bottom:78px;

        width:auto;

        height:
            min(
                680px,
                calc(100vh - 98px)
            );

        border-radius:19px;
    }

    .nx-ai-suggestions{
        grid-template-columns:1fr;
    }

    .nx-ai-suggestions button:last-child{
        grid-column:auto;
    }

}