/* DubDeal Message Center Styles - Generated 2026-05-09 */

/* =================================================================================
   DUBDEAL MESSAGE CENTER STYLES - Generated 2025-01-14
   Drop-in replacement for all chat-related styles
   Brand: DubDeal (Green #169B62, Orange #E67A38)
   Prefixes: .chat-*, #chat*, #messagesPage

   INTEGRATION: This file is loaded AFTER style-core.css, style-components-part1.css,
   and style-components-part2.css. All selectors use .chat-* prefixes to avoid conflicts.
================================================================================= */

/* =================================================================================
   SECTION 1: CSS CUSTOM PROPERTIES (THEME VARIABLES)

   NOTE: The original DubDeal CSS files do not define CSS custom properties (they
   use hardcoded values). The brand variables below are scoped here to support the
   new Message Center styles. Chat-specific variables (--chat-*) are grouped separately.
================================================================================= */
:root {
  /* --- Brand colors (used by chat styles, no conflicts with existing hardcoded CSS) --- */
  --brand-green: #169B62;
  --brand-orange: #E67A38;
  --brand-dark: #0a0a0a;
  --brand-white: #ffffff;
  --brand-gray-50: #f9fafb;
  --brand-gray-100: #f3f4f6;
  --brand-gray-200: #e5e7eb;
  --brand-gray-300: #d1d5db;
  --brand-gray-400: #9ca3af;
  --brand-gray-500: #6b7280;
  --brand-gray-600: #4b5563;
  --brand-gray-700: #374151;
  --brand-gray-800: #1f2937;
  --brand-gray-900: #111827;

  /* --- Chat-specific colors (unique to this file) --- */
  --chat-sidebar-bg: #ffffff;
  --chat-main-bg: #f0f2f5;
  --chat-bubble-me: #dcf8c6;
  --chat-bubble-them: #ffffff;
  --chat-bubble-me-bg: #e8f5e9;
  --chat-bubble-them-bg: #ffffff;
  --chat-online: #22c55e;
  --chat-typing-dot: #9ca3af;
  --chat-divider: rgba(0, 0, 0, 0.05);
  --chat-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --chat-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --chat-shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --chat-header-blur: rgba(255, 255, 255, 0.85);
  --chat-hover: rgba(22, 155, 98, 0.06);
  --chat-active: rgba(22, 155, 98, 0.1);
  --chat-unread-badge: #E67A38;
}

/* =================================================================================
   SECTION 2: CONTAINER & LAYOUT
================================================================================= */
.chat-dashboard-container {
  display: flex;
  height: calc(100vh - 180px);
  min-height: 500px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--chat-shadow-lg);
  border: 1px solid var(--brand-gray-200);
  position: relative;
}

.chat-dashboard-container.full-screen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 2147483647 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  background: white !important;
}

/* --- Fullscreen Toggle Button (inside chat-header-actions flex row) --- */
.chat-fs-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--brand-gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}

.chat-fs-toggle:hover {
  background: var(--chat-hover);
  color: var(--brand-green);
  transform: scale(1.08);
  box-shadow: var(--chat-shadow-md);
}

.chat-fs-toggle svg {
  width: 18px;
  height: 18px;
}

/* In fullscreen mode, keep button visible */
.chat-dashboard-container.full-screen .chat-fs-toggle {
  color: var(--brand-gray-600);
}

/* =================================================================================
   SECTION 3: SIDEBAR
================================================================================= */
.chat-sidebar {
  width: 360px;
  min-width: 360px;
  background: var(--chat-sidebar-bg);
  border-right: 1px solid var(--brand-gray-200);
  display: flex;
  flex-direction: column;
  position: relative;
}

.chat-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--brand-gray-100);
  position: relative;
}

.title-with-icon {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-dark);
  margin: 0;
}

.title-with-icon svg {
  width: 24px;
  height: 24px;
  color: var(--brand-green);
  flex-shrink: 0;
}

.chat-sidebar-actions {
  position: absolute;
  right: 20px;
  top: 20px;
}

.chat-sidebar-actions .btn-icon {
  width: 36px;
  height: 36px;
  color: var(--brand-gray-500);
  transition: all 0.15s ease;
}

.chat-sidebar-actions .btn-icon:hover {
  background: var(--chat-hover);
  color: var(--brand-green);
}

