/* Interakt SPA — Unified Shared Team Inbox Stylesheet */

.inbox-container {
  display: flex;
  height: calc(100vh - var(--header-height) - 48px); /* Account for padding */
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* COLUMN 1: CONVERSATIONS LIST (LEFT) */
.inbox-sidebar {
  width: 300px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background-color: var(--surface);
}

.inbox-search {
  padding: 16px;
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.inbox-search span {
  position: absolute;
  left: 28px;
  color: var(--text-muted);
}
.inbox-search input {
  padding-left: 36px;
  background-color: var(--background);
  height: 38px;
  border-radius: 8px;
}

.inbox-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background-color: var(--background);
}
.inbox-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}
.inbox-tab:hover {
  color: var(--text-primary);
}
.inbox-tab.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
  background-color: var(--surface);
}

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

.conversation-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.conversation-row:hover {
  background-color: var(--background);
}
.conversation-row.active {
  background-color: var(--primary-light);
}

.conversation-row .avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-secondary);
  position: relative;
  flex-shrink: 0;
}
.conversation-row.active .avatar-circle {
  background-color: var(--primary);
  color: white;
}

.conversation-row .channel-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
}
.channel-badge.whatsapp { background-color: var(--primary); }
.channel-badge.instagram { background-color: var(--accent); }

.conv-meta {
  flex: 1;
  min-width: 0;
}

.conv-meta h5 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.conv-meta h5 .time {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.conv-meta p {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conversation-row.unread .conv-meta p {
  font-weight: 600;
  color: var(--text-primary);
}

.conv-indicators {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.conv-indicators .unread-badge {
  background-color: var(--error);
  color: white;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* COLUMN 2: ACTIVE CHAT SCREEN (MIDDLE) */
.inbox-chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #efeae2; /* WhatsApp chat wallpaper tone */
  position: relative;
}

.chat-header {
  height: 64px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 10;
}

.chat-contact-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-contact-summary h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.chat-contact-summary span {
  font-size: 12px;
  color: var(--text-secondary);
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select-sm {
  height: 32px;
  font-size: 12px;
  padding: 0 8px;
  border-radius: 6px;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  text-align: center;
  padding: 20px;
}
.chat-empty-state span {
  margin-bottom: 12px;
}

/* Message Bubble Styles */
.msg-row {
  display: flex;
  width: 100%;
  margin-bottom: 4px;
}
.msg-row.sent { justify-content: flex-end; }
.msg-row.received { justify-content: flex-start; }

.msg-bubble {
  max-width: 65%;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  line-height: 1.4;
  position: relative;
}

/* Received WhatsApp/Insta bubbles */
.msg-row.received .msg-bubble {
  background-color: var(--surface);
  color: var(--text-primary);
  border-top-left-radius: 0;
}

/* Sent WhatsApp/Insta bubbles */
.msg-row.sent .msg-bubble {
  background-color: #d9fdd3; /* WhatsApp outbound green tone */
  color: var(--text-primary);
  border-top-right-radius: 0;
}

/* Private Internal Team Notes */
.msg-row.private-note {
  justify-content: center;
}
.msg-row.private-note .msg-bubble {
  background-color: #fef3c7; /* Warm yellow note bg */
  color: #92400e;
  border: 1px dashed #f59e0b;
  max-width: 80%;
  font-style: italic;
  font-size: 13px;
  border-radius: 8px;
  text-align: center;
}
.msg-row.private-note .msg-bubble::before {
  content: '🔒 Private Team Note: ';
  font-weight: 700;
}

/* System updates bubble */
.msg-row.system {
  justify-content: center;
}
.msg-row.system .msg-bubble {
  background-color: var(--info-light);
  color: #1e3a8a;
  box-shadow: none;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  padding: 4px 10px;
  border-radius: 99px;
  max-width: 90%;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-secondary);
}
.msg-meta span.tick {
  font-size: 14px;
  font-weight: bold;
}
.msg-meta span.tick.read { color: #53bdeb; } /* Blue ticks */

/* Interactive Catalogue Product Inside Chat */
.chat-product-card {
  background-color: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: 6px;
  width: 180px;
  box-shadow: var(--shadow-sm);
}
.chat-product-card img {
  width: 100%;
  height: 100px;
  object-fit: cover;
}
.chat-product-card-body {
  padding: 8px;
}
.chat-product-card-body h6 {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-product-card-body span {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-dark);
}

/* Input Reply area container (Bottom) */
.chat-reply-container {
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  flex-shrink: 0;
  z-index: 10;
}

.chat-toolbox {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.toolbox-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
}
.toolbox-btn:hover {
  background-color: var(--background);
  color: var(--text-primary);
}
.toolbox-btn span {
  font-size: 16px;
}
.toolbox-divider {
  width: 1px;
  height: 16px;
  background-color: var(--border);
}

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

.reply-input-box textarea {
  flex: 1;
  height: 40px;
  max-height: 120px;
  padding: 10px 12px;
  resize: none;
}

/* COLUMN 3: CRM SIDEBAR PANEL (RIGHT) */
.inbox-crm-sidebar {
  width: 280px;
  border-left: 1px solid var(--border);
  background-color: var(--surface);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.crm-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background-color: var(--background);
}
.crm-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}
.crm-tab.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
  background-color: var(--surface);
}

.crm-tab-content {
  display: none;
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.crm-tab-content.active {
  display: block;
}

.crm-profile-header {
  text-align: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}
.avatar-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--accent-light);
  color: var(--accent);
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
  box-shadow: var(--shadow-sm);
}

.crm-profile-header h4 {
  font-size: 16px;
  font-weight: 700;
}
.crm-profile-header span {
  font-size: 12px;
  color: var(--text-secondary);
}

.crm-profile-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f9fafb;
}
.detail-row span {
  color: var(--text-secondary);
}
.detail-row strong {
  color: var(--text-primary);
  font-weight: 600;
}

.crm-tag-container h5 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.crm-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Shopify CRM lists in inbox */
.shopify-orders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shopify-order-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--background);
  font-size: 12px;
}

.shopify-order-card .order-title {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 6px;
}
.shopify-order-card p {
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.shopify-order-card .cod-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

/* Inbox Templates selection lists popup styling */
.inbox-selection-item {
  display: flex;
  flex-direction: column;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.inbox-selection-item:hover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}
.inbox-selection-item h5 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}
.inbox-selection-item p {
  font-size: 12px;
  color: var(--text-secondary);
}
