/* ===========================================================
   CPLUS AI Assistant
   ChatGPT Style
   ai.css
=========================================================== */

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

html,
body{

    font-family: "Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
    font-size:15px;
    font-weight:400;
    line-height:1.6;
    color:#1f2937;

    margin:0;
    padding:0;

    width:100%;
    height:100%;

}

#app{

    position:absolute;

    left:0;
    top:0;
    right:0;
    bottom:0;

    display:flex;
    flex-direction:column;

}

/*==========================================================
    HEADER
==========================================================*/

.ai-header{

    height:52px;

    display:flex;

    align-items:center;

    justify-content:space-between;

    padding:0 12px;

    background:#ffffff;

    border-bottom:1px solid #e5e7eb;

}

.btn-back{

    width:40px;

    height:40px;

    border:none;

    background:transparent;

    border-radius:12px;

    cursor:pointer;

    color:#2563eb;

    font-size:20px;

    display:flex;

    align-items:center;

    justify-content:center;

    transition:.2s;

}

.btn-back:hover{

    background:#eef2ff;

}

.btn-back:active{

    transform:scale(.95);

}

.header-center{

    flex:1;

    display:flex;

    flex-direction:column;

    align-items:center;

    justify-content:center;

}

.header-title{

    display:flex;

    align-items:center;

    gap:10px;

    color:#2563eb;

    font-size:19px;

    font-weight:700;

}

.header-ai-logo{

    width:34px;

    height:34px;

    object-fit:contain;

}

.header-status{

    margin-top:2px;

    display:flex;

    align-items:center;

    gap:6px;

    color:#6b7280;

    font-size:13px;

}

.status-dot{

    width:9px;

    height:9px;

    border-radius:50%;

    background:#22c55e;

    box-shadow:

        0 0 8px rgba(34,197,94,.45);

}

.btn-menu{

    width:42px;

    height:42px;

    border:none;

    background:#ffffff;

    border-radius:16px;

    color:#2563eb;

    cursor:pointer;

    display:flex;

    justify-content:center;

    align-items:center;

    font-size:20px;

    transition:.2s;

}

.btn-menu:hover{

    background:#eff6ff;

}

/*==========================================================*/

#chatContainer{

    flex:1;

    min-height:0;

    display:flex;
    flex-direction:column;

}

#chatArea{

    flex:1;

    min-height:0;

    overflow-y:auto;

    padding:16px;

}

/*========================================================*/

#footer{

    flex-shrink:0;

    background:#ffffff;

    border-top:1px solid #e5e7eb;

    padding:16px 18px;

}

/*==========================================================
    INPUT PANEL
==========================================================*/

.input-panel{

    display:flex;

    align-items:flex-end;

    gap:12px;

}

/*==========================================================
    TEXTAREA
==========================================================*/

#txtMessage{
    font-family: inherit;
    font-size:15px;
    font-weight:400;

    flex:1;
    resize:none;
    border:none;
    outline:none;
    background:#f9fafb;
    border:1px solid #d1d5db;
    border-radius:16px;
    padding:14px 16px;
    min-height:46px;
    max-height:160px;
    overflow-y:auto;
    line-height:1.5;
    color:#111827;
    transition:.2s;
}

#txtMessage::placeholder{

    color:#9ca3af;

}

#txtMessage:focus{

    border-color:#3b82f6;

    box-shadow:0 0 0 3px rgba(59,130,246,.15);

    background:#ffffff;

}

/*==========================================================
    SEND BUTTON
==========================================================*/

#btnSend{

    width:46px;

    height:46px;

    border:none;

    outline:none;

    cursor:pointer;

    border-radius:50%;

    background:#2563eb;

    color:#ffffff;

    font-size:20px;

    display:flex;

    align-items:center;

    justify-content:center;

    transition:.20s;

}

#btnSend:hover{

    background:#1d4ed8;

    transform:scale(1.05);

}

#btnSend:active{

    transform:scale(.96);

}

#btnSend i{

    pointer-events:none;

}

/*==========================================================
    MESSAGE ROW
==========================================================*/

.message{
    font-family: inherit;
    display:flex;
    align-items:flex-start;
    gap:12px;
    margin-bottom:14px;
}

.user-message{

    justify-content:flex-end;

}

.ai-message{

    align-items:flex-start;

}

/*==========================================================
    BUBBLE
==========================================================*/

.bubble{
    font-family: inherit;
    font-size:15px;
    font-weight:400;
    line-height:1.65;
    letter-spacing:-0.01em;
    position:relative;
    padding:14px 18px;
    border-radius:18px;
    word-wrap:break-word;
    white-space:pre-wrap;
}