/* --- Sidebar Search --- */
.chat-search-wrapper {
  position: relative;
  margin-top: 12px;
}

.chat-search-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand-gray-400);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

#inboxSearchInput {
  width: 100%;
  padding: 10px 36px 10px 38px;
  border: 1px solid var(--brand-gray-200);
  border-radius: 24px;
  background: var(--brand-gray-50);
  font-size: 14px;
  transition: all 0.2s ease;
  outline: none;
  color: var(--brand-gray-800);
}

#inboxSearchInput::placeholder {
  color: var(--brand-gray-400);
}

#inboxSearchInput:focus {
  border-color: var(--brand-green);
  background: var(--brand-white);
  box-shadow: 0 0 0 3px rgba(22, 155, 98, 0.1);
}

#clearInboxSearch {
  position: absolute;
  right: 12px;
  top: 0;
  bottom: 0;
  margin: auto 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand-gray-200);
  border: none;
  color: var(--brand-gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-right: 0;
  box-sizing: border-box;
  line-height: 1;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

#clearInboxSearch svg {
  width: 10px;
  height: 10px;
  display: block;
  flex-shrink: 0;
}

#clearInboxSearch:hover {
  background: var(--brand-gray-300);
  color: var(--brand-gray-700);
}

/* --- Inbox List --- */
.inbox-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* =================================================================================
   SECTION 4: CONVERSATION ITEMS
================================================================================= */
.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  position: relative;
}

.conversation-item:hover {
  background: var(--chat-hover);
}

.conversation-item.active {
  background: var(--chat-active);
  border-left-color: var(--brand-green);
}

.conversation-item.unread {
  background: rgba(230, 122, 56, 0.03);
}

.conversation-item.unread .conversation-name-row h4 {
  font-weight: 700;
  color: var(--brand-gray-900);
}

.conversation-item.unread .conversation-preview-row p {
  color: var(--brand-gray-700);
  font-weight: 500;
}

/* --- Conversation Avatar --- */
.conversation-avatar {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
}

.conversation-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--brand-gray-100);
}

.conversation-avatar .avatar-initials {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-gray-200) 0%, var(--brand-gray-300) 100%);
  color: var(--brand-gray-600);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Online Indicator (shared by avatar and header) --- */
.online-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: var(--chat-online);
  border: 2px solid var(--brand-white);
  border-radius: 50%;
  z-index: 2;
}

.online-indicator.away {
  background: #f59e0b;
}

.online-indicator.offline {
  background: var(--brand-gray-400);
}

/* --- Conversation Info --- */
.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  gap: 8px;
}

.conversation-name-row h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--brand-gray-800);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.conversation-name-row .time {
  font-size: 12px;
  color: var(--brand-gray-400);
  flex-shrink: 0;
}

.conversation-item.unread .conversation-name-row .time {
  color: var(--brand-orange);
  font-weight: 600;
}

.conversation-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.conversation-preview-row p {
  font-size: 13px;
  color: var(--brand-gray-500);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* --- Unread Badge --- */
.unread-badge {
  background: var(--chat-unread-badge);
  color: var(--brand-white);
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  flex-shrink: 0;
}

/* --- Conversation Actions (pin/mute) --- */
.conversation-actions {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 3;
}

.conversation-item:hover .conversation-actions {
  opacity: 1;
}

.pin-btn,
.mute-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--brand-white);
  box-shadow: var(--chat-shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--brand-gray-400);
  transition: all 0.15s ease;
  font-size: 12px;
  padding: 0;
}

.pin-btn:hover {
  color: #f59e0b;
  background: #fef3c7;
}

.pin-btn.pinned {
  color: #f59e0b;
  opacity: 1;
}

.mute-btn:hover {
  color: #dc2626;
  background: #fef2f2;
}

.mute-btn.muted {
  color: #dc2626;
  opacity: 1;
}

/* Muted conversation indicator */
.conversation-item.muted .preview {
  opacity: 0.6;
}

.conversation-item .muted-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  color: var(--brand-gray-400);
  flex-shrink: 0;
}

.conversation-item.muted .muted-indicator {
  color: #dc2626;
}

/* =================================================================================
   SECTION 5: CHAT MAIN PANEL & EMPTY STATE
================================================================================= */
.chat-main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--chat-main-bg);
  position: relative;
  min-width: 0;
}

