/* Inbox/Messages Page Styles */

.inbox-page {
  background: var(--bg-cream);
  padding: 48px 0;
  min-height: calc(100vh - 300px);
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 38px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Inbox Layout */
.inbox-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  height: calc(100vh - 280px);
  min-height: 600px;
}

/* Conversations Panel */
.conversations-panel {
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  background: var(--bg-light);
}

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

.conversations-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.conversations-list {
  overflow-y: auto;
  flex: 1;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
  border-bottom: 1px solid var(--border-color);
}

.conversation-item:hover {
  background: rgba(20, 17, 15, 0.03);
}

.conversation-item.active {
  background: var(--bg-white);
  border-left: 3px solid var(--accent-color);
  padding-left: 17px;
}

.conversation-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.conversation-content {
  flex: 1;
  min-width: 0;
}

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

.conversation-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.conversation-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.conversation-preview {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unread-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-color);
  flex-shrink: 0;
}

/* Messages Panel */
.messages-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-white);
}

.messages-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  gap: 20px;
}

.chat-user-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: white;
}

.chat-user-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-user-status {
  font-size: 13px;
  color: var(--text-secondary);
}

.chat-listing-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-light);
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.chat-listing-info img {
  width: 48px;
  height: 64px;
  border-radius: 6px;
  object-fit: cover;
}

.chat-listing-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-listing-price {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Messages Container */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-cream);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-date {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 12px 0;
  font-weight: 500;
}

.message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.message-received {
  flex-direction: row;
}

.message-sent {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 65%;
}

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

.message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  word-wrap: break-word;
}

.message-received .message-bubble {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.message-sent .message-bubble {
  background: var(--primary-color);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-bubble p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.message-time {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 0 4px;
}

/* Messages Input */
.messages-input {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-white);
}

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

.message-input {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  font-size: 15px;
  background: var(--bg-light);
  transition: border-color 0.2s, background 0.2s;
}

.message-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: var(--bg-white);
}

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

.send-button:hover {
  background: var(--secondary-color);
  transform: scale(1.05);
}

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

/* Responsive */
@media (max-width: 1024px) {
  .inbox-layout {
    grid-template-columns: 320px 1fr;
  }

  .message-content {
    max-width: 75%;
  }
}

@media (max-width: 768px) {
  .inbox-page {
    padding: 24px 0;
  }

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

  .inbox-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 220px);
  }

  .conversations-panel {
    display: none;
  }

  .conversations-panel.mobile-show {
    display: flex;
  }

  .messages-panel.mobile-hide {
    display: none;
  }

  .messages-header {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .chat-listing-info {
    width: 100%;
  }

  .message-content {
    max-width: 85%;
  }

  .messages-container {
    padding: 16px;
  }

  .messages-input {
    padding: 12px 16px;
  }
}
