/* chat.css - EasyGo chatbot styling (green user bubbles, blue bot bubbles) */

/* theme vars */
:root{
  --bot-blue: #2d6cdf;     /* bot bubble */
  --bot-blue-dark: #1e4eb0;
  --user-green: #27ae60;   /* user bubble */
  --user-green-dark: #1f8a4a;
  --bg: #ffffff;
  --text: #fff;
  --shell: #f4f6f8;
  --muted: #6b7280;
}

/* Chat container (matches your HTML #chatbot) */
#chatbot{
  width: 340px;
  max-width: 95vw;
  height: 480px;
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(10,20,30,0.12);
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  z-index: 1200;
}

/* Header */
#chat-header{
  background: linear-gradient(180deg, var(--bot-blue) 0%, var(--bot-blue-dark) 100%);
  color: white;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Chat body (message history) */
#chat-body{
  flex: 1 1 auto;
  padding: 12px;
  overflow-y: auto;
  background: var(--shell);
  font-size: 14px;
  line-height: 1.4;
  -webkit-overflow-scrolling: touch;
}

/* ensure floats clear so messages stack nicely */
#chat-body::after{
  content: "";
  display: block;
  clear: both;
}

/* Generic bubble style */
.chat-bubble{
  display: inline-block;
  max-width: 80%;
  padding: 10px 14px;
  margin: 8px;
  border-radius: 14px;
  word-wrap: break-word;
  box-shadow: 0 2px 6px rgba(10,10,10,0.04);
  line-height: 1.3;
  font-size: 13.75px;
  clear: both;
}

/* Bot (left) */
.chat-bubble.bot{
  background: var(--bot-blue);
  color: var(--text);
  float: left;
  margin-right: auto;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 14px;
}

/* User (right) */
.chat-bubble.user{
  background: var(--user-green);
  color: var(--text);
  float: right;
  margin-left: auto;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 14px;
}

/* Typing bubble style (when JS uses "..." or a typing indicator) */
.chat-bubble.typing{
  background: rgba(0,0,0,0.07);
  color: var(--muted);
  font-style: italic;
  padding-left: 12px;
  padding-right: 12px;
}

/* animated typing dots (optional) */
.chat-bubble.typing::after{
  content: "…"; /* ellipsis */
  display: inline-block;
  margin-left: 6px;
  opacity: 0.9;
  animation: blink 1.2s infinite;
}
@keyframes blink{
  0% { opacity: 0.2 }
  50% { opacity: 1 }
  100% { opacity: 0.2 }
}

/* Input area */
#chat-input-area{
  display: flex;
  gap: 8px;
  padding: 10px;
  align-items: center;
  border-top: 1px solid rgba(10,10,10,0.06);
  background: #fff;
}

/* Input field */
#chat-input{
  flex: 1 1 auto;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(10,10,10,0.08);
  font-size: 14px;
  outline: none;
}

/* Give strong focus ring for keyboard users */
#chat-input:focus{
  box-shadow: 0 0 0 3px rgba(45,108,223,0.14);
  border-color: var(--bot-blue-dark);
}

/* Send button */
#send-btn{
  background: var(--bot-blue);
  color: white;
  border: 0;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

/* Hover & focus */
#send-btn:hover { background: var(--bot-blue-dark); }
#send-btn:focus { outline: 3px solid rgba(45,108,223,0.14); outline-offset: 1px; }

/* Accessible visually-hidden helper (same as .sr-only) */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* small screens: full width bottom bar */
@media (max-width: 520px){
  #chatbot{
    width: 100%;
    height: 55vh;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px 12px 0 0;
  }
  #chat-header{ padding-left: 14px; }
}

/* optional: make sure content does not overlap footer buttons */
body { /* no change to body layout, but safe fallback */
  min-height: 100vh;
}
