@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;700&display=swap');

:root {
  --border-input: #D1D5DB;
  --bg-background: #FFFFFF;
  --text-foreground: #111827;
  --text-muted-foreground: #6B7280;
  --ring-color: #3B82F6;
  --ring-offset-background: #FFFFFF;
  --primary: 240 5.9% 10%;
  --radius: 0.5rem;

  --border-color: #D1D5DB;
  --font-weight-semibold: 600;
  --padding: 1rem;
  --background-color: #ffffff;
  --text-color: #111827;

  --separator-color: #D1D5DB;
  --separator-thickness: 1px;
  --separator-width: 100%;
  --separator-margin: 0.5rem;

  --font-sans: 'Inter', sans-serif;
  --font-mono: 'Fira Code', monospace;
  --font-serif: 'Merriweather', serif;
}

html {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
}

.flex-container {
  display: flex;
  height: 600px;
  max-width: 56rem;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid var(--border-input);
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: #F9FAFB;
}

.chat-container {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background-color: #FFFFFF;
  border-bottom: 1px solid #E5E7EB;
}

.chat-header-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.chat-header-button {
  display: flex;
  align-items: center;
  justify-content: center;
  align-content: center;
  padding: 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #4B5563;
  transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out;
  border-radius: 0.375rem;
  width: 2.5rem;
  height: 2.5rem;
}

.chat-header-icon {
  display: block;
  align-self: center;
  justify-self: center;
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
}

.chat-header-button:hover {
  background-color: #F3F4F6;
  color: #111827;
}

.chat-header-button:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.chat-messages-container {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

.messages-space {
  display: flex;
  flex-direction: column;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: 70%;
  margin-bottom: 1.5rem;
}

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

.avatar {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
}

.avatar-image {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.avatar-fallback {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: #E5E7EB;
  color: #374151;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1rem;
  font-weight: 600;
  display: none;
}

.avatar-image:not([src])+.avatar-fallback,
.avatar-image[src=""]+.avatar-fallback {
  display: flex;
}

.message-content {
  background-color: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  position: relative;
  word-wrap: break-word;
}

.message.sent .message-content {
  background-color: hsl(var(--primary));
  color: #FFFFFF;
  border: none;
}

.message-user {
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0.25rem;
}

.message-text {
  font-size: 0.875rem;
  margin: 0;
}

.avatar:hover .avatar-fallback {
  display: none;
}

.input-container {
  padding: 1rem;
  background-color: white;
  border-top: 1px solid #e5e7eb;
}

.input-container>*+* {
  margin-top: 1rem;
}

.connect-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 400px;
}

.connect-input {
  display: flex;
  width: 100%;
  flex: 1 1 0%;
  border: 1px solid var(--border-input);
  background-color: var(--bg-background);
  border-radius: 0.375rem;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-foreground);
  transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;

  ::placeholder {
    color: var(--text-muted-foreground);
  }
}

.connect-input::-webkit-file-upload-button {
  border: none;
  background-color: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-foreground);
  cursor: pointer;
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.connect-input::-webkit-file-upload-button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.connect-input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring-color), 0 0 0 4px var(--ring-offset-background);
}

.connect-input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}


.connect-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: color 0.2s ease, background-color 0.2s ease;
  outline: none;
  border: 1px solid var(--border-input);
  background-color: var(--background-color);
  height: 2.5rem;
  padding: 0 1rem;
  cursor: pointer;
  opacity: 1;
  pointer-events: auto;
}

.connect-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.connect-button:not(:disabled):hover {
  background-color: var(--accent-color);
  color: var(--accent-foreground-color);
}

.connect-button svg {
  pointer-events: none;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.connect-button:focus {
  box-shadow: 0 0 0 2px var(--ring-color), 0 0 0 4px var(--ring-offset-background);
}


.send-button {
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 600;
  transition: color 0.2s ease, background-color 0.2s ease;
  outline: none;
  border: 1px solid var(--border-input);
  background-color: hsl(var(--primary));
  height: 2.5rem;
  padding: 0 1rem;
  cursor: pointer;
  opacity: 1;
  pointer-events: auto;
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.send-button:not(:disabled):hover {
  background-color: hsl(var(--primary) / 0.9);
}

.send-button svg {
  pointer-events: none;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.send-button:focus {
  box-shadow: 0 0 0 2px var(--ring-color), 0 0 0 4px var(--ring-offset-background);
}

.send-icon {
  margin-right: 0.5rem;
}

.users-container {
  width: 16rem;
  background-color: #ffffff;
  border-left: 1px solid var(--border-input);
  display: none;
}

@media (min-width: 768px) {
  .users-container {
    display: block;
  }
}

.users-header {
  display: flex;
  align-items: center;
  padding: var(--padding);
  border-bottom: 1px solid var(--border-color);
  transition: border-color 0.2s ease;
  height: 1.75rem;
}

.text-title {
  font-weight: var(--font-weight-semibold);
  font-size: 1rem;
  margin: 0;
}

@media (max-width: 768px) {
  .users-header {
    padding: 0.75rem;
  }

  .text-title {
    font-size: 0.875rem;
  }
}

.users-list {
  position: relative;
  height: calc(100% - 57px);
  margin: 0;
  list-style-type: none;
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.user {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  padding-left: 1rem;
  padding-right: 1rem;
}

.separator:not(:only-child) {
  border: none;
  border-top: var(--separator-thickness) solid var(--separator-color);
  margin: var(--separator-margin);
}