/* ─────────────────────────────────────────────────────────────────────────
   Chat with Awwee — Resting Pill
   Drop-in floating button. No dependencies.
   ───────────────────────────────────────────────────────────────────────── */

/* Tokens (scoped so they don't leak into the host site) */
.awwee-pill,
.awwee-pill * {
  box-sizing: border-box;
}

.awwee-pill {
  /* Awestruck brand tokens — override at the host level if needed */
  --awp-yellow:    #FEB602;
  --awp-yellow-lt: #FFD96B;
  --awp-yellow-dk: #E89F00;
  --awp-ink:       #0F0D0B;
  --awp-paper:     #FFFFFF;
  --awp-night:     #14110F;
  --awp-green:     #2BC26A;

  /* Fixed-position floating widget. Sits bottom-right with safe-area
     respect; override .awwee-pill { right/bottom } if you need different
     placement. */
  position: fixed;
  right: 24px;
  bottom: 24px;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 9999;

  /* Reset button defaults */
  appearance: none;
  border: 0;
  margin: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 10px;
  border-radius: 999px;

  background: var(--awp-paper);
  color: var(--awp-ink);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  /* Crisp text rendering — important because the pill contains animated
     elements (chevron, X, avatar). We keep all transforms OFF the pill
     itself so the text never re-rasterizes. */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  /* Hairline border so the pill separates from any background */
  border: 1px solid rgba(15, 13, 11, 0.10);

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 2px 4px -1px rgba(15, 13, 11, 0.06),
    0 12px 22px -8px rgba(15, 13, 11, 0.18),
    0 28px 60px -22px rgba(15, 13, 11, 0.28);

  /* NOTE: no breathing transform here on purpose. Breathing is applied
     to the avatar only — scaling the whole pill blurs the text on most
     GPUs (subpixel rasterization). */
  transition:
    box-shadow 220ms ease,
    background 200ms ease,
    border-color 200ms ease,
    width 360ms cubic-bezier(0.2, 0.9, 0.25, 1.1),
    padding 360ms cubic-bezier(0.2, 0.9, 0.25, 1.1),
    gap 360ms cubic-bezier(0.2, 0.9, 0.25, 1.1),
    border-radius 360ms cubic-bezier(0.2, 0.9, 0.25, 1.1);
}

.awwee-pill:hover {
  /* translateY only — no scale, so text stays crisp */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 2px 4px -1px rgba(15, 13, 11, 0.06),
    0 16px 30px -10px rgba(15, 13, 11, 0.22),
    0 36px 70px -22px rgba(15, 13, 11, 0.32);
}
.awwee-pill:hover .awwee-pill__avatar {
  /* Lift effect via the avatar so we never scale the text */
  transform: translateY(-3px) scale(1);
}

.awwee-pill:active .awwee-pill__avatar {
  transform: translateY(0) scale(0.94);
  transition-duration: 100ms;
}

.awwee-pill:focus-visible {
  outline: 2px solid var(--awp-yellow);
  outline-offset: 3px;
}

/* Breathing — applied to the AVATAR only, so the text doesn't re-rasterize
   on every frame. Subtle, slow, just enough to feel alive. */
@keyframes awp-breath {
  0%, 100% { transform: scale(1) translateY(0); }
  50%      { transform: scale(1.04) translateY(-1px); }
}

