  .chatroom-body-contents {
    display: flex;
    height: calc(60vh - 25px); /* Adjust based on your header/footer height */
    gap: 0;
    }

  .sidebar {
    width: 220px;
    background: white;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
  }
  .sidebar-header {
    padding: 13px;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
    font-size: 16px;
  }
  .user-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
  }
  .user {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
  }
  .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
  }
  .online {
    background-color: #34d399; /* green */
  }
  .offline {
    background-color: #9ca3af; /* gray */
  }
  .room-info {
    padding: 13.5px 16px;
    border-top: 1px solid #ddd;
    font-size: 14px;
    color: #555;
  }
  .chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  .header {
    background-color: #D32F2F;
    color: white;
    padding: 12px 16px;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .header .online-status {
    display: flex;
    align-items: center;
    font-size: 14px;
  }
  .header .online-status .status-dot {
    margin-right: 6px;
  }
  .messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background-color: #f3f4f6;
    font-size: 13px;
  }
  .message {
    max-width: 60%;
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background-color: white;
    border: 1px solid #ddd;
    word-wrap: break-word;
  }
  .message.self {
    background-color:#9999ff;
    color: #000000;
    margin-left: auto;
    border: none;
  }
  .message-header {
    font-weight: bold;
    /* font-size: 14px; */
    margin-bottom: 4px;
  }
  .message-time {
    font-size: 11px;
    color: #2c3e53;
    margin-left: 8px;
    font-weight: normal;
  }
  .input-area {
    padding: 12px 0;
    border-top: 1px solid #ddd;
    background: white;
    display: flex;
    align-items: center;
    position: relative; /* ✅ ADD: Make input-area the positioning context */
  }
  .input-area textarea {
    flex: 1;
    resize: none;
    padding: 8px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid #ccc;
    outline: none;
    font-family: inherit;
  }
  .input-area .sendbutton {
    margin-left: 3px;
    background-color: #003893;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
  }
  .input-area button:disabled {
    background-color: #a5b4fc;
    cursor: not-allowed;
  }

  /* Login message modal */
.login-message-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.login-message-content {
  background: white;
  padding: 30px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
}

.login-message-content h3 {
  margin-bottom: 20px;
  color: #333;
}

.modalbutton {
width: 100%;
padding: 10px 0;
margin: 10px auto;
border-radius: 5px;
border: none;
background: #003893;
font-size: 14px;
font-weight: 600;
color: #fff;
}

.emoji-toggle-btn {
    margin-left: 3px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
    min-width: 40px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; /* ✅ ADD: Make button the positioning reference */
}

.emoji-toggle-btn:hover {
    background-color: #e9ecef;
    transform: scale(1.05);
}

.emoji-toggle-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.emoji-box {
    position: absolute;
    bottom: 50px; /* ✅ CHANGE: Position above the button */
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    width: 200px;
}

.emoji-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-btn:hover {
    background-color: #f0f0f0;
    transform: scale(1.1);
}

.emoji-btn:active {
    background-color: #e9ecef;
}

  /* Media query for smaller screens */
@media (max-width: 600px) {
    .chatroom-body-contents {
        flex-direction: column;
        height: calc(100vh - 50px); /* Maintain a calculated height instead of auto */
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ddd;
        order: -1; /* Move sidebar above chat-area */
        overflow: hidden;
        transition: all 0.3s ease;
    }

    .sidebar:not(.expanded) {
        height: 50px; /* Exact height when collapsed */
    }

    .sidebar.expanded {
        height: auto;
        max-height: 250px;
    }

    .sidebar:not(.expanded) .user-list {
        display: none; /* Completely hide when not expanded */
    }

    .sidebar.expanded .user-list {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 16px;
    }

    .sidebar-header {
        cursor: pointer;
        padding: 10px 16px;
        justify-content: space-between;
        align-items: center;

    }

    .sidebar-header::after {
        content: "▼";
        transition: transform 0.3s ease;
    }
    
    .sidebar.expanded .sidebar-header::after {
        transform: rotate(180deg);
    }
    
    .user-list {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 16px;
        max-height: 120px;
        overflow-y: auto;
    }
    
    .user {
        margin-bottom: 0;
        white-space: nowrap;
        background-color: #f8f9fa;
        padding: 4px 8px;
        border-radius: 16px;
        border: 1px solid #e9ecef;
        font-size: 14px;
    }
    
    .chat-area {
        flex: 1;
        min-height: 50vh;
    }
    
    .room-info {
        display: none; /* Hide room info on mobile to save space */
    }
}

.status-dot.offline {
    background-color: #ef4444; /* red */
}

.online-status {
    transition: all 0.3s ease;
}

/* Additional responsive adjustments for very small screens */
@media (max-width: 480px) {
    .user-list {
        padding: 8px 12px;
        gap: 8px;
    }
    
    .user {
        font-size: 12px;
        padding: 3px 6px;
    }
    
    .status-dot {
        width: 8px;
        height: 8px;
        margin-right: 6px;
    }
}