/* Simple Chat Component Styles */
.simple-chat {
  display: flex;
  flex-direction: column;
  height: 500px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--color-white);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Header */
.chat-header {
  padding: 16px 20px;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-color);
}

.chat-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-title h4 {
  font-size: var(--font-18);
  font-weight: 600;
  color: var(--typo-secondary);
  margin: 0;
}

.status-indicator {
  font-size: var(--font-xs);
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.status-indicator.connected {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.status-indicator.disconnected {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-color);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 12px;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-color);
  text-align: center;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 20px;
}

/* Individual Messages */
.message {
  display: flex;
  gap: 12px;
  max-width: 80%;
}

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

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

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

.message-avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

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

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.sender-name {
  font-size: var(--font-small);
  font-weight: 600;
  color: var(--typo-secondary);
}

.message-time {
  font-size: var(--font-xs);
  color: var(--text-color);
}

.message-body {
  background: var(--bg-light);
  padding: 12px 16px;
  border-radius: 16px;
  position: relative;
}

.message.sent .message-body {
  background: var(--color-primary);
  color: var(--color-white);
  border-radius: 16px 16px 4px 16px;
}

.message.received .message-body {
  background: var(--bg-light);
  color: var(--typo-secondary);
  border-radius: 16px 16px 16px 4px;
}

.message-body p {
  margin: 0;
  font-size: var(--font-small);
  line-height: 1.5;
  word-wrap: break-word;
}

.message-status {
  text-align: right;
  margin-top: 4px;
}

.message-status span {
  font-size: 10px;
  opacity: 0.8;
}

.message-status .read {
  color: #22c55e;
  opacity: 1;
}

.message.sent .message-status span {
  color: rgba(255, 255, 255, 0.8);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 0 20px;
  background: var(--bg-light);
  border-radius: 16px;
  max-width: 120px;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-color);
  animation: typing-pulse 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

.typing-indicator small {
  font-size: var(--font-xs);
  color: var(--text-color);
}

/* Input */
.chat-input {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--color-white);
}

.chat-disabled {
  text-align: center;
  color: var(--text-color);
  font-style: italic;
}

.input-form {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-light);
  border-radius: 24px;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--border-color);
}

.message-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 8px 0;
  font-size: var(--font-small);
  color: var(--typo-secondary);
}

.message-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.message-input::placeholder {
  color: var(--text-color);
}

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

.send-button:hover:not(:disabled) {
  background: #d6610e;
  transform: scale(1.05);
}

.send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Animations */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes typing-pulse {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  30% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Scrollbar Styles */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: var(--bg-light);
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--text-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  .simple-chat {
    height: 400px;
  }
  
  .chat-header {
    padding: 12px 16px;
  }
  
  .chat-title h4 {
    font-size: var(--font-16);
  }
  
  .messages-list {
    padding: 0 16px;
    gap: 12px;
  }
  
  .message {
    max-width: 90%;
  }
  
  .message-avatar img {
    width: 32px;
    height: 32px;
  }
  
  .message-body {
    padding: 10px 14px;
  }
  
  .chat-input {
    padding: 12px 16px;
  }
  
  .input-form {
    padding: 6px 6px 6px 12px;
  }
  
  .send-button {
    width: 36px;
    height: 36px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .simple-chat {
    background: #1f2937;
    border-color: #4b5563;
  }
  
  .chat-header {
    background: #374151;
    border-bottom-color: #4b5563;
  }
  
  .chat-messages {
    background: #1f2937;
  }
  
  .message-body {
    background: #374151;
    color: #f9fafb;
  }
  
  .message.received .message-body {
    background: #374151;
    color: #f9fafb;
  }
  
  .chat-input {
    background: #1f2937;
    border-top-color: #4b5563;
  }
  
  .input-form {
    background: #374151;
    border-color: #4b5563;
  }
}