.message-icon-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin-right: 20px;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.3s;
}

.message-icon-wrapper:hover {
  background: rgba(0, 123, 255, 0.1);
}

.message-icon-wrapper-mobile {
  position: relative;
  display: none;
  align-items: center;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.3s;
  margin-right: 5px;
}

.message-icon-wrapper-mobile:hover {
  background: rgba(0, 123, 255, 0.1);
}

@media (max-width: 768px) {
  .message-icon-wrapper {
    display: none !important;
  }
  
  .message-icon-wrapper-mobile {
    position: relative !important;
    display: inline-flex !important;
    z-index: 10;
  }
  
  .mobile-controls {
    display: flex !important;
    align-items: center;
    gap: 5px;
  }
  
  .navbar-center {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .navbar-center .brand {
    flex: 1;
    text-align: center;
  }
}

@media (min-width: 769px) {
  .message-icon-wrapper-mobile {
    display: none !important;
  }
}

.message-icon {
  font-size: 20px;
  color: #6c757d;
  transition: all 0.3s;
}

.message-icon:hover {
  color: #495057;
  transform: scale(1.1);
}

.message-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #ff4d4d, #dc3545);
  color: white;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.4);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { 
    transform: scale(1);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.4);
  }
  50% { 
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(220, 53, 69, 0.6);
  }
  100% { 
    transform: scale(1);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.4);
  }
}

@keyframes badge-animate {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.badge-animate {
  animation: badge-animate 0.3s ease;
}

.message-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  width: 380px;
  max-height: 500px;
  display: none;
  z-index: 1050;
  overflow: hidden;
}

.message-dropdown-mobile {
  position: fixed;
  top: 60px;
  left: 10px;
  right: 10px;
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  width: calc(100% - 20px);
  max-width: 500px;
  margin: 0 auto;
  max-height: 70vh;
  display: none;
  z-index: 1050;
  overflow: hidden;
  border-radius: 8px;
}

.message-dropdown.show,
.message-dropdown-mobile.show {
  display: block;
  animation: slideDown 0.3s ease;
}

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

.message-dropdown-header {
  padding: 15px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
}

.message-dropdown-title {
  font-weight: 600;
  font-size: 16px;
  color: #343a40;
}

.mark-all-read {
  font-size: 12px;
  color: #007bff;
  cursor: pointer;
  transition: color 0.3s;
  padding: 4px 8px;
  border-radius: 4px;
}

.mark-all-read:hover {
  color: #0056b3;
  background: rgba(0, 123, 255, 0.1);
}

.message-dropdown-body {
  max-height: 350px;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .message-dropdown-mobile .message-dropdown-body {
    max-height: calc(70vh - 120px);
  }
  
  .message-dropdown-mobile .message-item {
    padding: 12px 10px;
  }
  
  .message-dropdown-mobile .message-title {
    font-size: 14px;
    line-height: 1.4;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
    word-break: break-word;
  }
  
  .message-dropdown-mobile .message-preview {
    font-size: 12px;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
    max-height: 2.4em;
    line-height: 1.2;
  }
}

.message-item {
  padding: 12px 15px;
  border-bottom: 1px solid #f1f3f5;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: flex-start;
}

.message-item:hover {
  background: #f8f9fa;
}

.message-item.unread {
  background: #e7f3ff;
  border-left: 3px solid #007bff;
}

.message-type-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
}

.message-type-icon.user {
  background: #e3f2fd;
  color: #2196f3;
}

.message-type-icon.system {
  background: #fff3e0;
  color: #ff9800;
}

.message-type-icon.notification {
  background: #f3e5f5;
  color: #9c27b0;
}

.message-type-icon.auto {
  background: #e8f5e9;
  color: #4caf50;
}

.message-content-wrapper {
  flex: 1;
  min-width: 0;
}

.message-title {
  font-weight: 500;
  color: #343a40;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-preview {
  font-size: 13px;
  color: #6c757d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-time {
  font-size: 11px;
  color: #adb5bd;
  margin-top: 4px;
}

.message-dropdown-footer {
  padding: 12px;
  text-align: center;
  border-top: 1px solid #e9ecef;
  background: #f8f9fa;
}

.view-all-messages {
  color: #007bff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.3s;
}

