.lead-widget-root {
  --lead-widget-accent: #00c6fb;
  --lead-widget-accent-dark: #02aede;
  --lead-widget-bg: #ffffff;
  --lead-widget-text: #1e2430;
  --lead-widget-muted: #6f7582;
  --lead-widget-border: rgba(0, 0, 0, 0.08);
  --lead-widget-shadow: 0 22px 60px rgba(18, 42, 61, 0.22);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--lead-widget-text);
}

.lead-widget-root * {
  box-sizing: border-box;
}

.lead-widget-root button,
.lead-widget-root input,
.lead-widget-root h2,
.lead-widget-root h3,
.lead-widget-root p {
  font: inherit;
}

.lead-widget-root button,
.lead-widget-root input {
  appearance: none;
  letter-spacing: normal;
  text-transform: none;
  transform: none;
}

.lead-widget-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--lead-widget-accent), #7be4ff);
  color: #fff;
  box-shadow: 0 18px 38px rgba(0, 198, 251, 0.36);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lead-widget-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 44px rgba(0, 198, 251, 0.42);
}

.lead-widget-bubble svg {
  width: 32px;
  height: 32px;
}

.lead-widget-card {
  width: min(420px, calc(100vw - 24px));
  height: min(720px, calc(100vh - 32px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  background: var(--lead-widget-bg);
  border: 0;
  box-shadow: var(--lead-widget-shadow);
}

.lead-widget-card.is-open {
  display: flex;
}

.lead-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 16px;
  background: linear-gradient(135deg, var(--lead-widget-accent), #1abef0);
  color: #fff;
}

.lead-widget-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.lead-widget-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.lead-widget-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lead-widget-logo span {
  font-size: 18px;
  font-weight: 700;
  color: var(--lead-widget-accent-dark);
}

.lead-widget-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-widget-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lead-widget-icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.lead-widget-body {
  position: relative;
  flex: 1;
  min-height: 0;
  background:
    radial-gradient(circle at top center, rgba(0, 198, 251, 0.16), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
}

.lead-widget-messages {
  height: 100%;
  overflow-y: auto;
  padding: 22px 18px 18px;
}

.lead-widget-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  text-align: center;
  padding: 32px 18px 40px;
}

.lead-widget-empty-logo {
  width: 108px;
  height: 108px;
  margin-bottom: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(0, 198, 251, 0.18), rgba(0, 198, 251, 0.03) 60%, transparent 72%);
}

.lead-widget-empty-logo img {
  max-width: 88px;
  max-height: 88px;
}

.lead-widget-empty-title {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 700;
}

.lead-widget-empty-text {
  margin: 0;
  max-width: 280px;
  color: var(--lead-widget-muted);
  font-size: 15px;
  line-height: 1.5;
}

.lead-widget-day-label {
  margin: 28px 0 18px;
  text-align: center;
  color: var(--lead-widget-muted);
  font-size: 13px;
}

.lead-widget-message-row {
  display: flex;
  margin-bottom: 14px;
}

.lead-widget-message-row.user {
  justify-content: flex-end;
}

.lead-widget-message-row.bot {
  justify-content: flex-start;
}

.lead-widget-message {
  max-width: 82%;
  padding: 16px 18px;
  border-radius: 22px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.lead-widget-message-row.user .lead-widget-message {
  background: linear-gradient(145deg, var(--lead-widget-accent), #31cff9);
  color: #fff;
  border-top-right-radius: 8px;
}

.lead-widget-message-row.bot .lead-widget-message {
  background: #f4f5f8;
  color: var(--lead-widget-text);
  border-top-left-radius: 8px;
}

.lead-widget-typing {
  display: none;
  margin-bottom: 14px;
}

.lead-widget-typing.is-visible {
  display: flex;
}

.lead-widget-typing-bubble {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 14px 16px;
  background: #f4f5f8;
  border-radius: 20px;
  border-top-left-radius: 8px;
}

.lead-widget-typing-bubble span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(30, 36, 48, 0.35);
  animation: lead-widget-bounce 1.2s infinite ease-in-out;
}

.lead-widget-typing-bubble span:nth-child(2) {
  animation-delay: 0.15s;
}

.lead-widget-typing-bubble span:nth-child(3) {
  animation-delay: 0.3s;
}

.lead-widget-footer {
  border-top: 1px solid var(--lead-widget-border);
  padding: 14px;
  background: rgba(255, 255, 255, 0.95);
}

.lead-widget-form {
  display: flex;
  gap: 10px;
}

.lead-widget-input {
  flex: 1;
  min-width: 0;
  height: 56px;
  padding: 0 18px;
  border-radius: 18px;
  border: 1px solid rgba(30, 36, 48, 0.12);
  background: #fff;
  font-size: 16px;
  outline: none;
}

.lead-widget-input:focus {
  border-color: rgba(0, 198, 251, 0.6);
  box-shadow: 0 0 0 3px rgba(0, 198, 251, 0.14);
}

.lead-widget-send {
  min-width: 56px;
  height: 56px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--lead-widget-accent), #31cff9);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0, 198, 251, 0.24);
}

.lead-widget-input:disabled,
.lead-widget-send:disabled {
  cursor: wait;
  opacity: 0.72;
}

.lead-widget-root[data-open="true"] .lead-widget-bubble {
  display: none;
}

@keyframes lead-widget-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.55;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .lead-widget-root {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .lead-widget-card {
    width: 100%;
    height: min(78vh, 680px);
    border-radius: 14px;
  }

  .lead-widget-message {
    max-width: 88%;
  }
}
