body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #222;
    overflow-x: hidden; /* Prevent horizontal scrollbar on the body */
}

.chat-container {
    width: 100%;
    height: 100vh;
    margin: 0;
    background-color: #fff;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 10px;
    background-color: #007bff;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    margin: 0;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    -webkit-overflow-scrolling: touch; /* Enable smooth scrolling on iOS */
}

.message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 15px;
    text-align: justify;
    hyphens: auto;
    white-space: pre-wrap;
    max-width: 75%;
    word-wrap: break-word;
    display: inline-block;
    clear: both;
}

.user-message {
    background-color: #DCF8C6;
    float: right;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 2px;
}

.bot-message {
    background-color: #eee;
    float: left;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    border-bottom-left-radius: 2px;
    border-bottom-right-radius: 15px;
}

.chat-input {
    display: flex;
    padding: 10px;
    position: sticky;
    bottom: 0;
    background-color: white;
    align-items: center;
}

.chat-input input {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 25px;
    margin-right: 10px;
    font-size: 1rem;
    outline: none;
}

.dark-mode .chat-input input {
    border-color: #555;
    background-color: #333;
    color: #eee;
}

.chat-input button {
    padding: 10px 20px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    white-space: nowrap;
}

.chat-input input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.message pre {
    background-color: #282c34;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
}

.message code {
    background-color: #282c34;
    padding: 3px 5px;
    border-radius: 3px;
    color: #e0e0e0;
}

.message pre code {
    color: #e0e0e0;
    padding-left: 0px;
}

body.dark-mode {
    background-color: #222;
    color: #eee;
}

.dark-mode .chat-container {
    background-color: #333;
}

.dark-mode .chat-header {
    background-color: #0056b3;
}

.dark-mode .user-message {
    background-color: #004785;
}

.dark-mode .bot-message {
    background-color: #3c3c3c;
}

.dark-mode .chat-input {
    background-color: #333;
}

.dark-mode .chat-input input {
    border-color: #555;
}

.dark-mode .message code {
    background-color: #444;
}

.dark-mode .message pre {
    background-color: #1e1e1e;
}

.toggle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 10px;
}

.toggle-container span {
    font-size: 14px;
    margin: 0 5px;
    color: #fff;
    user-select: none;
}

body.dark-mode .toggle-container span {
    color: #eee;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    margin-top: 5px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
    -webkit-transform: translateX(19px);
    -ms-transform: translateX(19px);
    transform: translateX(19px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.hljs-string{
    color: lightgreen !important
}

.hljs-title{
    color: lightgreen !important
}

.hljs-variable{
    color: limegreen !important;
}

.waiting-message {
  display: none; /* Initially hidden */
  float: left; /* Float like a bot message */
  max-width: 5%; /* Same max-width as other messages */
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 15px;
  background-color: #eee; /* Or use dark-mode bot-message color */
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
  border-bottom-left-radius: 2px;
  border-bottom-right-radius: 15px;
}

.dark-mode .waiting-message{
  background-color: #3c3c3c;
}

.waiting-message .dot {
    width: 8px; /* Smaller dots */
    height: 8px;
    margin-right: 3px;
    background-color: #888;
    border-radius: 50%;
    animation: dot-animation 1.5s infinite;
    display: inline-block; /*  Ensure dots are inline */
}

/* Staggered animation for dots */
.waiting-message .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.waiting-message .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-animation {
    0% { transform: translateY(0); }
    25% { transform: translateY(-4px); }
    50% { transform: translateY(0); }
    100% { transform: translateY(0); }
}

/* Media Queries for Mobile Devices */
@media (max-width: 768px) {
    .chat-header {
        flex-direction: column; /* Stack header elements vertically */
        align-items: flex-start; /* Align to the left */
    }

    .header-title {
        margin-bottom: 10px; /* Add spacing below title */
    }
    .toggle-container {
        width: 100%;
        justify-content: flex-start; /* Correctly justify to the start*/
        margin-right: 0;
    }

     .chat-messages {
        height: calc(100vh - 160px); /* Adjust based on header and input height */
    }

    .chat-input {
        flex-direction: column; /* Stack input and button vertically */
    }

    .chat-input input {
        margin-bottom: 10px; /* Space between input and button */
        margin-right: 0; /* Remove right margin */
        width: auto;
    }

    .chat-input button{
        width: 100%;
    }

    .message {
        max-width: 90%; /* Allow more space on smaller screens */
    }

}