/* chat.css - Floating chat bubble + window */

/* Floating button */
#chat-button {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: #2f80ed;
  color: #fff;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 26px;
  box-shadow: 0 8px 22px rgba(15,23,42,0.18);
  z-index: 99999;
  user-select: none;
}

/* Chat window container */
#chat-root {
  position: fixed;
  bottom: 92px;
  right: 22px;
  width: 340px;
  max-width: calc(100% - 44px);
  height: 460px;
  max-height: 80vh;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15,23,42,0.18);
  display: none; /* toggled by JS */
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

/* Header */
#chat-header {
  background: linear-gradient(90deg,#2f80ed,#56b4ff);
  color: #fff;
  padding: 12px 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Header small controls */
#chat-header .close-btn {
  background: transparent;
  color: #fff;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

/* Messages area */
#chat-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: #fbfdff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  -webkit-overflow-scrolling: touch;
}

/* Message bubbles */
.msg {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 78%;
  line-height: 1.3;
  word-break: break-word;
  font-size: 14px;
}

.msg-user {
  align-self: flex-end;
  background: #DCF8C6;
  color: #0b3a0b;
  border-bottom-right-radius: 6px;
}

.msg-admin {
  align-self: flex-start;
  background: #eef2ff;
  color: #0b2a66;
  border-bottom-left-radius: 6px;
}

/* Timestamp (small) */
.msg-time {
  font-size: 11px;
  color: #8c8c8c;
  margin-top: 4px;
  display: block;
}

/* Input area */
#chat-input-area {
  padding: 10px;
  display: flex;
  gap: 8px;
  border-top: 1px solid #f0f0f0;
  background: #fff;
}

#chat-input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  font-size: 14px;
  outline: none;
}

#chat-send {
  padding: 9px 12px;
  border-radius: 8px;
  background: #2f80ed;
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

/* Small screens */
@media (max-width:420px){
  #chat-root { right: 12px; left: 12px; width: auto; bottom: 80px; }
  #chat-button { right: 12px; bottom: 18px; }
}