.chat-main-panel.empty-state {
  align-items: center;
  justify-content: center;
}

/* --- Empty State --- */
.chat-empty-view {
  text-align: center;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  animation: fadeIn 0.4s ease;
}

.empty-illustration {
  width: 160px;
  height: 160px;
  margin-bottom: 24px;
  opacity: 0.9;
}

.empty-illustration svg {
  width: 100%;
  height: 100%;
  color: var(--brand-gray-300);
}

.chat-empty-view h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-gray-800);
  margin-bottom: 8px;
}

.chat-empty-view p {
  font-size: 15px;
  color: var(--brand-gray-500);
  margin-bottom: 20px;
}

.empty-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(22, 155, 98, 0.06);
  color: var(--brand-green);
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 20px;
}

.empty-hint svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* =================================================================================
   SECTION 6: CHAT HEADER
================================================================================= */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--chat-header-blur);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--brand-gray-200);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.chat-header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  position: relative;
  flex-shrink: 0;
}

.chat-header-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--brand-gray-100);
}

.chat-header-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-header-info h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--brand-gray-800);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-info .online-text {
  font-size: 13px;
  color: var(--chat-online);
  font-weight: 500;
}

.chat-header-info .online-text.offline {
  color: var(--brand-gray-400);
}

/* --- Chat Header Actions --- */
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  position: relative;
  padding-right: 8px;
}

.chat-header-actions .btn-icon {
  width: 38px;
  height: 38px;
  color: var(--brand-gray-500);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.chat-header-actions .btn-icon:hover {
  background: var(--chat-hover);
  color: var(--brand-green);
  transform: scale(1.08);
}

.chat-header-actions .btn-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* --- Dropdown Menu --- */
.dropdown-menu {
  position: absolute;
  right: 16px;
  top: 60px;
  background: var(--brand-white);
  border-radius: 12px;
  box-shadow: var(--chat-shadow-lg);
  border: 1px solid var(--brand-gray-200);
  min-width: 200px;
  z-index: 100;
  padding: 8px 0;
  animation: dropdownIn 0.15s ease;
  overflow: hidden;
}

.dropdown-menu.hidden {
  display: none !important;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--brand-gray-700);
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.1s ease;
  text-decoration: none;
  font-family: inherit;
}

.dropdown-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--brand-gray-400);
}

.dropdown-item:hover {
  background: var(--brand-gray-50);
}

.dropdown-item.block {
  color: #dc2626;
}

.dropdown-item.block svg {
  color: #dc2626;
}

/* =================================================================================
   SECTION 7: MESSAGE LIST & DATE DIVIDERS
================================================================================= */
.chat-message-list {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scroll-behavior: smooth;
  min-height: 0;
}

/* --- Date Divider --- */
.date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
  position: relative;
}

.date-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--chat-divider);
  z-index: 0;
}

.date-divider span {
  position: relative;
  z-index: 1;
  background: var(--chat-main-bg);
  color: var(--brand-gray-500);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 16px;
  border-radius: 12px;
}

/* --- Message Group --- */
.chat-message-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 4px;
}

/* =================================================================================
   SECTION 8: MESSAGE BUBBLES
================================================================================= */
.chat-message-wrapper {
  display: flex;
  margin-bottom: 8px;
  animation: messageSlideIn 0.25s ease;
}

.chat-message-wrapper[data-from="me"] {
  justify-content: flex-end;
}

.chat-message-wrapper[data-from="them"] {
  justify-content: flex-start;
}

.chat-message-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 18px;
  position: relative;
  box-shadow: var(--chat-shadow-sm);
  transition: box-shadow 0.15s ease;
}

.chat-message-wrapper[data-from="me"] .chat-message-bubble {
  background: var(--chat-bubble-me-bg);
  border-bottom-right-radius: 4px;
  color: var(--brand-gray-800);
}

.chat-message-wrapper[data-from="them"] .chat-message-bubble {
  background: var(--chat-bubble-them-bg);
  border-bottom-left-radius: 4px;
  color: var(--brand-gray-800);
}

.chat-message-bubble:hover {
  box-shadow: var(--chat-shadow-md);
}

/* --- Message Content --- */
.chat-message-content p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.chat-message-content a {
  color: var(--brand-green);
  text-decoration: underline;
  font-weight: 600;
}

