/* Chats List Styles */
.chats-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.chats-header {
  margin-bottom: 24px;
}

.chats-header h1 {
  font-size: 28px;
}

.chats-list {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
}

.chat-item:last-child {
  border-bottom: none;
}

.chat-item:hover {
  background: var(--bg-light);
}

.chat-item.unread {
  background: #eff6ff;
}

.chat-avatar {
  flex-shrink: 0;
}

.avatar-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
}

.chat-info {
  flex: 1;
  min-width: 0;
}

.chat-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.chat-user-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-color);
}

.chat-time {
  font-size: 12px;
  color: #9ca3af;
}

.chat-ad-title {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-last-message {
  font-size: 14px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-prefix {
  font-weight: 600;
  color: var(--text-color);
}

.unread-badge {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

/* Chat Show Styles */
.chat-show-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 84px);
  max-width: 1000px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: white;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-button {
  color: var(--text-color);
  text-decoration: none;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.back-button:hover {
  background: var(--bg-light);
}

.chat-header-info h2 {
  font-size: 18px;
  margin: 0;
}

.ad-title-link {
  font-size: 13px;
  color: #6b7280;
  text-decoration: none;
}

.ad-title-link:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.language-toggle-btn {
  padding: 8px 16px;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.language-toggle-btn:hover {
  background: var(--border-color);
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  background: #f9fafb;
  padding: 20px;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  display: flex;
  max-width: 70%;
}

.message-sent {
  align-self: flex-end;
  justify-content: flex-end;
}

.message-received {
  align-self: flex-start;
  justify-content: flex-start;
}

.message-bubble {
  background: white;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message-sent .message-bubble {
  background: var(--primary-color);
  color: white;
}

.message-content {
  word-wrap: break-word;
  line-height: 1.5;
}

.message-content p {
  margin: 0;
}

.message-translation {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-style: italic;
  opacity: 0.9;
}

.message-sent .message-translation {
  border-top-color: rgba(255, 255, 255, 0.3);
}

.message-attachment {
  margin-top: 8px;
}

.attachment-image {
  max-width: 100%;
  border-radius: 8px;
}

.attachment-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  padding: 8px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

.message-sent .attachment-link {
  background: rgba(255, 255, 255, 0.2);
}

.attachment-link:hover {
  background: rgba(0, 0, 0, 0.1);
}

.message-meta {
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.7;
}

.message-input-container {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: white;
}

.message-form {
  display: flex;
  gap: 12px;
}

.message-input-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-light);
  border-radius: 24px;
  padding: 8px 12px;
}

.message-input {
  flex: 1;
  border: none;
  background: none;
  resize: none;
  font-size: 15px;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  font-family: inherit;
}

.message-input:focus {
  outline: none;
}

.send-button {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.send-button:hover {
  background: var(--primary-hover);
}

.send-button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.send-button .icon {
  width: 20px;
  height: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .chat-show-container {
    height: calc(100vh - 64px);
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .message {
    max-width: 85%;
  }

  .chat-header {
    padding: 12px 16px;
  }

  .messages-container {
    padding: 16px;
  }

  .message-input-container {
    padding: 12px 16px;
  }
}
