html {
  scroll-behavior: smooth;
}

/* Custom scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: #c7d2fe;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #818cf8;
}

/* Message container styling */
#messages-container {
  scrollbar-width: thin;
  scrollbar-color: #c7d2fe #f1f1f1;
}

/* Enhanced message alignment */
.message-row {
  display: flex;
  margin-bottom: 1rem;
  width: 100%;
}

.message-row.mine {
  justify-content: flex-end;
}

.message-row.others {
  justify-content: flex-start;
}

.message-content {
  display: flex;
  align-items: flex-end;
  max-width: 75%;
  gap: 0.75rem;
}

.message-content.mine {
  flex-direction: row-reverse;
  margin-left: auto;
}

.message-content.others {
  flex-direction: row;
  margin-right: auto;
}

/* Avatar styling */
.avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: white;
  font-weight: bold;
  font-size: 16px;
  flex-shrink: 0;
}

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

.avatar-others {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Message bubble styling */
.message-bubble {
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  word-wrap: break-word;
  position: relative;
  max-width: 100%;
}

.message-bubble.mine {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.message-bubble.others {
  background: #f3f4f6;
  color: #374151;
  border-bottom-left-radius: 0.25rem;
}

/* Message metadata */
.message-meta {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  gap: 0.5rem;
}

.message-meta.mine {
  justify-content: flex-end;
  color: rgba(255, 255, 255, 0.75);
}

.message-meta.others {
  justify-content: flex-start;
  color: #6b7280;
}

.username-time {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.username-time.mine {
  text-align: right;
  color: rgba(255, 255, 255, 0.75);
}

/* Message status indicators */
.message-status {
  font-size: 0.75rem;
}

.status-sent {
  color: rgba(255, 255, 255, 0.75);
}

.status-delivered {
  color: rgba(255, 255, 255, 0.75);
}

.status-read {
  color: #93c5fd;
}

/* Animation for new messages */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.new-message {
  animation: fadeIn 0.3s ease-in-out;
}

/* Date divider in messages */
.date-divider {
  display: flex;
  align-items: center;
  margin: 1rem 0;
  color: #6b7280;
  font-size: 0.75rem;
}

.date-divider::before,
.date-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #e5e7eb;
}

.date-divider::before {
  margin-right: 0.5rem;
}

.date-divider::after {
  margin-left: 0.5rem;
}

/* Button hover effects */
.btn-hover-effect {
  transition: transform 0.2s ease-in-out;
}

.btn-hover-effect:hover {
  transform: translateY(-2px);
}

/* User status indicator */
.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}

.status-online {
  background-color: #10b981;
}

.status-offline {
  background-color: #d1d5db;
}

/* Typing indicator animation */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-indicator span {
  height: 8px;
  width: 8px;
  background-color: #a5b4fc;
  border-radius: 50%;
  display: inline-block;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
  animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Input styling improvements */
.message-input {
  border-radius: 1.5rem;
  transition: all 0.2s ease;
}

.message-input:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .message-content {
    max-width: 85%;
  }

  .avatar-initial {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .message-bubble {
    padding: 0.5rem 0.75rem;
  }
}
