/*
 * Assignee tabs (mine | unassigned | all)
 * ChatTypeTabs uses <woot-tabs>/<woot-tabs-item> which are Vue components —
 * they render as plain div/ul/li/a in the DOM, NOT as custom elements.
 * Actual anchor gets class "text-button" (TabsItem.vue).
 * Active tab gets "text-n-blue-11" added by Vue.
 */

/* Tab bar background + border */
.conversations-list-wrap div:has(> ul > li > a.text-button) {
  background: linear-gradient(180deg, #fff 0%, #fdf8f5 100%);
  border-bottom: 1px solid #f5d0dc !important;
  padding-top: 4px;
  padding-bottom: 4px;
}

/* Tab link — pill shape, brand font */
.conversations-list-wrap a.text-button {
  font-family: 'Cairo', 'Almarai', system-ui, sans-serif !important;
  font-weight: 700 !important;
  font-size: 12.5px !important;
  border-radius: 999px !important;
  padding: 4px 12px !important;
  color: #64748b !important;
  background: transparent;
  border: 1px solid transparent;
  letter-spacing: 0 !important;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

/* Hide Chatwoot's underline indicator — using pill bg instead */
.conversations-list-wrap a.text-button::after {
  display: none !important;
}

/* Inactive hover */
.conversations-list-wrap a.text-button:hover {
  background: rgba(235, 95, 125, 0.08) !important;
  color: #7a5068 !important;
  border-color: rgba(235, 95, 125, 0.22) !important;
}

/* Active tab — pink pill */
.conversations-list-wrap a.text-button.text-n-blue-11 {
  background: linear-gradient(135deg, #eb5f7d, #c94068) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 1px 6px rgba(201, 64, 104, 0.28) !important;
}

/* Inactive badge */
.conversations-list-wrap a.text-button:not(.text-n-blue-11) > .rounded-full {
  background: rgba(100, 116, 139, 0.1) !important;
  color: #64748b !important;
}

/* Active badge — white-on-pink */
.conversations-list-wrap a.text-button.text-n-blue-11 > .rounded-full {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #fff !important;
}

#eldalil-inbox-tools {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}

/* Vue-safe column: tools live outside .conversations-list-wrap */
.eldalil-list-column {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  min-height: 0;
  max-height: 100%;
}

/* Desktop: column must keep width when Vue re-parents the list (mobile forces 100% in mobile-layout.css) */
@media (min-width: 769px) {
  section.flex.w-full > #eldalil-list-column,
  section.flex.w-full > .eldalil-list-column {
    flex: 0 0 340px;
    width: 340px;
    min-width: 340px;
    max-width: 100%;
    box-sizing: border-box;
  }

  @media (min-width: 1536px) {
    section.flex.w-full > #eldalil-list-column,
    section.flex.w-full > .eldalil-list-column {
      flex-basis: 412px;
      width: 412px;
      min-width: 412px;
    }
  }

  section.flex.w-full > #eldalil-list-column:has(.conversations-list-wrap.basis-full),
  section.flex.w-full > .eldalil-list-column:has(.conversations-list-wrap.basis-full) {
    flex: 1 1 auto;
    width: auto;
    min-width: 280px;
    max-width: 100%;
  }

  #eldalil-inbox-tools {
    display: flex !important;
    flex-direction: column;
    flex-shrink: 0;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  #eldalil-inbox-tools #eldalil-unread-bar,
  #eldalil-inbox-tools .eldalil-inbox-channel-bar {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    min-height: 36px;
    width: 100%;
    box-sizing: border-box;
  }

  #eldalil-inbox-tools .eldalil-top-bar-inner {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    visibility: visible !important;
    width: 100%;
    min-width: 0;
  }

  #eldalil-inbox-tools .eldalil-channel-group {
    display: flex !important;
    flex: 1 1 auto;
    min-width: 0;
    visibility: visible !important;
  }

  #eldalil-inbox-tools .eldalil-channel-btn,
  #eldalil-inbox-tools .eldalil-unread-toggle-btn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}

.eldalil-list-column > .conversations-list-wrap {
  flex: 1 1 0%;
  min-height: 0;
  overflow: hidden;
}

/* Channel shortcuts bar — inside conversation list (below search) */
#eldalil-unread-bar,
.eldalil-inbox-channel-bar {
  display: block;
  direction: rtl;
  width: 100%;
  box-sizing: border-box;
}

.conversations-list-wrap #eldalil-unread-bar,
#eldalil-inbox-tools #eldalil-unread-bar {
  display: block !important;
  position: static !important;
  padding: 4px 0 2px !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  z-index: auto !important;
  pointer-events: auto !important;
}

