* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  background: #ece5dd;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

/* Dark Mode */
body.dark {
  background: #121212;
}

body.dark .chat-container {
  background: #1e1e1e;
}

body.dark .messages {
  background: #2a2a2a;
}

body.dark .received {
  background: #3a3a3a;
  color: white;
}

.chat-container {
  width: 450px;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 15px rgba(0,0,0,0.2);
}


#onlineUsers {
  text-align: center;
  padding: 8px;
  background: #f5f5f5;
  font-size: 14px;
  font-weight: bold;
  color: #075e54;
}

#typingStatus {
  height: 20px;
  padding-left: 10px;
  font-size: 13px;
  color: gray;
  font-style: italic;
}

.messages {
  height: 450px;
  overflow-y: auto;
  padding: 15px;
  background: #efeae2;
  display: flex;
  flex-direction: column;
}

.message {
  padding: 10px 14px;
  margin: 6px 0;
  border-radius: 12px;
  max-width: 75%;
  width: fit-content;
  word-wrap: break-word;
}

.sent {
  background: #dcf8c6;
  margin-left: auto;
}

.received {
  background: white;
  margin-right: auto;
}

.input-area {
  display: flex;
  gap: 5px;
  padding: 10px;
  border-top: 1px solid #ddd;
}

#username {
  width: 120px;
}

#messageInput {
  flex: 1;
}

button {
  width: 80px;
  min-width: 80px;
  background: #25d366;
  border: none;
  color: white;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .chat-container {
    width: 95%;
    height: 95vh;
  }

  .messages {
    height: 70vh;
  }

  .input-area {
    flex-direction: column;
  }

  #username,
  #messageInput,
  button {
    width: 100%;
  }
}
@media (max-width: 600px) {

  body {
    padding: 0;
    height: 100vh;
  }

  .chat-container {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }

  .messages {
    height: calc(100vh - 180px);
  }

  .input-area {
    padding: 8px;
    gap: 4px;
  }

  #username {
    width: 90px;
    font-size: 12px;
  }

  #messageInput {
    font-size: 14px;
  }

  button {
    width: 65px;
    min-width: 65px;
    font-size: 13px;
  }



  .message {
    max-width: 85%;
    font-size: 14px;
  }
}

/* RESPONSIVE CHAT */

.chat-container{
    width: 420px;
    max-width: 95%;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.messages{
    flex: 1;
    overflow-y: auto;
}

.message{
    padding: 10px 14px;
    margin: 8px;
    border-radius: 12px;
    max-width: 75%;
    word-wrap: break-word;
}

.sent{
    background:#dcf8c6;
    align-self:flex-end;
    margin-left:auto;
}

.received{
    background:white;
    align-self:flex-start;
    margin-right:auto;
}

.input-area{
    display: flex;
    gap: 5px;
    padding: 10px;
}

#username{
    width: 110px;
}

#messageInput{
    flex: 1;
}

button{
    background: #25d366;
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 5px;
}

/* JOIN / LEAVE MESSAGE */

.system-message{
    text-align: center;
    color: gray;
    font-size: 13px;
    margin: 10px 0;
    font-style: italic;
}

/* DARK MODE */

.dark{
    background: #121212;
}

.dark .chat-container{
    background: #1e1e1e;
}

.dark .messages{
    background: #222;
}

.dark .received{
    background: #333;
    color: white;
}

.dark .sent{
    background: #056162;
    color: white;
}

/* MOBILE */

@media(max-width:600px){

    body{
        padding:0;
        margin:0;
    }

    .chat-container{
        width:100%;
        height:100vh;
        border-radius:0;
    }

    #username{
        width:80px;
    }

    button{
        width:70px;
    }
}

#emojiBar{
    display:none;
    flex-wrap:wrap;
    justify-content:center;
    gap:6px;
    padding:8px;
    background:#f5f5f5;
}

#emojiBar button{
    width:40px;
    height:40px;
    min-width:40px;
    border-radius:50%;
    font-size:20px;
}



.messages{
    flex:1;
    overflow-y:auto;
    padding:15px;
    background:#efeae2;
    display:flex;
    flex-direction:column;
    align-items:flex-start;
}





.header{
    background:#075e54;
    color:white;
    padding:12px 15px;
    display:flex;
    justify-content:space-between;
    align-items:center;
}

.header span{
    font-size:24px;
    font-weight:bold;
}

.header button{
    width:45px;
    height:45px;
    min-width:45px;
    border:none;
    border-radius:8px;
    margin-left:5px;
    font-size:20px;
}