/* Team Chat Styles - WhatsApp/Slack inspired */

/* Main Container - Split Panel Layout */
.team-chat-container {
  display: flex;
  height: calc(100vh - 140px);
  background: #f8fafc;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Sidebar - Team List */
.team-chat-sidebar {
  width: 320px;
  min-width: 320px;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
}

.team-chat-sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.team-chat-sidebar-header h5 {
  color: #1e293b;
  font-weight: 600;
}

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

/* Team Item */
.team-chat-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.15s ease;
}

.team-chat-item:hover {
  background: #f8fafc;
}

.team-chat-item.active {
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
}

.team-chat-item.unread .team-chat-name,
.team-chat-item.unread .team-chat-preview {
  font-weight: 600;
}

.team-chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.team-chat-info {
  flex: 1;
  min-width: 0;
  margin-left: 12px;
}

.team-chat-name {
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-chat-badge {
  background: #3b82f6;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.team-chat-preview {
  font-size: 13px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.team-chat-time {
  font-size: 11px;
  color: #94a3b8;
  margin-left: 8px;
  white-space: nowrap;
}

/* Main Chat Area */
.team-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
  min-width: 0;
}

.team-chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
}

.team-chat-empty > i {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.team-chat-empty p {
  font-size: 15px;
  margin: 0;
  color: #64748b;
}

.team-chat-empty .btn {
  font-size: 13px;
  font-weight: 500;
}

/* Chat Header */
.team-chat-header {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

.team-chat-header .team-chat-avatar {
  width: 40px;
  height: 40px;
  font-size: 13px;
}

.team-chat-header-info {
  margin-left: 12px;
}

.team-chat-header-info h6 {
  color: #1e293b;
  font-weight: 600;
}

/* Messages Area */
.team-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
}

.team-chat-empty-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
}

.team-chat-empty-messages i {
  font-size: 3rem;
  margin-bottom: 12px;
}

.team-chat-empty-messages p {
  margin: 0;
  font-size: 15px;
}

.team-chat-empty-messages small {
  color: #cbd5e1;
}

/* Load More Button */
.team-chat-load-more {
  text-align: center;
  padding: 12px;
  margin-bottom: 16px;
}

/* Date Divider */
.team-chat-date-divider {
  text-align: center;
  margin: 16px 0;
  position: relative;
}

.team-chat-date-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: #e2e8f0;
}

.team-chat-date-divider::after {
  content: attr(data-text);
}

.team-chat-date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
}

.team-chat-date-divider span,
.team-chat-date-divider {
  background: #f1f5f9;
  padding: 4px 12px;
  font-size: 12px;
  color: #64748b;
  border-radius: 12px;
  position: relative;
  z-index: 1;
}

/* Message Styles */
.team-chat-message {
  display: flex;
  margin-bottom: 8px;
  align-items: flex-end;
}

.team-chat-message.consecutive {
  margin-top: -4px;
}

.team-chat-message.consecutive .team-chat-message-content {
  margin-left: 44px;
}

.team-chat-message.own {
  flex-direction: row-reverse;
}

.team-chat-message.own.consecutive .team-chat-message-content {
  margin-left: 0;
  margin-right: 0;
}

.team-chat-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  margin-bottom: 4px;
}

.team-chat-message-content {
  max-width: 65%;
  margin-left: 8px;
}

.team-chat-message.own .team-chat-message-content {
  margin-left: 0;
  margin-right: 8px;
}

.team-chat-message-author {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 2px;
  margin-left: 12px;
}

.team-chat-message.own .team-chat-message-author {
  display: none;
}

.team-chat-message-bubble {
  background: #fff;
  padding: 8px 12px;
  border-radius: 16px;
  border-top-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  position: relative;
}

.team-chat-message.own .team-chat-message-bubble {
  background: #3b82f6;
  color: #fff;
  border-radius: 16px;
  border-top-right-radius: 4px;
  border-top-left-radius: 16px;
}

.team-chat-message.consecutive .team-chat-message-bubble {
  border-radius: 16px;
}

.team-chat-message.own.consecutive .team-chat-message-bubble {
  border-radius: 16px;
}

.team-chat-message-text {
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.team-chat-message-text a {
  color: #2563eb;
  text-decoration: underline;
}

.team-chat-message.own .team-chat-message-text a {
  color: #bfdbfe;
}

.team-chat-message-time {
  font-size: 10px;
  color: #94a3b8;
  margin-left: 8px;
  white-space: nowrap;
}

.team-chat-message.own .team-chat-message-time {
  color: rgba(255, 255, 255, 0.7);
}

/* Typing Indicator */
.team-chat-typing {
  display: flex;
  align-items: center;
  padding: 8px 20px;
  font-size: 13px;
  color: #64748b;
  background: #f1f5f9;
}

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

.typing-dots span {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out both;
}

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

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

@keyframes typingDot {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Message Input */
.team-chat-input {
  display: flex;
  align-items: flex-end;
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  gap: 12px;
}

.team-chat-input textarea {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 120px;
  transition: border-color 0.2s;
}

.team-chat-input textarea:focus {
  border-color: #3b82f6;
}

.team-chat-input textarea::placeholder {
  color: #94a3b8;
}

.team-chat-send {
  width: 40px;
  height: 40px;
  border: none;
  background: #3b82f6;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  flex-shrink: 0;
}

.team-chat-send:hover {
  background: #2563eb;
}

.team-chat-send:active {
  transform: scale(0.95);
}

.team-chat-send i {
  font-size: 16px;
  margin-left: 2px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .team-chat-container {
    height: calc(100vh - 120px);
    border-radius: 0;
  }

  .team-chat-sidebar {
    width: 100%;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 10;
    transition: transform 0.3s ease;
  }

  .team-chat-sidebar.hidden {
    transform: translateX(-100%);
  }

  .team-chat-message-content {
    max-width: 80%;
  }
}

/* Scrollbar Styling */
.team-chat-list::-webkit-scrollbar,
.team-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.team-chat-list::-webkit-scrollbar-track,
.team-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.team-chat-list::-webkit-scrollbar-thumb,
.team-chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.team-chat-list::-webkit-scrollbar-thumb:hover,
.team-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Chat Header Actions */
.team-chat-header-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* Color Picker */
.team-color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.team-color-picker input[type="radio"] {
  display: none;
}

.team-color-picker label {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
}

.team-color-picker label:hover {
  transform: scale(1.1);
}

.team-color-picker input[type="radio"]:checked + label {
  border-color: #1e293b;
  transform: scale(1.1);
}

/* User List (for invite) */
.team-user-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.team-user-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.15s;
}

.team-user-item:last-child {
  border-bottom: none;
}

.team-user-item:hover {
  background: #f8fafc;
}

.team-user-item input[type="checkbox"] {
  margin-right: 12px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.team-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  margin-right: 12px;
}

.team-user-info {
  flex: 1;
  min-width: 0;
}

.team-user-name {
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
}

.team-user-email {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Team Settings */
.team-settings-header {
  display: flex;
  align-items: center;
}

.team-members-list {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.team-member-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.team-member-item:last-child {
  border-bottom: none;
}

.team-member-info {
  flex: 1;
  min-width: 0;
  margin-left: 12px;
}

.team-member-name {
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.team-member-email {
  font-size: 12px;
  color: #64748b;
}

/* System Messages */
.team-chat-system-message {
  text-align: center;
  margin: 12px 0;
}

.team-chat-system-message span {
  background: #e2e8f0;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  color: #64748b;
}