/*==========================================================
    USER
==========================================================*/

.user-message .bubble{
    max-width:65%;
	
    background:#2f6df6;

    color:#ffffff;

    border-bottom-right-radius:6px;

    box-shadow:
        0 6px 14px rgba(37,99,235,.20);

}

/*==========================================================
    AI
==========================================================*/

.ai-message .bubble{
    max-width:80%;
	
    background:#ffffff;

    color:#111827;

    border:1px solid #e5e7eb;

    border-bottom-left-radius:6px;

    box-shadow:0 2px 8px rgba(0,0,0,.06);

}

/*==========================================================
    LINKS
==========================================================*/

.bubble a{

    color:#2563eb;

    text-decoration:none;

}

.bubble a:hover{

    text-decoration:underline;

}

/*==========================================================
    PARAGRAPH
==========================================================*/

.bubble p{

    margin:0 0 10px 0;

}

.bubble p:last-child{

    margin-bottom:0;

}

/*==========================================================
    LIST
==========================================================*/

.bubble ul,
.bubble ol{

    margin:10px 0 10px 22px;

}

.bubble li{

    margin:5px 0;

}

/*==========================================================
    BOLD
==========================================================*/

.bubble strong{

    font-weight:600;

}

/*==========================================================
    ITALIC
==========================================================*/

.bubble em{

    font-style:italic;

}

/*==========================================================
    ANIMATION
==========================================================*/

@keyframes fadeIn{

    from{

        opacity:0;

        transform:translateY(12px);

    }

    to{

        opacity:1;

        transform:translateY(0);

    }

}

/*==========================================================
    AVATAR
==========================================================*/

.avatar{

    width:38px;

    height:38px;

    border-radius:50%;

    overflow:hidden;

    display:flex;

    justify-content:center;

    align-items:center;

    background:#ffffff;

    box-shadow:0 2px 8px rgba(0,0,0,.08);

}

.avatar img{

    width:100%;

    height:100%;

    object-fit:cover;

}

.ai-message .avatar{
	
    background:#2563eb;

    color:#ffffff;

    margin-right:10px;

}

.user-message .avatar{

    background:#111827;

    color:#ffffff;

    margin-left:10px;

    order:2;

}

.user-message .bubble{

    order:1;

}

.ai-message .bubble{

    order:2;

}

/*==========================================================
    TYPING
==========================================================*/

.typing{

    display:flex;

    align-items:center;

    margin:0 0 20px 0;

    padding-left:52px;

}

.typing-box{

    display:flex;

    align-items:center;

    gap:6px;

    background:#ffffff;

    border:1px solid #e5e7eb;

    border-radius:18px;

    padding:12px 18px;

    box-shadow:0 4px 12px rgba(0,0,0,.05);

}

.typing-box span{

    width:8px;

    height:8px;

    border-radius:50%;

    background:#9ca3af;

    animation:typingBounce 1.4s infinite ease-in-out;

}

.typing-box span:nth-child(2){

    animation-delay:.2s;

}

.typing-box span:nth-child(3){

    animation-delay:.4s;

}

@keyframes typingBounce{

    0%{

        transform:translateY(0);
        opacity:.35;

    }

    25%{

        transform:translateY(-5px);
        opacity:1;

    }

    50%{

        transform:translateY(0);
        opacity:.6;

    }

    100%{

        transform:translateY(0);
        opacity:.35;

    }

}

/*==========================================================
    CODE BLOCK
==========================================================*/

.bubble pre{

    margin:14px 0;

    padding:16px;

    overflow-x:auto;

    border-radius:12px;

    background:#111827;

    color:#f9fafb;

    border:1px solid #1f2937;

    font-family:

        Consolas,
        "Courier New",
        monospace;

    font-size:14px;

    line-height:1.6;

}

.bubble code{

    font-family:

        Consolas,
        "Courier New",
        monospace;

    font-size:14px;

}

.bubble :not(pre) > code{

    padding:2px 6px;

    border-radius:6px;

    background:#eef2ff;

    color:#2563eb;

}

/*==========================================================
    BLOCKQUOTE
==========================================================*/

.bubble blockquote{

    margin:14px 0;

    padding:10px 16px;

    border-left:4px solid #2563eb;

    background:#f8fafc;

    color:#4b5563;

    font-style:italic;

}

/*==========================================================
    TABLE
==========================================================*/

.bubble table{

    width:100%;

    margin:16px 0;

    border-collapse:collapse;

    border-radius:10px;

    overflow:hidden;

}