.chat-message-wrapper[data-from="me"] .chat-message-content a {
  color: #15803d;
}

/* --- Message Meta (time, read status) --- */
.chat-message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  justify-content: flex-end;
}

.chat-message-meta .time {
  font-size: 11px;
  color: var(--brand-gray-400);
}

.chat-message-meta .read-status {
  font-size: 11px;
  color: var(--brand-green);
  letter-spacing: -1px;
  font-weight: 600;
}

.chat-message-wrapper[data-from="them"] .chat-message-meta {
  justify-content: flex-end;
}

.chat-message-wrapper[data-from="them"] .read-status {
  display: none;
}

/* --- Message failed/retry state --- */
.chat-message-wrapper.failed .chat-message-bubble {
  border: 1px solid #fecaca;
  background: #fef2f2;
}

.chat-message-wrapper.failed .chat-message-meta .retry-btn {
  color: #dc2626;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
}

/* --- Image inside message bubbles --- */
.chat-message-image {
  margin-bottom: 8px;
  border-radius: 12px;
  overflow: hidden;
  max-width: 240px;
}

.chat-message-image img {
  max-width: 240px;
  max-height: 200px;
  width: 100%;
  height: auto;
  border-radius: 12px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-message-image img:hover {
  opacity: 0.92;
  transform: scale(1.02);
}

/* Full-width image on mobile */
@media (max-width: 768px) {
  .chat-message-image {
    max-width: 180px;
  }
  .chat-message-image img {
    max-width: 180px;
    max-height: 160px;
  }
}

/* =================================================================================
   SECTION 9: TYPING INDICATOR
================================================================================= */
.chat-typing-indicator {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 12px;
  animation: fadeIn 0.2s ease;
}

.chat-typing-indicator.hidden {
  display: none !important;
}

.typing-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  align-self: flex-end;
}

.typing-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.typing-bubble {
  background: var(--brand-white);
  padding: 14px 18px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--chat-shadow-sm);
}

.typing-bubble .dot {
  width: 7px;
  height: 7px;
  background: var(--chat-typing-dot);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
  display: inline-block;
}

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

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

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

/* =================================================================================
   SECTION 10: INPUT AREA
================================================================================= */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  background: var(--brand-white);
  border-top: 1px solid var(--brand-gray-200);
  flex-shrink: 0;
  position: relative;
}

.chat-input-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--brand-gray-50);
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
  border: 1px solid var(--brand-gray-200);
  transition: border-color 0.2s ease, background 0.2s ease;
  min-width: 0;
}

.chat-input-wrapper:focus-within {
  border-color: var(--brand-green);
  background: var(--brand-white);
}

#chatInputText {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  max-height: 120px;
  min-height: 40px;
  padding: 8px 0;
  font-size: 14px;
  outline: none;
  line-height: 1.4;
  color: var(--brand-gray-800);
  font-family: inherit;
  overflow-y: auto;
}

#chatInputText::placeholder {
  color: var(--brand-gray-400);
}

.attach-btn {
  color: var(--brand-gray-400);
  transition: color 0.2s ease;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.attach-btn:hover {
  color: var(--brand-green);
}

.btn-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-green);
  color: var(--brand-white);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(22, 155, 98, 0.3);
  padding: 0;
}

.btn-send:hover {
  background: #128a55;
  transform: scale(1.05);
}

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

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

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

/* --- Emoji Button --- */
#chatEmojiBtn {
  color: var(--brand-gray-500);
  transition: all 0.15s ease;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 10;
  background: transparent;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#chatEmojiBtn:hover {
  color: #f59e0b;
  background: #fef3c7;
  border-color: #fbbf24;
}

/* =================================================================================
   SECTION 10b: EMOJI PICKER CONTAINER
================================================================================= */
.chat-emoji-picker-container {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 100;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.chat-emoji-picker-container .picker {
  --emoji-size: 1.5rem;
  --num-columns: 8;
  width: 340px;
}

/* Show state - toggled by JS */
.chat-emoji-picker-container.visible {
  display: block;
}

/* =================================================================================
   SECTION 11: SCROLL TO BOTTOM BUTTON
================================================================================= */
.btn-scroll-bottom {
  position: absolute;
  right: 20px;
  bottom: 80px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-white);
  border: none;
  box-shadow: var(--chat-shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--brand-gray-600);
  z-index: 5;
  transition: all 0.2s ease;
  padding: 0;
}

