/* Simple Chatbot widget styles */
:root {
  --sc-color: #2563eb;
  --sc-color-dark: #1d4ed8;
  --sc-radius: 12px;
  --sc-shadow: 0 8px 32px rgba(0,0,0,0.18);
  --sc-z: 99999;
}

#simple-chatbot-root * {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Toggle button */
#simple-chatbot-toggle {
  position: fixed;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--sc-color);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: var(--sc-shadow);
  z-index: var(--sc-z);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}
#simple-chatbot-toggle:hover,
#simple-chatbot-toggle:focus {
  background: var(--sc-color-dark);
  transform: scale(1.07);
  outline: 3px solid rgba(37,99,235,0.35);
}
#simple-chatbot-toggle svg {
  width: 26px;
  height: 26px;
  fill: #fff;
  pointer-events: none;
}

/* Position variants */
.sc-pos-bottom-right #simple-chatbot-toggle { bottom: 24px; right: 24px; }
.sc-pos-bottom-left  #simple-chatbot-toggle { bottom: 24px; left:  24px; }
.sc-pos-bottom-right #simple-chatbot-panel  { bottom: 90px; right: 24px; }
.sc-pos-bottom-left  #simple-chatbot-panel  { bottom: 90px; left:  24px; }

/* Panel */
#simple-chatbot-panel {
  position: fixed;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: var(--sc-radius);
  box-shadow: var(--sc-shadow);
  z-index: var(--sc-z);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transition: opacity 0.18s, transform 0.18s;
}
#simple-chatbot-panel[hidden] {
  display: none;
}

/* Header */
#simple-chatbot-header {
  background: var(--sc-color);
  color: #fff;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#simple-chatbot-header span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#simple-chatbot-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 6px;
  opacity: 0.85;
  flex-shrink: 0;
}
#simple-chatbot-close:hover { opacity: 1; background: rgba(255,255,255,0.15); }
#simple-chatbot-close svg { width: 18px; height: 18px; fill: #fff; }

/* Messages */
#simple-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.sc-msg {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.sc-msg-user {
  align-self: flex-end;
  background: var(--sc-color);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.sc-msg-bot {
  align-self: flex-start;
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 3px;
}
.sc-msg-error {
  align-self: flex-start;
  background: #fee2e2;
  color: #b91c1c;
  border-bottom-left-radius: 3px;
}
.sc-msg-sources {
  font-size: 12px;
  margin-top: 6px;
  color: #475569;
}
.sc-msg-sources a {
  color: var(--sc-color);
  text-decoration: underline;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Typing indicator */
.sc-typing {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  align-self: flex-start;
  background: #f1f5f9;
  border-radius: 10px;
  border-bottom-left-radius: 3px;
}
.sc-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: sc-bounce 1.2s infinite;
}
.sc-typing span:nth-child(2) { animation-delay: 0.2s; }
.sc-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes sc-bounce {
  0%,80%,100% { transform: translateY(0); opacity: 0.5; }
  40%         { transform: translateY(-6px); opacity: 1; }
}

/* Input area */
#simple-chatbot-input-area {
  border-top: 1px solid #e2e8f0;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
#simple-chatbot-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  outline: none;
  line-height: 1.4;
  color: #1e293b;
  background: #fff;
  transition: border-color 0.15s;
  font-family: inherit;
}
#simple-chatbot-input:focus {
  border-color: var(--sc-color);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
#simple-chatbot-send {
  background: var(--sc-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
#simple-chatbot-send:hover { background: var(--sc-color-dark); }
#simple-chatbot-send:disabled { opacity: 0.5; cursor: not-allowed; }
#simple-chatbot-send svg { width: 18px; height: 18px; fill: #fff; pointer-events: none; }

/* Powered-by */
#simple-chatbot-footer {
  text-align: center;
  padding: 4px 0 6px;
  font-size: 11px;
  color: #94a3b8;
}

/* Accessibility: screen-reader only */
.sc-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 400px) {
  #simple-chatbot-panel { width: calc(100vw - 20px); }
  .sc-pos-bottom-right #simple-chatbot-panel { right: 10px; }
  .sc-pos-bottom-left  #simple-chatbot-panel { left: 10px; }
}
