/* ===== Direct Messages UI ===== */
.dm-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4757;
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  border: 2px solid white;
  animation: bounce 1s infinite;
}

.dm-modal-card {
  width: 900px;
  height: 600px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.dm-modal-card .modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.dm-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  background: #fdfdfd;
}

.dm-sidebar {
  width: 250px;
  border-right: 1px solid rgba(0,0,0,0.05);
  overflow-y: auto;
  background: #f8f9fa;
}

.dm-chat-item {
  display: flex;
  align-items: center;
  padding: 15px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  transition: background 0.2s;
}

.dm-chat-item:hover {
  background: rgba(255, 105, 180, 0.05);
}

.dm-chat-item.active {
  background: rgba(255, 105, 180, 0.1);
  border-left: 4px solid #ff69b4;
}

.dm-chat-item-avatar {
  font-size: 24px;
  margin-right: 12px;
  background: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  border: 1px solid rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

.dm-chat-item-info {
  flex: 1;
  overflow: hidden;
}

.dm-chat-item-name {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  margin-bottom: 4px;
}

.dm-chat-item-preview {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-chat-item.unread .dm-chat-item-name {
  font-weight: 700;
}

.dm-chat-item.unread .dm-chat-item-preview {
  font-weight: 600;
  color: #111;
}

.dm-chat-item-unread-dot {
  width: 8px;
  height: 8px;
  background-color: #0095f6;
  border-radius: 50%;
  margin-left: 8px;
  flex-shrink: 0;
}

.dm-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.dm-chat-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 16px;
}

.dm-chat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dm-chat-header {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  background: white;
}

.dm-chat-header .dm-chat-avatar {
  font-size: 28px;
  margin-right: 15px;
}

.dm-chat-header .dm-chat-name {
  font-size: 18px;
  font-weight: 700;
}

.dm-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: #fafafa;
}

.dm-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.dm-bubble-npc {
  align-self: flex-start;
  background: white;
  border: 1px solid #eee;
  border-bottom-left-radius: 4px;
}

.dm-bubble-player {
  align-self: flex-end;
  background: #ff69b4;
  color: white;
  border-bottom-right-radius: 4px;
}

.dm-options {
  padding: 20px;
  background: white;
  border-top: 1px solid rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dm-option-btn {
  background: #f8f9fa;
  border: 1px solid #ddd;
  padding: 12px 15px;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.dm-option-btn:hover {
  background: #fff0f5;
  border-color: #ffb6c1;
  transform: translateY(-1px);
}

/* Enhanced DM Elements */
.dm-chat-header-info {
  display: flex;
  flex-direction: column;
}

.dm-chat-status {
  font-size: 12px;
  color: #2ecc71;
  font-weight: 500;
  margin-top: 2px;
}

.dm-wrapper-npc {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.dm-wrapper-player {
  align-self: flex-end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.dm-bubble {
  max-width: 100%;
}

.dm-time {
  font-size: 10px;
  color: #aaa;
  margin-top: 4px;
  margin-bottom: 4px;
}

.dm-attachment-card {
  width: 140px !important; /* override the 80px from catalog */
  height: auto;
  margin-top: 10px;
  pointer-events: auto; /* ensure we can click it */
}

.dm-attachment-card .item-thumb-wrapper {
  height: 140px;
}

.dm-attachment-card .item-name {
  white-space: normal;
  text-align: center;
  font-size: 11px;
}


.dm-wrapper-typing {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.dm-bubble-typing {
  background: white;
  border: 1px solid #eee;
  border-bottom-left-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 20px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: #ccc;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Mobile Messenger Layout Fix */
.btn-dm-back {
  display: none;
}

@media (max-width: 768px), (orientation: portrait) {
  .is-mobile .dm-layout {
    display: block !important;
    position: relative;
    width: 100%;
    height: 100%;
  }
  .is-mobile .dm-sidebar {
    width: 100% !important;
    height: 100%;
    border-right: none !important;
  }
  .is-mobile .dm-chat-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none !important;
    background: white;
    z-index: 10;
  }
  .is-mobile .dm-layout.chat-active .dm-sidebar {
    display: none !important;
  }
  .is-mobile .dm-layout.chat-active .dm-chat-area {
    display: flex !important;
  }
  .is-mobile .dm-chat-placeholder {
    display: none !important;
  }
  .is-mobile .btn-dm-back {
    display: block;
    background: none;
    border: none;
    color: #ff69b4;
    margin-right: 15px;
    cursor: pointer;
    padding: 0;
  }
  .is-mobile .btn-dm-back:hover {
    opacity: 0.8;
  }
}

/* System Message inside DMs */
.dm-system-message {
  align-self: center;
  background: rgba(0, 0, 0, 0.05);
  color: #666;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 12px;
  margin: 8px 0;
  text-align: center;
  max-width: 80%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.dm-system-message.gain {
  background: rgba(46, 204, 113, 0.1);
  color: #27ae60;
  border: 1px solid rgba(46, 204, 113, 0.2);
}

.dm-system-message.loss {
  background: rgba(231, 76, 60, 0.1);
  color: #c0392b;
  border: 1px solid rgba(231, 76, 60, 0.2);
}

/* Narrator / Consequences Message inside DMs */
.dm-narrator-message {
  align-self: center;
  background: rgba(142, 110, 136, 0.04); /* Neutral slate background */
  color: var(--text-primary);
  font-size: 13px;
  font-style: italic;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  margin: 10px 0;
  text-align: center;
  max-width: 85%;
  line-height: 1.4;
  border: 1px dashed rgba(142, 110, 136, 0.15); /* Neutral slate dashed border */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.01);
}


