/* ============================================
   Chat Interface - Professional Style
   ============================================ */

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(20, 22, 32, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

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

.chat-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  border: 2px solid var(--border-default);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.chat-avatar .initial {
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

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

.chat-status {
  font-size: 12px;
  color: var(--text-muted);
}

/* Chat Container */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Messages */
.message {
  display: flex;
  gap: 12px;
  max-width: 70%;
  animation: messageIn 0.3s var(--ease-out);
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
  align-self: flex-end;
  border: 2px solid var(--border-default);
  overflow: hidden;
}

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

.message-avatar .initial {
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.message.user .message-avatar {
  display: none;
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-blue);
  margin-left: 4px;
}

.message.user .message-name {
  display: none;
}

.bubble {
  padding: 14px 18px;
  border-radius: 20px;
  line-height: 1.6;
  font-size: 14px;
  word-wrap: break-word;
}

.message.user .bubble {
  background: var(--gradient-primary);
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 16px rgba(58, 123, 255, 0.25);
}

.message.assistant .bubble {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
  border: 1px solid var(--border-subtle);
}

/* Typing Indicator */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 16px 20px;
}

.typing-bubble .dot {
  width: 8px;
  height: 8px;
  background: var(--accent-blue);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-bubble .dot:nth-child(1) { animation-delay: 0s; }
.typing-bubble .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Chat Form */
.chat-form {
  padding: 20px 24px;
  background: rgba(20, 22, 32, 0.8);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
}

.input-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-form textarea {
  flex: 1;
  padding: 14px 20px;
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: 24px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 48px;
  max-height: 140px;
  line-height: 1.5;
  transition: all 0.2s var(--ease-out);
}

.chat-form textarea::placeholder {
  color: var(--text-muted);
}

.chat-form textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(58, 123, 255, 0.1);
}

.send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--gradient-primary);
  color: white;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(58, 123, 255, 0.3);
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(58, 123, 255, 0.4);
}

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

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

/* Shared Chat */
#view-shared {
  overflow-y: auto;
}

.participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.participant-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Mobile */
@media (max-width: 768px) {
  .chat-header {
    padding: 14px 16px;
  }

  .chat-avatar {
    width: 38px;
    height: 38px;
    font-size: 15px;
  }

  .chat-name {
    font-size: 15px;
  }

  .chat-status {
    display: none;
  }

  .messages {
    padding: 16px;
    gap: 16px;
  }

  .message {
    max-width: 85%;
  }

  .message-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .bubble {
    padding: 12px 16px;
    font-size: 15px;
  }

  .chat-form {
    padding: 14px 16px;
  }

  .chat-form textarea {
    padding: 12px 16px;
    font-size: 16px;
    min-height: 44px;
  }

  .send-btn {
    width: 44px;
    height: 44px;
  }

  .send-btn svg {
    width: 18px;
    height: 18px;
  }
}
