body {
  font-family: Arial, sans-serif;
  background: #f5f5f5;
  padding: 2rem;
  text-align: center;
  color: #333;
}

h2 {
  margin-top: 2rem;
  color: #444;
}

#messageForm {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1rem;
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

#messageForm input,
#messageForm textarea,
#messageForm button {
  font-family: inherit;
}

#messageForm input,
#messageForm textarea {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 16px;
  box-sizing: border-box;
  transition: border-color 0.3s, box-shadow 0.3s;
}

#messageForm textarea {
  resize: vertical;
  min-height: 50px;
  max-height: 400px;
  overflow-y: auto;
}

#messageForm input:focus,
#messageForm textarea:focus {
  border-color: #007BFF;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
  outline: none;
}

#messageForm button {
  padding: 12px 20px;
  margin-top: 12px;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.3s;
}

#messageForm button:hover {
  background-color: #218838;
}

#messageList {
  list-style: none;
  padding: 0;
  margin-top: 1rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

#messageList li {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  text-align: left;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  word-wrap: break-word;
}

#messageList li .username {
  display: block;
  font-weight: bold;
  margin-bottom: 0.5rem;
  background-color: #007BFF;
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.9rem;
  max-width: fit-content;
}

.message-content span:last-child {
  display: block;
  color: #555;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-bottom: 1rem;
}

.message-buttons {
  display: flex;
  gap: 0.5rem;
}

.message-buttons .edit-btn,
.message-buttons .delete-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.3s, color 0.3s;
}

.message-buttons .edit-btn {
  background-color: #ffc107;
  color: #333;
}

.message-buttons .edit-btn:hover {
  background-color: #e0a800;
  color: #fff;
}

.message-buttons .delete-btn {
  background-color: #dc3545;
  color: #fff;
}

.message-buttons .delete-btn:hover {
  background-color: #bd2130;
}

#pagination {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 10px;
}

#pagination button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background-color: #007BFF;
  color: white;
  transition: background 0.3s;
}

#pagination button:disabled {
  background-color: #ccc;
  cursor: default;
}

#pagination button:hover:not(:disabled) {
  background-color: #0056b3;
}

#pageInfo {
  display: flex;
  align-items: center;
  font-weight: bold;
}

.message-timestamp {
  font-size: 0.8rem;
  color: #888;
}

.message-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

#siteHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: #ff6b6b;
  color: white;
  border-radius: 12px;
  max-width: 1200px;
  margin: 0 auto 2rem auto;
}

#siteHeader h1 {
  margin: 0;
  font-size: 1.5rem;
}

#siteHeader .header-right button {
  margin-left: 0.5rem;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
}

#signupBtn {
  background-color: #28a745;
  color: white;
}

#signupBtn:hover {
  background-color: #218838;
}

#loginBtn {
  background-color: #6f42c1;
  color: white;
}

#loginBtn:hover {
  background-color: #5936a2;
}

.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
}

.modal-content {
  background-color: #fff;
  margin: 10% auto;
  padding: 2rem;
  border-radius: 12px;
  max-width: 400px;
  text-align: center;
  position: relative;
}

.close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
}

#authForm input {
  width: 90%;
  padding: 10px;
  margin: 8px 0;
  border-radius: 8px;
  border: 1px solid #ccc;
}

#authForm button {
  padding: 10px 20px;
  margin-top: 12px;
  background-color: #6f42c1;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#authForm button:hover {
  background-color: #5936a2;
}

#switchAuthText a {
  cursor: pointer;
  color: #007BFF;
  text-decoration: underline;
}

#searchForm {
  display: flex;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
  justify-content: center;
}

#searchContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 1rem auto;
  max-width: 500px;
  background: #fff;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#searchInput {
  flex: 2;
  min-width: 150px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
}

#searchInput:focus {
  border-color: #007BFF;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
  outline: none;
}

#searchBtn,
#clearSearchBtn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.3s, color 0.3s;
}

#searchBtn {
  background-color: #007BFF;
  color: white;
}

#searchBtn:hover {
  background-color: #0056b3;
}

#clearSearchBtn {
  background-color: #6c757d;
  color: white;
}

#clearSearchBtn:hover {
  background-color: #5a6268;
}
