/* =========================================================================
   ChinaHub · Floating WhatsApp Chat Widget (Click-to-Chat)
   -------------------------------------------------------------------------
   Aligned with the original ChinaHub midnight-indigo Liquid Glass palette
   (#070912 / #0c1024 / #5b51e8 / #8b7bff / #a9a0ff) while preserving the
   recognizable WhatsApp green emblem (#25d366) and WCAG AA CTA (#15803d).
   ========================================================================= */

.wh-widget {
  --wh-ink: var(--ink, #f5f6ff);
  --wh-ink-2: var(--ink-2, #c1c4e6);
  --wh-ink-3: var(--ink-3, #9da2cc);
  --wh-border: rgba(169, 160, 255, 0.28);
  --wh-border-strong: rgba(201, 195, 255, 0.48);
  --wh-focus: var(--indigo-300, #a9a0ff);
  --wh-green-brand: #25d366;
  --wh-green-cta: #15803d;
  --wh-green-cta-hover: #166534;

  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  font-family: var(--font-body, "Noto Sans Georgian", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
}
.wh-widget * { box-sizing: border-box; }

/* =========================================================== closed button */
.wh-fab {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  width: 58px;
  height: 58px;
  font-family: inherit;
  color: var(--wh-ink);
  cursor: pointer;
  white-space: nowrap;

  background:
    radial-gradient(120% 80% at 15% 0%, rgba(255, 255, 255, 0.22), transparent 55%),
    linear-gradient(155deg, rgba(22, 23, 46, 0.72), rgba(10, 11, 24, 0.68));
  border: 1px solid var(--wh-border);
  border-radius: 999px;
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  box-shadow:
    inset 0 1px 0.5px rgba(255, 255, 255, 0.68),
    inset 0 -1px 1px rgba(255, 255, 255, 0.22),
    0 16px 36px -12px rgba(0, 0, 0, 0.72);

  transition: transform 160ms ease, box-shadow 180ms ease, border-color 160ms ease;
}
.wh-fab__badge {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #ffffff;
  border-radius: 50%;
  background-color: var(--wh-green-brand);
}
.wh-fab__logo { width: 24px; height: 24px; display: block; }

.wh-fab:hover {
  border-color: var(--wh-border-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 20px 42px -12px rgba(0, 0, 0, 0.88);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .wh-fab:hover { transform: translateY(-2px); }
}
.wh-fab:focus-visible {
  outline: 2px solid var(--wh-focus);
  outline-offset: 3px;
}

/* ============================================================ open (panel) */
.wh-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(352px, calc(100vw - 32px));

  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: min(460px, calc(100dvh - 150px));

  color: var(--wh-ink);
  background:
    radial-gradient(120% 80% at 15% 0%, rgba(255, 255, 255, 0.18), transparent 55%),
    linear-gradient(155deg, rgba(18, 19, 42, 0.88), rgba(9, 10, 22, 0.84));
  border: 1px solid var(--wh-border);
  border-radius: 24px;
  backdrop-filter: blur(26px) saturate(185%);
  -webkit-backdrop-filter: blur(26px) saturate(185%);
  box-shadow:
    inset 0 1px 0.5px rgba(255, 255, 255, 0.62),
    inset 0 -1px 1px rgba(255, 255, 255, 0.20),
    0 26px 56px -18px rgba(0, 0, 0, 0.82);

  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transform-origin: bottom right;
  transition: opacity 180ms ease, transform 180ms ease, visibility 0s linear 180ms;
}
.wh-widget.is-open .wh-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 180ms ease, visibility 0s linear 0s;
}

/* ---- header ---- */
.wh-panel__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 12px 12px 14px;
  background-color: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(169, 160, 255, 0.16);
}
.wh-panel__badge {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #ffffff;
  border-radius: 12px;
  background-color: var(--wh-green-brand);
}
.wh-panel__badge svg { width: 21px; height: 21px; display: block; }
.wh-panel__meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.wh-panel__title { font-size: 0.98rem; font-weight: 700; color: var(--wh-ink); }
.wh-panel__sub   { font-size: 0.78rem; color: var(--wh-ink-2); }
.wh-panel__close {
  margin-left: auto;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--wh-ink-2);
  background-color: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(169, 160, 255, 0.22);
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.wh-panel__close svg { width: 18px; height: 18px; }
.wh-panel__close:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.12);
  border-color: var(--wh-border-strong);
}
.wh-panel__close:focus-visible {
  outline: 2px solid var(--wh-focus);
  outline-offset: 2px;
}
.wh-panel__title:focus { outline: none; }

/* ---- chat body ---- */
.wh-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}
.wh-msg {
  display: inline-block;
  max-width: 100%;
  margin: 0;
  padding: 12px 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--wh-ink);
  background-color: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(169, 160, 255, 0.20);
  border-radius: 4px 14px 14px 14px;
}

/* ---- message input ---- */
.wh-input {
  flex: 0 0 auto;
  padding: 10px 16px 8px;
}
.wh-veil {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.wh-input__field {
  width: 100%;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--wh-ink);
  background-color: rgba(7, 9, 18, 0.72);
  border: 1px solid rgba(169, 160, 255, 0.28);
  border-radius: 12px;
  padding: 11px 13px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.wh-input__field::placeholder { color: var(--wh-ink-3); opacity: 1; }
.wh-input__field:focus {
  border-color: var(--wh-focus);
  box-shadow: 0 0 0 3px rgba(139, 123, 255, 0.26);
}

/* ---- Continue-in-WhatsApp pill CTA (WCAG AA white on green) ---- */
.wh-cta {
  flex: 0 0 auto;
  margin: 4px 16px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  color: #ffffff;
  padding: 12px 16px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background-color: var(--wh-green-cta);
  cursor: pointer;
  box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.65);
  transition: background-color 160ms ease, transform 120ms ease;
}
.wh-cta svg { flex: 0 0 auto; }
.wh-cta:hover { background-color: var(--wh-green-cta-hover); }
.wh-cta:active { transform: translateY(1px); }
.wh-cta:focus-visible {
  outline: 2px solid var(--wh-focus);
  outline-offset: 2px;
}

/* ============================================================ responsive */
@media (max-width: 720px) {
  .wh-widget {
    right: calc(14px + env(safe-area-inset-right, 0px));
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
  .wh-fab { width: 52px; height: 52px; padding: 4px; }
  .wh-fab__badge { width: 42px; height: 42px; }
  .wh-fab__logo { width: 22px; height: 22px; }
  .wh-panel {
    width: calc(100vw - 28px);
    right: 0;
    bottom: calc(100% + 10px);
    max-height: calc(100dvh - 140px);
  }
}

/* ===================================================================== a11y */
@media (prefers-reduced-motion: reduce) {
  .wh-fab, .wh-panel, .wh-cta {
    transition: opacity 140ms ease, visibility 140ms ease;
  }
  .wh-fab:hover, .wh-cta:active { transform: none; }
  .wh-panel, .wh-widget.is-open .wh-panel { transform: none; }
}
