/* Komponent i wspólne ustawienia */
.ai-chatbot {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 500;
  font-family: source-sans-pro, tahoma, arial, sans-serif;
  color: #111A29;
}

.ai-chatbot * {
  box-sizing: border-box;
}

.ai-chatbot button {
  margin: 0;
  font-family: inherit;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
}

.ai-chatbot button:disabled {
  cursor: default;
}

/* Przycisk otwarcia i powłoka okna */
.ai-chatbot__launcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 0;
  border-radius: 20px;
  background: #F3F0FB;
  color: #360EA1;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 4px 16px rgba(17, 26, 41, 0.08);
}

.ai-chatbot__launcher-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.ai-chatbot__launcher-icon img {
  display: block;
  width: 100%;
  height: 100%;
}

.ai-chatbot__window {
  display: none;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 400px;
  height: 650px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 20px 80px rgba(17, 26, 41, 0.10);
}

.ai-chatbot.is-open .ai-chatbot__launcher {
  display: none;
}

.ai-chatbot.is-open .ai-chatbot__window {
  display: block;
}

.ai-chatbot__close {
  position: absolute;
  top: -56px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

.ai-chatbot__close img {
  width: 8px;
  height: 8px;
}

.ai-chatbot__panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  padding: 24px;
}

/* Nagłówek */
.ai-chatbot__header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
}

.ai-chatbot__assistant {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-chatbot__assistant-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #EEE9FA;
}

.ai-chatbot__assistant-icon img {
  width: 20px;
  height: 20px;
}

.ai-chatbot__assistant-info {
  display: flex;
  flex-direction: column;
}

.ai-chatbot__assistant-info strong {
  color: #111A29;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.ai-chatbot__status {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  color: #111A29;
  font-size: 12px;
  line-height: 1.2;
}

.ai-chatbot__status > span {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #19AF55;
}

.ai-chatbot__new-chat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid #E4E6EA;
  border-radius: 20px;
  background: #fff;
  color: #6E6E6E;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
}

.ai-chatbot__new-chat span {
  font-size: 18px;
  line-height: 1;
}

/* Jedna przewijana konwersacja */
.ai-chatbot__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.ai-chatbot__conversation {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Message to cały wpis; message-text to tylko dymek tekstowy. */
.ai-chatbot__message {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  text-align: left;
}

.ai-chatbot__message--assistant {
  align-self: flex-start;
  align-items: flex-start;
  width: 100%;
  text-align: left;
}

.ai-chatbot__message--user {
  align-self: flex-end;
  align-items: flex-end;
  max-width: 100%;
}

.ai-chatbot__message-text {
  width: fit-content;
  max-width: 100%;
  padding: 12px 16px;
  border-radius: 0 10px 10px 10px;
  background: #F3F5F8;
  color: #111A29;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-chatbot__message--user .ai-chatbot__message-text {
  max-width: 100%;
  border-radius: 10px 0 10px 10px;
  background: #360EA1;
  color: #fff;
}

/* Elementy odpowiedzi: opcje i formularze */
.ai-chatbot__message-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.ai-chatbot__option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: #F3F5F8;
  color: #111A29;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  text-align: left;
}

.ai-chatbot__option:hover,
.ai-chatbot__option.is-selected {
  background: #F3F5F8;
  color: #111A29;
  box-shadow: none;
}

.ai-chatbot__option:disabled {
  opacity: 1;
}

.ai-chatbot__option-icon,
.ai-chatbot__option-arrow {
  display: flex;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.ai-chatbot__option-icon img {
  display: block;
  width: 100%;
  height: 100%;
}

.ai-chatbot__option-arrow {
  flex-basis: 14px;
  width: 14px;
  height: 14px;
}

.ai-chatbot__option-arrow img {
  display: block;
  width: 6px;
  height: 10px;
}

.ai-chatbot__option-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ai-chatbot__message-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  background: #F3F5F8;
}

.ai-chatbot__field {
  position: relative;
  display: block;
  margin: 0;
}

