:root {
  --docsbot-accent: #15aa9f;
  --docsbot-accent-2: #99c21c;
  --docsbot-accent-hover: #119088;
  --docsbot-text: #1a1a1a;
  --docsbot-muted: #666;
  --docsbot-border: #e8ecec;
}

.docsbot-hidden {
  display: none !important;
}

#docsbot-root {
  position: fixed;
  right: 24px;
  bottom: 158px;
  z-index: 9997;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--docsbot-text);
}

#docsbot-panel {
  width: min(400px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 180px));
  min-height: 0;
  background: #fff;
  border: 1px solid rgba(21, 170, 159, 0.15);
  border-radius: 20px;
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.04),
    0 24px 48px rgba(21, 170, 159, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: docsbot-slide-up 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes docsbot-slide-up {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#docsbot-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 16px;
  background: linear-gradient(135deg, var(--docsbot-accent) 0%, var(--docsbot-accent-2) 100%);
  color: #fff;
}

#docsbot-header h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
}

.docsbot-header-sub {
  margin: 0;
  font-size: 12px;
  opacity: 0.92;
}

#docsbot-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

.docsbot-gate {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, #f8fbfb 0%, #f4f6f6 100%);
}

.docsbot-gate-hidden {
  display: none !important;
}

.docsbot-chat-hidden {
  display: none !important;
}

#docsbot-chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.docsbot-gate h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.docsbot-gate p {
  margin: 0;
  font-size: 13px;
  color: var(--docsbot-muted);
  line-height: 1.45;
}

.docsbot-gate-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.docsbot-gate-field input {
  border: 1px solid #dde3e3;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}

.docsbot-gate-field input:focus {
  outline: none;
  border-color: var(--docsbot-accent);
  box-shadow: 0 0 0 3px rgba(21, 170, 159, 0.12);
}

.docsbot-gate-error {
  margin: 0;
  font-size: 12px;
  color: #c0392b;
}

.docsbot-gate-submit {
  margin-top: 4px;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--docsbot-accent), var(--docsbot-accent-2));
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

#docsbot-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, #f8fbfb 0%, #f4f6f6 100%);
}

.docsbot-msg {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 16px;
  word-break: break-word;
  animation: docsbot-fade-in 0.2s ease;
}

@keyframes docsbot-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.docsbot-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--docsbot-accent), #12b5a8);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 8px rgba(21, 170, 159, 0.25);
}

.docsbot-msg-bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--docsbot-border);
  border-bottom-left-radius: 6px;
}

.docsbot-msg-text {
  white-space: pre-wrap;
  line-height: 1.5;
  word-break: break-word;
}

.docsbot-answer-p {
  margin: 0 0 8px;
}

.docsbot-answer-p:last-child {
  margin-bottom: 0;
}

.docsbot-answer-list {
  margin: 8px 0 0;
  padding-left: 1.25rem;
}

.docsbot-answer-list li {
  margin-bottom: 4px;
}

.docsbot-msg-operator {
  border-color: rgba(21, 170, 159, 0.35);
  background: #f0faf9;
}

.docsbot-system {
  font-size: 12px;
  color: #667;
  text-align: center;
}

.docsbot-msg-bot a {
  color: var(--docsbot-accent);
  font-weight: 500;
}

.docsbot-sources {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eef1f1;
  font-size: 12px;
}

.docsbot-sources strong {
  display: block;
  margin-bottom: 6px;
  color: var(--docsbot-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.docsbot-source-link {
  display: inline-flex;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(21, 170, 159, 0.08);
  color: var(--docsbot-accent) !important;
  text-decoration: none;
  font-size: 12px;
}

.docsbot-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--docsbot-border);
  border-radius: 16px;
  border-bottom-left-radius: 6px;
  color: var(--docsbot-muted);
  font-size: 13px;
}

.docsbot-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--docsbot-accent);
  animation: docsbot-bounce 1.2s infinite ease-in-out;
}

.docsbot-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.docsbot-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes docsbot-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

#docsbot-footer {
  flex-shrink: 0;
  border-top: 1px solid #eef1f1;
  padding: 10px 12px 12px;
  background: #fff;
  font-size: 13px;
}

#docsbot-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

#docsbot-input {
  flex: 1;
  border: 1px solid #dde3e3;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  line-height: 1.35;
  resize: none;
  height: 40px;
  min-height: 40px;
  max-height: 96px;
  box-sizing: border-box;
}

#docsbot-input:focus {
  outline: none;
  border-color: var(--docsbot-accent);
  box-shadow: 0 0 0 2px rgba(21, 170, 159, 0.12);
}

#docsbot-send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--docsbot-accent), var(--docsbot-accent-2));
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

#docsbot-send:disabled {
  opacity: 0.55;
}

#docsbot-operator {
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px solid #e5e8e8;
  border-radius: 10px;
  background: #fafbfc;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.docsbot-operator-highlight {
  background: #fffbeb !important;
  border-color: var(--docsbot-accent) !important;
  box-shadow: 0 0 0 3px rgba(21, 170, 159, 0.15);
}

.docsbot-msg-escalate {
  border-color: #f0d78c;
  background: #fffdf5;
}

.docsbot-escalate-hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--docsbot-muted);
}

#docsbot-launcher {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 9997;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--docsbot-accent) 0%, var(--docsbot-accent-2) 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(21, 170, 159, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

#docsbot-launcher:hover {
  transform: scale(1.06);
}

#docsbot-launcher svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

@media (max-width: 480px) {
  #docsbot-root {
    right: 12px;
    bottom: 148px;
  }
  #docsbot-launcher {
    right: 12px;
    bottom: 80px;
  }
}
