

.msg-widget__overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(8px);
  animation: msgFadeIn .15s var(--ease-out);
}

@keyframes msgFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.msg-widget {
  width: 100%;
  max-width: 480px;
  height: 85vh;
  max-height: 85vh;
  background: var(--c-surface);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--c-border2);
  display: flex;
  flex-direction: column;
  animation: msgSlideUp .25s var(--ease-out);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

@keyframes msgSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}


.msg-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
}

.msg-widget__close,
.msg-widget__new {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border);
  background: var(--c-surface2);
  color: var(--c-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background .2s var(--ease-out), transform .2s var(--ease-out);
}

.msg-widget__close:hover,
.msg-widget__new:hover {
  background: var(--c-surface3);
  transform: translateY(-1px);
}

.msg-widget__title {
  font-family: var(--ff-display);
  font-size: 17px;
  font-weight: 800;
  color: var(--c-text);
  letter-spacing: -0.02em;
}


.msg-widget__list {
  flex: 1;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.msg-widget__list::-webkit-scrollbar { display: none; }

.msg-widget__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 80px 20px;
  color: var(--c-muted2);
  text-align: center;
}

.msg-widget__empty i { font-size: 44px; }

.msg-widget__empty p {
  font-family: var(--ff-body);
  font-size: 14px;
  color: var(--c-muted);
}


.msg-widget__conv {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background .15s var(--ease-out);
  border-bottom: 1px solid var(--c-border);
}

.msg-widget__conv:hover {
  background: var(--c-surface2);
}

.msg-widget__conv.is-unread {
  background: rgba(184, 245, 61, 0.03);
}

.msg-widget__conv-avatar {
  width: 50px;
  height: 50px;
  border-radius: var(--r-md);
  background: var(--c-surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--c-border);
}

.msg-widget__conv-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msg-widget__conv-avatar i {
  font-size: 20px;
  color: var(--c-muted2);
}

.msg-widget__conv-info {
  flex: 1;
  min-width: 0;
}

.msg-widget__conv-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.msg-widget__conv-name {
  font-family: var(--ff-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: -0.01em;
}

.msg-widget__verified {
  color: var(--c-accent);
  font-size: 11px;
}

.msg-widget__conv-time {
  font-family: var(--ff-body);
  font-size: 11px;
  color: var(--c-muted);
  flex-shrink: 0;
}

.msg-widget__conv-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.msg-widget__conv-msg {
  font-family: var(--ff-body);
  font-size: 13px;
  color: var(--c-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75%;
}

.msg-widget__conv.is-unread .msg-widget__conv-msg {
  color: var(--c-text);
  font-weight: 500;
}

.msg-widget__conv-badge {
  background: var(--c-accent);
  color: var(--c-bg);
  font-family: var(--ff-display);
  font-size: 10px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  flex-shrink: 0;
}


.msg-widget__chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
  background: var(--c-surface);
  justify-content: space-between;
}

.msg-widget__back {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border);
  background: var(--c-surface2);
  color: var(--c-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: background .2s var(--ease-out);
}

.msg-widget__back:hover { background: var(--c-surface3); }

.msg-widget__chat-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.msg-widget__chat-name {
  font-family: var(--ff-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: -0.01em;
}

.msg-widget__chat-handle {
  font-family: var(--ff-body);
  font-size: 12px;
  color: var(--c-muted);
}


.msg-widget__chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--c-bg);
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.msg-widget__chat-msgs::-webkit-scrollbar { display: none; }

.msg-widget__chat-date {
  text-align: center;
  font-family: var(--ff-body);
  font-size: 11px;
  color: var(--c-muted2);
  padding: 12px 0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}


.msg-widget__bubble {
  display: flex;
  gap: 8px;
  max-width: 82%;
  position: relative;
}

.msg-widget__bubble--them {
  align-self: flex-start;
}

.msg-widget__bubble--me {
  align-self: flex-end;
}

.msg-widget__bubble-avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  background: var(--c-surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  margin-top: 2px;
}

.msg-widget__bubble-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msg-widget__bubble-avatar i {
  font-size: 11px;
  color: var(--c-muted2);
}

.msg-widget__bubble-text {
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-family: var(--ff-body);
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.msg-widget__bubble--them .msg-widget__bubble-text {
  background: var(--c-surface2);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-top-left-radius: var(--r-xs);
}

.msg-widget__bubble--me .msg-widget__bubble-text {
  background: var(--c-accent);
  color: var(--c-bg);
  border-top-right-radius: var(--r-xs);
  font-weight: 500;
}

.msg-widget__bubble-text i {
  opacity: 0.5;
}

.msg-widget__bubble-time {
  font-family: var(--ff-body);
  font-size: 10px;
  color: var(--c-muted2);
  margin-top: 3px;
  padding: 0 4px;
}


.msg-widget__bubble--me .msg-widget__bubble-time {
  text-align: right;
}

.msg-widget__bubble.is-read .msg-widget__bubble-time::after {
  content: ' · Read';
  color: var(--c-accent);
  font-weight: 500;
}


.msg-widget__bubble-actions {
  display: flex;
  gap: 2px;
  margin-top: 2px;
  padding: 0 4px;
  opacity: 0;
  transition: opacity .15s var(--ease-out);
}

.msg-widget__bubble:hover .msg-widget__bubble-actions {
  opacity: 1;
}

.msg-widget__bubble-actions button {
  background: none;
  border: none;
  color: var(--c-muted);
  cursor: pointer;
  font-size: 9px;
  padding: 3px 5px;
  border-radius: var(--r-xs);
  transition: all .15s var(--ease-out);
  font-family: var(--ff-body);
}

.msg-widget__bubble-actions button:hover {
  color: var(--c-text);
  background: var(--c-surface3);
}


.msg-widget__chat-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--c-border);
  flex-shrink: 0;
  background: var(--c-surface);
}