.ai-chatbot__field-label {
  position: absolute;
  top: 8px;
  left: 12px;
  z-index: 1;
  color: #111A29;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}

.ai-chatbot__field-input {
  width: 100%;
  height: 56px;
  margin: 0;
  padding: 22px 12px 7px;
  border: 1px solid #E4E6EA !important;
  border-radius: 8px;
  background: #fff;
  color: #111A29;
  font-family: inherit;
  font-size: 13px;
}

.ai-chatbot__field-input::placeholder,
.ai-chatbot__input::placeholder {
  color: #AFB3B9;
  opacity: 1;
}

.ai-chatbot__field-input:focus {
  border-color: #360EA1 !important;
}

/* Oczekiwanie i błąd odpowiedzi */
.ai-chatbot__typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 16px;
  border-radius: 0 10px 10px 10px;
  background: #F3F5F8;
}

.ai-chatbot__typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6E6E6E;
  animation: ai-chatbot-typing 1.2s ease-in-out infinite;
}

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

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

@keyframes ai-chatbot-typing {
  0%, 60%, 100% { opacity: 0.35; }
  30% { opacity: 1; }
}

.ai-chatbot__message--error .ai-chatbot__message-text {
  border: 1px solid #E4E6EA;
}

.ai-chatbot__retry {
  padding: 8px 12px;
  border: 1px solid #E4E6EA;
  border-radius: 8px;
  background: #fff;
  color: #360EA1;
  font-size: 13px;
  font-weight: 600;
}

/* Stopka i composer: bez pozycjonowania wysyłania nad inputem. */
.ai-chatbot__footer {
  flex: 0 0 auto;
}

.ai-chatbot__composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.ai-chatbot__composer-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 48px;
  padding: 5px;
  border: 1px solid #E7E9ED;
  border-radius: 10px;
  background: #fff;
}

.ai-chatbot__input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  height: 100%;
  margin: 0;
  padding: 0 10px;
  border: 0 !important;
  border-radius: 4px;
  background: transparent;
  color: #111A29;
  font-family: inherit;
  font-size: 13px;
  line-height: normal;
  box-shadow: none;
}

.ai-chatbot__input:focus,
.ai-chatbot__input:focus-visible {
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

.ai-chatbot__send {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: #360EA1;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.ai-chatbot__send:disabled,
.ai-chatbot__next:disabled,
.ai-chatbot__retry:disabled {
  opacity: 0.5;
}

/* Dodatkowe elementy odpowiedzi preview */
.ai-chatbot__option--multiple {
  cursor: pointer;
}

.ai-chatbot__option--multiple.is-selected {
  background: #fff;
}

.ai-chatbot__option--multiple:has(input:disabled) {
  cursor: default;
}

.ai-chatbot__checkbox {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #360EA1;
}

.ai-chatbot__next {
  align-self: flex-start;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: #EEE9FA;
  color: #360EA1;
  font-size: 13px;
  font-weight: 600;
}

.ai-chatbot__message-product,
.ai-chatbot__message-contact {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid #E7E9ED;
  border-radius: 10px;
  color: #111A29;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.ai-chatbot__message-product img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.ai-chatbot__message-table {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #E7E9ED;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 400;
}

.ai-chatbot__message-table table {
  width: 100%;
  border-collapse: collapse;
}

.ai-chatbot__message-table caption {
  padding: 10px;
  text-align: left;
  font-weight: 600;
}

.ai-chatbot__message-table th,
.ai-chatbot__message-table td {
  padding: 8px;
  border: 1px solid #E7E9ED;
  text-align: left;
  vertical-align: top;
}

.ai-chatbot__message-table thead {
  background: #F3F5F8;
}

.ai-chatbot__message-steps {
  width: 100%;
  margin: 0;
  padding: 12px 16px 12px 36px;
  border-radius: 10px;
  background: #F3F5F8;
  font-weight: 400;
}

.ai-chatbot__message-steps li + li {
  margin-top: 6px;
}

/* Zwijane narzędzia podglądu, dodawane wyłącznie przez konfigurację preview. */
.ai-chatbot__preview {
  flex: 0 0 auto;
  color: #6E6E6E;
  font-size: 12px;
}

.ai-chatbot__preview summary {
  cursor: pointer;
}

.ai-chatbot__preview-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}

.ai-chatbot__preview-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}

.ai-chatbot__preview-field select {
  width: 100%;
  min-width: 0;
  padding: 6px;
  border: 1px solid #E4E6EA;
  border-radius: 6px;
  background: #fff;
  color: #111A29;
  font-family: inherit;
  font-size: 12px;
}
