/* Messages Page */
.messages-page {
  min-height: calc(100vh - 64px);
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 2rem 1rem;
}

.messages-container {
  max-width: 800px;
  margin: 0 auto;
}

.messages-header {
  text-align: center;
  margin-bottom: 2rem;
}

.messages-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

/* Conversations List */
.conversations-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.conversation-item:hover {
  border-color: rgba(247, 147, 26, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

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

.conversation-avatar .avatar-image,
.conversation-avatar .avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.conversation-avatar .avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f7931a 0%, #ff6b00 100%);
  color: #fff;
  font-weight: 600;
  font-size: 1.25rem;
}

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

.conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.conversation-name {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-time {
  font-size: 0.75rem;
  color: #64748b;
  flex-shrink: 0;
}

.conversation-preview {
  font-size: 0.875rem;
  color: #94a3b8;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-sender {
  color: #64748b;
}

.conversation-arrow {
  flex-shrink: 0;
  color: #64748b;
}

/* Conversation View */
.conversation-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px - 4rem);
  padding: 0;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  overflow: hidden;
}

.conversation-header-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.back-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #94a3b8;
  transition: all 0.2s ease;
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.conversation-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.conversation-user-info:hover {
  opacity: 0.8;
}

.conversation-header-bar .conversation-avatar .avatar-image,
.conversation-header-bar .conversation-avatar .avatar-placeholder {
  width: 40px;
  height: 40px;
}

.conversation-header-bar .conversation-name {
  font-size: 1.125rem;
}

/* Messages Container */
.conversation-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.empty-conversation {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  text-align: center;
}

/* Message Bubbles */
.message {
  display: flex;
  max-width: 75%;
}

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

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

.message-bubble {
  padding: 0.75rem 1rem;
  border-radius: 16px;
  position: relative;
}

.message-sent .message-bubble {
  background: linear-gradient(135deg, #f7931a 0%, #ff6b00 100%);
  border-bottom-right-radius: 4px;
}

.message-received .message-bubble {
  background: rgba(51, 65, 85, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-left-radius: 4px;
}

.message-content {
  margin: 0 0 0.25rem;
  color: #fff;
  font-size: 0.9375rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message-time {
  display: block;
  font-size: 0.6875rem;
  text-align: right;
}

.message-sent .message-time {
  color: rgba(255, 255, 255, 0.7);
}

.message-received .message-time {
  color: #64748b;
}

/* Message Form */
.message-form {
  padding: 1rem 1.25rem;
  background: rgba(15, 23, 42, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.message-input-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.message-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: rgba(51, 65, 85, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  color: #fff;
  font-size: 0.9375rem;
  resize: none;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s ease;
}

.message-input::placeholder {
  color: #64748b;
}

.message-input:focus {
  border-color: rgba(247, 147, 26, 0.5);
}

.message-submit {
  flex-shrink: 0;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #f7931a 0%, #ff6b00 100%);
  border: none;
  border-radius: 24px;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.message-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(247, 147, 26, 0.3);
}

.message-errors {
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #f87171;
  font-size: 0.875rem;
}

/* Empty State */
.messages-page .empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
}

.messages-page .empty-state-icon {
  margin-bottom: 1rem;
  color: #64748b;
}

.messages-page .empty-state p {
  color: #94a3b8;
  font-size: 1rem;
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .messages-page {
    padding: 1rem;
  }

  .conversation-view {
    height: calc(100vh - 64px - 2rem);
    border-radius: 12px;
  }

  .messages-header h1 {
    font-size: 1.5rem;
  }

  .conversation-item {
    padding: 0.875rem 1rem;
  }

  .conversation-avatar .avatar-image,
  .conversation-avatar .avatar-placeholder {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .conversation-name {
    font-size: 0.9375rem;
  }

  .conversation-preview {
    font-size: 0.8125rem;
  }

  .message {
    max-width: 85%;
  }

  .conversation-messages {
    padding: 1rem;
  }

  .message-form {
    padding: 0.875rem 1rem;
  }

  .message-submit {
    padding: 0.75rem 1rem;
  }
}
