body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f8f6ff;
  color: #333333;
  line-height: 1.6;
}

main {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background-color: white;
  min-height: calc(100vh - 120px);
  box-shadow: 0 0 10px rgba(147, 112, 219, 0.1);
}

header {
  background-color: #9370db;
  color: white;
  padding: 1rem 0;
}

nav {
  background-color: #9370db;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav a {
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  margin: 0 4px;
  border-radius: 4px;
  transition: background-color 0.3s;
}

nav a:hover {
  background-color: #8a2be2;
}

button {
  background-color: #9370db;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

button:hover {
  background-color: #8a2be2;
}

.error {
  color: #721c24;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  padding: 10px;
  margin: 10px 0;
  border-radius: 4px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 8px;
  border: 2px solid #e6e6fa;
  border-radius: 4px;
  box-sizing: border-box;
  margin: 5px 0;
  transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #9370db;
}

.comment {
  border: 1px solid #e6e6fa;
  border-radius: 8px;
  padding: 15px;
  margin: 15px 0;
  background-color: white;
}

.comment-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 10px;
}

.comment-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #dda0dd;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-right: 10px;
}

.comment-meta {
  flex-grow: 1;
}

.comment-author {
  font-weight: bold;
  color: #333333;
}

.comment-date {
  color: #666666;
  font-size: 0.9em;
}

.comment-content {
  margin-top: 10px;
}

.comment-edited {
  color: #666666;
  font-style: italic;
  font-size: 0.8em;
}

.footer {
  background-color: #9370db;
  color: white;
  text-align: center;
  padding: 20px;
  margin-top: auto;
}

.form-buttons {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.button-secondary {
  background-color: #dda0dd;
  color: #333333;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 4px;
  display: inline-block;
  transition: background-color 0.3s;
}

.button-secondary:hover {
  background-color: #d8bfd8;
}

.button-danger {
  background-color: #dc3545;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.button-danger:hover {
  background-color: #c82333;
}

.danger-zone {
  border: 2px solid #dc3545;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  background-color: #fff5f5;
}

.danger-zone h3 {
  color: #dc3545;
  margin-top: 0;
}

.comment-actions {
  margin-left: auto;
}

.comment-action-link {
  color: #9370db;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.9em;
  transition: background-color 0.3s;
}

.comment-action-link:hover {
  background-color: #f8f6ff;
  text-decoration: underline;
}

.nav-user-info {
  display: flex;
  align-items: center;
  gap: 15px;
  color: white;
  font-weight: 500;
}

.profile-section {
  background-color: white;
  border: 1px solid #e6e6fa;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.profile-info {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.profile-avatar-section {
  flex-shrink: 0;
}

.profile-avatar-large {
  width: 100px;
  height: 100px;
  border-radius: 50%;
}

.profile-avatar-placeholder-large {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background-color: #dda0dd;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 2em;
}

.profile-details {
  flex-grow: 1;
}

.profile-field {
  margin: 10px 0;
  padding: 10px 0;
}

.form-group {
  margin: 15px 0;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #333333;
}

.form-group small {
  display: block;
  margin-top: 5px;
  color: #666666;
  font-size: 0.9em;
}

.security-section {
  background-color: #f8f6ff;
  border: 1px solid #e6e6fa;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.security-section h3 {
  color: #9370db;
  margin-top: 0;
}

/* Pagination styles */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 30px 0;
  padding: 20px 0;
  border-top: 1px solid #e6e6fa;
}

.pagination-link {
  background: #9370db;
  color: white;
  padding: 10px 20px;
  text-decoration: none;
  border-radius: 5px;
  transition: background 0.3s;
}

.pagination-link:hover {
  background: #8a2be2;
}

.pagination-current {
  font-weight: bold;
  color: #666666;
}

.pagination-info {
  text-align: center;
  margin-bottom: 20px;
  color: #666666;
  font-size: 0.9em;
}

.pagination-info p {
  margin: 0;
}

/* Chat Styles */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 70vh;
  background-color: white;
  border: 1px solid #e6e6fa;
  border-radius: 8px;
  overflow: hidden;
}

.chat-header {
  background-color: #9370db;
  color: white;
  padding: 15px 20px;
  border-bottom: 1px solid #8a2be2;
}

.chat-header h1 {
  margin: 0;
  font-size: 1.5em;
}

.chat-stats {
  font-size: 0.9em;
  opacity: 0.9;
  margin-top: 5px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background-color: #f8f6ff;
  scroll-behavior: smooth;
}