#eldalil-inbox-tools #eldalil-unread-bar,
.eldalil-inbox-channel-bar {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  min-height: 36px;
}

.eldalil-top-bar-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  padding: 2px 0 4px;
}

.eldalil-channel-group {
  display: flex;
  flex: 1;
  gap: 6px;
  overflow-x: auto;
  min-width: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.eldalil-channel-group::-webkit-scrollbar {
  display: none;
}

.eldalil-channel-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 6px 12px;
  font-family: 'Cairo', 'Almarai', system-ui, sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
  background: #f8fafc;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.3;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.eldalil-channel-btn:hover {
  background: rgba(235, 95, 125, 0.08);
  color: #7a5068;
  border-color: rgba(235, 95, 125, 0.22);
}

.eldalil-channel-btn.active {
  background: linear-gradient(135deg, #eb5f7d, #c94068);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 6px rgba(201, 64, 104, 0.28);
}

#eldalil-unread-bar .eldalil-unread-toggle-btn {
  display: inline-flex !important;
  flex-shrink: 0;
  margin: 0;
}

.eldalil-unread-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 4px 12px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 6px 14px;
  font-family: 'Cairo', 'Almarai', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  background: #f8fafc;
  cursor: pointer;
  line-height: 1.3;
  box-shadow: none;
}

.eldalil-unread-toggle-btn.active {
  background: #fff1f2;
  color: #be123c;
  border-color: #fda4af;
  outline: none;
  box-shadow: 0 0 0 2px rgba(235, 95, 125, 0.2);
}

.eldalil-unread-toggle-btn.loading {
  opacity: 0.65;
  pointer-events: none;
}

.eldalil-unread-toggle-btn .eut-count {
  background: #ef4444;
  color: #fff;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 900;
  min-width: 18px;
  text-align: center;
}

/* Removed admin insights ribbon */
#eldalil-admin-insights {
  display: none !important;
}

/* Legacy duplicate bars — never show */
#eldalil-channel-filters,
#eldalil-channel-filters * {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

/* Hide duplicate filter links in left sidebar (desktop only) */
@media (min-width: 769px) {
  body.eldalil-no-assign aside a[href*="/custom_view/"],
  body.eldalil-no-assign aside a[href*="/unattended/conversations"] {
    display: none !important;
  }

  body.eldalil-no-assign aside a[href*="inbox-view"],
  body.eldalil-no-assign aside [href*="inbox-view"] {
    display: none !important;
  }

  body.eldalil-no-assign aside ul.group.min-w-0:has(a[href*="/custom_view/"]) {
    display: none !important;
  }
}

body.eldalil-no-assign .conversations-list-wrap woot-tabs-item:first-child,
body.eldalil-no-assign .conversations-list-wrap ul > li:first-child {
  display: none !important;
}

/* Hide My Inbox shortcut — agents use «الكل» / channel filters */
body.eldalil-no-assign aside button[aria-label*="Inbox"],
body.eldalil-no-assign aside a[href*="inbox-view"] {
  display: none !important;
}

/* Conversation list — show native time top-left, hide inbox line */
body.eldalil-simple-list .conversation .px-0.py-3 {
  position: relative;
  padding-top: 1.4rem !important;
  padding-bottom: 0.5rem !important;
  overflow: visible !important;
}

