:root {
  --chat-width: 400px;
}

body {
  transition: padding-right 0.3s ease;
}

body.chat-active {
  padding-right: var(--chat-width);
}

#chat-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #2a5d84;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s, background-color 0.2s;
}
#chat-toggle:hover {
  transform: scale(1.05);
  background-color: #1e4563;
}

#chat-sidebar {
  position: fixed;
  top: 0;
  right: calc(var(--chat-width) * -1);
  width: var(--chat-width);
  height: 100vh;
  background-color: #f9f9f9;
  border-left: 1px solid #ddd;
  box-shadow: -2px 0 10px rgba(0,0,0,0.05);
  transition: right 0.3s ease;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  font-family: "Source Sans 3", sans-serif;
}

body.chat-active #chat-sidebar {
  right: 0;
}

#chat-sidebar-header {
  background-color: #2a5d84;
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

#chat-sidebar-close {
  cursor: pointer;
  font-size: 20px;
  background: none;
  border: none;
  color: white;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Scrollbar invisibile / fine */
#chat-messages::-webkit-scrollbar {
  width: 6px;
}
#chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
#chat-messages::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 10px;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 15px;
  border-radius: 8px;
  line-height: 1.4;
  font-size: 0.95rem;
  word-wrap: break-word;
}

.chat-msg.user {
  background-color: #2a5d84;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.chat-msg.bot {
  background-color: #e2e8f0;
  color: #333;
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

#chat-input-area {
  padding: 15px;
  background: white;
  border-top: 1px solid #ddd;
  display: flex;
  gap: 10px;
}

#chat-input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ccc;
  border-radius: 20px;
  outline: none;
  font-family: inherit;
}
#chat-input:focus {
  border-color: #2a5d84;
}

#chat-send {
  background-color: #2a5d84;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 0 20px;
  cursor: pointer;
  font-weight: 600;
}
#chat-send:hover {
  background-color: #1e4563;
}

@media (max-width: 768px) {
  :root {
    --chat-width: 100%;
  }
}