.chat-message {
  display: flex;
  align-items: flex-start;
  margin-bottom: 15px;
  padding: 10px;
  background-color: white;
  border-radius: 8px;
  border: 1px solid #e6e6fa;
}

.chat-message.own-message {
  background-color: #f0ebff;
  border-color: #dda0dd;
}

.chat-message.system-message {
  background-color: #fff5f5;
  border-color: #fbb6ce;
  justify-content: center;
  font-style: italic;
  color: #666666;
}

.chat-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  margin-right: 10px;
  flex-shrink: 0;
}

.chat-avatar-placeholder {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background-color: #dda0dd;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-right: 10px;
  flex-shrink: 0;
  font-size: 0.9em;
}

.chat-message-content {
  flex: 1;
}

.chat-message-header {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
}

.chat-user-name {
  font-weight: bold;
  color: #9370db;
  margin-right: 10px;
}

.chat-timestamp {
  font-size: 0.8em;
  color: #666666;
}

.chat-message-text {
  color: #333333;
  line-height: 1.4;
  word-wrap: break-word;
}

.typing-indicators {
  padding: 5px 15px;
  background-color: #f8f6ff;
  border-top: 1px solid #e6e6fa;
  min-height: 20px;
  font-style: italic;
  color: #666666;
  font-size: 0.9em;
}

.typing-indicator {
  margin-bottom: 3px;
}

.chat-input-container {
  padding: 15px;
  background-color: white;
  border-top: 1px solid #e6e6fa;
}

.chat-input-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input-wrapper {
  flex: 1;
  position: relative;
}

.chat-input {
  width: 100%;
  min-height: 20px;
  max-height: 100px;
  padding: 10px;
  border: 2px solid #e6e6fa;
  border-radius: 20px;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  box-sizing: border-box;
  transition: border-color 0.3s;
}

.chat-input:focus {
  outline: none;
  border-color: #9370db;
}

.chat-input::placeholder {
  color: #999999;
}

.char-counter {
  position: absolute;
  bottom: -20px;
  right: 10px;
  font-size: 0.8em;
  color: #666666;
}

.char-counter.warning {
  color: #ff6b35;
}

.char-counter.error {
  color: #dc3545;
}

.chat-send-button {
  background-color: #9370db;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s;
  white-space: nowrap;
}

.chat-send-button:hover:not(:disabled) {
  background-color: #8a2be2;
}

.chat-send-button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

/* Chat navigation link styling */
nav a[href="/chat"] {
  position: relative;
}

nav a[href="/chat"]:after {
  content: "💬";
  margin-left: 5px;
}

/* Responsive chat design */
@media (max-width: 768px) {
  .chat-container {
    height: 60vh;
  }
  
  .chat-header {
    padding: 10px 15px;
  }
  
  .chat-header h1 {
    font-size: 1.2em;
  }
  
  .chat-messages {
    padding: 10px;
  }
  
  .chat-message {
    padding: 8px;
    margin-bottom: 10px;
  }
  
  .chat-input-container {
    padding: 10px;
  }
  
  .chat-input-form {
    gap: 8px;
  }
  
  .chat-send-button {
    padding: 8px 15px;
    font-size: 0.9em;
  }
}

/* Scrollbar styling for chat messages */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background-color: #f8f6ff;
}

.chat-messages::-webkit-scrollbar-thumb {
  background-color: #dda0dd;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background-color: #d8bfd8;
}

/* Animation for new messages */
.chat-message {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Status indicators */
.chat-online-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #28a745;
  border-radius: 50%;
  margin-left: 5px;
}

.chat-offline-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #6c757d;
  border-radius: 50%;
  margin-left: 5px;
}

/* Chat message avatars - much smaller than comment avatars */
.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px;
}

.message-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #9370db;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  margin-right: 8px;
  flex-shrink: 0;
}

/* Message header layout */
.message-header {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.message-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.message-author {
  font-weight: bold;
  color: #9370db;
  font-size: 14px;
}

.message-time {
  font-size: 12px;
  color: #666;
}

/* Chat message container */
.chat-message {
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background-color: #f8f6ff;
  border-left: 3px solid #dda0dd;
}

.chat-message.own-message {
  background-color: #e6d3f7;
  border-left-color: #9370db;
  margin-left: 20px;
}

.message-content {
  margin-top: 4px;
  line-height: 1.4;
  word-wrap: break-word;
}