.view-all-messages:hover {
  background: rgba(0, 123, 255, 0.1);
  text-decoration: none;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.modal.show {
  display: flex !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  border-radius: 16px;
  max-width: 90%;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideInUp 0.3s ease;
  display: flex;
  flex-direction: column;
}

@keyframes slideInUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.system-message-detail {
  max-width: 600px;
  width: 100%;
}

.modal-header {
  padding: 20px 25px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  flex-shrink: 0;
}

.system-message-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.system-message-header-content {
  flex: 1;
  min-width: 0;
}

.system-message-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 12px 0;
  line-height: 1.4;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.system-message-meta {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: center;
}

.message-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  gap: 4px;
  background: rgba(255, 255, 255, 0.25);
  color: white;
  backdrop-filter: blur(5px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.message-type-badge.notification {
  background: rgba(156, 39, 176, 0.9);
}

.message-type-badge.system {
  background: rgba(255, 152, 0, 0.9);
}

.message-type-badge.auto {
  background: rgba(76, 175, 80, 0.9);
}

.message-type-badge.user {
  background: rgba(33, 150, 243, 0.9);
}

.message-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(5px);
}

.modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 28px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.3s;
  flex-shrink: 0;
  line-height: 1;
  margin-left: 15px;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.modal-body {
  padding: 25px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.system-message-body {
  background: #f8f9fa;
}

.message-content-box {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid #e9ecef;
}

.message-content-text {
  font-size: 15px;
  line-height: 1.8;
  color: #2d3748;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-footer {
  padding: 20px 25px;
  border-top: 1px solid #e9ecef;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f8f9fa;
  flex-shrink: 0;
}

.btn-ok {
  padding: 10px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-ok:hover {
  background: linear-gradient(135deg, #5569d8 0%, #6a4291 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-ok:active {
  transform: translateY(0);
}

.chat-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1100;
}

.chat-modal.pc-draggable {
  background: none;
  pointer-events: none;
}

.chat-modal.pc-draggable .chat-container {
  pointer-events: all;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.chat-modal.mobile-centered {
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s;
}

.chat-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: -1;
}

.chat-modal.show {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.chat-modal.pc-draggable.show {
  display: block !important;
  align-items: initial;
  justify-content: initial;
}

.chat-container {
  background: white;
  width: 100%;
  max-width: 500px;
  height: calc(100vh - 40px);
  max-height: 550px;
  margin: auto;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s;
}

.pc-draggable .chat-container {
  position: fixed !important;
  margin: 0;
  resize: both !important;
  overflow: auto !important;
  width: 450px;
  height: 550px;
  min-width: 380px;
  min-height: 400px;
  max-width: min(800px, 90vw);
  max-height: min(80vh, calc(100vh - 100px));
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
}

.pc-draggable .chat-container::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 0%, transparent 50%, rgba(150, 150, 150, 0.5) 50%, rgba(150, 150, 150, 0.5) 100%);
  border-radius: 0 0 12px 0;
  z-index: 100;
  pointer-events: auto !important;
}

.pc-draggable .chat-container.dragging {
  opacity: 0.9;
}

.pc-draggable .chat-container.resizing > * {
  pointer-events: none;
  user-select: none;
}

.pc-draggable .chat-container > * {
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.mobile-centered .chat-container {
  position: relative !important;
  width: calc(100% - 20px);
  max-width: 100%;
  height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 80px);
  height: calc(100vh - 80px);
  max-height: min(600px, calc(100vh - 80px));
  margin: 10px;
  resize: none;
}

@supports (-webkit-touch-callout: none) {
  .mobile-centered .chat-container {
    height: calc(100dvh - 100px);
    max-height: calc(100dvh - 100px);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.chat-header {
  padding: 12px 15px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  height: 50px;
  min-height: 50px;
  cursor: move;
}

.pc-draggable .chat-header {
  -webkit-user-select: none;
  user-select: none;
}

.chat-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.chat-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  border: 2px solid white;
}

.chat-username {
  font-weight: 600;
  font-size: 16px;
}

.chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.3s;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}

.chat-close:hover {
  opacity: 1;
}

.user-search-area {
  padding: 12px;
  background: white;
  border-bottom: 1px solid #e9ecef;
  flex-shrink: 0;
  max-height: 180px;
  overflow-y: auto;
}

.user-search-input {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  outline: none;
  font-size: 14px;
}

.user-search-results {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 10px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  display: none;
}

.user-search-results.show {
  display: block;
}

.user-result-item {
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.user-result-item:hover {
  background: #f8f9fa;
}

.user-result-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.user-result-info {
  flex: 1;
}

.user-result-name {
  font-weight: 500;
  color: #343a40;
}

.user-result-uid {
  font-size: 12px;
  color: #6c757d;
}

.chat-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: #f8f9fa;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 20px;
  position: relative;
}

.chat-messages img {
  min-height: 50px;
  background: #f0f2f5;
}

.chat-message {
  margin-bottom: 15px;
  display: flex;
  animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.sent {
  justify-content: flex-end;
}

.chat-message.sent .message-bubble {
  background: #007bff;
  color: white;
  border-radius: 18px 18px 4px 18px;
}

.chat-message.received .message-bubble {
  background: white;
  color: #343a40;
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.message-bubble {
  max-width: 70%;
  padding: 8px 12px;
  word-wrap: break-word;
  word-break: break-word;
  position: relative;
}

.message-meta {
  font-size: 11px;
  margin-top: 5px;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 5px;
}

.new-message-indicator {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #007bff;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
  animation: bounce 2s infinite;
  z-index: 10;
}

.new-message-indicator:hover {
  background: #0056b3;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(-10px); }
  60% { transform: translateX(-50%) translateY(-5px); }
}

.sending-icon {
  color: #6c757d;
  font-size: 12px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.message-meta .read-icon {
  color: #4fc3f7;
  font-size: 12px;
}

.message-meta .unread-icon {
  color: #999;
  font-size: 12px;
}

.message-status {
  position: absolute;
  bottom: -18px;
  right: 0;
  font-size: 10px;
  color: #6c757d;
}

.message-status.sending {
  color: #ffc107;
}

.message-status.sent {
  color: #28a745;
}

.message-status.failed {
  color: #dc3545;
  cursor: pointer;
}

.retry-btn {
  display: inline-block;
  margin-left: 5px;
  color: #007bff;
  cursor: pointer;
  text-decoration: underline;
}

.chat-input-area {
  padding: 10px;
  background: white;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  height: 60px;
  min-height: 60px;
  align-items: center;
  position: relative;
  z-index: 10;
}

.emoji-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f0f2f5;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  color: #65676b;
  font-size: 18px;
  flex-shrink: 0;
}

.emoji-btn:hover {
  background: #e4e6eb;
}

.emoji-btn.active {
  background: #007bff;
  color: white;
}

.chat-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #dee2e6;
  border-radius: 20px;
  outline: none;
  transition: border-color 0.3s;
  font-size: 16px;
}

.chat-input:focus {
  border-color: #007bff;
}

.chat-send-btn {
  padding: 8px 16px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s;
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: #0056b3;
  transform: translateY(-1px);
}

.chat-send-btn:active {
  transform: translateY(0);
}

.chat-send-btn.sending {
  background: #6c757d;
  cursor: not-allowed;
  opacity: 0.7;
}

.chat-send-btn.sending::after {
  content: '...';
  animation: dots 1s infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

.connection-status {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #28a745;
  animation: pulse-green 2s infinite;
}

.connection-status.disconnected {
  background: #dc3545;
  animation: none;
}

.connection-status.reconnecting {
  background: #ffc107;
  animation: pulse-yellow 1s infinite;
}

@keyframes pulse-green {
  0% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
  }
}

@keyframes pulse-yellow {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 193, 7, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
  }
}

.message-loading {
  text-align: center;
  padding: 10px;
  color: #6c757d;
  font-size: 12px;
}

.message-loading i {
  animation: spin 1s linear infinite;
}

.chat-user-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-top: 3px;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9e9e9e;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.status-indicator.online {
  background: #00ff00;
  box-shadow: 0 0 8px rgba(0, 255, 0, 0.6);
  animation: pulse-status-green 2s infinite;
}

.status-indicator.offline {
  background: #ff4444;
  box-shadow: 0 0 4px rgba(255, 68, 68, 0.4);
}

@keyframes pulse-status-green {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 255, 0, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(0, 255, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 255, 0, 0);
  }
}

.status-text {
  font-size: 12px;
  font-weight: 600;
  color: white;
  text-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.5),
    0 0 8px rgba(255, 255, 255, 0.3);
  letter-spacing: 0.5px;
}

