:root {
  --primary-color: #2c3e50;
  --secondary-color: #3498db;
  --accent-color: #e74c3c;
  --text-color: #2c3e50;
  --light-bg: #f5f6fa;
  --white: #ffffff;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f0f2f5;
}

.chat-container {
  display: flex;
  padding: 1rem;
  gap: 1rem;
  margin: 0 20px 0;
  height: calc(100vh - 140px);
}

.sidebar {
  height: 100%;
  max-height: 100%;
  width: 280px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.user-profile {
  padding: 15px;
  border-bottom: 1px solid #eee;
}

.user-profile h3 {
  color: #1a73e8;
  margin-bottom: 5px;
}

.online-users {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
}

.user-list-item {
  padding: 10px;
  margin-bottom: 5px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-list-item:hover {
  background: #f0f2f5;
}

.online-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #42b72a;
}

.main-chat {
  flex: 1;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
}

.chat-header {
  padding: 15px;
  border-bottom: 1px solid #eee;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #f8f9fa;
  height: auto;
  max-height: calc(100% - 120px);
  margin-bottom: 0;
}

.message {
  max-width: 75%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  animation: fadeIn 0.3s ease;
}

.message.sent {
  align-self: flex-end;
}

.message.received {
  align-self: flex-start;
}

.message-header {
  font-size: 0.8rem;
  color: #6c757d;
  padding: 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

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

.message-content {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  position: relative;
  word-wrap: break-word;
  line-height: 1.4;
  width: fit-content;
  max-width: 100%;
}

.message.sent .message-content {
  background: #1a73e8;
  color: white;
  border-bottom-right-radius: 0.25rem;
  margin-left: auto;
}

.message.received .message-content {
  background: white;
  color: #212529;
  border-bottom-left-radius: 0.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  margin-right: auto;
}

.file-attachment {
  margin-top: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: fit-content;
  max-width: 100%;
}

.message.sent .file-attachment {
  background: rgba(255, 255, 255, 0.2);
}

.message.received .file-attachment {
  background: rgba(0, 0, 0, 0.05);
}

.file-attachment img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 0.5rem;
  object-fit: cover;
}

.file-attachment a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-attachment i {
  font-size: 1.25rem;
}

.message-form {
  padding: 1rem;
  background: white;
  border-top: 1px solid #dee2e6;
}

.message-input-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #f8f9fa;
  border-radius: 1.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid #dee2e6;
}

#message-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.5rem 0;
  font-size: 0.95rem;
  min-height: 24px;
  max-height: 120px;
  resize: none;
}

#message-input:focus {
  outline: none;
}

.file-label {
  color: #6c757d;
  cursor: pointer;
  transition: color 0.2s;
  padding: 0.5rem;
  border-radius: 50%;
}

.file-label:hover {
  color: #1a73e8;
  background: rgba(26, 115, 232, 0.1);
}

button[type="submit"] {
  background: #1a73e8;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 1.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

button[type="submit"]:hover {
  background: #1557b0;
  transform: translateY(-1px);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-time {
  font-size: 0.75rem;
  opacity: 0.8;
}

.message.sent .message-time {
  text-align: right;
}

.message.system {
  align-self: center;
  max-width: 90%;
  text-align: center;
}

.message.system .message-content {
  background: rgba(108, 117, 125, 0.1);
  color: #6c757d;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 1rem;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  background: rgba(108, 117, 125, 0.1);
  border-radius: 1rem;
  width: fit-content;
  margin: 0.5rem 0;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #6c757d;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

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

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

@keyframes typingBounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-4px);
  }
}

.active-chat {
  background: #e7f0fe;
  color: #1a73e8;
}

.header-buttons {
  position: absolute;
  right: 15px;
  top: 15px;
  display: flex;
  gap: 10px;
}



.logout-btn {
  background: #dc3545;
}

.logout-btn:hover {
  background: #c82333;
}

.chat-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.active-chat {
  background: #e7f0fe !important;
  color: #1a73e8;
}

.online-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 10px;
  transition: all 0.3s ease;
}

.online-indicator.active {
  background-color: #42b72a;
  box-shadow: 0 0 0 2px rgba(66, 183, 42, 0.2);
}

.online-indicator.inactive {
  background-color: #ccc;
}

.user-list-item {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  margin: 5px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-list-item:hover {
  background-color: #f0f2f5;
}

.user-list-item.active-chat {
  background-color: #e7f0fe;
  color: #1a73e8;
}

#messages {
  height: 400px;
  overflow-y: auto;
  padding: 15px;
  background: #fff;
  border-radius: 8px;
  margin-bottom: 15px;
}

.message {
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  max-width: 70%;
}

.message.sent {
  background-color: #e3f2fd;
  margin-left: auto;
}

.message.received {
  background-color: #f5f5f5;
  margin-right: auto;
}

.message-input-container {
  flex: 1;
  display: flex;
  align-items: center;
  background: white;
  border-radius: 25px;
  padding: 5px 15px;
  border: 1px solid #ddd;
}

.file-label {
  cursor: pointer;
  padding: 5px 10px;
  color: #666;
}

.file-label:hover {
  color: #1a73e8;
}

.message-with-file {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.file-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 5px;
}

.file-attachment img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 5px;
}

.file-attachment a {
  color: #1a73e8;
  text-decoration: none;
}

/* Loading indicator */
.upload-progress {
  height: 3px;
  background: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  background: #1a73e8;
  transition: width 0.3s ease;
}



/* Users list */
.users-list {
  width: 250px;
  background: white;
  border-radius: 10px;
  padding: 15px;
  overflow-y: auto;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Chat area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Messages container */
#messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  min-height: 500px;
  /* Minimum height */
  max-height: calc(85vh - 120px);
  /* Adjusted max height */
}

/* Message form */
.message-form {
  padding: 20px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
}

#message-input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
}

/* Individual messages */
.message {
  margin-bottom: 15px;
  padding: 10px 15px;
  border-radius: 10px;
  max-width: 75%;
}

.message.sent {
  background-color: #e3f2fd;
  margin-left: auto;
}

.message.received {
  background-color: #f5f5f5;
  margin-right: auto;
}

/* Chat header */
.chat-header {
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Add these to your existing styles */
.translate-btn {
  background: none;
  border: none;
  color: #1a73e8;
  cursor: pointer;
  padding: 2px 5px;
  font-size: 14px;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.translate-btn:hover {
  opacity: 1;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.message.received .translate-btn {
  margin-left: auto;
}

/* Add Google Translate dropdown in chat header */
#google_translate_element {
  margin-left: auto;
  margin-right: 20px;
}

.goog-te-combo {
  padding: 5px;
  border-radius: 4px;
  border: 1px solid #ddd;
}