* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 500px;
  height: 600px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.chat-header h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.header-info {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.status {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  display: inline-block;
}

.online-count {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.status.connected {
  background: #4caf50;
  color: white;
}

.status.disconnected {
  background: #f44336;
  color: white;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f5f5f5;
}

.message {
  margin-bottom: 15px;
  animation: slideIn 0.3s ease-in-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.system {
  text-align: center;
}

.message.system .message-content {
  display: inline-block;
  background: #e3f2fd;
  color: #1976d2;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-style: italic;
}

.message.user {
  text-align: right;
}

.message.user .message-content {
  display: inline-block;
  background: #667eea;
  color: white;
  padding: 10px 15px;
  border-radius: 12px 12px 4px 12px;
  max-width: 80%;
  word-wrap: break-word;
}

.message.other {
  text-align: left;
}

.message.other .message-content {
  display: inline-block;
  background: #e0e0e0;
  color: #333;
  padding: 10px 15px;
  border-radius: 12px 12px 12px 4px;
  max-width: 80%;
  word-wrap: break-word;
}

.message-username {
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 4px;
  color: #666;
}

.message.user .message-username {
  color: #667eea;
}

.message.other .message-username {
  color: #555;
}

.message-time {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

.message.user .message-time {
  color: #999;
}

.message.other .message-time {
  color: #999;
}

.chat-input-area {
  padding: 15px;
  background: white;
  border-top: 1px solid #e0e0e0;
}

.input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

#username,
#messageInput {
  flex: 1;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.3s;
}

#username {
  flex: 0 0 120px;
}

#username:focus,
#messageInput:focus {
  outline: none;
  border-color: #667eea;
}

.btn-send {
  padding: 12px 24px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.btn-send:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-send:active {
  transform: translateY(0);
}

.button-group {
  display: flex;
  gap: 10px;
}

.btn-reset {
  flex: 1;
  padding: 10px;
  background: #f44336;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-reset:hover {
  background: #d32f2f;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(244, 67, 54, 0.4);
}

.btn-reset:active {
  transform: translateY(0);
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #f5f5f5;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    height: 100vh;
    max-width: 100%;
    border-radius: 0;
  }

  .chat-header h1 {
    font-size: 20px;
  }

  #username {
    flex: 0 0 100px;
  }
}