.msg-widget__chat-field {
  flex: 1;
  padding: 12px 18px;
  border-radius: var(--r-full);
  background: var(--c-surface2);
  border: 1px solid var(--c-border2);
  color: var(--c-text);
  font-family: var(--ff-body);
  font-size: 14px;
  outline: none;
  transition: border-color .2s var(--ease-out);
}

.msg-widget__chat-field:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 1px var(--c-accent-dim);
}

.msg-widget__chat-field::placeholder {
  color: var(--c-muted);
}

.msg-widget__chat-send {
  width: 42px;
  height: 42px;
  border-radius: var(--r-full);
  background: var(--c-accent);
  color: var(--c-bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
  box-shadow: 0 0 16px var(--c-accent-dim);
}

.msg-widget__chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 0 24px var(--c-accent-glow);
}


@media (min-width: 768px) {
  .msg-widget__overlay {
    align-items: center;
    justify-content: center;
    padding: 40px;
  }

  .msg-widget {
    max-height: 75vh;
    border-radius: 24px;
    border: 1px solid var(--c-border2);
  }
}


.msg-widget__share-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all .15s var(--ease-out);
  max-width: 280px;
}

.msg-widget__share-card:hover {
  background: var(--c-surface3);
  border-color: var(--c-accent);
  transform: translateY(-1px);
}

.msg-widget__share-card-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--r-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--c-surface3);
}

.msg-widget__share-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msg-widget__share-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--c-muted);
  background: var(--c-surface3);
}

.msg-widget__share-card-info {
  flex: 1;
  min-width: 0;
}

.msg-widget__share-card-title {
  font-family: var(--ff-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.msg-widget__share-card-price {
  font-family: var(--ff-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--c-accent);
}

.msg-widget__share-card-arrow {
  color: var(--c-muted);
  font-size: 12px;
  flex-shrink: 0;
}

.msg-widget__bubble--me .msg-widget__share-card {
  background: rgba(0,0,0,0.15);
  border-color: rgba(255,255,255,0.1);
}

.msg-widget__chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
  background: var(--c-surface);
}

.msg-widget__chat-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.msg-widget__back {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border);
  background: var(--c-surface2);
  color: var(--c-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: background .2s var(--ease-out);
}

.msg-widget__back:hover { background: var(--c-surface3); }

.msg-widget__chat-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.msg-widget__chat-name {
  font-family: var(--ff-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-widget__chat-handle {
  font-family: var(--ff-body);
  font-size: 12px;
  color: var(--c-muted);
}

.msg-widget__close {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border);
  background: var(--c-surface2);
  color: var(--c-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  transition: background .2s var(--ease-out);
}

.msg-widget__close:hover {
  background: var(--c-surface3);
}
.msg-widget__conv-delete {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--c-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.msg-widget__conv-delete:hover {
  background: rgba(255, 82, 82, 0.1);
  color: #ff5252;
}