/* Chatbot Widget Styles */
#cb-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#cb-bubble {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  padding: 10px 14px;
  max-width: 220px;
  font-size: 13px;
  color: #333;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  position: relative;
  animation: cb-fade-in 0.3s ease;
  cursor: pointer;
  line-height: 1.4;
}

#cb-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 18px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #dee2e6;
}

#cb-bubble::before {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 18px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #fff;
  z-index: 1;
}

#cb-bubble-close {
  position: absolute;
  top: 4px;
  right: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #999;
  line-height: 1;
  padding: 0;
}

#cb-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #E63946;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(230,57,70,0.4);
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
}

#cb-btn:hover {
  background: #C1121F;
  transform: scale(1.08);
}

#cb-btn svg {
  width: 28px;
  height: 28px;
}

#cb-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 370px;
  height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  animation: cb-slide-up 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#cb-window.cb-hidden {
  display: none;
}

@keyframes cb-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

#cb-header {
  background: #E63946;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#cb-header-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

#cb-header-title span.cb-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  display: inline-block;
}

#cb-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

#cb-close:hover {
  background: rgba(255,255,255,0.35);
}

#cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8f9fa;
}

#cb-messages::-webkit-scrollbar {
  width: 4px;
}
#cb-messages::-webkit-scrollbar-track { background: transparent; }
#cb-messages::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 2px; }

.cb-msg {
  display: flex;
  animation: cb-fade-in 0.25s ease;
}

.cb-msg.bot { justify-content: flex-start; }
.cb-msg.user { justify-content: flex-end; }

.cb-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.cb-msg.bot .cb-bubble {
  background: #fff;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.cb-msg.user .cb-bubble {
  background: #E63946;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.cb-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  background: #fff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  width: fit-content;
}

.cb-typing span {
  width: 7px;
  height: 7px;
  background: #ccc;
  border-radius: 50%;
  animation: cb-bounce 1.2s infinite;
}

.cb-typing span:nth-child(2) { animation-delay: 0.2s; }
.cb-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cb-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); background: #E63946; }
}

#cb-input-area {
  padding: 12px;
  border-top: 1px solid #f0f0f0;
  background: #fff;
  flex-shrink: 0;
}

.cb-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.cb-input-row input,
.cb-input-row textarea {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #dee2e6;
  border-radius: 22px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: none;
  transition: border-color 0.2s;
  line-height: 1.4;
}

.cb-input-row input:focus,
.cb-input-row textarea:focus {
  border-color: #E63946;
}

.cb-input-row textarea {
  border-radius: 12px;
  min-height: 60px;
  max-height: 100px;
}

.cb-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #E63946;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.cb-send-btn:hover { background: #C1121F; }

.cb-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.cb-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}

.cb-opt-btn {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1.5px solid #E63946;
  background: #fff;
  color: #E63946;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
  font-weight: 500;
}

.cb-opt-btn:hover,
.cb-opt-btn.selected {
  background: #E63946 !important;
  color: #fff;
}

.cb-scale-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cb-scale-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cb-scale-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid #E63946;
  background: #fff;
  color: #E63946;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}

.cb-scale-btn:hover {
  background: #E63946;
  color: #fff;
}

.cb-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #888;
}

.cb-next-btn {
  padding: 9px 20px;
  background: #E63946;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  margin-top: 4px;
  transition: background 0.2s;
}

.cb-next-btn:hover { background: #C1121F; }

.cb-wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  margin-top: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.cb-wa-btn:hover { background: #1ebe5d; }

@media (max-width: 420px) {
  #cb-window {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 80px;
    height: 80vh;
  }
  #cb-launcher {
    right: 16px;
    bottom: 16px;
  }
}
