/* Global Styles */
body {
    background-color: #fff;
    font-family: 'Bungee Outline', cursive;
    font-weight: 800;
    overflow: hidden;
    animation: blur 0.5s ease-out;
    color: #000;
    margin: 0;
    padding: 0;
    font-size: 16px;
}

body.dark_mode {
    background-color: #121212;
    color: #fff;
}

/* Ensure all elements inherit color from the body */
body * {
    color: inherit;
}

/* Specific elements inheriting body color */
#room_header_container,
#title,
#chat_content_container,
.message_user,
.message_content {
    color: inherit;
}

/* Header Styling */
#title_container {
    position: relative;
    width: 100%;
    height: 225px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #D64045;
    border-bottom: none;
    box-shadow: 0 0 30px -18px #D64045;
}

#online_users_container {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 14px;
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 5px;
    font-family: 'Roboto', sans-serif;
    display: flex;
    align-items: center;
}

#online_users_container i {
    margin-right: 5px;
}

#online_users_count {
    font-family: 'Roboto', sans-serif;
    font-weight: bold;
    font-size: 16px;
    color: white;
}

/* Title Container */
#title_inner_container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#title {
    color: white;
    font-size: 35px !important;
    letter-spacing: 2px;
    user-select: none;
    font-family: 'Bungee Outline', cursive;
}

/* Join Container */
#join_container {
    width: 100%;
    height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 80px;
    position: relative;
}

#join_inner_container {
    width: 100%;
    max-width: 600px;
}

#join_input_container {
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Input Styles */
#name_input,
#room_input {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border-radius: 20px;
    border: none;
    background: linear-gradient(145deg, #f4f4f4, #e0e0e0);
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.2), -4px -4px 8px rgba(255, 255, 255, 0.5);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

#name_input:focus,
#room_input:focus {
    background: linear-gradient(145deg, #ffffff, #f4f4f4);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    outline: none;
}

/* Join Button */
#join_button {
    width: 300px;
    height: 50px;
    /* Increased height */
    font-family: 'Varela Round', sans-serif;
    font-size: 18px;
    /* Increased font size */
    font-weight: bold;
    text-align: center;
    color: #fff;
    background-color: #1D3354;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.3s ease, transform 0.3s ease;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

#join_button.enabled {
    opacity: 1;
}

#join_button:hover {
    background-color: #0d1b2a;
    transform: translateX(-50%) scale(1.05);
}

#join_button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Chat Container */
#chat_container {
    width: 100%;
    height: 450px;
    /* Default height */
    display: flex;
    justify-content: center;
    float: left;
    margin-top: 40px;
    animation: fadeIn 1s linear;
}

#chat_inner_container {
    width: clamp (2500px, 50vw, 500px);
    width: 100%;
    max-width: 500px;
    height: 100%;
}

#chat_content_container {
    width: 100%;
    height: 90%;
    overflow-y: auto;
    font-family: 'Varela Round', sans-serif;
    padding: 0 15px;
    color: inherit;
}

/* Message Styles */
.message_container {
    width: 100%;
    display: flex;
    margin-bottom: 10px;
}

.message_inner_container {
    display: flex;
    flex-direction: column;
    color: inherit;
    max-width: 70%;
    padding: 6px 10px;
    border-radius: 12px;
    background-color: #eee;
}

.message_user_container {
    width: 100%;
    display: flex;
    justify-content: flex-start;
}

.message_user {
    font-weight: bold;
    font-size: 12px;
}

.message_content_container {
    display: flex;
    justify-content: flex-start;
}

.message_content {
    font-weight: normal;
    font-size: 12px;
    margin-top: 5px;
}

/* Styling for sent messages */
.message_container.user {
    justify-content: flex-end;
}

.message_inner_container.user {
    background-color: #5b9cff;
    color: #fff;
}

/* Dark Mode Adjustments */
body.dark_mode .message_inner_container {
    background-color: #333;
}

body.dark_mode .message_inner_container.user {
    background-color: #1D3354;
}

/* Chat Input */
#chat_input_container {
    width: 100%;
    height: 30px;
    display: flex;
    align-items: center;
    border-top: 2px dashed #e41111;
    padding: 0 15px;
    font-family: 'Varela Round', sans-serif;
    margin-top: 10px;
    position: relative;
}

#chat_input {
    flex: 1;
    height: 100%;
    background-color: transparent;
    color: inherit;
    font-size: 15px;
    border: none;
    outline: none;
    padding-right: 50px;
}

#chat_input_send {
    width: 30px;
    height: 30px;
    background: url('send.png') no-repeat center center;
    background-size: contain;
    border: none;
    cursor: pointer;
    position: absolute;
    right: 15px;
}

#chat_input_send.enabled {
    color: #b1b1b1;
    background-color: transparent;
}

#chat_logout_container {
    position: fixed;
    bottom: 10px;
    left: 10px;
    z-index: 1000;
}

#chat_logout {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

#chat_logout:hover {
    background-color: #d30d5f;
}

/* Enabled Class */
.enabled {
    transition: background-color 0.5s;
    color: #fff;
    background-color: #D64045;
    cursor: pointer;
}

/* Title Animation */
#title_container.chat_title_container {
    transition: 0.8s ease-in-out;
    height: 100px;
}

#title.chat_title {
    transition: 0.8s;
    font-size: 47px;
}

/* Loader */
.loader_container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    border-top: 6px solid #D64045;
    border-bottom: 6px solid #1D3354;
    border-left: 6px solid #E9FFF9;
    border-right: 6px solid #E9FFF9;
}

.system_message_container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.system_message_inner_container {
    background-color: #f4f4f4;
    color: #333;
    padding: 10px 15px;
    border-radius: 12px;
    max-width: 90%;
    text-align: center;
    font-style: italic;
}

body.dark_mode .system_message_inner_container {
    background-color: #444;
    color: #ddd;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes blur {
    0% {
        filter: blur(5px);
    }

    100% {}
}

@keyframes logoutAnimation {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Footer */
#footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    font-family: 'Varela Round', sans-serif;
    font-size: 10px;
    color: inherit;
    padding: 10px;
    text-align: center;
}

/* Logout Animation */
#chat_logout.animate {
    animation: logoutAnimation .5s ease;
}

/* Text Selection */
::selection {
    background-color: #D64045;
    color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #ccc;
}

::-webkit-scrollbar-thumb {
    background: #D64045;
    border-radius: 5px;
}

/* Dark Mode Toggle */
#dark_mode_toggle {
    width: 40px;
    height: 40px;
    background: url('night.png') no-repeat center center;
    background-size: contain;
    border: none;
    cursor: pointer;
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1000;
}

/* Responsive Styles */
@media only screen and (max-width: 768px) {
    body {
        font-size: 14px;
    }

    #title {
        font-size: 24px;
    }

    #join_button {
        width: 250px;
        /* Adjusted for smaller screens */
        height: 50px;
        font-size: 16px;
    }

    #chat_container {
        height: 350px;
        /* Adjusted height */
    }

    #chat_input_container {
        height: 40px;
        /* Adjusted height */
    }
}

@media only screen and (max-width: 480px) {
    body {
        font-size: 12px;
    }

    #title {
        font-size: 18px;
    }

    #join_button {
        width: 200px;
        /* Further adjustment */
        height: 50px;
        font-size: 14px;
    }

    #chat_container {
        height: 300px;
        /* Further adjusted height */
    }

    #chat_input_container {
        height: 35px;
        /* Further adjustment */
    }
}