.wl-chat-toggle {
  position: fixed;
  left: 0;
  top: auto;
  bottom: calc(24px + env(safe-area-inset-bottom));
  right: auto;
  min-width: 56px;
  height: 52px;
  padding: 0 12px 0 14px;
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 8px;
  background: #19747E;
  border: 1px solid #0b1f3b;
  border-radius: 0 999px 999px 0;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(25, 116, 126, 0.3);
  z-index: 9997;
  transform: translateX(calc(-100% + 56px));
  transition: transform 0.25s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.wl-chat-toggle:hover {
  background: #156068;
  box-shadow: 0 6px 20px rgba(25, 116, 126, 0.4);
}

.wl-chat-toggle:hover,
.wl-chat-toggle:focus-visible,
.wl-chat-toggle.is-nudging,
.wl-chat-toggle.is-open {
  transform: translateX(0);
}

.wl-chat-toggle-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.wl-chat-toggle-text {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.wl-chat-toggle:hover .wl-chat-toggle-text,
.wl-chat-toggle:focus-visible .wl-chat-toggle-text,
.wl-chat-toggle.is-nudging .wl-chat-toggle-text,
.wl-chat-toggle.is-open .wl-chat-toggle-text {
  opacity: 1;
}

.wl-chat-widget {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 72px;
  right: auto;
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  z-index: 9997;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.wl-chat-widget.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.wl-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 3px solid #19747E;
  background: #ffffff;
  color: #1a1d29;
  border-radius: 16px 16px 0 0;
}

.wl-chat-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1a1d29;
}

.wl-chat-subtitle {
  margin: 4px 0 0 0;
  font-size: 12px;
  color: #6b7280;
  opacity: 1;
}

.wl-chat-close {
  background: #E2E2E2;
  border: none;
  color: #4b5563;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.wl-chat-close:hover {
  background: #D1E8E2;
  color: #19747E;
}

.wl-chat-quick-actions {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #E2E2E2;
  background: #F9FAFB;
}

.wl-quick-action {
  flex: 1;
  min-height: 44px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #E2E2E2;
  border-radius: 8px;
  font-size: 13px;
  color: #1a1d29;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wl-quick-action:hover {
  background: #D1E8E2;
  border-color: #19747E;
  color: #19747E;
  transform: translateY(-1px);
}

.wl-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wl-message {
  display: flex;
  animation: wlMessageSlideIn 0.25s ease;
}

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

.wl-user-message {
  justify-content: flex-end;
}

.wl-assistant-message {
  justify-content: flex-start;
}

.wl-message-bubble {
  max-width: 84%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.wl-user-message .wl-message-bubble {
  background: #19747E;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.wl-assistant-message .wl-message-bubble {
  background: #D1E8E2;
  color: #1a1d29;
  border: 1px solid #E2E2E2;
  border-bottom-left-radius: 4px;
}

.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.action-button {
  display: inline-block;
  min-height: 44px;
  padding: 8px 16px;
  background: #ffffff;
  border: 2px solid #19747E;
  border-radius: 8px;
  color: #19747E;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.action-button:hover {
  background: #19747E;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(25, 116, 126, 0.2);
}

.action-button:active {
  transform: translateY(0);
}

.action-button:focus-visible {
  outline: 2px solid #19747E;
  outline-offset: 2px;
}

.wl-assistant-message:has(.message-actions) .wl-message-bubble {
  margin-bottom: 0;
}

.wl-typing-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b7280;
  margin: 0 2px;
  animation: wlTypingBounce 1.4s infinite;
}

.wl-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.wl-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes wlTypingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}

.wl-chat-input-container {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid #e2e2e2;
  background: #ffffff;
}

.wl-chat-input {
  flex: 1;
  min-height: 44px;
  padding: 12px;
  border: 1px solid #E2E2E2;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: #1a1d29;
  resize: none;
  max-height: 100px;
  overflow-y: hidden;
}

.wl-chat-input:focus {
  outline: none;
  border-color: #19747E;
  box-shadow: 0 0 0 3px rgba(25, 116, 126, 0.1);
}

.wl-chat-send {
  width: 44px;
  height: 44px;
  background: #19747E;
  border: none;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
}

.wl-chat-send:hover {
  background: #156068;
}

.wl-chat-footer {
  padding: 12px 16px;
  background: #F9FAFB;
  border-top: 1px solid #E2E2E2;
  border-radius: 0 0 16px 16px;
  text-align: center;
}

.wl-chat-footer small {
  font-size: 11px;
  color: #4b5563;
}

.wl-chat-footer a {
  color: #19747E;
  text-decoration: none;
}

.wl-chat-footer a:hover {
  text-decoration: underline;
}

.wl-chat-contact-redirect {
  margin-top: 10px;
  min-height: 44px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: #19747E;
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
}

.wl-chat-contact-redirect:hover {
  background: #156068;
}

@media (max-width: 768px) {
  .wl-chat-widget {
    top: var(--wl-viewport-top, 0px);
    right: 0;
    bottom: auto;
    width: 100%;
    height: var(--wl-viewport-height, 100dvh);
    max-height: var(--wl-viewport-height, 100dvh);
    border-radius: 0;
    transform: translateY(14px);
  }

  .wl-chat-widget.open {
    transform: translateY(0);
  }

  .wl-chat-header,
  .wl-chat-footer {
    border-radius: 0;
  }

  .wl-chat-header {
    padding: 14px 12px;
  }

  .wl-chat-title h3 {
    font-size: 16px;
  }

  .wl-chat-subtitle {
    font-size: 11px;
  }

  .wl-chat-quick-actions {
    gap: 6px;
    padding: 10px 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .wl-chat-quick-actions::-webkit-scrollbar {
    display: none;
  }

  .wl-quick-action {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 12px;
    padding: 8px 10px;
  }

  .wl-chat-messages {
    padding: 12px;
    gap: 10px;
  }

  .wl-message-bubble {
    max-width: 90%;
    font-size: 13.5px;
  }

  .wl-chat-input-container {
    position: sticky;
    bottom: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .wl-chat-input {
    font-size: 16px;
    max-height: 120px;
  }

  .wl-chat-send {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }

  .wl-chat-footer {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  }

  .wl-chat-footer small {
    display: none;
  }

  .wl-chat-contact-redirect {
    margin-top: 0;
    width: 100%;
  }

  .wl-chat-toggle {
    top: auto;
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 0;
  }

  body.wl-chat-open {
    overflow: hidden;
    touch-action: none;
  }

  .message-actions {
    flex-direction: column;
  }

  .action-button {
    width: 100%;
    text-align: center;
  }
}
