/* Live messenger — chatcn FullMessenger / Lunar feel on OkayCMS */
:root {
  --sx-chat-ink: #0f172a;
  --sx-chat-muted: #64748b;
  --sx-chat-line: #e2e8f0;
  --sx-chat-mine: #0f766e;
  --sx-chat-theirs: #ffffff;
  --sx-chat-accent: #c2410c;
  --sx-chat-ok: #047857;
  --sx-chat-surface: #f8fafc;
  --sx-chat-radius: 16px;
}

.sx-chat {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: none;
  min-height: 420px;
  height: min(62vh, 640px);
  border: 1px solid var(--sx-chat-line);
  border-radius: var(--sx-chat-radius);
  background: #fff;
  overflow: hidden;
}

.sx-chat__log,
.dropex-chat__log.sx-chat__log {
  flex: 1 1 auto;
  max-height: none;
  overflow: auto;
  border: 0;
  border-radius: 0;
  padding: 18px 16px 12px;
  margin: 0;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(15, 118, 110, 0.06), transparent 55%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  scroll-behavior: smooth;
}

.sx-chat__empty {
  color: var(--sx-chat-muted);
  padding: 48px 16px;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
}

.sx-bubble {
  width: fit-content;
  max-width: min(460px, 78%);
  margin: 0 0 10px;
  padding: 10px 12px 9px;
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  animation: sxBubbleIn 0.2s ease both;
}

@keyframes sxBubbleIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sx-bubble,
  .sx-badge--pulse {
    animation: none !important;
  }
}

.sx-bubble.is-mine {
  margin-left: auto;
  background: var(--sx-chat-mine);
  color: #ecfdf5;
  border-bottom-right-radius: 6px;
}

.sx-bubble.is-theirs {
  margin-right: auto;
  background: var(--sx-chat-theirs);
  border: 1px solid var(--sx-chat-line);
  border-bottom-left-radius: 6px;
  color: var(--sx-chat-ink);
}

.sx-bubble__meta {
  font-size: 11px;
  opacity: 0.75;
  margin-bottom: 4px;
  font-weight: 500;
}

.sx-bubble.is-mine .sx-bubble__meta {
  color: #99f6e4;
  opacity: 1;
}

.sx-bubble__body {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.sx-bubble__file {
  display: inline-block;
  margin-top: 8px;
}

.sx-bubble__file img {
  max-width: 220px;
  max-height: 180px;
  border-radius: 10px;
  display: block;
}

.sx-chat__form.is-sending {
  opacity: 0.65;
  pointer-events: none;
}

.sx-chat__composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.sx-chat__input {
  flex: 1 1 auto;
  min-height: 44px;
  max-height: 120px;
  resize: none;
  width: auto !important;
  border-radius: 12px !important;
  border: 1px solid var(--sx-chat-line) !important;
  background: var(--sx-chat-surface) !important;
  padding: 10px 12px !important;
  font-size: 14px;
  line-height: 1.4;
}

.sx-chat__input:focus {
  outline: none;
  border-color: #99f6e4 !important;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
  background: #fff !important;
}

.sx-chat__emoji-btn,
.sx-chat__attach {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--sx-chat-line);
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: background 0.15s ease;
}

.sx-chat__emoji-btn:hover,
.sx-chat__attach:hover {
  background: var(--sx-chat-surface);
}

.sx-chat__attach {
  margin: 0;
}

.sx-chat__send {
  flex: 0 0 auto;
  min-width: 108px;
  min-height: 42px;
  border-radius: 12px !important;
  background: var(--sx-chat-mine) !important;
}

.sx-chat__send:hover {
  background: #0d9488 !important;
}

.sx-emoji-picker {
  position: absolute;
  left: 12px;
  bottom: 72px;
  z-index: 20;
  width: min(320px, calc(100% - 24px));
  display: none;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--sx-chat-line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
}
.sx-emoji-picker.is-open,
.sx-emoji-picker:not([hidden]) {
  display: grid;
}
.sx-emoji-picker[hidden] {
  display: none !important;
}

.sx-emoji-picker__btn {
  border: 0;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px;
}

.sx-emoji-picker__btn:hover {
  background: #f1f5f9;
}

/* Split inbox — chatcn Conversations + thread */
.supplyex-chat-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 0;
  align-items: stretch;
  border: 1px solid var(--sx-chat-line);
  border-radius: var(--sx-chat-radius);
  background: #fff;
  overflow: hidden;
  min-height: min(68vh, 680px);
}

@media (max-width: 900px) {
  .supplyex-chat-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }
}

.supplyex-chat-list {
  border: 0;
  border-right: 1px solid var(--sx-chat-line);
  border-radius: 0;
  background: #fff;
  max-height: none;
  overflow: auto;
}

.supplyex-chat-item {
  display: block;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--sx-chat-line);
  color: inherit;
  text-decoration: none;
  transition: background 0.15s ease;
}

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

.supplyex-chat-item.is-active {
  background: #f0fdfa;
  box-shadow: inset 3px 0 0 var(--sx-chat-mine);
}

.supplyex-chat-item.has-unread {
  background: #fff7ed;
  box-shadow: inset 3px 0 0 var(--sx-chat-accent);
}

.supplyex-chat-item.has-unread .supplyex-chat-item__title {
  color: var(--sx-chat-accent);
}

.supplyex-chat-item__title {
  font-family: Manrope, "IBM Plex Sans", sans-serif;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sx-chat-ink);
}

.supplyex-chat-thread {
  border: 0;
  border-radius: 0;
  background: #fff;
  padding: 0;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.supplyex-chat-thread__head {
  font-family: Manrope, "IBM Plex Sans", sans-serif;
  font-weight: 700;
  font-size: 14px;
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--sx-chat-line);
  background: #fff;
  color: var(--sx-chat-ink);
}

.supplyex-chat-thread .sx-chat {
  border: 0;
  border-radius: 0;
  height: auto;
  flex: 1 1 auto;
  min-height: 360px;
}

.supplyex-chat-thread .sx-chat__empty,
.supplyex-chat-thread > .dropex-muted,
.supplyex-chat-thread > .supplyex-muted {
  margin: auto;
  padding: 40px 20px;
  text-align: center;
}

.dropex-badge,
.sx-badge--on {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--sx-chat-accent);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  text-align: center;
  font-weight: 700;
}

.sx-badge--pulse {
  animation: sxPulse 1s ease;
  box-shadow: 0 0 0 0 rgba(194, 65, 12, 0.55);
}

@keyframes sxPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(194, 65, 12, 0.45); }
  50% { transform: scale(1.12); box-shadow: 0 0 0 8px rgba(194, 65, 12, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(194, 65, 12, 0); }
}

body.sx-notify-active .tabs__link .dropex-badge,
body.sx-notify-active .tabs__link .sx-badge--on {
  animation: sxPulse 1.4s ease infinite;
}

.tabs__link.has-notify {
  position: relative;
}

.tabs__link.has-notify::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sx-chat-accent);
  box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.18);
}
