/* ZapBot floating assistant */
#zapbot-root {
  position: fixed;
  right: 22px;
  left: auto;
  bottom: 22px;
  z-index: 11020;
  font-family: inherit;
}

.zapbot-nudge {
  position: absolute;
  right: 0;
  bottom: 58px;
  width: 248px;
  padding: 13px 38px 12px 14px;
  border-radius: 16px 16px 5px 16px;
  border: 1px solid rgba(230, 57, 70, 0.28);
  background: rgba(17, 4, 8, 0.96);
  color: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.26);
  animation: zapbotNudgeIn 0.38s ease both;
}

.zapbot-nudge.dismissed {
  display: none;
}

.zapbot-nudge-close {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.72;
}

.zapbot-nudge-close:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.16);
}

.zapbot-nudge-close svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zapbot-nudge::after {
  content: "";
  position: absolute;
  right: 24px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  transform: rotate(45deg);
  background: inherit;
  border-right: 1px solid rgba(230, 57, 70, 0.28);
  border-bottom: 1px solid rgba(230, 57, 70, 0.28);
}

#zapbot-root.open .zapbot-nudge {
  display: none;
}

.zapbot-nudge span {
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.zapbot-nudge small {
  display: inline-flex;
  margin-top: 7px;
  color: #fca5a5;
  font-size: 0.68rem;
  font-weight: 850;
}

@keyframes zapbotNudgeIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.zapbot-fab {
  min-width: 174px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(230, 57, 70, 0.34);
  background: rgba(17, 4, 8, 0.94);
  color: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 12px 0 15px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.zapbot-fab:hover {
  transform: translateY(-2px);
  border-color: rgba(230, 57, 70, 0.66);
  box-shadow: 0 22px 60px rgba(230, 57, 70, 0.18), 0 18px 50px rgba(0, 0, 0, 0.26);
}

.zapbot-fab-icon,
.zapbot-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
}

.zapbot-fab-icon svg,
.zapbot-mark svg,
.zapbot-close svg,
.zapbot-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zapbot-fab-text {
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.zapbot-quota {
  min-width: 48px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.zapbot-quota.low {
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
}

.zapbot-quota.needs-login {
  background: rgba(250, 204, 21, 0.14);
  color: #fde68a;
}

.zapbot-panel {
  position: absolute;
  right: 0;
  bottom: 62px;
  width: min(392px, calc(100vw - 32px));
  height: min(580px, calc(100vh - 110px));
  border-radius: 18px;
  border: 1px solid rgba(230, 57, 70, 0.24);
  background: rgba(13, 5, 8, 0.98);
  color: #fff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  overflow: hidden;
}

.zapbot-panel[hidden] {
  display: none;
}

.zapbot-header {
  height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.zapbot-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(230, 57, 70, 0.12);
  border: 1px solid rgba(230, 57, 70, 0.22);
  flex: 0 0 auto;
}

.zapbot-head-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.zapbot-head-copy strong {
  font-size: 0.96rem;
  font-weight: 900;
  line-height: 1.1;
}

.zapbot-head-copy span {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.48);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zapbot-head-quota {
  flex: 0 0 auto;
  max-width: 132px;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(239, 68, 68, 0.13);
  color: #fca5a5;
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zapbot-head-quota.low {
  background: rgba(239, 68, 68, 0.20);
  color: #fecaca;
}

.zapbot-head-quota.needs-login {
  background: rgba(250, 204, 21, 0.14);
  color: #fde68a;
}

.zapbot-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.zapbot-close:hover {
  color: #fff;
  border-color: rgba(230, 57, 70, 0.42);
}

.zapbot-messages {
  height: calc(100% - 146px);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}

.zapbot-msg {
  display: flex;
}

.zapbot-user {
  justify-content: flex-end;
}

.zapbot-bot {
  justify-content: flex-start;
}

.zapbot-bubble {
  max-width: 84%;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.zapbot-bubble p {
  margin: 0 0 8px;
}

.zapbot-bubble p:last-child {
  margin-bottom: 0;
}

.zapbot-list {
  margin: 6px 0 10px;
  padding-left: 18px;
}

.zapbot-list:last-child {
  margin-bottom: 0;
}

.zapbot-list li {
  margin: 5px 0;
  padding-left: 2px;
}

.zapbot-bubble strong,
.zapbot-section-title {
  color: #ef4444;
  font-weight: 900;
}

.zapbot-section-title {
  display: block;
  margin: 4px 0 6px;
  letter-spacing: 0;
}

.zapbot-section-title.inline {
  display: inline;
  margin: 0;
}

.zapbot-link {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin: 2px 2px 2px 0;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.10);
  color: #fca5a5;
  font-size: 0.78rem;
  font-weight: 850;
  text-decoration: none;
  vertical-align: baseline;
}

.zapbot-link:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.44);
  color: #fecaca;
}

.zapbot-user .zapbot-bubble {
  background: #ef4444;
  color: #fff;
  border-bottom-right-radius: 5px;
}

.zapbot-user .zapbot-bubble strong,
.zapbot-user .zapbot-section-title {
  color: #fff;
}

.zapbot-bot .zapbot-bubble {
  background: rgba(255, 255, 255, 0.065);
  color: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom-left-radius: 5px;
}

.zapbot-form {
  height: 78px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.zapbot-form textarea {
  width: 100%;
  min-width: 0;
  resize: none;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.045);
  color: #fff;
  outline: none;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.84rem;
  line-height: 1.35;
}

.zapbot-form textarea:focus {
  border-color: rgba(230, 57, 70, 0.55);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.12);
}

.zapbot-form textarea::placeholder {
  color: rgba(255, 255, 255, 0.34);
}

.zapbot-send {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  border: 0;
  background: #ef4444;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.zapbot-send:disabled,
.zapbot-form textarea:disabled {
  opacity: 0.58;
  cursor: wait;
}

html[data-theme="light"] .zapbot-fab {
  background: rgba(255, 255, 255, 0.96);
  color: #18181b;
  border-color: rgba(230, 57, 70, 0.28);
  box-shadow: 0 18px 45px rgba(24, 24, 27, 0.13);
}

html[data-theme="light"] .zapbot-nudge {
  background: rgba(255, 255, 255, 0.98);
  color: #18181b;
  border-color: rgba(230, 57, 70, 0.24);
  box-shadow: 0 18px 45px rgba(24, 24, 27, 0.13);
}

html[data-theme="light"] .zapbot-nudge small {
  color: #b91c1c;
}

html[data-theme="light"] .zapbot-quota {
  background: rgba(230, 57, 70, 0.08);
  color: #b91c1c;
}

html[data-theme="light"] .zapbot-panel {
  background: rgba(255, 255, 255, 0.99);
  color: #18181b;
  border-color: rgba(230, 57, 70, 0.22);
  box-shadow: 0 30px 80px rgba(24, 24, 27, 0.16);
}

html[data-theme="light"] .zapbot-header,
html[data-theme="light"] .zapbot-form {
  border-color: rgba(24, 24, 27, 0.08);
}

html[data-theme="light"] .zapbot-head-copy span {
  color: rgba(24, 24, 27, 0.55);
}

html[data-theme="light"] .zapbot-head-quota {
  background: rgba(230, 57, 70, 0.08);
  color: #b91c1c;
}

html[data-theme="light"] .zapbot-head-quota.needs-login {
  background: rgba(250, 204, 21, 0.16);
  color: #b45309;
}

html[data-theme="light"] .zapbot-close {
  background: rgba(24, 24, 27, 0.04);
  color: rgba(24, 24, 27, 0.7);
  border-color: rgba(24, 24, 27, 0.08);
}

html[data-theme="light"] .zapbot-bot .zapbot-bubble {
  background: rgba(24, 24, 27, 0.045);
  color: rgba(24, 24, 27, 0.86);
  border-color: rgba(24, 24, 27, 0.06);
}

html[data-theme="light"] .zapbot-link {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.24);
  color: #dc2626;
}

html[data-theme="light"] .zapbot-link:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.38);
  color: #b91c1c;
}

html[data-theme="light"] .zapbot-form textarea {
  background: rgba(24, 24, 27, 0.035);
  color: #18181b;
  border-color: rgba(24, 24, 27, 0.10);
}

html[data-theme="light"] .zapbot-form textarea::placeholder {
  color: rgba(24, 24, 27, 0.42);
}

@media (max-width: 640px), (max-device-width: 640px) {
  #zapbot-root {
    right: 14px;
    left: auto;
    bottom: 86px;
  }

  .zapbot-fab {
    position: fixed;
    right: 14px;
    left: auto;
    bottom: 86px;
    z-index: 11021;
    min-width: 54px;
    width: 54px;
    padding: 0;
  }

  .zapbot-fab-text,
  .zapbot-quota {
    display: none;
  }

  .zapbot-nudge {
    right: 0;
    bottom: 64px;
    width: min(250px, calc(100vw - 86px));
  }

  .zapbot-panel {
    position: fixed;
    right: 10px;
    left: 10px;
    bottom: 78px;
    width: auto;
    height: min(560px, calc(100vh - 100px));
  }
}