.chat-user-status.online {
  background: rgba(76, 175, 80, 0.3);
}

.chat-user-status.online .status-text {
  color: #b8ffb8;
  text-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.5),
    0 0 10px rgba(76, 175, 80, 0.8);
}

.chat-user-status.offline {
  background: rgba(255, 68, 68, 0.2);
}

.chat-user-status.offline .status-text {
  color: #ffcccc;
  text-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.5),
    0 0 8px rgba(255, 68, 68, 0.5);
}

.chat-emoji-picker {
  position: absolute !important;
  bottom: 60px;
  left: 10px;
  width: 340px;
  height: 400px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  display: none;
  flex-direction: column;
  z-index: 1400;
  animation: slideUp 0.3s ease;
  border: 1px solid #e4e6eb;
}

.chat-emoji-picker.show {
  display: flex !important;
}

.chat-container {
  position: relative;
  overflow: visible !important;
}

.pc-draggable .chat-container {
  overflow: visible !important;
}

.chat-emoji-picker .emoji-tabs {
  display: flex;
  align-items: center;
  padding: 8px;
  background: #f7f8fa;
  border-top: 1px solid #e4e6eb;
  border-radius: 0 0 12px 12px;
  gap: 8px;
  overflow-x: auto;
  flex-shrink: 0;
}