/* ── Avatar ─────────────────────────────────────────────────────────── */
.awwee-pill__avatar {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;

  background: radial-gradient(
    circle at 32% 30%,
    #fff4c2 0%,
    var(--awp-yellow) 55%,
    var(--awp-yellow-dk) 100%
  );

  box-shadow:
    inset 0 -3px 5px rgba(232, 159, 0, 0.55),
    inset 0 2px 3px rgba(255, 255, 255, 0.55),
    0 4px 10px -3px rgba(232, 159, 0, 0.55);

  display: flex;
  align-items: center;
  justify-content: center;

  /* Breath lives here — only the avatar scales, never the text */
  animation: awp-breath 5s ease-in-out infinite;
  transition:
    transform 220ms cubic-bezier(0.2, 0.9, 0.25, 1.1),
    width 320ms cubic-bezier(0.2, 0.9, 0.25, 1.1),
    height 320ms cubic-bezier(0.2, 0.9, 0.25, 1.1);
  /* Hint the GPU to allocate a layer up-front so the first breath
     cycle doesn't flicker into compositing on slower devices. */
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.awwee-pill__eyes {
  display: flex;
  gap: 5px;
  align-items: center;
}

.awwee-pill__eye {
  width: 4px;
  height: 7px;
  background: var(--awp-ink);
  border-radius: 50%;
  transition: transform 120ms ease;
}

.awwee-pill__avatar.is-blink .awwee-pill__eye {
  transform: scaleY(0.1);
}

/* Online dot */
.awwee-pill__live {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--awp-green);
  border: 2px solid var(--awp-paper);
  box-shadow: 0 0 0 1px rgba(43, 194, 106, 0.25);
}

.awwee-pill__live::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(43, 194, 106, 0.45);
  animation: awp-ping 2.4s ease-out infinite;
  z-index: -1;
}

