/* 메시지 아이콘 스타일 - 헤더 네비게이션에 통합 */
.message-icon-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.message-icon-button {
  position: relative;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0;
  text-decoration: none;
  width: 40px;
  height: 40px;
  padding: 8px !important;
  border-radius: 10px;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.message-icon-button::before {
  content: "";
  width: 22px;
  height: 22px;
  background-color: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") no-repeat center / contain;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") no-repeat center / contain;
}

.message-icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.message-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  background: #ef4444;
  color: #ffffff;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border: 2px solid #ffffff;
}

.message-badge.hidden {
  display: none;
}

/* 메시지 드로어 스타일 */
.message-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
  height: 100vh;
  height: calc(var(--app-vh, 1vh) * 100);
  background: #ffffff;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.15);
  z-index: 3000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.message-drawer.open {
  transform: translateX(0);
}

.message-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: calc(var(--app-vh, 1vh) * 100);
  background: rgba(0, 0, 0, 0.5);
  z-index: 2999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.message-drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.message-drawer-header {
  padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  color: #ffffff;
}

.message-drawer-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.message-drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.message-drawer-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.message-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.message-room-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.message-room-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--stroke);
  cursor: pointer;
  transition: background 0.2s ease;
  position: relative;
}

.message-room-item:hover {
  background: var(--card);
}

.message-room-item.unread {
  background: #f0f9ff;
}

.message-room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.message-room-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.message-room-time {
  font-size: 12px;
  color: var(--muted);
}

.message-room-preview {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-room-unread-badge {
  position: absolute;
  top: 16px;
  right: 20px;
  background: #3b82f6;
  color: #ffffff;
  border-radius: 12px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
}

.message-room-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}

.message-room-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.message-room-empty-text {
  font-size: 16px;
  margin: 0;
}

/* 모바일 대응 */
@media (max-width: 768px) {
  .message-drawer {
    max-width: 100%;
  }
}
