* {
  box-sizing: border-box;
  font-family: "Segoe UI", Arial, sans-serif;
}

body {
  background: linear-gradient(135deg, #667eea, #764ba2);
  height: 100vh;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Card entrance animation */
@keyframes popIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.chat-container {
  background: white;
  width: 420px;
  max-height: 600px;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  padding: 20px;
  display: flex;
  flex-direction: column;
  animation: popIn 0.6s ease-out;
}

h2 {
  text-align: center;
  margin-bottom: 15px;
}

/* Inputs */
input {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  outline: none;
  font-size: 14px;
  transition:
    border 0.2s,
    box-shadow 0.2s;
}

input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* Sections */
.room-section,
.message-section {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Buttons */
button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: #667eea;
  color: white;
  cursor: pointer;
  font-size: 14px;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

button:hover {
  background: #5563d6;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

button:active {
  transform: scale(0.95);
}

/* Messages box */
ul {
  list-style: none;
  padding: 10px;
  margin-top: 12px;
  flex: 1;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
}

/* Message animation */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

li {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #e9e9e9;
  border-radius: 12px;
  font-size: 14px;
  max-width: 80%;
  animation: slideIn 0.2s ease-out;
}

/* Header: username + time */
.msg-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.sender {
  font-weight: bold;
  color: #333;
}

.time {
  font-size: 11px;
  color: gray;
}

/* Message text */
.msg-body {
  font-size: 14px;
  color: #000;
  word-wrap: break-word;
}

/* My messages */
.my-message {
  background: #d1e7ff;
  align-self: flex-end;
  margin-left: auto;
}

/* Scrollbar (optional nice look) */
ul::-webkit-scrollbar {
  width: 6px;
}

ul::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

ul::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}