@keyframes awp-ping {
  0%   { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ── Text stack ──────────────────────────────────────────────────────── */
.awwee-pill__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  /* Stable width so the pill doesn't snap-resize when subtitle rotates */
  min-width: 200px;
}

.awwee-pill__name {
  font-family: 'Bricolage Grotesque', 'DM Sans', system-ui, sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: inherit;
}

.awwee-pill__sub {
  position: relative;
  font-size: 11px;
  font-weight: 600;
  color: rgba(15, 13, 11, 0.55);
  letter-spacing: 0.005em;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The inner span is what gets re-rendered on rotation — animate it in. */
.awwee-pill__sub > span {
  display: inline-block;
  animation: awp-sub-in 420ms cubic-bezier(0.2, 0.9, 0.25, 1.1) both;
}

@keyframes awp-sub-in {
  0%   { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ── Chevron ─────────────────────────────────────────────────────────── */
.awwee-pill__chev {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--awp-ink);
  color: var(--awp-yellow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 4px;
  transition: transform 220ms cubic-bezier(0.2, 0.9, 0.25, 1.1);
}

.awwee-pill:hover .awwee-pill__chev {
  transform: translateX(2px);
}

.awwee-pill__chev svg {
  width: 9px;
  height: 9px;
  display: block;
}

/* ─────────────────────────────────────────────────────────────────────────
   X · CLOSE / MINIMIZE
   Sits on the top-right corner of the pill. Subtle by default,
   prominent on pill-hover. Clicking it collapses the pill into a FAB.
   ───────────────────────────────────────────────────────────────────────── */
.awwee-pill__x {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--awp-ink);
  background: var(--awp-paper);
  color: var(--awp-ink);
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  z-index: 2;
  opacity: 0.55;
  transform: scale(0.85);
  box-shadow: 0 4px 10px -2px rgba(15, 13, 11, 0.28);
  transition:
    opacity 200ms ease,
    transform 220ms cubic-bezier(0.2, 0.9, 0.25, 1.1),
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease;
}

.awwee-pill:hover .awwee-pill__x,
.awwee-pill__x:focus-visible {
  opacity: 1;
  transform: scale(1);
}

.awwee-pill__x:hover {
  background: var(--awp-ink);
  color: var(--awp-paper);
  transform: scale(1.08) rotate(90deg);
}

.awwee-pill__x:focus-visible {
  outline: 2px solid var(--awp-yellow);
  outline-offset: 2px;
}

.awwee-pill__x svg {
  width: 9px;
  height: 9px;
  display: block;
}

[data-theme="dark"] .awwee-pill__x,
[data-bs-theme="dark"] .awwee-pill__x,
.awwee-pill.is-dark .awwee-pill__x {
  background: rgba(20, 17, 15, 0.95);
  border-color: rgba(255, 255, 255, 0.32);
  color: var(--awp-paper);
}
[data-theme="dark"] .awwee-pill__x:hover,
[data-bs-theme="dark"] .awwee-pill__x:hover,
.awwee-pill.is-dark .awwee-pill__x:hover {
  background: var(--awp-paper);
  color: var(--awp-ink);
  border-color: var(--awp-paper);
}

/* ─────────────────────────────────────────────────────────────────────────
   COLLAPSED · FAB STATE  ·  Option C — Floating label below
   X click → pill drops the white card and morphs into a stacked layout:
     1. Yellow avatar circle (its own gradient + shadow — no card behind)
     2. "Chat with Awwee" chip below
   • Clicking anywhere on the widget fires the open-chat intent.
   • One-way: cannot re-expand to the full pill within this session.
   • In-memory only — a page reload restores the full pill.
   ───────────────────────────────────────────────────────────────────────── */
.awwee-pill.is-collapsed {
  /* Drop the card chrome — the avatar carries its own visual weight */
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  /* Stack avatar + chip vertically, centred. Right edge stays anchored to
     the same fixed offset. */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0;
  width: auto;
  height: auto;
  border-radius: 0;
}

/* Hide the full-state interior */
.awwee-pill.is-collapsed .awwee-pill__text,
.awwee-pill.is-collapsed .awwee-pill__chev,
.awwee-pill.is-collapsed .awwee-pill__x,
.awwee-pill.is-collapsed .awwee-pill__orbit {
  display: none;
}

/* Avatar takes its solo size — slightly bigger because it's now the
   main focal point and carries the brand on its own. */
.awwee-pill.is-collapsed .awwee-pill__avatar {
  width: 56px;
  height: 56px;
  transition:
    width 320ms cubic-bezier(0.2, 0.9, 0.25, 1.1),
    height 320ms cubic-bezier(0.2, 0.9, 0.25, 1.1);
}
.awwee-pill.is-collapsed .awwee-pill__avatar .awwee-pill__eye {
  width: 5px;
  height: 8px;
}
.awwee-pill.is-collapsed .awwee-pill__avatar .awwee-pill__live {
  width: 13px;
  height: 13px;
}

/* ─────────────────────────────────────────────────────────────────────────
   LABEL · "Chat with Awwee" chip
   Lives in the DOM all the time so we can transition it; hidden in the
   full state, appears below the avatar when collapsed.
   ───────────────────────────────────────────────────────────────────────── */
.awwee-pill__label {
  display: none;
  font-family: 'Bricolage Grotesque', 'DM Sans', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--awp-ink);
  background: var(--awp-paper);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 13, 11, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 6px 14px -4px rgba(15, 13, 11, 0.22);
  white-space: nowrap;
  pointer-events: none;
  animation: awp-label-in 360ms cubic-bezier(0.2, 0.9, 0.25, 1.1) both;
  animation-delay: 200ms;
}
.awwee-pill.is-collapsed .awwee-pill__label {
  display: inline-flex;
  align-items: center;
}
@keyframes awp-label-in {
  0%   { opacity: 0; transform: translateY(-4px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Dark theme chip — matches the existing pill dark treatment */
[data-theme="dark"] .awwee-pill__label,
[data-bs-theme="dark"] .awwee-pill__label,
.awwee-pill.is-dark .awwee-pill__label {
  background: rgba(20, 17, 15, 0.92);
  color: var(--awp-paper);
  border-color: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 6px 16px -4px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .awwee-pill.is-collapsed .awwee-pill__label,
[data-bs-theme="dark"] .awwee-pill.is-collapsed .awwee-pill__label,
.awwee-pill.is-dark.is-collapsed .awwee-pill__label {
  background: rgba(20, 17, 15, 0.92) !important;
  color: var(--awp-paper);
  border-color: rgba(255, 255, 255, 0.16) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 6px 16px -4px rgba(0, 0, 0, 0.55) !important;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

[data-theme="dark"] .awwee-pill.is-collapsed:hover,
[data-bs-theme="dark"] .awwee-pill.is-collapsed:hover,
.awwee-pill.is-dark.is-collapsed:hover {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]):not([data-bs-theme]) body .awwee-pill__label {
    background: rgba(20, 17, 15, 0.92);
    color: var(--awp-paper);
    border-color: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      0 6px 16px -4px rgba(0, 0, 0, 0.55);
  }

  html:not([data-theme]):not([data-bs-theme]) body .awwee-pill.is-collapsed .awwee-pill__label {
    background: rgba(20, 17, 15, 0.92) !important;
    color: var(--awp-paper);
    border-color: rgba(255, 255, 255, 0.16) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      0 6px 16px -4px rgba(0, 0, 0, 0.55) !important;
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
  }

  html:not([data-theme]):not([data-bs-theme]) body .awwee-pill.is-collapsed,
  html:not([data-theme]):not([data-bs-theme]) body .awwee-pill.is-collapsed:hover {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   (Legacy orbit element — removed visually but kept the rule so the DOM
   node, if present from an older build, doesn't render.)
   ───────────────────────────────────────────────────────────────────────── */
.awwee-pill__orbit { display: none; }

/* ─────────────────────────────────────────────────────────────────────────
   DARK THEME
   Triggered by either:
     [data-theme="dark"]      on any ancestor
     [data-bs-theme="dark"]   (Bootstrap)
     prefers-color-scheme: dark — only if no data-theme override exists
   ───────────────────────────────────────────────────────────────────────── */
[data-theme="dark"] .awwee-pill,
[data-bs-theme="dark"] .awwee-pill,
.awwee-pill.is-dark {
  background: rgba(20, 17, 15, 0.78);
  color: var(--awp-paper);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 2px 6px rgba(0, 0, 0, 0.45),
    0 18px 34px -10px rgba(0, 0, 0, 0.55),
    0 36px 70px -22px rgba(0, 0, 0, 0.65);
}
[data-theme="dark"] .awwee-pill:hover,
[data-bs-theme="dark"] .awwee-pill:hover,
.awwee-pill.is-dark:hover {
  background: rgba(20, 17, 15, 0.86);
  border-color: rgba(255, 255, 255, 0.22);
}
[data-theme="dark"] .awwee-pill .awwee-pill__sub,
[data-bs-theme="dark"] .awwee-pill .awwee-pill__sub,
.awwee-pill.is-dark .awwee-pill__sub {
  color: rgba(255, 255, 255, 0.65);
}
[data-theme="dark"] .awwee-pill .awwee-pill__live,
[data-bs-theme="dark"] .awwee-pill .awwee-pill__live,
.awwee-pill.is-dark .awwee-pill__live {
  border-color: var(--awp-night);
}

/* Auto dark only when host hasn't set an explicit theme */
@media (prefers-color-scheme: dark) {
  html:not([data-theme]):not([data-bs-theme]) body .awwee-pill {
    background: rgba(20, 17, 15, 0.78);
    color: var(--awp-paper);
    border-color: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 2px 6px rgba(0, 0, 0, 0.45),
      0 18px 34px -10px rgba(0, 0, 0, 0.55),
      0 36px 70px -22px rgba(0, 0, 0, 0.65);
  }
  html:not([data-theme]):not([data-bs-theme]) body .awwee-pill .awwee-pill__sub {
    color: rgba(255, 255, 255, 0.65);
  }
  html:not([data-theme]):not([data-bs-theme]) body .awwee-pill .awwee-pill__live {
    border-color: var(--awp-night);
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   RESPONSIVE — Tablet sizing (≤991px wide host)
   The widget shrinks slightly so it doesn't dominate a smaller layout.
   On tablet and mobile the pill is centered at the bottom and redirects
   to /chat instead of opening a popup. Desktop (≥992px) is unchanged.
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
  /* Desktop pill hidden on mobile/tablet — mobile pill takes over */
  .awwee-pill--desktop {
    display: none !important;
  }
}

/* ── Mobile / Tablet pill — compact, centered at bottom ─────────────────── */
.awwee-pill--mobile {
  /* Centered at bottom instead of right-anchored */
  right: 42% !important;
  bottom: 20px !important;
  bottom: max(20px, env(safe-area-inset-bottom)) !important;
  transform: translateX(50%);
  /* Compact sizing */
  padding: 8px 14px 8px 8px !important;
  gap: 8px !important;
}

.awwee-pill--mobile .awwee-pill__avatar {
  width: 30px !important;
  height: 30px !important;
}

.awwee-pill--mobile .awwee-pill__name {
  font-size: 12px !important;
}

.awwee-pill--mobile .awwee-pill__sub {
  font-size: 10px !important;
}

.awwee-pill--mobile .awwee-pill__text {
  min-width: 150px !important;
}

.awwee-pill--mobile .awwee-pill__chev {
  width: 15px !important;
  height: 15px !important;
  margin-left: 2px !important;
}

.awwee-pill--mobile .awwee-pill__chev svg {
  width: 7px !important;
  height: 7px !important;
}

.awwee-pill--mobile .awwee-pill__live {
  width: 9px !important;
  height: 9px !important;
}

.awwee-pill--mobile .awwee-pill__eye {
  width: 3.5px !important;
  height: 6px !important;
}

/* When booking bar is visible, shift pill to the right so it doesn't overlap */
body.has-booking-bar .awwee-pill--mobile {
  right: 20px !important;
  transform: none;
}

/* Collapsed FAB state for the mobile pill — stays centered */
.awwee-pill--mobile.is-collapsed {
  right: 42% !important;
  transform: translateX(50%);
}

body.has-booking-bar .awwee-pill--mobile.is-collapsed {
  right: 20px !important;
  transform: none;
}

/* Hide the mobile pill on desktop */
@media (min-width: 992px) {
  .awwee-pill--mobile {
    display: none !important;
  }
}

/* Tablet tweaks — slightly bigger than phone */
@media (min-width: 641px) and (max-width: 991px) {
  .awwee-pill--mobile {
    padding: 9px 15px 9px 9px !important;
    gap: 9px !important;
  }
  .awwee-pill--mobile .awwee-pill__avatar {
    width: 32px !important;
    height: 32px !important;
  }
  .awwee-pill--mobile .awwee-pill__text {
    min-width: 165px !important;
  }
  .awwee-pill--mobile .awwee-pill__name { font-size: 13px !important; }
  .awwee-pill--mobile .awwee-pill__sub  { font-size: 10.5px !important; }
}

/* Legacy desktop pill (no modifier class) — tablet/mobile hide */
@media (max-width: 991px) {
  .awwee-pill:not(.awwee-pill--mobile) {
    display: none !important;
  }
}

/* Hide all awwee pills when any Bootstrap modal is open */
.awwee-pill.awwee-pill--modal-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(12px) !important;
  transition: opacity 200ms ease, transform 200ms ease !important;
}

/* Mobile pill is centered (has its own transform), so override carefully */
.awwee-pill--mobile.awwee-pill--modal-hidden {
  transform: translateX(50%) translateY(12px) !important;
}
body.has-booking-bar .awwee-pill--mobile.awwee-pill--modal-hidden {
  transform: translateY(12px) !important;
}

/* Hide mobile pill when the off-canvas side menu is open */
body.mobile-side-menu-open .awwee-pill--mobile {
  display: none !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   TOUCH DEVICES — no hover, so make the X always fully visible.
   Otherwise tablet users can't discover the close button.
   ───────────────────────────────────────────────────────────────────────── */
@media (hover: none) {
  .awwee-pill__x {
    opacity: 1;
    transform: scale(1);
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   PRINT — hide the widget. It has no place on a printed page.
   ───────────────────────────────────────────────────────────────────────── */
@media print {
  .awwee-pill { display: none !important; }
}

/* ─────────────────────────────────────────────────────────────────────────
   REDUCED MOTION
   Honor the user's preference: kill the breath, ping, and rotation
   transitions; static rendering still works.
   ───────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .awwee-pill,
  .awwee-pill__live::after,
  .awwee-pill__sub > span {
    animation: none !important;
  }
  .awwee-pill,
  .awwee-pill__chev,
  .awwee-pill__eye {
    transition: none !important;
  }
}

@media (min-width: 768px) and (max-width: 991px) {
.awwee-pill--mobile.is-collapsed {
  right: 50% !important;
  transform: translateX(50%);
}
.awwee-pill--mobile {
  right: 46% !important;

}
}