/* ═══════════════════════════════════════════════════════════
   Master FAB v1 — consolidates My Trip, Talk Story, and Rate
   into a single bottom-right launcher with a fan-out menu.
   All three underlying modules (itinerary.js, talkstory-v1.js,
   feedback-fab-v1.js) keep doing their own work — this file just
   hides their individual FAB buttons and repositions their
   panels/pills next to the master launcher.
   Scoped to .hg-mfab-*.
   ═══════════════════════════════════════════════════════════ */

/* ── Hide the three original FAB triggers ───────────────────── */
/* Only once the master is mounted — body.hg-mfab-active is set by
   the JS after the container is appended. Before that, the old FABs
   stay visible as a fail-safe in case the master script errors out. */
body.hg-mfab-active .hg-sw-fab,
body.hg-mfab-active .hg-ts-fab,
body.hg-mfab-active .hg-fb-fab,
body.hg-mfab-active .hg-fb-tooltip {
  display: none !important;
}

/* Hide the hero action-bar share row (page-meta-share-v1.js). The
   Share pill under the master FAB replaces it. Rule is defensive:
   the footer no longer loads the injector, but a cached build
   could still have the DOM in place for a brief window. */
.pm-share { display: none !important; }

/* ── Reposition the panels that used to anchor to those FABs ─ */
/* The feedback rating panel previously sat at right: 78px next to
   the yellow Shaka FAB. Slide it flush-right above the master. */
body.hg-mfab-active .hg-fb-panel {
  right: 16px !important;
  bottom: 200px !important;
  transform-origin: bottom right !important;
}

/* Itinerary pill was anchored bottom-left next to the blue suitcase
   FAB. Move it bottom-right above the master FAB. */
body.hg-mfab-active .hg-sw-pill {
  left: auto !important;
  right: 16px !important;
  bottom: 200px !important;
  align-items: flex-end !important;
  transform-origin: bottom right !important;
}

/* ── Master FAB container ───────────────────────────────────── */
/* bottom: 130px sits just above the Raptive sticky footer ad on
   both desktop and mobile. Dropped from 160 → 130 so the FAB reads
   as "near the bottom of the screen" rather than floating mid-viewport.
   Keep this in sync with the stack convention. */
.hg-mfab {
  position: fixed;
  bottom: 130px;
  right: 16px;
  z-index: 9993;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none; /* children opt back in */
}
.hg-mfab,
.hg-mfab * {
  box-sizing: border-box;
}

/* ── Primary launcher button ────────────────────────────────── */
.hg-mfab-main {
  pointer-events: auto;
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: linear-gradient(135deg, #F27A24 0%, #d8630e 100%);
  box-shadow: 0 6px 20px rgba(0,0,0,0.28);
  cursor: pointer;
  padding: 0;
  color: #fff;
  font-family: inherit;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  animation: hg-mfab-breathe 3s ease-in-out infinite;
}
.hg-mfab-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0,0,0,0.34);
}
.hg-mfab-main:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
.hg-mfab-main.is-open {
  animation: none;
  background: linear-gradient(135deg, #2f3640 0%, #1e252e 100%);
  transform: rotate(90deg);
}

.hg-mfab-icon,
.hg-mfab-close {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 0.25s ease, transform 0.25s ease;
  font-size: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hg-mfab-close {
  opacity: 0;
  font-style: normal;
  font-size: 28px;
  transform: translate(-50%, -50%) rotate(-90deg) scale(0.4);
}
.hg-mfab-main.is-open .hg-mfab-icon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg) scale(0.4);
}
.hg-mfab-main.is-open .hg-mfab-close {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0) scale(1);
}

/* Count badge (My Trip items) */
.hg-mfab-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #e74c3c;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.hg-mfab-count:empty {
  display: none;
}
.hg-mfab-main.is-open .hg-mfab-count {
  opacity: 0;
  pointer-events: none;
}

@keyframes hg-mfab-breathe {
  0%, 100% { box-shadow: 0 6px 20px rgba(0,0,0,0.28), 0 0 0 0 rgba(242,122,36,0.45); }
  70%      { box-shadow: 0 6px 20px rgba(0,0,0,0.28), 0 0 0 14px rgba(242,122,36,0); }
}

/* ── Fan-out menu ───────────────────────────────────────────── */
.hg-mfab-menu {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  opacity: 0;
  transform: translateY(12px) scale(0.92);
  transform-origin: bottom right;
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  margin-bottom: 2px;
}
.hg-mfab.is-open .hg-mfab-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.hg-mfab-child {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 14px;
  min-height: 44px;
  border: 3px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #555;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.24);
  white-space: nowrap;
  line-height: 1;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  opacity: 0;
  transform: translateY(8px);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.18s ease;
}
.hg-mfab.is-open .hg-mfab-child {
  opacity: 1;
  transform: translateY(0);
}
/* Stagger the fan-out so children cascade in top-down order. */
.hg-mfab.is-open .hg-mfab-child:nth-child(1) { transition-delay: 0.02s; }
.hg-mfab.is-open .hg-mfab-child:nth-child(2) { transition-delay: 0.06s; }
.hg-mfab.is-open .hg-mfab-child:nth-child(3) { transition-delay: 0.10s; }