.btn-scroll-bottom:hover {
  transform: translateY(-2px);
  box-shadow: var(--chat-shadow-lg);
  color: var(--brand-gray-800);
}

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

.btn-scroll-bottom.hidden {
  display: none !important;
}

/* =================================================================================
   SECTION 12: ATTACHMENT PREVIEW
================================================================================= */
.attachment-preview {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  overflow-x: auto;
  max-width: 100%;
}

.attachment-preview.hidden {
  display: none !important;
}

.attachment-item {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--brand-gray-200);
}

.attachment-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-attachment {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dc2626;
  color: var(--brand-white);
  border: 2px solid var(--brand-white);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: all 0.15s ease;
  font-weight: 700;
}

.remove-attachment:hover {
  background: #b91c1c;
  transform: scale(1.1);
}

/* =================================================================================
   SECTION 13: CONTEXT MENU (Message Actions)
================================================================================= */
.chat-message-context-menu {
  position: absolute;
  background: var(--brand-white);
  border-radius: 10px;
  box-shadow: var(--chat-shadow-lg);
  border: 1px solid var(--brand-gray-200);
  padding: 6px 0;
  min-width: 140px;
  z-index: 50;
  animation: dropdownIn 0.12s ease;
  overflow: hidden;
}

.chat-message-context-menu.hidden {
  display: none !important;
}

.chat-message-context-menu button {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--brand-gray-700);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.1s ease;
  border-radius: 0;
}

.chat-message-context-menu button:hover {
  background: var(--brand-gray-50);
}

.chat-message-context-menu button.delete-action {
  color: #dc2626;
}

.chat-message-context-menu button.delete-action:hover {
  background: #fef2f2;
}

/* =================================================================================
   SECTION 14: SCROLLBAR STYLING
================================================================================= */
.chat-message-list::-webkit-scrollbar {
  width: 6px;
}

.chat-message-list::-webkit-scrollbar-track {
  background: transparent;
}

.chat-message-list::-webkit-scrollbar-thumb {
  background: var(--brand-gray-300);
  border-radius: 3px;
}

.chat-message-list::-webkit-scrollbar-thumb:hover {
  background: var(--brand-gray-400);
}

.inbox-list::-webkit-scrollbar {
  width: 5px;
}

.inbox-list::-webkit-scrollbar-track {
  background: transparent;
}

.inbox-list::-webkit-scrollbar-thumb {
  background: var(--brand-gray-300);
  border-radius: 3px;
}

.inbox-list::-webkit-scrollbar-thumb:hover {
  background: var(--brand-gray-400);
}

/* Firefox scrollbar */
.chat-message-list {
  scrollbar-width: thin;
  scrollbar-color: var(--brand-gray-300) transparent;
}

.inbox-list {
  scrollbar-width: thin;
  scrollbar-color: var(--brand-gray-300) transparent;
}

/* =================================================================================
   SECTION 15: ANIMATIONS (@keyframes)
================================================================================= */
@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}

