body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
}

.container {
    margin: 0 auto;
    background-color: white;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    color: #333;
}

.connection-panel {
    background-color: #f0f8ff;
    padding: 15px;
}

.connection-panel div {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.connection-panel label {
    width: 80px;
    font-weight: bold;
}

.connection-panel input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    margin-right: 10px;
}

.connection-panel button {
    padding: 8px 15px;
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
}

.connection-panel button:hover {
    background-color: #45a049;
}

.chat-container {
    border: 1px solid #ddd;
    overflow: hidden;
}

.messages {
    height: 400px;
    overflow-y: auto;
    padding: 15px;
    background-color: #f9f9f9;
}

.message {
    margin-bottom: 15px;
    padding: 10px;
    word-wrap: break-word;
}

.message.sent {
    background-color: #e3f2fd;
    margin-left: auto;
}

.message.received {
    background-color: #f1f1f1;
    margin-right: auto;
}

.message-info {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.message-text {
    margin: 5px 0;
}

.message-file, .message-image {
    margin-top: 10px;
}

.message-image img {
    max-width: 100%;
    max-height: 200px;
}

.input-area {
    border-top: 1px solid #ddd;
    padding: 15px;
    background-color: white;
}

input[type="text"]:focus, textarea:focus {
    outline: none;
    border: 1px solid #2196F3; /* 只有1px的蓝色边框 */
    box-shadow: none; /* 移除默认的阴影效果 */
}

textarea {
    width: 100%;
    height: 100px;
    border: 1px solid #ddd;
    resize: none;
    margin-bottom: 10px;
    font-family: Tahoma, sans-serif;
}

.buttons {
    padding: 8px 15px;
    border: none;
    cursor: pointer;
}

#send-message {
    background-color: #4CAF50;
    color: white;
}

#send-file, #send-image {
    background-color: #2196F3;
    color: white;
}

#send-message:hover {
    background-color: #45a049;
}

#send-file:hover, #send-image:hover {
    background-color: #0b7dda;
}

#register {
    padding: 8px 15px;
    background-color: #2196F3;
    color: white;
    border: none;
    cursor: pointer;
}

#register:hover {
    background-color: #0b7dda;
}

#register:disabled {
    background-color: #999;
    cursor: not-allowed;
}

/* 按钮样式调整 */
#register, #connect {
    width: 80px; /* 固定宽度 */
    padding: 8px 0; /* 调整内边距 */
    text-align: center;
}

/* 底部按钮右对齐 */
.buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end; /* 右对齐 */
}

/* 系统消息样式修改 */
.message.system {
    background-color: #f5f5f5; /* 灰色背景 */
    border-left: 4px solid #9e9e9e; /* 灰色左边框 */
    text-align: left; /* 左对齐 */
    margin: 10px 0; /* 调整边距 */
    max-width: 100%; /* 恢复全宽 */
    font-size: small;
    padding: 2px;
}

/* 对方消息样式修改 */
.message.received {
    background-color: #e8f5e9; /* 淡绿色背景 */
    border-left: 4px solid #81c784; /* 绿色左边框 */
}

/* 错误消息样式 */
.message.error {
    background-color: #ffebee; /* 浅红色背景 */
    border-left: 4px solid #f44336; /* 红色左边框 */
    text-align: left; /* 左对齐 */
    font-size: small;
    padding: 2px;
}