*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

body{

    font-family:Arial, Helvetica, sans-serif;

    background:#f2f5fa;

    height:100vh;

    display:flex;

    justify-content:center;

    align-items:center;

}

/* ==========================
   Main Layout
========================== */

.app-container{

    display:flex;

    width:95%;

    max-width:1500px;

    height:90vh;

    gap:20px;

}

/* ==========================
   Sidebar
========================== */

.sidebar{

    width:280px;

    flex-shrink:0;

    background:white;

    border-radius:12px;

    box-shadow:0 0 15px rgba(0,0,0,.15);

    display:flex;

    flex-direction:column;

    padding:20px;

}

.new-chat-btn{

    width:100%;

    padding:14px;

    background:#2563eb;

    color:white;

    border:none;

    border-radius:10px;

    cursor:pointer;

    font-size:16px;

    margin-bottom:20px;

}

.chat-list{

    flex:1;

    overflow-y:auto;

}

.chat-item{

    padding:14px;

    border-radius:10px;

    cursor:pointer;

    margin-bottom:10px;

    transition:.3s;

}

.chat-item:hover{

    background:#dbeafe;

}

.container{

    flex:1;

    height:90vh;

    background:white;

    border-radius:12px;

    overflow:hidden;

    box-shadow:0 0 15px rgba(0,0,0,.15);

    display:flex;

    flex-direction:column;

}

/* ==========================
   Header
========================== */

.header{
    background:#2563eb;
    color:white;
    padding:20px;
    text-align:center;
}

/* ==========================
   Chat Area
========================== */

.chat-area{

    flex:1;

    display:flex;

    flex-direction:column;

    overflow-y:auto;

    padding:20px;

    background:#f8fafc;

}

/* ==========================
   Messages
========================== */

.message{

    max-width:70%;

    padding:12px 18px;

    margin-bottom:15px;

    border-radius:10px;

    font-size:16px;

    line-height:1.5;

    word-wrap: break-word;

    white-space: pre-wrap;

}

.ai{

    background:white;

    border:1px solid #ddd;

    align-self:flex-start;

}

.user{

    background:#2563eb;

    color:white;

    margin-left:auto;

}

/* ==========================
   Input Area
========================== */

.input-area{

    padding:20px;

    border-top:1px solid #ddd;

    background:white;

}

.input-container{

    display:flex;

    align-items:flex-end;

    gap:12px;

    border:1px solid #d1d5db;

    border-radius:18px;

    padding:12px 16px;

    background:white;

}

/* Input Box */

#messageInput{

    flex:1;

    border:none;

    outline:none;

    resize:none;

    overflow-y:auto;

    min-height:26px;

    max-height:120px;

    padding:0;

    margin:0;

    font-size:16px;

    line-height:24px;

    font-family:inherit;

    background:transparent;

    display:block;

}

.button-group{

    display:flex;

    gap:10px;

}

/* Buttons */

button{

    width:50px;

    height:50px;

    border:none;

    border-radius:50%;

    background:#2563eb;

    color:white;

    font-size:20px;

    cursor:pointer;

    flex-shrink:0;

    transition:.3s;

}

button:hover{

    background:#1d4ed8;

}

button:disabled{

    opacity:0.6;

    cursor:not-allowed;

}

/* ==========================
   Markdown Styling
========================== */

.ai h1,
.ai h2,
.ai h3,
.ai h4,
.ai h5,
.ai h6{
    margin:16px 0 10px;
    color:#111827;
}

.ai p{
    margin:10px 0;
    line-height:1.8;
}

.ai ul,
.ai ol{
    margin:12px 0 12px 25px;
}

.ai li{
    margin:6px 0;
}

.ai code{
    background:#eef2ff;
    color:#1d4ed8;
    padding:2px 6px;
    border-radius:4px;
    font-family:Consolas, monospace;
}

.ai pre{
    background:#1e293b;
    color:#f8fafc;
    padding:16px;
    border-radius:10px;
    overflow-x:auto;
    margin:15px 0;
}

.ai pre code{
    background:none;
    color:inherit;
    padding:0;
}

.ai blockquote{
    border-left:4px solid #2563eb;
    padding-left:15px;
    margin:15px 0;
    color:#555;
}

.ai table{
    border-collapse:collapse;
    width:100%;
    margin:15px 0;
}

.ai th,
.ai td{
    border:1px solid #ddd;
    padding:10px;
}

.ai th{
    background:#2563eb;
    color:white;
}

#modeSelect{

    margin-top:15px;

    padding:10px 15px;

    border:none;

    border-radius:8px;

    font-size:16px;

    cursor:pointer;

    background:white;

    color:#2563eb;

    font-weight:bold;

}