* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    display: flex;
    height: 100vh;
    background: #f0f0f0;
    overflow: hidden;
    color: #222;
    transition: background-color 0.3s, color 0.3s;
}

body.dark {
    background: #121212;
    color: #eee;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background: #fff;
    border-right: 1px solid #ddd;
    padding: 10px;
    overflow-y: auto;
    transform: translateX(-260px);
    transition: transform 0.3s ease, background-color 0.3s;
    z-index: 1000;
    color: #222;
}

body.dark .sidebar {
    background: #222;
    border-color: #444;
    color: #eee;
}

.sidebar.show {
    transform: translateX(0);
}

.chat-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    margin-left: 0;
    transition: margin-left 0.3s ease;
    width:100%
}

.chat-container.sidebar-open {
    margin-left: 250px;
}

.ai-chat-header {
    background: #fff;
    padding: 10px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #ddd;
    color: #222;
}
.clear-chat {
    background: transparent;
    border: 1px solid #d8d8d8;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
}
.dark .clear-chat{
    background: #1e1e1e;
    border-color:#444;
    color:#fff;
}
.clear-chat:hover {
    background: #f0f0f0;
    border-color: #c8c8c8;
} 
.dark .clear-chat:hover{
    background: #323232;
    border-color:#5c5c5c;
    color:#fff;
}  

body.dark .ai-chat-header {
    background: #1e1e1e;
    border-color: #444;
    color: #eee;
}

#toggle-sidebar-btn,
#theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    margin-right: 10px;
    user-select: none;
    color: inherit;
}

#theme-toggle-btn {
    margin-left: auto;
    margin-right:0px;
}

#theme-toggle-btn img {
    max-width: 35px;
    display: block;
}

.chat-box {
    flex-grow: 1;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    color: inherit;
}

.chat-box::-webkit-scrollbar {
    width: 6px;
}

.chat-box::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 10px;
}

.chat-box:hover::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
}

.chat-box:hover {
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.message-wrapper {
    display: flex;
    margin: 8px 0;
    max-width: 90%;
}

.user.message-wrapper {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai.message-wrapper {
    align-self: flex-start;
}

.avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    margin: 0 8px;
    background: #ffffff;
    padding: 3px;
    box-shadow: 0 0 5px #bfb8b8;
}
.user .avatar {
    box-shadow: none;
    border: 1px solid #bdbdbd;
    padding: 6px;
    background: #d3d3d3;
}
.dark .user .avatar {
    filter: invert(1);
    background: transparent;
    box-shadow: none;
}
.dark .avatar {
    background: #2e2e2e;
    box-shadow: 0 0 5px #000000;
}

.user .label {
    text-align: right;
}

.bubble {
    background: #fe6564;
    padding: 10px;
    border-radius: 10px 0 10px 10px;
    max-width: 100%;
    word-break: break-word;
    color: #ffffff;
    margin-top: 2px;
    border: 1px solid #fc5b5b;
}

.bubble p {
    margin: 0;
    font-size: 14px;
}

.bubble img {
    max-width: 250px;
}

body.dark .bubble {
    color: #eee;
}

.ai .bubble {
    background: #ffffff;
    color:#333;
    border-radius: 0 10px 10px 10px;
    border-color:#e9e9e9;
}

body.dark .ai .bubble {
    background: #333;
    border-color: #444444;
}
.bubble ul,
.bubble ol {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    font-size: 14px;
}
.bubble ul li,
.bubble ol li{
    background: url('https://threadify.com/resources/themes/theme_aster/public/assets/img/bullet-icon.svg') no-repeat left 5px;
    padding: 5px 5px 5px 22px;
    background-size: 16px;
    line-height: 15px;
    border-bottom: 1px solid #f0f0f0;
}
.bubble ul li:last-child, .bubble ol li:last-child {
    border:none;    
}
.dark .bubble ul li, 
.dark .bubble ol li {
    border-color:#404040;
}
.bubble a {
    color: #fe6564;
}
.label {
    font-size: 12px;
    color: #555;
    margin-bottom: 2px;
}

body.dark .label {
    color: #bbb;
}

.message-content {
    display: flex;
    flex-direction: column;
}

.chat-input {
    display: flex;
    align-items: center;
    border-top: 1px solid #ddd;
    background: #fff;
    width: 100%;
}

body.dark .chat-input {
    border-color: #444;
    background: #1e1e1e;
}

.chat-input input[type="text"] {
    flex: 1;
    padding: 12px;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
    color: inherit;
}

.chat-input button {
    padding: 12px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
}


#upload-label {
    font-size: 20px;
    cursor: pointer;
    padding: 0 10px;
    display: flex;
    align-items: center;
    color: inherit;
}

.chat-input img {
    max-width: 22px;
}


.sidebar .header {
    font-weight: bold;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar button.action-btn {
    margin: 5px 0;
    padding: 6px 10px;
    cursor: pointer;
}

.sidebar input[type="text"] {
    padding: 6px;
    margin: 10px 0;
    width: 100%;
    border: 1px solid #ccc;
}

body.dark .sidebar input[type="text"] {
    background: #333;
    border-color: #555;
    color: #eee;
}

.history-item {
    display: flex;
    justify-content: space-between;
    background: #f5f5f5;
    margin: 4px 0;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    color: #222;
}

body.dark .history-item {
    background: #333;
    color: #eee;
}

.history-item span {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.history-item button {
    border: none;
    background: transparent;
    color: red;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}