/* =================================================================================
   SECTION 16: MOBILE RESPONSIVE OVERRIDES (max-width: 768px)
================================================================================= */
@media (max-width: 768px) {
  /* Container */
  .chat-dashboard-container {
    height: calc(100vh - 100px);
    border-radius: 0;
    border: none;
    min-height: 0;
  }

  /* Sidebar slides left when chat active */
  .chat-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    min-width: 0;
    border-right: none;
    transition: transform 0.3s ease;
  }

  #messagesPage.mobile-chat-active .chat-sidebar {
    transform: translateX(-100%);
  }

  /* Main panel slides in from right */
  .chat-main-panel {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 2;
  }

  #messagesPage.mobile-chat-active .chat-main-panel {
    transform: translateX(0);
  }

  /* Active chat view fills screen */
  .chat-active-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
  }

  /* Chat Header */
  .chat-header {
    padding: 10px 12px;
    gap: 8px;
  }

  .chat-fs-toggle {
    width: 36px;
    height: 36px;
  }

  .chat-fs-toggle svg {
    width: 16px;
    height: 16px;
  }

  .chat-header-info h4 {
    font-size: 15px;
  }

  /* Message List */
  .chat-message-list {
    padding: 12px;
  }

  /* Message Bubbles wider on mobile */
  .chat-message-bubble {
    max-width: 85%;
  }

  /* Input Area */
  .chat-input-area {
    padding: 8px 12px;
    gap: 6px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .chat-input-wrapper {
    padding: 4px 4px 4px 12px;
  }

  #chatInputText {
    font-size: 16px; /* Prevents iOS zoom on focus */
  }

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

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

  /* Scroll to bottom button adjusted */
  .btn-scroll-bottom {
    right: 12px;
    bottom: 76px;
  }

  /* Dropdown menu repositioned */
  .dropdown-menu {
    right: 8px;
    top: 56px;
    min-width: 180px;
  }

  /* Conversation actions always visible on touch */
  .conversation-actions {
    opacity: 1;
  }

  .pin-btn,
  .mute-btn {
    width: 32px;
    height: 32px;
  }

  /* Sidebar header */
  .chat-sidebar-header {
    padding: 16px;
  }

  .title-with-icon {
    font-size: 18px;
  }

  .chat-sidebar-actions {
    right: 16px;
    top: 16px;
  }

  /* Empty state */
  .chat-empty-view {
    padding: 24px;
  }

  .empty-illustration {
    width: 120px;
    height: 120px;
  }

  .chat-empty-view h3 {
    font-size: 19px;
  }

  .chat-empty-view p {
    font-size: 14px;
  }

  /* Conversation items */
  .conversation-item {
    padding: 12px 14px;
    gap: 10px;
  }

  .conversation-avatar {
    width: 44px;
    height: 44px;
  }

  .conversation-name-row h4 {
    font-size: 14px;
  }

  .conversation-preview-row p {
    font-size: 12px;
  }

  /* Context menu */
  .chat-message-context-menu {
    min-width: 120px;
  }

  .chat-message-context-menu button {
    padding: 10px 16px;
    font-size: 14px;
  }

  /* Typing indicator */
  .chat-typing-indicator {
    margin-bottom: 8px;
  }

  .typing-bubble {
    padding: 12px 16px;
  }

  /* Mobile-only utility class */
  .mobile-only {
    display: flex !important;
  }

  /* Mobile emoji picker adjustment */
  .chat-emoji-picker-container {
    position: fixed !important;
    bottom: 80px;
    left: 50% !important;
    transform: translateX(-50%);
    right: auto;
    top: auto !important;
    width: 90vw;
    max-width: 340px;
  }

  .chat-emoji-picker-container .picker {
    --num-columns: 7;
    width: 100%;
  }
}

/* =================================================================================
   SECTION 17: MOBILE-ONLY UTILITY (hidden on desktop)
================================================================================= */
.mobile-only {
  display: none;
}

/* =================================================================================
   SECTION 18: SMALL MOBILE BREAKPOINT (max-width: 480px)
================================================================================= */
@media (max-width: 480px) {
  .chat-dashboard-container {
    height: calc(100vh - 80px);
  }

  .chat-message-bubble {
    padding: 8px 12px;
    border-radius: 14px;
  }

  .chat-message-wrapper[data-from="me"] .chat-message-bubble {
    border-bottom-right-radius: 4px;
  }

  .chat-message-wrapper[data-from="them"] .chat-message-bubble {
    border-bottom-left-radius: 4px;
  }

  .chat-message-content p {
    font-size: 13px;
  }

  .chat-header-avatar {
    width: 36px;
    height: 36px;
  }

  .chat-header-info h4 {
    font-size: 14px;
  }

  .chat-header-info .online-text {
    font-size: 12px;
  }

  .chat-sidebar-header {
    padding: 12px;
  }

  #inboxSearchInput {
    padding: 8px 32px 8px 36px;
    font-size: 15px;
  }

  .conversation-item {
    padding: 10px 12px;
  }

  .conversation-avatar {
    width: 40px;
    height: 40px;
  }

  .unread-badge {
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    border-radius: 9px;
  }

  .chat-input-area {
    gap: 4px;
  }

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

  .chat-empty-view h3 {
    font-size: 18px;
  }

  .empty-illustration {
    width: 100px;
    height: 100px;
  }
}

/* =================================================================================
   SECTION 19: INBOX LOADING SKELETON
================================================================================= */
.conversation-skeleton {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-left: 3px solid transparent;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--brand-gray-100) 25%, var(--brand-gray-200) 50%, var(--brand-gray-100) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  flex-shrink: 0;
}

.skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.skeleton-line {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--brand-gray-100) 25%, var(--brand-gray-200) 50%, var(--brand-gray-100) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
}

.skeleton-line.short {
  width: 60%;
}

.skeleton-line.name {
  width: 45%;
  height: 16px;
}

@keyframes skeletonShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* =================================================================================
   SECTION 20: IN-CONVERSATION SEARCH (Enhanced with Navigation & Auto-Focus)
================================================================================= */

/* --- Search highlight mark inside message text --- */
.chat-message-content .search-highlight {
  background: rgba(230, 122, 56, 0.35);
  border-radius: 3px;
  padding: 1px 3px;
  font-weight: 700;
  color: var(--brand-gray-900);
  box-shadow: 0 0 0 1px rgba(230, 122, 56, 0.2);
}

/* --- Search focused message (contains a match) --- */
.chat-message-wrapper.search-focused .chat-message-bubble {
  box-shadow: 0 0 0 2px rgba(230, 122, 56, 0.3), 0 4px 12px rgba(230, 122, 56, 0.15);
  transition: box-shadow 0.3s ease;
}

/* --- Current focused match (the one being navigated to) --- */
.chat-message-wrapper.search-current-match .chat-message-bubble {
  animation: searchFocusPulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 0 3px rgba(230, 122, 56, 0.5), 0 6px 20px rgba(230, 122, 56, 0.25);
}

@keyframes searchFocusPulse {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(230, 122, 56, 0.4), 0 6px 20px rgba(230, 122, 56, 0.2);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(230, 122, 56, 0.6), 0 8px 24px rgba(230, 122, 56, 0.3);
  }
}

/* --- Dimmed messages (don't contain the search term) --- */
.chat-message-wrapper.search-dimmed {
  opacity: 0.25;
  filter: grayscale(0.7);
  transition: opacity 0.3s ease, filter 0.3s ease;
  pointer-events: none;
}

.chat-message-wrapper.search-dimmed .chat-message-bubble {
  transform: scale(0.97);
  transition: transform 0.3s ease;
}

/* --- Search overlay bar --- */
.chat-search-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: var(--chat-header-blur);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--brand-gray-200);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 15;
  animation: slideDown 0.2s ease;
}

.chat-search-overlay.hidden {
  display: none !important;
}

.chat-search-overlay input {
  flex: 1;
  border: 1px solid var(--brand-gray-200);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  outline: none;
  background: var(--brand-gray-50);
  color: var(--brand-gray-800);
  transition: all 0.2s ease;
}

.chat-search-overlay input:focus {
  border-color: var(--brand-green);
  background: var(--brand-white);
  box-shadow: 0 0 0 3px rgba(22, 155, 98, 0.1);
}

/* --- Search navigation buttons --- */
.chat-search-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--brand-gray-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}

.chat-search-nav-btn:hover {
  background: var(--chat-hover);
  color: var(--brand-green);
  transform: scale(1.1);
}

.chat-search-nav-btn:active {
  transform: scale(0.95);
}

.chat-search-nav-btn svg {
  width: 16px;
  height: 16px;
}

/* Match counter styling */
#searchMatchCounter {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile responsive for search overlay */
@media (max-width: 768px) {
  .chat-search-overlay {
    padding: 8px 12px;
    gap: 6px;
  }

  .chat-search-overlay input {
    font-size: 16px; /* Prevents iOS zoom */
    padding: 8px 12px;
  }

  .chat-search-nav-btn {
    width: 36px;
    height: 36px;
  }
}

/* =================================================================================
   SECTION 21: REPLY PREVIEW (quoted message)
================================================================================= */
.chat-reply-preview {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  background: var(--brand-gray-50);
  border-left: 3px solid var(--brand-green);
  border-radius: 0 8px 8px 0;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--brand-gray-500);
  animation: fadeIn 0.2s ease;
}

.chat-reply-preview .reply-author {
  font-weight: 600;
  color: var(--brand-gray-700);
  font-size: 12px;
}

.chat-reply-preview .reply-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.chat-reply-preview .cancel-reply {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--brand-gray-400);
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.chat-reply-preview .cancel-reply:hover {
  color: var(--brand-gray-600);
}

