/* General styles */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-image: url("https://files.joon.id.au/public/space.jpg");
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

/* Chat container */
.chat-container {
  width: 450px;
  height: 800px;
  background: white;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
}

/* Header */
.chat-header {
  background: rgba(132, 191, 255, 0.23);
  backdrop-filter: blur(5px);
  color: white;
  padding: 10px;
  text-align: center;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Messages */
/* Chat messages container */
.chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto; /* Enables scrolling */
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  gap: 10px;
  
  /* Custom scrollbar styling */
  scrollbar-width: thin; /* For Firefox */
  scrollbar-color: rgba(0, 123, 255, 0.5) transparent; /* Thumb and track colors with transparency */
}

/* WebKit scrollbar styles (Chrome, Edge, Safari) */
.chat-messages::-webkit-scrollbar {
  width: 8px; /* Width of the scrollbar */
}

.chat-messages::-webkit-scrollbar-thumb {
  background-color: rgba(0, 123, 255, 0.5); /* Semi-transparent blue thumb */
  border-radius: 4px; /* Roundness of the scrollbar thumb */
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 123, 255, 0.8); /* Slightly darker on hover */
}

.chat-messages::-webkit-scrollbar-track {
  background-color: transparent; /* Fully transparent track */
}
/* Messages */
.message {
  max-width: 70%;
  padding: 10px 15px;
  border-radius: 15px;
  display: inline-block;
  position: relative;
  font-size: 14px;
  line-height: 1.4;
}

.message.sent {
  right: 10px;
  background: rgba(48, 147, 255, 0.5);
  color: white;
  align-self: flex-end;
  margin-left: auto;
  border-bottom-right-radius: 0;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.message.sent::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: -10px; /* Positions the tail to the right edge */
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 0 0 10px; /* Creates the triangle */
  border-color: transparent transparent rgba(48, 147, 255, 0.5) rgba(48, 147, 255, 0.5);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
}

.message.received {
  left: 10px;
background: rgba(255, 255, 255, 0.66);
  color: #000;
  align-self: flex-start;
  margin-right: auto;
  border-bottom-left-radius: 0;
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
}

.message.received::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -10px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 10px 0 0;
  border-color: transparent rgba(255, 255, 255, 0.66) rgba(255, 255, 255, 0.66) transparent;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* Input area */
.chat-input {
  display: flex;
  padding: 10px;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  background: rgba(255, 255, 255, 0.25);
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.chat-input input {
  flex: 1;
  padding: 10px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.chat-input button {
  margin-left: 10px;
  padding: 10px 15px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: rgba(48, 147, 255, 0.75);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);

}

.chat-input button:hover {
  background-color: #0056b3;
}

/* Spinner for typing indicator */
.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #007bff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: auto;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