@media (max-width: 1200px) {
  .pc-draggable .chat-container {
    max-width: min(600px, 80vw);
    max-height: min(70vh, calc(100vh - 120px));
  }
}

@media (max-width: 375px) {
  .mobile-centered .chat-container {
    height: calc(100vh - 60px);
    max-height: calc(100vh - 60px);
  }
  
  .chat-header {
    height: 45px;
    min-height: 45px;
    padding: 10px 12px;
  }
  
  .chat-input-area {
    height: 55px;
    min-height: 55px;
    padding: 8px;
  }
  
  .chat-messages {
    font-size: 14px;
  }
  
  .chat-input {
    font-size: 16px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .mobile-centered .chat-container {
    height: calc(100vh - 20px);
    max-height: calc(100vh - 20px);
  }
  
  .pc-draggable .chat-container {
    max-height: min(90vh, calc(100vh - 60px));
  }
  
  .chat-header {
    height: 40px;
    min-height: 40px;
    padding: 8px 12px;
  }
  
  .chat-input-area {
    height: 50px;
    min-height: 50px;
  }
  
  .user-search-area {
    max-height: 120px;
  }
  
  .chat-avatar {
    width: 30px;
    height: 30px;
  }

  .chat-user-status {
    padding: 2px 6px;
    font-size: 11px;
  }
  
  .status-indicator {
    width: 8px;
    height: 8px;
  }
}

.message-center {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.message-center-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 3px solid linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-radius: 12px;
  padding: 25px;
}

.message-center-title {
  font-size: 28px;
  font-weight: 700;
  color: #2d3748;
  display: flex;
  align-items: center;
  gap: 12px;
}

.message-center-title::before {
  content: '';
  width: 5px;
  height: 32px;
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
  border-radius: 3px;
}

.message-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.message-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.message-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.message-btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.message-btn-primary:hover {
  background: linear-gradient(135deg, #5569d8 0%, #6a4291 100%);
}

.message-btn-danger {
  background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
  color: white;
}

.message-btn-secondary {
  background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
  color: white;
}

.message-btn-ghost {
  background: #f8f9fa;
  color: #495057;
  border: 1px solid #dee2e6;
}

.message-btn-ghost:hover {
  background: #e9ecef;
}

.message-table-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  overflow: hidden;
  width: 100%;
  position: relative;
}

.message-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.message-table-scroll::-webkit-scrollbar {
  height: 8px;
}

.message-table-scroll::-webkit-scrollbar-track {
  background: #f1f3f5;
  border-radius: 4px;
}

.message-table-scroll::-webkit-scrollbar-thumb {
  background: #adb5bd;
  border-radius: 4px;
}

.message-table-scroll::-webkit-scrollbar-thumb:hover {
  background: #6c757d;
}

.message-table-scroll table {
  width: 100%;
  border-collapse: collapse;
}

.message-table-scroll thead {
  background: #f8f9fa;
}

.message-table-scroll th {
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
  color: #495057;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
}

.message-table-scroll td {
  padding: 12px 15px;
  border-bottom: 1px solid #f1f3f5;
}

.message-table-scroll tbody tr:hover {
  background: #f8f9fa;
}

.message-table-scroll tbody tr.unread {
  background: #e7f3ff;
}

.message-title-link {
  color: #007bff;
  text-decoration: none;
  font-weight: 500;
}

.message-title-link:hover {
  text-decoration: underline;
}

.message-delete-btn {
  padding: 4px 8px;
  font-size: 12px;
}

.message-btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

.message-target {
  font-size: 13px;
  color: #6c757d;
}

@media (max-width: 768px) {
  .message-center {
    padding: 10px;
    overflow-x: hidden;
    max-width: 100vw;
  }
  
  .message-center-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
    padding: 15px;
  }
  
  .message-center-title {
    font-size: 20px;
  }
  
  .message-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .message-actions .message-btn {
    width: 100%;
    justify-content: center;
  }

  .message-table-container {
    border-radius: 8px;
    margin: 0;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    position: relative;
  }

  .message-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: scroll !important;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  .message-table-scroll::-webkit-scrollbar {
    height: 10px !important;
    display: block !important;
  }
  
  .message-table-scroll::-webkit-scrollbar-track {
    background: #e9ecef !important;
    border-radius: 5px;
  }
  
  .message-table-scroll::-webkit-scrollbar-thumb {
    background: #6c757d !important;
    border-radius: 5px;
  }
  
  .message-table-scroll::-webkit-scrollbar-thumb:hover {
    background: #495057 !important;
  }

  .message-table-scroll table {
    min-width: 700px !important;
    width: 700px !important;
    font-size: 13px;
  }

  .message-table-scroll th,
  .message-table-scroll td {
    padding: 10px 8px;
    white-space: nowrap !important;
  }

  .message-table-scroll td:nth-child(3),
  .message-table-scroll th:nth-child(3) {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .message-table-scroll td:nth-child(4),
  .message-table-scroll th:nth-child(4) {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .message-table-scroll td:nth-child(5),
  .message-table-scroll th:nth-child(5) {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .message-type-badge {
    font-size: 11px;
    padding: 3px 8px;
  }

  .message-btn-sm {
    padding: 4px 6px;
    font-size: 11px;
  }

  .message-table-scroll input[type="checkbox"] {
    width: 16px;
    height: 16px;
  }

  .message-table-scroll::after {
    content: '← 左右滑动查看完整内容 →';
    display: block;
    text-align: center;
    padding: 10px;
    font-size: 12px;
    color: #6c757d;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    width: 700px;
    min-width: 700px;
  }

  .chat-header,
  .chat-input-area {
    -webkit-user-select: none;
    user-select: none;
  }
  
  .chat-send-btn,
  .emoji-btn {
    -webkit-tap-highlight-color: transparent;
  }
  
  .message-bubble:active {
    opacity: 0.8;
  }

  .chat-user-status {
    padding: 2px 6px;
  }
  
  .status-text {
    font-size: 11px;
  }

  .modal-content {
    max-width: 95%;
    max-height: 90vh;
    margin: 10px;
  }
  
  .system-message-detail {
    max-width: 100%;
  }
  
  .modal-header {
    padding: 15px 18px;
  }
  
  .system-message-title {
    font-size: 18px;
    margin-bottom: 10px;
  }
  
  .system-message-meta {
    gap: 10px;
  }
  
  .message-type-badge {
    font-size: 11px;
    padding: 4px 10px;
  }
  
  .message-date {
    font-size: 12px;
  }
  
  .modal-body {
    padding: 18px;
  }
  
  .message-content-box {
    padding: 15px;
  }
  
  .message-content-text {
    font-size: 14px;
    line-height: 1.7;
  }
  
  .modal-footer {
    padding: 15px 18px;
  }
  
  .btn-ok {
    padding: 10px 20px;
    font-size: 14px;
    width: 100%;
    justify-content: center;
  }
  
  .modal-close {
    width: 32px;
    height: 32px;
    font-size: 24px;
    margin-left: 10px;
  }
}

@media (max-width: 375px) {
  .message-center {
    padding: 5px;
    overflow-x: hidden;
  }
  
  .message-table-container {
    max-width: 100%;
  }
  
  .message-table-scroll {
    overflow-x: scroll !important;
  }
  
  .message-table-scroll table {
    min-width: 650px !important;
    width: 650px !important;
    font-size: 12px;
  }
  
  .message-table-scroll th,
  .message-table-scroll td {
    padding: 8px 6px;
  }
  
  .message-table-scroll td:nth-child(3),
  .message-table-scroll th:nth-child(3) {
    max-width: 150px;
  }
  
  .message-table-scroll td:nth-child(4),
  .message-table-scroll th:nth-child(4) {
    max-width: 80px;
  }
  
  .message-table-scroll td:nth-child(5),
  .message-table-scroll th:nth-child(5) {
    max-width: 100px;
  }
  
  .message-table-scroll::after {
    font-size: 11px;
    padding: 8px;
    width: 650px;
    min-width: 650px;
  }
}