/* Messaging Styles */
.messaging-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1rem;
  height: calc(100vh - 200px);
  background: var(--bg-panel-alt);
}

.conversations-panel {
  background: var(--bg-panel);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-y: auto;
}

.conversations-panel h3 {
  margin-top: 0;
  color: var(--text-light);
  font-size: 1rem;
}

.conversations-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.conversation-item {
  padding: 0.75rem;
  background: var(--bg-panel-alt);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  border-left: 4px solid transparent;
}

.conversation-item:hover {
  background: rgba(59, 130, 246, 0.1);
  border-left-color: var(--primary);
}

.conversation-item.active {
  background: rgba(59, 130, 246, 0.2);
  border-left-color: var(--primary);
  color: var(--primary);
}

.conversation-item h4 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-light);
}

.conversation-item p {
  margin: 0.25rem 0 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.unread-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

/* chat panel */
.chat-panel {
  background: var(--bg-panel);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 1rem;
  border-bottom: 1px solid #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h3 {
  margin: 0;
  color: var(--text-light);
}

.status-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-badge.en-route {
  background: #3b82f6;
  color: white;
}

.status-badge.arrived {
  background: #fbbf24;
  color: #000;
}

.status-badge.working {
  background: #ef4444;
  color: white;
}

.status-badge.completed {
  background: #22c55e;
  color: white;
}

/* messages area */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  display: flex;
  gap: 0.75rem;
  max-width: 80%;
}

.message.own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-bubble {
  background: var(--bg-panel-alt);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: var(--text-light);
  word-break: break-word;
}

.message.own .message-bubble {
  background: var(--primary);
  color: white;
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  align-self: flex-end;
}

.status-update {
  text-align: center;
  padding: 0.5rem;
  background: rgba(59, 130, 246, 0.1);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--primary);
}

/* status updates */
.status-updates {
  padding: 1rem;
  border-bottom: 1px solid #334155;
}

.status-updates h4 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: var(--text-light);
}

.status-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.5rem;
}

.status-btn {
  padding: 0.5rem;
  background: var(--bg-panel-alt);
  color: var(--text-light);
  border: 1px solid #334155;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
}

.status-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* message input */
.message-input-area {
  padding: 1rem;
  border-top: 1px solid #334155;
}

#messageInput {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg-panel-alt);
  color: var(--text-light);
  border: 1px solid #334155;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  margin-bottom: 0.75rem;
}

#messageInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#sendBtn {
  width: 100%;
  padding: 0.75rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: all var(--transition);
}

#sendBtn:hover {
  background: #2563eb;
}

#sendBtn:active {
  transform: scale(0.98);
}

/* responsive */
@media (max-width: 768px) {
  .messaging-container {
    grid-template-columns: 1fr;
  }

  .conversations-panel {
    display: none;
  }

  .message {
    max-width: 100%;
  }
}
