#kacc-chatbot,
#kacc-chatbot * {
  box-sizing: border-box;
}

#kacc-chatbot {
  position: fixed;
  z-index: 999999;
  bottom: 22px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: #111827;
}

#kacc-chatbot.kacc-position-right {
  right: 22px;
}

#kacc-chatbot.kacc-position-left {
  left: 22px;
}

.kacc-toggle {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 999px;
  border: none;
  background: var(--kacc-primary, #2563eb);
  color: #fff;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kacc-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.26);
}

.kacc-toggle-icon {
  font-size: 27px;
  line-height: 1;
}

.kacc-toggle-pulse {
  position: absolute;
  inset: -6px;
  border: 2px solid var(--kacc-primary, #2563eb);
  border-radius: 999px;
  animation: kaccPulse 1.8s infinite;
}

@keyframes kaccPulse {
  0% { transform: scale(0.95); opacity: 0.7; }
  80% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

.kacc-window {
  position: absolute;
  bottom: 78px;
  width: 390px;
  max-width: calc(100vw - 34px);
  height: 590px;
  max-height: calc(100vh - 110px);
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  overflow: hidden;
  display: none;
  flex-direction: column;
  border: 1px solid rgba(148, 163, 184, 0.24);
}

.kacc-position-right .kacc-window {
  right: 0;
}

.kacc-position-left .kacc-window {
  left: 0;
}

.kacc-open .kacc-window {
  display: flex;
  animation: kaccSlideUp 0.22s ease;
}

.kacc-open .kacc-toggle {
  display: none;
}

@keyframes kaccSlideUp {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.kacc-header {
  background: linear-gradient(135deg, var(--kacc-primary, #2563eb), #111827);
  color: #fff;
  padding: 18px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.kacc-header strong {
  display: block;
  font-size: 16px;
  line-height: 1.25;
}

.kacc-header span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  opacity: 0.86;
}

.kacc-close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.kacc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 15px;
  background: #f8fafc;
}

.kacc-msg {
  display: flex;
  margin: 0 0 12px;
  flex-direction: column;
}

.kacc-msg-user {
  align-items: flex-end;
}

.kacc-msg-bot {
  align-items: flex-start;
}

.kacc-bubble {
  width: fit-content;
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.kacc-msg-user .kacc-bubble {
  background: var(--kacc-primary, #2563eb);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.kacc-msg-bot .kacc-bubble {
  background: #fff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 5px;
}

.kacc-bubble a {
  color: inherit;
  text-decoration: underline;
}

.kacc-typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-width: 60px;
  min-height: 39px;
}

.kacc-typing span {
  width: 7px;
  height: 7px;
  background: #94a3b8;
  border-radius: 999px;
  animation: kaccDots 1.2s infinite ease-in-out;
}

.kacc-typing span:nth-child(2) { animation-delay: 0.15s; }
.kacc-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes kaccDots {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.45; }
  40% { transform: scale(1); opacity: 1; }
}

.kacc-quick-actions {
  display: flex;
  gap: 8px;
  padding: 11px 12px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  overflow-x: auto;
}

.kacc-action {
  border: 1px solid #dbe3ef;
  background: #f8fafc;
  color: #111827;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.kacc-action:hover {
  border-color: var(--kacc-primary, #2563eb);
  color: var(--kacc-primary, #2563eb);
}

.kacc-form {
  display: flex;
  gap: 9px;
  padding: 12px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
}

.kacc-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  background: #fff;
}

.kacc-form input:focus {
  border-color: var(--kacc-primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.kacc-form button {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: var(--kacc-primary, #2563eb);
  color: #fff;
  cursor: pointer;
  font-size: 17px;
}

.kacc-feedback-inline {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 5px;
  margin-left: 4px;
  font-size: 11px;
  color: #64748b;
}

.kacc-feedback-inline button {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 999px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 11px;
}

.kacc-lead-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 270px;
}

.kacc-lead-form strong,
.kacc-rating-box strong {
  font-size: 14px;
}

.kacc-lead-form input,
.kacc-lead-form textarea,
.kacc-rating-box textarea {
  width: 100%;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.kacc-lead-form textarea,
.kacc-rating-box textarea {
  resize: vertical;
  min-height: 64px;
}

.kacc-lead-form button,
.kacc-rating-box .kacc-submit-rating,
.kacc-rating-box .kacc-skip-rating {
  border: none;
  border-radius: 999px;
  background: var(--kacc-primary, #2563eb);
  color: #fff;
  padding: 10px 13px;
  cursor: pointer;
  font-weight: 600;
}

.kacc-rating-box .kacc-skip-rating {
  background: #e5e7eb;
  color: #111827;
}

.kacc-lead-form small,
.kacc-rating-box small {
  color: #16a34a;
  font-size: 12px;
}

.kacc-rating-box {
  min-width: 270px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.kacc-stars {
  display: flex;
  gap: 3px;
}

.kacc-stars button {
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-size: 25px;
  cursor: pointer;
  padding: 0;
}

.kacc-stars button.active {
  color: #f59e0b;
}

@media (max-width: 480px) {
  #kacc-chatbot {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }

  #kacc-chatbot.kacc-position-right,
  #kacc-chatbot.kacc-position-left {
    right: 12px;
    left: 12px;
  }

  .kacc-toggle {
    margin-left: auto;
    width: 58px;
    height: 58px;
  }

  .kacc-position-left .kacc-toggle {
    margin-left: 0;
    margin-right: auto;
  }

  .kacc-window {
    left: 0 !important;
    right: 0 !important;
    width: 100%;
    height: min(640px, calc(100vh - 28px));
    max-width: none;
    max-height: none;
    bottom: 0;
    border-radius: 20px;
  }

  .kacc-open .kacc-toggle {
    display: none;
  }

  .kacc-bubble {
    max-width: 92%;
    font-size: 13.5px;
  }
}
