:root {
    --background-color: #ffffff;
    --sidebar-bg-color: #fafafa;
    --sidebar-header-bg-color: #f0f0f5;
    --sidebar-border-color: #ddd;
    --message-bg-color: #007bff;
    --message-text-color: #fff;
    --their-message-bg-color: #888;
    --their-message-text-color: #fff;
    --button-bg-color: #007bff;
    --button-hover-bg-color: #0056b3;
    --input-bg-color: #fff;
    --input-border-color: #ddd;
    --input-focus-border-color: #4CAF50;
    --chat-item-hover-bg-color: #e7e7f3;
    --chat-item-active-bg-color: #007bff;
    --chat-item-active-text-color: #fff;
    --modal-overlay-bg-color: rgba(0, 0, 0, 0.5);
    --modal-bg-color: #ffffff;
    --modal-border-color: #888;
    --close-modal-color: #888;
    --close-modal-hover-color: red;
    --unread-marker-bg-color: red;
    --unread-marker-text-color: white;
    --message-input-bg-color: #fafafa;
}

[data-theme="dark"] {
    --background-color: #121212;
    --sidebar-bg-color: #333;
    --sidebar-header-bg-color: #222;
    --sidebar-border-color: #444;
    --message-bg-color: #1e88e5;
    --message-text-color: #fff;
    --their-message-bg-color: #444;
    --their-message-text-color: #eaeaea;
    --button-bg-color: #1e88e5;
    --button-hover-bg-color: #0d47a1;
    --input-bg-color: #333;
    --input-border-color: #555;
    --input-focus-border-color: #4CAF50;
    --chat-item-hover-bg-color: #555;
    --chat-item-active-bg-color: #007bff;
    --chat-item-active-text-color: #fff;
    --modal-overlay-bg-color: rgba(0, 0, 0, 0.8);
    --modal-bg-color: #333;
    --modal-border-color: #666;
    --close-modal-color: #ddd;
    --close-modal-hover-color: red;
    --unread-marker-bg-color: red;
    --unread-marker-text-color: white;
    --message-input-bg-color: #444;
}

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

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 1rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.messages-container {
    display: flex;
    flex-direction: row;
    height: 100%;
    width: 100%;
    background: var(--sidebar-bg-color);
    border: none;
    border-radius: 8px;
    margin: 0 auto;
    margin-bottom: 2px;
}

.messages-sidebar-container {
    width: 25%;
    min-width: 250px;
    background: var(--sidebar-bg-color);
    border: none;
	border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    font-size: 1.2rem;
    font-weight: bold;
    padding: 15px;
    border: none;
    background: var(--sidebar-header-bg-color);
    text-align: center;
	border-radius: 10px 0 0 0;
}

.chat-list {
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
	
}

.chat-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.chat-item:hover {
    background-color: var(--chat-item-hover-bg-color);
    color: #007bff;
}

.chat-item.active {
    background-color: var(--chat-item-active-bg-color);
    color: var(--chat-item-active-text-color);
}

.messages-content-container {
    width: 75%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--background-color);
    overflow: auto;
	border-radius: 0 10px 10px 0;
}

.message-list::-webkit-scrollbar {
    display: none;
}
.chat-list::-webkit-scrollbar {
    display: none;
}

.messages-content-container p {
    margin: auto;
    font-size: 24px;
}

.message-list {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
	overflow-y: auto;
}

.my-message-container,
.their-message-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    animation: slideIn 0.4s ease-out;
}

.my-message-container {
    align-items: flex-end;
}

.their-message-container {
    align-items: flex-start;
}

.message-username {
    font-size: 0.8rem;
    color: #555;
    margin-bottom: 5px;
    text-align: center;
}

.my-message {
    background-color: var(--message-bg-color);
    color: var(--message-text-color);
    padding: 10px 15px;
    border-radius: 15px 15px 0 15px;
    max-width: 50%;
    word-wrap: break-word;
    margin-bottom: 5px;
    opacity: 0;
    animation: fadeIn 0.6s forwards;
}

.their-message {
    background-color: var(--their-message-bg-color);
    color: var(--their-message-text-color);
    padding: 10px 15px;
    border-radius: 15px 15px 15px 0;
    max-width: 50%;
    word-wrap: break-word;
    margin-bottom: 5px;
    opacity: 0;
    animation: fadeIn 0.6s forwards;
}

.message-input-container {
    display: flex;
    background: var(--message-input-bg-color);
    border-top: 1px solid var(--sidebar-border-color);
    position: sticky;
    bottom: 0;
    width: 100%;
    z-index: 10;
    align-items: center; /* Ensures button and input align properly */
	border-radius: 0 0 10px 0;
	padding-bottom: 5px;
	padding-top: 5px;
}

#message-input {
    flex-grow: 1;
    padding: 10px;
    border: none;
    border-radius: 5px;
    background-color: var(--input-bg-color);
    font-size: 14px; /* Ensures consistent font size */
    height: 40px; /* Explicit height to match button */
	margin-bottom: 0;
	margin-left: 10px;
	margin-right: 10px;
}

#send-message-button {
    background-color: var(--button-bg-color);
    color: var(--message-text-color);
    border: none;
    margin-right: 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    padding: 0.5rem 1rem;
    font-size: 14px;
    height: 40px; /* Match the input field height */
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-message-button:hover {
    background-color: var(--button-hover-bg-color);
}


@keyframes slideIn {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.sidebar-header {
    font-size: 1.2rem;
    font-weight: bold;
    padding: 15px;
    border-bottom: 1px solid var(--sidebar-border-color);
    background: var(--sidebar-header-bg-color);
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#add-chat-btn {
    background: var(--button-bg-color);
    color: var(--message-text-color);
    border: none;
    padding: 10px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#add-chat-btn:hover {
    background-color: var(--button-hover-bg-color);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-overlay-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content h3 {
    margin-bottom: 20px;
}

.modal-content .user-list {
    padding: 0;
    margin: 0 0 20px 0;
}

.modal-content .user-item {
    list-style: none;
    cursor: pointer;
    padding: 10px;
    border: 1px solid var(--sidebar-border-color);
    margin-bottom: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.unread-marker {
    background-color: var(--unread-marker-bg-color);
    color: var(--unread-marker-text-color);
    border-radius: 50%;
    padding: 4px 8px;
    font-size: 12px;
    margin-left: 10px;
    font-weight: bold;
}

.chat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--sidebar-border-color);
    cursor: pointer;
}

.chat-item:hover {
    background-color: #f5f5f5;
}

.chat-item.active {
    background-color: var(--chat-item-active-bg-color);
    font-weight: bold;
}

.close-modal {
    color: var(--close-modal-color);
    float: right;
    font-size: 28px;
    font-weight: bold;
    transition: color 0.3s;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--close-modal-hover-color);
    text-decoration: none;
    cursor: pointer;
}

.button {
    background-color: #fff;
    color: #000;
    padding: 10px 20px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.button:hover {
    background-color: #D3D3D3;
}
