*{
box-sizing:border-box;
margin:0;
padding:0;
font-family:system-ui, Arial;
}

/* BODY */

body{
background:#0f172a;
color:white;
height:100vh;
}

/* LIGHT THEME */

.light-theme{
background:#f5f5f5;
color:#111;
}

.light-theme .sidebar{
background:#f5f5f5;
border-right:1px solid #ddd;
}

.light-theme .chat-header{
border-bottom:1px solid #fff;
}

.light-theme #userInput{
background:#fff;
color:#000;
border:1px solid #ccc;
}

/* APP */

.app{
display:flex;
height:100vh;
}

/* SIDEBAR */

.sidebar{
width:260px;
background:#020617;
padding:20px;
display:flex;
flex-direction:column;
gap:15px;
border-right:1px solid #1e293b;
z-index:200;
transition:transform .3s ease;
}

.sidebar.closed{
transform:translateX(-260px);
}

/* LOGO */

.logo{
font-size:22px;
font-weight:bold;
margin-bottom:10px;
}

/* BUTTON */

.new-chat{
background:#2563eb;
border:none;
padding:10px;
color:white;
cursor:pointer;
border-radius:6px;
}

/* SEARCH */

.search{
padding:8px;
border-radius:6px;
border:none;
}

/* CHAT HISTORY */

.chat-history{
list-style:none;
display:flex;
flex-direction:column;
gap:8px;
}

.chat-history li{
padding:6px;
cursor:pointer;
}

.chat-history li:hover{
background:#bdbebf;
border-radius:4px;
}

/* TOOLS */

.tools{
margin-top:20px;
display:flex;
flex-direction:column;
gap:8px;
}

.tools-title{
font-size:12px;
opacity:.7;
}

/* USER MENU */

.user-menu{
margin-top:auto;
display:flex;
flex-direction:column;
gap:6px;
}

/* CHAT AREA */

.chat-area{
flex:1;
display:flex;
flex-direction:column;
}

/* HEADER */

.chat-header{
padding:15px;
border-bottom:1px solid #1e293b;
font-weight:600;
display:flex;
align-items:center;
gap:10px;
}

/* CHAT BOX */

#chat-box{
flex:1;
padding:20px;
overflow-y:auto;
}

/* INPUT BAR */

.input-area{
display:flex;
align-items:center;
padding:10px;
border-top:1px solid #1e293b;
gap:10px;
position:relative;
}

/* USER INPUT */

#userInput{
flex:1;
padding:10px;
border-radius:6px;
border:none;
}

/* BUTTONS */

#sendBtn{
background:#2563eb;
border:none;
padding:10px 14px;
color:white;
border-radius:6px;
cursor:pointer;
}

#voiceBtn{
background:#1e293b;
border:none;
color:white;
padding:10px;
border-radius:6px;
cursor:pointer;
}

/* MENU BUTTON */

.menu-toggle{
background:#2563eb;
border:none;
color:white;
padding:8px 12px;
border-radius:6px;
cursor:pointer;
}

/* TOOL MAIN BUTTON */

.tool-main{
width:36px;
height:36px;
border-radius:8px;
font-size:18px;
cursor:pointer;
background:#1e293b;
border:none;
color:white;
}

/* FLOATING TOOL PANEL */

.tools-panel{
position:absolute;
bottom:55px;
left:0;
display:flex;
gap:8px;
background:#020617;
padding:8px;
border-radius:10px;
box-shadow:0 6px 20px rgba(0,0,0,0.4);
opacity:0;
pointer-events:none;
transform:translateY(10px);
transition:all .2s ease;
}

.tools-panel.active{
opacity:1;
pointer-events:auto;
transform:translateY(0);
}

/* TOOL ICON BUTTONS */

.tools-panel button{
width:36px;
height:36px;
border:none;
border-radius:8px;
cursor:pointer;
font-size:18px;
background:#1e293b;
color:white;
}

.tools-panel button:hover{
background:#334155;
}

/* OVERLAY */

.sidebar-overlay{
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
background:rgba(0,0,0,0.4);
display:none;
z-index:100;
}

.sidebar-overlay.active{
display:block;
}

/* MOBILE */

@media (max-width:900px){

.sidebar{
position:fixed;
top:0;
left:0;
height:100%;
}

.sidebar.closed{
transform:translateX(-260px);
}

}

.ai-content{
margin-top:6px;
line-height:1.6;
}

.ai-table{
border-collapse:collapse;
margin-top:10px;
width:100%;
font-size:14px;
}

.ai-table th,
.ai-table td{
border:1px solid #334155;
padding:6px;
text-align:left;
}

.ai-table th{
background:#1e293b;
}

/* GENERATED IMAGE */

.generated-image{
max-width:420px;
max-height:320px;
width:100%;
object-fit:cover;
border-radius:10px;
cursor:pointer;
margin-top:8px;
}

/* IMAGE WRAPPER */

.generated-image-wrapper{
display:flex;
flex-direction:column;
gap:8px;
}

/* IMAGE ACTIONS */

.image-actions{
display:flex;
gap:10px;
font-size:13px;
}

/* IMAGE LIBRARY */

.library-image{
width:100%;
max-width:420px;
border-radius:10px;
}

.image-tools{
margin-top:8px;
display:flex;
gap:10px;
}

/* workspace */

#workspace{
flex:1;
display:flex;
flex-direction:column;
position:relative;
overflow:hidden;
}

/* hide pages */

.hidden{
display:none;
}

/* image gallery */

#image-page{
flex:1;
padding:20px;
overflow-y:auto;
}

/* gallery grid */

.image-grid{
display:grid;
grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
gap:20px;
}

/* image card */

.image-library-card{
background:#020617;
padding:12px;
border-radius:10px;
}

.image-library-card img{
width:100%;
border-radius:8px;
}

.image-tools{
display:flex;
justify-content:space-between;
margin-top:8px;
font-size:13px;
}

.image-mode .input-area{
display:none;
}

/* CHAT ITEM */

.chat-item{
display:flex;
justify-content:space-between;
align-items:center;
padding:6px;
border-radius:6px;
cursor:pointer;
position:relative;
}

.chat-item:hover{
background:#1e293b;
}

/* CHAT TITLE */

.chat-title{
flex:1;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}

/* MENU BUTTON */

.chat-menu-btn{
background:none;
border:none;
color:white;
font-size:16px;
cursor:pointer;
padding:4px 8px;
opacity:0.6;
}

.chat-menu-btn{
opacity:0;
}

.chat-item:hover .chat-menu-btn{
opacity:1;
}

/* DROPDOWN */

.chat-dropdown{
position:absolute;
right:6px;
top:28px;
background:#020617;
border:1px solid #334155;
border-radius:8px;
box-shadow:0 6px 18px rgba(0,0,0,0.5);
overflow:hidden;
z-index:500;
}

.chat-dropdown div{
padding:8px 14px;
cursor:pointer;
font-size:14px;
}

.chat-dropdown div:hover{
background:#1e293b;
}

/* CHAT RENAME */

.chat-rename-input{
width:100%;
background:#020617;
border:1px solid #475569;
border-radius:6px;
padding:4px 6px;
color:white;
font-size:14px;
outline:none;
}