/*
  [INPUT]: WhatsApp inquiry section markup and theme viewport breakpoints
  [OUTPUT]: Responsive floating button, tooltip, direct B2B inquiry dialog presentation
  [POS]: WhatsApp inquiry section visual layer; B2B direct chat card & trigger
  [PROTOCOL]: 变更时更新此头部，然后检查 CLAUDE.md
*/
.whatsapp-inquiry__fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 9998;
  display: flex;
  width: 60px;
  height: 60px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgb(37 211 102 / 45%);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.whatsapp-inquiry__fab::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: rgb(37 211 102 / 35%);
  content: "";
  animation: whatsapp-inquiry-pulse 2s ease-out infinite;
}

.whatsapp-inquiry__fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgb(37 211 102 / 55%);
}

.whatsapp-inquiry__fab:focus-visible,
.whatsapp-inquiry__close:focus-visible,
.whatsapp-inquiry__btn:focus-visible {
  outline: 3px solid #075e54;
  outline-offset: 3px;
}

.whatsapp-inquiry__fab svg,
.whatsapp-inquiry__avatar svg,
.whatsapp-inquiry__btn svg {
  fill: currentColor;
}

.whatsapp-inquiry__fab svg {
  width: 32px;
  height: 32px;
}

.whatsapp-inquiry__tooltip {
  position: absolute;
  top: 50%;
  right: calc(100% + 14px);
  padding: 7px 14px;
  border-radius: 20px;
  background: #fff;
  color: #075e54;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgb(0 0 0 / 14%);
  pointer-events: none;
  transform: translateY(-50%);
  animation: whatsapp-inquiry-bounce 2s infinite ease-in-out;
}

.whatsapp-inquiry__tooltip::after {
  position: absolute;
  top: 50%;
  right: -5px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 6px solid #fff;
  content: "";
  transform: translateY(-50%);
}

.whatsapp-inquiry__fab[aria-expanded="true"] .whatsapp-inquiry__tooltip {
  display: none;
}

.whatsapp-inquiry__card {
  position: fixed;
  right: 28px;
  bottom: 100px;
  z-index: 9999;
  width: 360px;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 36px rgb(0 0 0 / 22%);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.6) translateY(20px);
  transform-origin: bottom right;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

.whatsapp-inquiry__card[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1) translateY(0);
}

.whatsapp-inquiry__header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: #080b0c;
  color: #fff;
}

.whatsapp-inquiry__avatar {
  display: flex;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
}

.whatsapp-inquiry__avatar svg {
  width: 24px;
  height: 24px;
}

.whatsapp-inquiry__info {
  min-width: 0;
}

.whatsapp-inquiry__info h4 {
  margin: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.whatsapp-inquiry__info p {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0 0;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.2;
}

.whatsapp-inquiry__status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.whatsapp-inquiry__close {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: rgb(255 255 255 / 60%);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  transition: color 0.15s ease;
}

.whatsapp-inquiry__close:hover {
  color: #fff;
}

.whatsapp-inquiry__body {
  padding: 18px;
  background: #fafafa;
}

.whatsapp-inquiry__intro {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  border-left: 3px solid #25d366;
}

.whatsapp-inquiry__intro p {
  margin: 0;
  color: #475569;
  font-size: 12.5px;
  line-height: 1.45;
}

.whatsapp-inquiry__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.whatsapp-inquiry__field {
  position: relative;
  display: flex;
  flex-direction: column;
}

.whatsapp-inquiry__label {
  margin-bottom: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
}

.whatsapp-inquiry__req {
  color: #ef4444;
}

.whatsapp-inquiry__input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.whatsapp-inquiry__input::placeholder {
  color: #94a3b8;
  font-size: 12.5px;
}

.whatsapp-inquiry__input:focus {
  border-color: #080b0c;
  box-shadow: 0 0 0 3px rgb(8 11 12 / 10%);
}

.whatsapp-inquiry__field.has-error .whatsapp-inquiry__input {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgb(239 68 68 / 15%);
}

.whatsapp-inquiry__error {
  display: none;
  margin-top: 4px;
  color: #ef4444;
  font-size: 11.5px;
  line-height: 1.3;
}

.whatsapp-inquiry__field.has-error .whatsapp-inquiry__error {
  display: block;
}

.whatsapp-inquiry__pills-label {
  margin-top: 2px;
  color: #64748b;
  font-size: 11.5px;
  font-weight: 600;
}

.whatsapp-inquiry__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.whatsapp-inquiry__pill {
  padding: 5px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.2;
  transition: all 0.15s ease;
}

.whatsapp-inquiry__pill:hover {
  border-color: #080b0c;
  color: #080b0c;
}

.whatsapp-inquiry__pill.is-active {
  border-color: #080b0c;
  background: #080b0c;
  color: #fff;
  font-weight: 600;
}

.whatsapp-inquiry__cta {
  margin-top: 4px;
}

.whatsapp-inquiry__btn {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 0;
  border-radius: 8px;
  background: #25d366;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.1s ease;
}

.whatsapp-inquiry__btn:hover {
  background: #1ebe57;
}

.whatsapp-inquiry__btn:active {
  transform: scale(0.99);
}

.whatsapp-inquiry__btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

@keyframes whatsapp-inquiry-pulse {
  0% {
    opacity: 0.6;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.7);
  }
}

@keyframes whatsapp-inquiry-bounce {
  0%,
  100% {
    transform: translateY(-50%) translateX(0);
  }

  50% {
    transform: translateY(-50%) translateX(-4px);
  }
}

@media (max-width: 768px) {
  .whatsapp-inquiry__fab {
    right: auto;
    bottom: 80px;
    left: 16px;
    width: 54px;
    height: 54px;
  }

  .whatsapp-inquiry__fab svg {
    width: 28px;
    height: 28px;
  }

  .whatsapp-inquiry__card {
    right: auto;
    bottom: 146px;
    left: 12px;
    width: calc(100vw - 24px);
    max-width: 360px;
    transform-origin: bottom left;
  }

  .whatsapp-inquiry__tooltip {
    right: auto;
    left: calc(100% + 14px);
    animation-name: whatsapp-inquiry-bounce-mobile;
  }

  .whatsapp-inquiry__tooltip::after {
    right: auto;
    left: -5px;
    border-right: 6px solid #fff;
    border-left: 0;
  }

  .whatsapp-inquiry__input {
    font-size: 16px; /* 防止 iOS Safari 自动缩放页面 */
  }
}

@keyframes whatsapp-inquiry-bounce-mobile {
  0%,
  100% {
    transform: translateY(-50%) translateX(0);
  }

  50% {
    transform: translateY(-50%) translateX(4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-inquiry__fab,
  .whatsapp-inquiry__card,
  .whatsapp-inquiry__btn {
    transition: none;
  }

  .whatsapp-inquiry__fab::before,
  .whatsapp-inquiry__tooltip {
    animation: none;
  }
}