.bubble th{

    background:#f3f4f6;

    color:#111827;

    padding:12px;

    text-align:left;

    border:1px solid #e5e7eb;

    font-weight:600;

}

.bubble td{

    padding:12px;

    border:1px solid #e5e7eb;

}

.bubble tr:nth-child(even){

    background:#fafafa;

}

/*==========================================================
    HORIZONTAL LINE
==========================================================*/

.bubble hr{

    border:none;

    height:1px;

    background:#e5e7eb;

    margin:18px 0;

}

/*==========================================================
    IMAGE
==========================================================*/

.bubble img{

    max-width:100%;

    border-radius:10px;

    margin:10px 0;

}

/*==========================================================
    SCROLLBAR
==========================================================*/

#chatArea::-webkit-scrollbar{

    width:10px;

}

#chatArea::-webkit-scrollbar-track{

    background:transparent;

}

#chatArea::-webkit-scrollbar-thumb{

    background:#d1d5db;

    border-radius:10px;

}

#chatArea::-webkit-scrollbar-thumb:hover{

    background:#9ca3af;

}

.bubble pre::-webkit-scrollbar{

    height:8px;

}

.bubble pre::-webkit-scrollbar-thumb{

    background:#4b5563;

    border-radius:10px;

}

.bubble pre::-webkit-scrollbar-track{

    background:#1f2937;

}

/*==========================================================
    MOBILE
==========================================================*/

@media (max-width:900px){

    .ai-header{

        height:56px;

        padding:0 14px;

    }

    .logo{

        font-size:17px;

    }

    .logo i{

        font-size:18px;

    }

    #chatArea{

        padding:14px;

    }

    #footer{

        padding:12px;

    }

    .bubble{

        max-width:90%;

        font-size:14px;

        padding:12px 14px;

    }

    .avatar{

        width:34px;
        height:34px;
        min-width:34px;

        font-size:16px;

    }

    .ai-message .avatar{

        margin-right:10px;

    }

    .user-message .avatar{

        margin-left:10px;

    }

    #txtMessage{

        min-height:48px;

        max-height:120px;

        font-size:14px;

        padding:12px 14px;

    }

    #btnSend{

        width:48px;
        height:48px;

        font-size:18px;

    }

}

/*==========================================================
    SMALL MOBILE
==========================================================*/

@media (max-width:600px){

    .bubble{

        max-width:96%;

    }

    .logo span{

        display:none;

    }

    .typing{

        padding-left:44px;

    }

}

/*==========================================================
    SELECTION
==========================================================*/

::selection{

    background:#2563eb;

    color:#ffffff;

}

/*==========================================================
    FOCUS
==========================================================*/

button:focus,
textarea:focus{

    outline:none;

}

/*==========================================================
    TRANSITION
==========================================================*/

button,
textarea,
.bubble,
.avatar{

    transition:all .20s ease;

}

/*==========================================================
    LAST MESSAGE
==========================================================*/

.message:last-child{

    margin-bottom:6px;

}

/*==========================================================
    EMPTY CHAT
==========================================================*/

#chatArea:empty::before{

    content:"CPLUS AI Assistant";

    display:block;

    margin-top:120px;

    text-align:center;

    font-size:26px;

    font-weight:600;

    color:#d1d5db;

}


/*==========================================================
    MICROPHONE BUTTON
==========================================================*/

#btnMic{

    width:46px;

    height:46px;

    border:1px solid #d1d5db;

    outline:none;

    cursor:pointer;

    border-radius:50%;

    background:#ffffff;

    color:#2563eb;

    font-size:20px;

    display:flex;

    align-items:center;

    justify-content:center;

    transition:.25s;

}

#btnMic:hover{
	
    width:50px;
	
	height:50px;
	
	font-size:22px;
	
    background:#eff6ff;

    border-color:#2563eb;

    transform:scale(1.08);

}

#btnMic:active{

    transform:scale(.96);

}

#btnMic i{

    pointer-events:none;

}

/* ==========================================
   Voice Mode
========================================== */

#voiceOverlay{

    position:fixed;
    inset:0;

    display:none;

    flex-direction:column;
    justify-content:center;
    align-items:center;

    background:rgba(8,12,20,.96);

    z-index:999999;

}

#voiceCenter{

    display:flex;

    flex-direction:column;

    justify-content:center;
    align-items:center;

    gap:28px;

}