.hg-mfab-child:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  color: #fff;
}
.hg-mfab-child:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.hg-mfab-child-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 15px;
}
.hg-mfab-child-icon svg {
  width: 14px;
  height: 14px;
  fill: #fff;
}

.hg-mfab-child-badge {
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-left: 4px;
}
.hg-mfab-child-badge:empty {
  display: none;
}

/* Per-child brand colors */
.hg-mfab-child-talk {
  background: linear-gradient(135deg, #1D9771 0%, #156d52 100%);
}
.hg-mfab-child-concierge {
  background: linear-gradient(135deg, #c3232f 0%, #9a1c26 100%);
}
.hg-mfab-child-email {
  background: linear-gradient(135deg, #00acc1 0%, #00838f 100%);
}
.hg-mfab-child-trip {
  background: linear-gradient(135deg, #1a6fbe 0%, #155da0 100%);
}
.hg-mfab-child-share {
  background: linear-gradient(135deg, #8e44ad 0%, #6c3483 100%);
}
.hg-mfab-child-share.is-active {
  background: linear-gradient(135deg, #6c3483 0%, #4a235a 100%);
}
.hg-mfab-child-rate {
  background: linear-gradient(135deg, #f5c842 0%, #e8b730 100%);
  color: #2d2a1a;
}
.hg-mfab-child-rate .hg-mfab-child-icon {
  background: rgba(0,0,0,0.15);
  color: #2d2a1a;
}

/* ── Share popover ──────────────────────────────────────────── */
/* Row of share icons that floats just above the master FAB's
   orange launcher when the Share pill is tapped.
   IMPORTANT: we explicitly anchor to the main button's height
   (58px desktop / 54px mobile) + 16px gap, NOT `bottom: 100%`.
   The parent `.hg-mfab` is a flex column whose `.hg-mfab-menu`
   child always reserves flex height even when visually hidden
   (opacity 0), so `bottom: 100%` would position the popover at
   the TOP of the reserved menu stack, several hundred pixels
   above the visible launcher — on mobile that lands the popover
   smack on top of the site header. The fixed-pixel anchor keeps
   it glued to the launcher regardless of menu state. */
.hg-mfab-share-popover {
  position: absolute;
  right: 0;
  bottom: 74px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(0,0,0,0.26), 0 2px 6px rgba(0,0,0,0.12);
  border: 2px solid #f0f2f5;
  opacity: 0;
  transform: translateY(6px) scale(0.94);
  transform-origin: bottom right;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
}
.hg-mfab-share-popover.is-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}
.hg-mfab-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: #fff;
  text-decoration: none;
  line-height: 1;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  padding: 0;
}
.hg-mfab-share-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 3px 10px rgba(0,0,0,0.18);
  color: #fff;
}
.hg-mfab-share-btn .fa { font-size: 15px; color: #fff; line-height: 1; }
.hg-mfab-share-fb     { background: #1877f2; }
.hg-mfab-share-pin    { background: #e60023; }
.hg-mfab-share-x      { background: #111111; }
.hg-mfab-share-email  { background: #5a6773; }
.hg-mfab-share-copy   { background: #1D9771; }
.hg-mfab-share-copy.is-copied { background: #0f5c44; }
.hg-mfab-share-native { background: #F27A24; }

/* Hide a child pill when its underlying feature isn't available on
   this page. .is-hidden is set by the JS at init. */
.hg-mfab-child.is-hidden {
  display: none !important;
}

/* If we have zero children, suppress the whole master. */
.hg-mfab.is-disabled {
  display: none !important;
}

/* ── First-run tooltip ──────────────────────────────────────── */
.hg-mfab-tip {
  position: fixed;
  bottom: 34px;
  right: 90px;
  z-index: 9993;
  background: #1a1d21;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 18px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  pointer-events: none;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
}
.hg-mfab-tip.is-visible {
  opacity: 1;
  transform: translateX(0);
}
.hg-mfab-tip::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -6px;
  margin-top: -6px;
  width: 0;
  height: 0;
  border-left: 6px solid #1a1d21;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

/* ── Mobile adjustments ─────────────────────────────────────── */
@media (max-width: 600px) {
  .hg-mfab {
    bottom: 110px;
    right: 12px;
  }
  .hg-mfab-main {
    width: 54px;
    height: 54px;
  }
  .hg-mfab-child {
    font-size: 13px;
    padding: 9px 14px 9px 12px;
    min-height: 42px;
  }
  /* Mobile main button is 54px; keep a 16px gap above it. */
  .hg-mfab-share-popover { bottom: 70px; }
  .hg-mfab-tip { display: none; }
  body.hg-mfab-active .hg-fb-panel,
  body.hg-mfab-active .hg-sw-pill {
    bottom: 180px !important;
  }
}

/* ── Print: hide everything ─────────────────────────────────── */
@media print {
  .hg-mfab,
  .hg-mfab-tip { display: none !important; }
}
