/* Persistent Help & Chat launcher — always visible on all environments */
.swym-help-chat-launcher,
#swym-help-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147483640;
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: none;
  border-radius: 50px;
  background: #009961;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: "Open Sans", sans-serif;
  box-shadow: 0 4px 20px rgba(0, 153, 97, 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.swym-help-chat-launcher:hover,
#swym-help-chat-launcher:hover {
  background: #00b371;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 153, 97, 0.45);
}

.swym-help-chat-launcher i,
#swym-help-chat-launcher i {
  font-size: 20px;
}

#qh-tawk-file-widget {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: 2147483641;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 110px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  display: none;
  overflow: hidden;
  border: 1px solid rgba(0, 153, 97, 0.15);
}

#qh-tawk-file-widget.is-open {
  display: block;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Preload iframe in background (hidden but still loads) */
#qh-tawk-file-widget.is-preloading {
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  bottom: -10000px;
  left: -10000px;
  z-index: -1;
}

#qh-tawk-file-widget.is-loading .qh-tawk-chat-loader {
  display: flex;
}

#qh-tawk-file-widget.is-ready .qh-tawk-chat-loader {
  display: none;
}

#qh-tawk-file-widget.is-ready iframe {
  opacity: 1;
}

.qh-tawk-chat-loader {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #fff;
  color: #4a5568;
  font-family: "Open Sans", sans-serif;
  font-size: 13px;
}

.qh-tawk-chat-loader-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2efe8;
  border-top-color: #009961;
  border-radius: 50%;
  animation: qh-tawk-spin 0.8s linear infinite;
}

@keyframes qh-tawk-spin {
  to { transform: rotate(360deg); }
}

#qh-tawk-file-widget iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#qh-tawk-file-widget .qh-tawk-file-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  appearance: none;
  border: none;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

#qh-tawk-file-widget .qh-tawk-file-close:hover {
  background: rgba(0, 0, 0, 0.5);
}

/* Agent unavailable — contact form overlay */
#qh-tawk-agent-form-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: 2147483642;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  display: none;
  overflow: hidden;
  border: 1px solid rgba(0, 153, 97, 0.15);
  font-family: "Open Sans", sans-serif;
}

#qh-tawk-agent-form-panel.is-open {
  display: block;
}

.qh-agent-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #009961;
  color: #fff;
}

.qh-agent-form-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.qh-agent-form-close {
  appearance: none;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
}

.qh-agent-form-body {
  padding: 16px;
  max-height: min(70vh, 480px);
  overflow-y: auto;
}

.qh-agent-form-intro {
  margin: 0 0 12px;
  font-size: 13px;
  color: #4a5568;
  line-height: 1.5;
}

.qh-agent-form-hint {
  margin: 0 0 12px;
  padding: 8px 10px;
  background: #f4fbf7;
  border-radius: 8px;
  font-size: 12px;
  color: #2d3748;
}

.qh-chat-lead-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qh-chat-lead-label {
  font-size: 11px;
  font-weight: 700;
  color: #2d3748;
  margin: 2px 0 0;
}

.qh-required {
  color: #c0392b;
}

.qh-chat-lead-input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #d8e6df;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
}

.qh-chat-lead-input:focus {
  outline: none;
  border-color: #009961;
  box-shadow: 0 0 0 2px rgba(0, 153, 97, 0.15);
}

.qh-chat-lead-submit {
  margin-top: 8px;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: #009961;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.qh-chat-lead-submit:hover:not(:disabled) {
  background: #00b371;
}

.qh-chat-lead-submit:disabled {
  opacity: 0.7;
  cursor: wait;
}

.qh-chat-lead-status {
  margin: 6px 0 0;
  font-size: 12px;
  color: #009961;
  min-height: 16px;
}

.qh-chat-lead-status.is-error {
  color: #c0392b;
}

@media (max-width: 480px) {
  .swym-help-chat-launcher,
  #swym-help-chat-launcher {
    padding: 14px;
    border-radius: 50%;
    bottom: 20px;
    right: 16px;
  }

  .swym-help-chat-launcher span,
  #swym-help-chat-launcher span {
    display: none;
  }

  #qh-tawk-file-widget,
  #qh-tawk-agent-form-panel {
    bottom: 88px;
    right: 16px;
    left: 16px;
    width: auto;
  }

  #qh-tawk-file-widget {
    height: min(70vh, 520px);
  }
}