#voiceOrb{

    width:170px;
    height:170px;

    border-radius:50%;

    background:#2b7cff;

    box-shadow:
        0 0 30px rgba(43,124,255,.55),
        0 0 90px rgba(43,124,255,.25);

    animation:voiceBreath 2.2s ease-in-out infinite;

}

#voiceText{

    color:#ffffff;

    font-size:22px;

    font-weight:600;

    letter-spacing:.3px;

}

#btnVoiceClose{

    position:absolute;

    left:50%;
    bottom:40px;

    transform:translateX(-50%);

    width:64px;
    height:64px;

    border:none;

    border-radius:50%;

    background:#34C759;

    color:#ffffff;

    display:flex;

    justify-content:center;
    align-items:center;

    font-size:30px;

    cursor:pointer;

    box-shadow:
        0 8px 24px rgba(0,0,0,.35);

    transition:.2s;

    z-index:20;

}

#btnVoiceClose:hover{

    transform:translateX(-50%) scale(1.08);

}

#btnVoiceClose:active{

    transform:translateX(-50%) scale(.94);

}

#btnVoiceClose i{

    pointer-events:none;

}

/* ==========================================
   Voice Animation
========================================== */

@keyframes voiceBreath{

    0%{

        transform:scale(1);

        box-shadow:
            0 0 30px rgba(43,124,255,.45),
            0 0 70px rgba(43,124,255,.20);

    }

    50%{

        transform:scale(1.10);

        box-shadow:
            0 0 55px rgba(43,124,255,.80),
            0 0 120px rgba(43,124,255,.45);

    }

    100%{

        transform:scale(1);

        box-shadow:
            0 0 30px rgba(43,124,255,.45),
            0 0 70px rgba(43,124,255,.20);

    }

}

/* ==========================================
   Voice States
========================================== */

#voiceOverlay.listening #voiceText{

    color:#ffffff;

}

#voiceOverlay.thinking #voiceOrb{

    background:#8b5cf6;

}

#voiceOverlay.speaking #voiceOrb{

    background:#22c55e;

    animation-duration:.7s;

}

#voiceOverlay.speaking #voiceText{

    color:#d1fae5;

}


#quickActions{

    display:flex;

    gap:10px;

    overflow-x:auto;

    padding:0 0 14px 0;

}

#quickActions::-webkit-scrollbar{

    display:none;

}

.quick-btn{

    display:flex;

    align-items:center;

    gap:8px;

    white-space:nowrap;

    border:none;

    border-radius:18px;

    padding:10px 16px;

    background:#ffffff;

    color:#2563eb;

    font-size:14px;

    cursor:pointer;

    box-shadow:0 2px 8px rgba(0,0,0,.08);

    transition:.20s;

}

.quick-btn:hover{

    background:#2563eb;

    color:#ffffff;

}

.quick-btn i{

    font-size:15px;

}


/*==========================================================
    ERP CARD
==========================================================*/

.erp-card{

    display:flex;

    align-items:center;

    gap:16px;

    background:#ffffff;

    border-radius:22px;

    border:1px solid #eef2f7;

    padding:14px 16px;

    width:100%;

    max-width:300px;

    box-shadow:
        0 8px 24px rgba(0,0,0,.05);

}

.erp-icon{

    width:46px;

    height:46px;

    border-radius:14px;

    background:#2563eb;

    color:#ffffff;

    display:flex;

    justify-content:center;

    align-items:center;

    font-size:22px;

    flex-shrink:0;

}


.erp-content{

    flex:1;

    display:flex;

    flex-direction:column;

    justify-content:center;

}


.erp-title{

    font-size:13px;

    color:#6b7280;

    margin-bottom:8px;

}

.erp-value{

    font-size:24px;

    font-weight:700;

    color:#2563eb;

    line-height:1.2;

}

.erp-footer{

    margin-top:8px;

    color:#9ca3af;

    font-size:12px;

}

/*=========================================
MESSAGE INFO
=========================================*/

.message-info{

    margin-top:10px;

    display:flex;

    justify-content:flex-end;

    align-items:center;

    gap:6px;

}

.message-info.ai{

    justify-content:flex-start;

}

.message-time{

    font-size:11px;

    color:#9ca3af;

}

.message-status{

    color:#ffffff;

    font-size:11px;

}

.message-status.read{

    color:#3b82f6;

}

/*=========================================
DATE
=========================================*/

.date-separator{

    display:flex;

    justify-content:center;

    margin:16px 0;

}

.date-separator span{

    padding:5px 14px;

    border-radius:20px;

    background:#eef2f7;

    color:#6b7280;

    font-size:12px;

    font-weight:600;

}

/*==========================================================
    END
==========================================================*/