body {
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 14px;
    display: flex;
    justify-content: center;
    height: 100vh;
    align-items: center;
    margin: 0;
}

#chatbot {
    width: 100%;
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: auto;
}

.message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 100%;
    box-sizing: border-box;
}

#loading {
    text-align: center;
    padding: 10px;
    height: 10px;
    display: flex;
    flex-direction: column;
}

#spinner {
    border: 4px solid rgba(0,0,0,0.1); /* Light grey border */
    border-top: 4px solid #007bff; /* Blue border */
    border-radius: 50%;
    width: 10px;
    height: 10px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#input-area {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px;
    flex-shrink: 0; /* Prevents the input area from shrinking */
}

#user-input {
    width: calc(100% - 90px);
    margin-right: 10px;
    resize: none;
}

button {
    width: 100%;
    height: 40px;
    background-color: #146AFF;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    min-width: 100px;
}

button:hover {
    background-color: #004ACB;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed; /* Shows a 'no entry' cursor when hovered */
    }

#reset-button {
    margin-top: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    background-color: #EB445A;
    height: 20px;
    font-size: 10px;
}

#reset-button:hover {
    background-color: #b02436;
}

#conversation {
    flex-grow: 1; /* Fills the available space */
    overflow-y: auto; /* Enables scrolling only for this div */
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.user {
    text-align: left;
    background-color: #095f87;
    color: white;
    align-self: flex-start;
}

.assistant, .system {
    text-align: left;
    background-color: #F3F2F9;
    align-self: flex-start;
}

.system i {
    font-size: 90%;
}

.error {
    text-align: left;
    background-color: #9d0015;
    color: white;
    align-self: flex-start;
}

code {
    font-family: monospace;
    padding: 2px 4px;
    border-radius: 4px;
}

code[class*=language-] {
    font-size: 13px!important;
}

pre {
    font-family: monospace;
    background-color: black;
    color: white!important;
    padding: 8px;
    border-radius: 4px;
    white-space: pre-wrap;
    overflow-x: auto;
    tab-size: 4;
}

pre[class*="language-"]::before {
    display: none;
}

.rating a {
    cursor: pointer;
}

.rating-saved {
    font-size: 12px;
    color: #146AFF;
}

div.code-toolbar>.toolbar>.toolbar-item>button {
    background: rgb(108 108 108 / 60%)!important;
    font-size: 10px!important;
    min-width: 64px!important;
    height: 24px!important;
    color: white!important;
}


@media (max-width: 767px) {
    #input-area textarea {
        height: 70px!important;
        padding-top: 1px;
    }
}

@media (max-width: 400px) {
    #input-area {
        flex-direction: column; /* Stacks the textarea and the button div vertically */
        height: auto; /* Adjust height to fit content vertically */
        padding-top: 0px;
    }

    #input-area textarea {
        width: 100%; /* Makes textarea take full width */
        margin-right: 0; /* Removes margin since it's no longer next to buttons */
    }

    #input-area div {
        flex-direction: column; /* Stacks buttons vertically */
        width: 100%; /* Makes the div take full width, aligning buttons under the textarea */
        margin-top: 10px; /* Adds some space between the textarea and the buttons */
    }

    button {
        width: 100%; /* Each button takes the full width of the input-area */
    }
    
    #send-button {
        height: 30px;
    }

    #reset-button {
        margin-top: 10px;
    }
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #0f0f0f;
}

body.dark-mode #chatbot {
    background-color: #0f0f0f;
}

body.dark-mode .assistant,
body.dark-mode .system {
    background-color: #333333; /* Dark gray */
    color: #ffffff;
}

body.dark-mode #user-input {
    background-color: #333333; /* Dark gray */
    color: #ffffff;
    border: 1px solid #555555; /* Optional: for better visibility */
}

body.dark-mode #user-input::placeholder {
    color: #bbbbbb; /* Light gray */
}