Style the Chat Interface
Create public/style.css to make the application easier to use.
The styles below create a simple centered chat interface with a scrollable message container and a responsive layout.
public/style.css
* {
box-sizing: border-box;
}
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
padding: 20px;
background: #f3f4f6;
font-family: Arial, sans-serif;
}
.chat-container {
width: 100%;
max-width: 600px;
background: #ffffff;
border-radius: 12px;
padding: 24px;
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}
header {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
}
.messages {
height: 350px;
overflow-y: auto;
padding: 16px;
margin: 20px 0;
background: #f9fafb;
border-radius: 8px;
}
.message {
padding: 10px;
margin-bottom: 10px;
background: #e5e7eb;
border-radius: 8px;
overflow-wrap: anywhere;
}
input {
min-width: 0;
padding: 12px;
border: 1px solid #d1d5db;
border-radius: 6px;
}
button {
padding: 12px 16px;
border: none;
border-radius: 6px;
background: #2563eb;
color: white;
cursor: pointer;
}
button:disabled,
input:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.user-panel,
#message-form {
display: flex;
gap: 8px;
}
.user-panel input,
#message-form input {
flex: 1;
}
@media (max-width: 480px) {
.chat-container {
padding: 14px;
}
header {
align-items: flex-start;
flex-direction: column;
}
}Provides a responsive layout, message list, input controls, and button styling.