#message_box {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#message_box:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.message-overlay {
  top: clamp(56px, 8vh, 96px);
  bottom: 0;
  right: 0;
  z-index: 101;
  width: 100%;
  max-height: calc(100dvh - clamp(56px, 8vh, 96px));
  backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
}

.message-overlay.is-hidden {
  display: none;
}

.message-overlay--profile {
  top: clamp(64px, 9vh, 104px);
  z-index: 100;
  max-height: calc(100dvh - clamp(64px, 9vh, 104px));
}

.message-overlay--compact {
  right: 0;
  z-index: 100;
  width: clamp(220px, 40vw, 320px);
  height: min(60vh, calc(100dvh - 6rem));
  bottom: auto;
}

.message-list {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  background-color: rgba(249, 250, 251, 0.5);
}

.message-list-compact {
  min-height: 180px;
  max-height: min(40vh, 320px);
}

.message-unread-badge {
  margin-left: auto;
  align-self: center;
  background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
  color: #fff;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
}

.message-item {
  cursor: pointer;
  padding: 12px 15px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.message-content {
  max-width: calc(100% - 60px);
}

.message-title {
  font-size: 0.875rem;
  font-weight: 500;
}

.message-preview {
  font-size: 0.8125rem;
  color: var(--color-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.notification-panel {
  top: 80px;
  bottom: 0;
  right: 20px;
  z-index: 100;
  width: 300px;
  height: 500px;
}

.notification-list {
  height: 422px;
}

.conversation-item {
  background-color: white;
  transition: all 0.3s ease;
  animation: fadeInRight 0.3s ease forwards;
  animation-delay: calc(var(--animation-order, 0) * 0.05s);
  opacity: 0;
}

.conversation-item:hover {
  background-color: rgba(14, 165, 233, 0.05);
  transform: translateX(5px);
}

.conversation-item img {
  transition: transform 0.3s ease;
}

.conversation-item:hover img {
  transform: scale(1.05);
}

#message_btn_close {
  transition: transform 0.2s ease;
}

#message_btn_close:hover {
  transform: rotate(90deg);
}

.text-muted i {
  opacity: 0.7;
}

#unread_messages::-webkit-scrollbar {
  width: 6px;
}

#unread_messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 5px;
}

#unread_messages::-webkit-scrollbar-thumb {
  background: rgba(14, 165, 233, 0.3);
  border-radius: 5px;
}

#unread_messages::-webkit-scrollbar-thumb:hover {
  background: rgba(14, 165, 233, 0.5);
}

.unread-indicator {
  width: 8px;
  height: 8px;
  background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
  border-radius: 50%;
  display: inline-block;
  margin-left: 5px;
}

@media (max-width: 768px) {
  #message_box {
    width: 100% !important;
    border-radius: 0;
  }

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

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