@import "tailwindcss";

.aggregate-chat-page {
  height: 100vh;
  display: flex;
  background: #f5f6f8;
  overflow: hidden;
}

.aggregate-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  height: 64px;
}

.aggregate-chat-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aggregate-chat-content {
  flex: 1;
  padding: 16px;
  overflow-x: auto;
  overflow-y: hidden;
}

/* V2 Layout: 4 Columns (Narrow Account | Navigation | Chat | Tools) */
.aggregate-chat-columns-v2 {
  display: flex;
  gap: 12px;
  height: 100%;
  min-width: 1200px;
}

/* Col 1: Narrow Account Sidebar */
.aggregate-chat-col-narrow {
  width: 72px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  overflow-y: auto;
  flex-shrink: 0;
}

.aggregate-chat-account-icon {
  position: relative;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.2s;
}

.aggregate-chat-account-icon:hover {
  transform: scale(1.05);
}

.aggregate-chat-account-icon.active .ant-avatar {
  border: 2px solid #1890ff;
}

.aggregate-chat-status-dot {
  position: absolute;
  bottom: 0;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
}

.aggregate-chat-status-dot.online {
  background: #52c41a;
}

.aggregate-chat-status-dot.offline {
  background: #d9d9d9;
}

/* Col 2: Navigation List (280px) */
.aggregate-chat-col-card {
  width: 300px; /* Default width for nav col */
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.aggregate-chat-col-header {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
  flex-shrink: 0;
  min-height: 48px;
}

.aggregate-chat-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.aggregate-chat-search-bar {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.aggregate-chat-msg-item {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.2s;
}

.aggregate-chat-msg-item:hover {
  background: #f9fafb;
}

.aggregate-chat-msg-item.active {
  background: #eff6ff;
}

.aggregate-chat-contact-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
}

.aggregate-chat-contact-item:hover {
  background: #f3f4f6;
}

/* Col 3: Chat Area (Flexible) */
.aggregate-chat-chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden; /* Ensure this container clips its content */
}

.aggregate-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f9f9f9;
}

.aggregate-chat-message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 80%;
  flex-shrink: 0; /* Prevent messages from shrinking */
}

.aggregate-chat-message.in {
  align-self: flex-start;
}

.aggregate-chat-message.out {
  align-self: flex-end;
  align-items: flex-end;
}

.aggregate-chat-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  background: #ffffff;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  max-width: 100%;
}

.aggregate-chat-message.out .aggregate-chat-bubble {
  background: #dbeafe;
  color: #1e3a8a;
}

.aggregate-chat-input-area {
  border-top: 1px solid #e5e7eb;
  padding: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0; /* Ensure input area is fixed height and doesn't shrink */
  z-index: 10; /* Ensure it stays above if there's any positioning issue (though flex should handle it) */
}

.aggregate-chat-toolbar {
  display: flex;
  gap: 16px;
  padding-bottom: 8px;
  color: #6b7280;
  font-size: 18px;
}

/* Col 4: Tools (Iframe Container) */
.aggregate-chat-iframe-container {
  height: 100%;
  width: 100%;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aggregate-chat-iframe-mask {
  text-align: center;
  padding: 24px;
  background: #fff;
  border-radius: 8px;
  border: 1px dashed #d9d9d9;
}

.aggregate-chat-tool-placeholder {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* New Message Types */
.aggregate-chat-msg-file {
  display: flex;
  align-items: center;
  min-width: 200px;
}

.aggregate-chat-msg-image {
  max-width: 300px;
}

.aggregate-chat-msg-card {
  min-width: 240px;
}

.aggregate-chat-tool-history {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
}

.aggregate-chat-history-list {
  display: flex;
  flex-direction: column;
}