/* =================================================================================
   SECTION 22: IMAGE MESSAGES (lightbox trigger)
================================================================================= */
.chat-message-content .message-image {
  max-width: 240px;
  max-height: 180px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: block;
  margin-top: 6px;
}

.chat-message-content .message-image:hover {
  transform: scale(1.02);
  box-shadow: var(--chat-shadow-md);
}

@media (max-width: 768px) {
  .chat-message-content .message-image {
    max-width: 180px;
    max-height: 140px;
  }
}

/* =================================================================================
   SECTION 23: PRESENCE INDICATOR PULSE (enhanced online status)
================================================================================= */
.online-indicator.pulsing {
  animation: onlinePulse 2s infinite;
}

@keyframes onlinePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

/* =================================================================================
   SECTION 24: NO CONVERSATIONS STATE
================================================================================= */
.chat-no-conversations {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--brand-gray-500);
}

.chat-no-conversations svg {
  width: 64px;
  height: 64px;
  color: var(--brand-gray-300);
  margin-bottom: 16px;
}

.chat-no-conversations h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--brand-gray-700);
  margin-bottom: 4px;
}

.chat-no-conversations p {
  font-size: 13px;
  color: var(--brand-gray-400);
  margin: 0;
}

/* =================================================================================
   SECTION 26: MUTED CONVERSATION VISUAL INDICATORS
   Prominent crossed bell badge on avatars for muted conversations
================================================================================= */

/* --- Avatar overlay container for muted state --- */
.conversation-avatar.muted-overlay {
  position: relative;
}

.conversation-avatar.muted-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.conversation-avatar.muted-overlay img,
.conversation-avatar.muted-overlay .avatar {
  filter: grayscale(0.6);
  opacity: 0.7;
  transition: all 0.2s ease;
}

.conversation-item:hover .conversation-avatar.muted-overlay img,
.conversation-item:hover .conversation-avatar.muted-overlay .avatar {
  filter: grayscale(0.3);
  opacity: 0.85;
}

/* --- Crossed bell badge on avatar --- */
.muted-avatar-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #dc2626;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4);
  z-index: 5;
  animation: mutedPulse 2s infinite ease-in-out;
  border: 2px solid var(--brand-white);
}

.muted-avatar-badge svg {
  width: 12px;
  height: 12px;
}

@keyframes mutedPulse {
  0%, 100% {
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 2px 10px rgba(220, 38, 38, 0.6);
    transform: scale(1.08);
  }
}

/* --- Muted header badge (in thread view) --- */
.muted-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fef2f2;
  color: #dc2626;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid #fecaca;
  animation: mutedPulse 2s infinite ease-in-out;
}

.muted-header-badge svg {
  flex-shrink: 0;
}

/* --- Muted conversation item styling --- */
.conversation-item.muted {
  opacity: 0.85;
}

.conversation-item.muted .preview {
  opacity: 0.55;
}

.conversation-item.muted .conversation-name-row h4 {
  color: var(--brand-gray-500);
}

/* --- Muted indicator inline (existing, enhanced) --- */
.conversation-item .muted-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  color: var(--brand-gray-400);
  flex-shrink: 0;
  vertical-align: middle;
}

.conversation-item.muted .muted-indicator {
  color: #dc2626;
}

/* Muted state on group folders */
.conversation-item.muted .conversation-avatar img,
.conversation-item.muted .conversation-avatar .avatar {
  filter: grayscale(0.5);
}

/* =================================================================================
   SECTION 27: MUTE BUTTON IN CONVERSATION ACTIONS
================================================================================= */

.conversation-actions .mute-btn.muted {
  color: #dc2626;
  background: #fef2f2;
  opacity: 1;
}

.conversation-actions .mute-btn.muted svg {
  color: #dc2626;
}

/* Mobile: always show mute button on touch devices */
@media (max-width: 768px) {
  .conversation-actions .mute-btn {
    opacity: 1;
    width: 32px;
    height: 32px;
  }
  
  .muted-avatar-badge {
    width: 20px;
    height: 20px;
  }
  
  .muted-avatar-badge svg {
    width: 10px;
    height: 10px;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .muted-avatar-badge {
    width: 18px;
    height: 18px;
  }
  
  .muted-avatar-badge svg {
    width: 10px;
    height: 10px;
  }
}
