body {
  font-family: 'Poppins', sans-serif;
}

/* Chat toggle button */
#chat-toggle {
  position: fixed;
  bottom: 50px;      
  width: 64px;
  height: 64px;
  background-color: transparent;
  border: 1px solid #ddd;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}
#chat-toggle:lang(en){
  right: 50px;
}
#chat-toggle:lang(ar){
  left: 50px;
}

#chat-toggle img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 50%;
}

/* Chat window */
#chat-window {
  position: fixed;
  bottom: 50px;      
  width: 360px;
  height: 580px;
  background: #F4F4F4;
  border: 1px solid #ddd;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  display: none;
  flex-direction: column;
  font-family: 'Poppins', sans-serif;
  z-index: 1000;
  border-radius: 18px;
  overflow: hidden;
}

#chat-window:lang(en){
  right: 130px;
}
#chat-window:lang(ar){
  left: 130px;
}


/* Header */
#chat-header {
  background: #F4F4F4;
  color: #333;
  padding: 10px 16px;
  font-weight: 600;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chat-avatar-header {
  position: absolute;
  left: 14px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.chatbot-name {
  font-size: 20px;
}

#chat-close {
  position: absolute;
  right: 14px;
  font-size: 18px;
  cursor: pointer;
  user-select: none;
  color: #45484B;
  font-weight: bold;
}

/* Messages container */
#chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 6px 16px 8px;
  background: #F7F7F7;
}

/* top avatar inside messages (scrolls with content) */
#top-avatar {
  display: flex;
  justify-content: center;
  margin: 16px 0 10px;
}

#top-avatar img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}

.message {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 16px;
  max-width: 85%;
  display: block;
  position: relative;
  white-space: pre-line;
  word-wrap: break-word;
  font-size: 15px;
  line-height: 1.5;
  width: fit-content;
}

.message.user {
  background-color: #1A4093;
  margin-left: auto;       /* now pushes to the right */
  margin-right: 0;
  text-align: right;
  color: #F4F4F4;
}
.message.user:lang(ar){
  margin-left: 0;
  margin-right: auto;
  direction: ltr;
}

.message.assistant {
  background-color: #eaeaea;
  margin-right: auto;
  margin-left: 0;
  color: #45484B;
  text-align: left;
}
.message.assistant:lang(ar){
  margin-right:0;
  margin-left:  auto;
  direction: ltr;
}


.message.assistant.rtl {
  direction: rtl;
  text-align: right;
}

.message.assistant a {
  color: #1a0dab;
  text-decoration: underline;
  word-break: break-word;
}

.meta {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  font-size: 10px;
  color: #888;
  margin-top: 6px;
}

.message.user .meta {
  justify-content: flex-end;
  text-align: right;
}

/* Clear chat button */
#clear-chat {
  color: #555;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  padding: 0 16px 4px;
  text-align: left;
}

/* Input area */
#chat-input-wrapper {
  border-top: 1px solid #eee;
  padding: 8px 12px;
  background: #ffffff;
  position: relative;
}

#chat-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

#message-input {
  flex-grow: 1;
  border: none;
  padding: 15px;
  font-size: 15px;
  outline: none;
  height: 48;
}

#send-btn {
  border-radius: 18px;
  padding: 6px 14px;
  height: 48px;
  border: 1px solid #ddd;
  background: #ffffff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

#send-btn:hover {
  background: #f5f5f5;
}

/* Emoji button – grey & white */
#emoji-btn {
  width: 32px;
  height: 48px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 33px;
  font-weight: 800;
  line-height: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #777;
}

#emoji-btn:hover {
  background: #f5f5f5;
}

/* Emoji panel */
#emoji-panel {
  position: absolute;
  bottom: 80px;
  left: 8px;
  right: 8px;
  width: auto;
  height: 330px;
  background: #ffffff;
  border: 1px solid #ddd;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  border-radius: 12px;
  padding: 10px 16px 8px;
  display: none;
  z-index: 1002;
  overflow-y: auto;
}

#emoji-search-container {
  margin-bottom: 6px;
}

#emoji-search {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 12px;
  outline: none;
}

#emoji-search:focus {
  border-color: #999;
}

.emoji-category-title {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin: 8px 0 3px;
}

.emoji-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: 4px;
}

.emoji-item {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 22px;   /* slightly bigger so flags look clear */
  padding: 2px 3px;
}

.emoji-item:hover {
  background: #f1f1f1;
  border-radius: 4px;
}