body.eldalil-simple-list .conversation .px-0.py-3 > .flex.items-center.min-w-0.gap-1:first-child {
  display: flex !important;
  position: absolute;
  top: 6px;
  left: 10px;
  right: auto;
  width: auto;
  max-width: 45%;
  margin: 0;
  z-index: 2;
}

body.eldalil-simple-list .conversation .px-0.py-3 > .flex.items-center.min-w-0.gap-1:first-child .truncate,
body.eldalil-simple-list .conversation .px-0.py-3 > .flex.items-center.min-w-0.gap-1:first-child fluent-icon,
body.eldalil-simple-list .conversation .px-0.py-3 > .flex.items-center.min-w-0.gap-1:first-child .size-4 {
  display: none !important;
}

body.eldalil-simple-list .conversation .text-xxs {
  display: inline-block !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #94a3b8 !important;
  white-space: nowrap;
  line-height: 1.2;
}

body.eldalil-simple-list .conversation .conversation--user {
  padding-top: 0 !important;
  margin-top: 0 !important;
  padding-inline-end: 48px;
}

body.eldalil-simple-list .conversation .mt-0\\.5.mx-2.mb-0,
body.eldalil-simple-list .conversation [class*="CardLabels"] {
  display: none !important;
}

.eldalil-inbox-tag {
  display: inline-block;
  margin: 2px 8px 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.eldalil-inbox-tag.tag-wa-012 { background: #dcfce7; color: #15803d; }
.eldalil-inbox-tag.tag-wa-010 { background: #d1fae5; color: #059669; }
.eldalil-inbox-tag.tag-wa-011 { background: #dbeafe; color: #1d4ed8; }
.eldalil-inbox-tag.tag-messenger { background: #e0f2fe; color: #0369a1; }
.eldalil-inbox-tag.tag-instagram { background: #fce7f3; color: #be185d; }

.eldalil-order-badge {
  display: inline-block;
  margin: 2px 8px 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.4;
  background: linear-gradient(135deg, #fce7f3, #fff1f2);
  color: #be185d;
  border: 1px solid rgba(235, 95, 125, 0.35);
  box-shadow: 0 1px 4px rgba(235, 95, 125, 0.15);
}

body.dark .eldalil-order-badge {
  background: linear-gradient(135deg, #3f1020, #2d0a1a);
  color: #fda4af;
  border-color: rgba(235, 95, 125, 0.4);
}

.eldalil-ad-badge {
  display: inline-block;
  margin: 2px 8px 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.4;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  color: #1d4ed8;
  border: 1px solid rgba(59, 130, 246, 0.35);
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.12);
}

body.dark .eldalil-ad-badge {
  background: linear-gradient(135deg, #1e3a5f, #172554);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.4);
}

body.eldalil-simple-list .conversation.eldalil-replied .overflow-hidden.text-ellipsis fluent-icon[icon="arrow-reply"],
body.eldalil-simple-list .conversation.eldalil-replied .overflow-hidden.text-ellipsis [icon="arrow-reply"] {
  display: none !important;
}

body.eldalil-simple-list .conversation.eldalil-replied .overflow-hidden.text-ellipsis::before {
  content: '✓ تم الرد · ';
  color: #16a34a;
  font-weight: 700;
  font-size: 12px;
}

/* Unread conversations — simple tint (no pseudo-layer overlays) */
body.eldalil-simple-list .conversations-list-wrap .conversation.eldalil-has-unread,
body.eldalil-simple-list .conversations-list .conversation.eldalil-has-unread,
body.eldalil-simple-list .conversations-list-wrap .conversation:has(.bg-n-teal-9),
body.eldalil-simple-list .conversations-list .conversation:has(.bg-n-teal-9),
body.eldalil-simple-list .conversations-list-wrap .conversation:has(h4.conversation--user.font-semibold),
body.eldalil-simple-list .conversations-list .conversation:has(h4.conversation--user.font-semibold) {
  background-color: rgba(235, 95, 125, 0.13) !important;
  border-inline-start: 3px solid var(--el-pink, #eb5f7d);
}

body.eldalil-simple-list .conversation.eldalil-has-unread:hover,
body.eldalil-simple-list .conversation.eldalil-has-unread.active,
body.eldalil-simple-list .conversation:has(.bg-n-teal-9):hover,
body.eldalil-simple-list .conversation:has(h4.conversation--user.font-semibold):hover {
  background-color: rgba(235, 95, 125, 0.18) !important;
}

body.eldalil-simple-list .conversation.eldalil-has-unread.eldalil-replied {
  background-color: rgba(235, 95, 125, 0.09) !important;
}

body.dark.eldalil-simple-list .conversation.eldalil-has-unread,
body.dark.eldalil-simple-list .conversation:has(.bg-n-teal-9),
body.dark.eldalil-simple-list .conversation:has(h4.conversation--user.font-semibold) {
  background-color: rgba(235, 95, 125, 0.16) !important;
  border-inline-start-color: var(--el-pink, #eb5f7d);
}

@media (max-width: 640px) {
  .eldalil-channel-btn { font-size: 11px; padding: 6px 10px; }
  .eldalil-unread-toggle-btn { font-size: 12px; padding: 7px 12px; margin: 0; }
  body.eldalil-no-assign .conversations-list-wrap woot-tabs-item a { font-size: 12px !important; padding: 7px 10px !important; }
}

/* ── Dark mode ── */

/* Tab bar */
body.dark .conversations-list-wrap div:has(> ul > li > a.text-button) {
  background: linear-gradient(180deg, #1e2023 0%, #1a1c1f 100%) !important;
  border-bottom-color: rgba(235, 95, 125, 0.18) !important;
}

/* Inactive tab link */
body.dark .conversations-list-wrap a.text-button {
  color: #94a3b8 !important;
}

body.dark .conversations-list-wrap a.text-button:hover {
  background: rgba(235, 95, 125, 0.1) !important;
  color: #f9a8d4 !important;
  border-color: rgba(235, 95, 125, 0.25) !important;
}

/* Active tab stays as pink gradient — looks great on dark */

/* Inactive badge dark */
body.dark .conversations-list-wrap a.text-button:not(.text-n-blue-11) > .rounded-full {
  background: rgba(148, 163, 184, 0.1) !important;
  color: #64748b !important;
}

body.dark .eldalil-channel-btn {
  background: #252830;
  color: #94a3b8;
  border-color: rgba(255, 255, 255, 0.09);
}

body.dark .eldalil-channel-btn:hover {
  background: #2e3038;
  border-color: rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
}

body.dark .eldalil-channel-btn.active {
  background: linear-gradient(135deg, #eb5f7d, #c94068);
  color: #fff;
  border-color: transparent;
}

body.dark .eldalil-unread-toggle-btn {
  background: #252830;
  color: #94a3b8;
  border-color: rgba(255, 255, 255, 0.09);
}

body.dark .eldalil-unread-toggle-btn.active {
  background: rgba(190, 18, 60, 0.18);
  color: #fda4af;
  border-color: rgba(253, 164, 175, 0.4);
  box-shadow: 0 0 0 2px rgba(235, 95, 125, 0.12);
}

body.dark .eldalil-inbox-tag.tag-wa-012    { background: #052e16; color: #4ade80; }
body.dark .eldalil-inbox-tag.tag-wa-011    { background: #0c1a3d; color: #93c5fd; }
body.dark .eldalil-inbox-tag.tag-messenger { background: #0c2a3a; color: #67e8f9; }
body.dark .eldalil-inbox-tag.tag-instagram { background: #2d0a1a; color: #f9a8d4; }

body.dark.eldalil-simple-list .conversation .text-xxs {
  color: #6b7280 !important;
}

body.dark.eldalil-simple-list .conversation.eldalil-replied .overflow-hidden.text-ellipsis::before {
  color: #34d399;
}

body.dark .eldalil-unread-toggle-btn:hover {
  background: #2e3038;
  border-color: rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
}

body.dark .eldalil-unread-toggle-btn.active:hover {
  background: rgba(190, 18, 60, 0.25);
  border-color: rgba(253, 164, 175, 0.5);
}
