.branchbot-container {
  position: fixed;
  bottom: 0;
  z-index: 9999;
  font-family: "Segoe UI", Tahoma, sans-serif;
  --branchbot-primary: #edbe83;
  --branchbot-panel: #ffffff;
  --branchbot-text: #1e293b;
}

.branchbot-position-right {
  right: 20px;
}

.branchbot-position-left {
  left: 20px;
}

.branchbot-container:not(.branchbot-manual-mode) {
  right: 12px !important;
  left: auto !important;
  bottom: 0;
}

.branchbot-manual-mode {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  max-width: 380px;
  overflow: visible;
}

.branchbot-launcher {
  position: relative;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  line-height: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: flex-end;
}

.branchbot-child {
  position: relative;
  width: 130px;
  max-width: 36vw;
  height: auto;
  display: block;
  transform: translateY(120px);
  opacity: 0;
}

.branchbot-child-launcher {
  width: 200px;
  max-width: 200px;
  transform: translateY(6px);
  opacity: 1;
}

.branchbot-chat-open .branchbot-child-launcher {
  display: none;
}

.branchbot-child-open {
  position: absolute;
  left: 10px;
  bottom: 0;
  width: 84px;
  height: auto;
  pointer-events: none;
  z-index: 2;
}

.branchbot-intro-ready .branchbot-child,
.branchbot-manual-mode .branchbot-child {
  animation: none;
}

.branchbot-speech {
  position: absolute;
  right: 212px;
  top: 50%;
  bottom: auto;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  max-width: none;
  line-height: 1.35;
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.2);
  opacity: 1;
  transform: translateY(-50%);
  pointer-events: none;
}

.branchbot-speech::after {
  content: none;
}

.branchbot-intro-ready .branchbot-speech,
.branchbot-manual-mode .branchbot-speech {
  animation: none;
}

.branchbot-chat-open .branchbot-speech {
  opacity: 0;
  transform: translateY(calc(-50% + 8px));
}

.branchbot-panel[hidden] {
  display: none !important;
}

.branchbot-panel {
  width: min(380px, calc(100vw - 28px));
  height: 500px;
  background: var(--branchbot-panel);
  color: var(--branchbot-text);
  border-radius: 24px;
  overflow: visible;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header"
    "messages"
    "options";
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(2, 6, 23, 0.12);
  margin-bottom: 10px;
}

.branchbot-header {
  grid-area: header;
  position: relative;
  background: var(--branchbot-primary);
  color: #ffffff;
  font-weight: 700;
  padding: 16px 130px 16px 100px;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
}

.branchbot-title {
  display: inline-block;
}

.branchbot-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.branchbot-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.branchbot-messages {
  grid-area: messages;
  padding: 12px;
  overflow-y: auto;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.branchbot-message {
  max-width: 88%;
  margin-bottom: 10px;
  padding: 10px 13px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
}

.branchbot-message-bot {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.branchbot-message-user {
  margin-left: auto;
  background: var(--branchbot-primary);
  color: #ffffff;
}

.branchbot-options {
  grid-area: options;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: flex-start;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.12);
  background: #ffffff;
  overflow-y: auto;
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
}

.branchbot-option {
  border: 1px solid rgba(15, 23, 42, 0.26);
  background: #f8fafc;
  color: #0f172a;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  text-align: center;
  width: auto;
}

.branchbot-option:hover {
  background: rgba(15, 118, 110, 0.08);
}

@keyframes branchbot-pop-in {
  0% {
    transform: translateY(120px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes branchbot-wave {
  0% {
    transform: rotate(-20deg);
  }
  50% {
    transform: rotate(-50deg);
  }
  100% {
    transform: rotate(-20deg);
  }
}

@keyframes branchbot-bubble-in {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 600px) {
  .branchbot-container:not(.branchbot-manual-mode) {
    right: 8px !important;
    left: auto !important;
  }

  .branchbot-panel {
    width: min(calc(100vw - 16px), 380px);
    height: min(70vh, 560px);
  }

  .branchbot-position-left,
  .branchbot-position-right {
    right: 8px;
    left: auto;
  }

  .branchbot-speech {
    right: 0;
    top: auto;
    bottom: calc(100% + 10px);
    transform: none;
    white-space: normal;
    max-width: min(240px, calc(100vw - 24px));
    padding: 10px 14px;
    font-size: 12px;
  }

  .branchbot-chat-open .branchbot-speech {
    transform: translateY(8px);
  }

  .branchbot-child-launcher {
    width: min(160px, 44vw);
    max-width: min(160px, 44vw);
  }

  .branchbot-child-open {
    left: 8px;
    bottom: 0;
    width: 74px;
  }

  .branchbot-close {
    right: 10px;
    top: 10px;
  }

  .branchbot-messages {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .branchbot-options {
    border-top: 1px solid rgba(15, 23, 42, 0.12);
    border-bottom-right-radius: 24px;
    border-bottom-left-radius: 24px;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .branchbot-option {
    width: auto;
  }
}
