/**
 * Tour product pages: price box under the title + sticky bottom bar on phones.
 * Markup and placement: inc/tour-price-box.php. Enqueued only on tour product
 * pages; every page-level rule is scoped to body.kt-tour-pricebox.
 *
 * Phones and tablets only (< 992px, the Bricks breakpoint where the booking
 * column stacks under the content). On desktop the plugin's booking form is
 * already the sticky right-hand column next to the title, so the new box and
 * bar stay hidden there and the old form stays visible.
 *
 * Selectors (dom-selector-contract.md):
 *   - .tour-booking-wrapper: the plugin's own class on its add-to-cart form
 *     (vt-woocommerce-booking templates/single-product/add-to-cart/tour.php),
 *     code-rendered, not a Bricks auto id. Hidden only while the sticky bar is
 *     on the page (:has(.kt-tpb-bar)), so a phone is never left with no way to
 *     book. A browser without :has() simply keeps showing it.
 *   - the Bricks footer's floating "Chat / WhatsApp / Book now - Pay later"
 *     bar: #brxe-nqawqe (auto id, measured on kisstour.com 2026-11-07, the same
 *     fallback ft-hub.css uses) or the requested class
 *     kt-custom-floating-contact-bar. If the id changes, the old bar just shows
 *     again above ours; nothing else is affected.
 */

.kt-tpb-box,
.kt-tpb-bar {
  --kt-tpb-pink: #E4367E;
  --kt-tpb-pink-dark: #c92a6b;
  --kt-tpb-ink: #0D0D0D;
  --kt-tpb-muted: #777777;
  box-sizing: border-box;
  color: var(--kt-tpb-ink);
  font-family: inherit;
}

.kt-tpb-box *,
.kt-tpb-bar * {
  box-sizing: border-box;
}

/* ---- price box under the title ---- */
.kt-tpb-box {
  display: none;
  width: 100%;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid #eeeeee;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 4px 14px -8px rgba(0, 0, 0, 0.2);
  gap: 10px;
}

.kt-tpb-price {
  margin: 0;
  font-size: 13px;
  line-height: 1.3;
  color: var(--kt-tpb-muted);
}

.kt-tpb-price b {
  font-size: 22px;
  font-weight: 700;
  color: var(--kt-tpb-ink);
}

.kt-tpb-price b .woocommerce-Price-amount,
.kt-tpb-bar-price b .woocommerce-Price-amount {
  color: inherit;
  font: inherit;
}

.kt-tpb-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: 13.5px;
  line-height: 1.35;
  color: #333333;
}

.kt-tpb-facts li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 0;
  padding: 0;
}

.kt-tpb-facts li::before {
  content: none;
}

.kt-tpb-ic {
  flex: 0 0 16px;
  margin-top: 1px;
  color: var(--kt-tpb-pink);
}

.kt-tpb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--kt-tpb-pink);
  color: #ffffff !important;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-decoration: none !important;
  white-space: nowrap;
}

.kt-tpb-btn:hover,
.kt-tpb-btn:focus-visible {
  background: var(--kt-tpb-pink-dark);
}

.kt-tpb-btn:focus-visible {
  outline: 2px solid var(--kt-tpb-ink);
  outline-offset: 2px;
}

.kt-tpb-box .kt-tpb-btn {
  width: 100%;
}

/* ---- sticky bottom bar ---- */
.kt-tpb-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 998;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: #ffffff;
  border-top: 1px solid #eeeeee;
  box-shadow: 0 -6px 16px -10px rgba(0, 0, 0, 0.25);
}

.kt-tpb-bar-price {
  min-width: 0;
  line-height: 1.15;
}

.kt-tpb-bar-price .kt-tpb-from {
  display: block;
  font-size: 11.5px;
  color: #888888;
}

.kt-tpb-bar-price b {
  display: block;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.kt-tpb-bar-price small {
  font-size: 12px;
  font-weight: 500;
  color: #888888;
}

@media (max-width: 991px) {
  .kt-tpb-box {
    display: grid;
  }

  .kt-tpb-bar {
    display: flex;
  }

  /* Room for the bar so it never covers the footer's last line. */
  body.kt-tour-pricebox:has(.kt-tpb-bar) {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }

  /* The old booking form at the bottom of the page: replaced by the box and
     the bar, which both open /book-tour/ with this tour selected. */
  body.kt-tour-pricebox:has(.kt-tpb-bar) .tour-booking-wrapper {
    display: none !important;
  }

  /* The Bricks footer's floating contact bar, replaced on tour pages. */
  body.kt-tour-pricebox:has(.kt-tpb-bar) #brx-footer #brxe-nqawqe,
  body.kt-tour-pricebox:has(.kt-tpb-bar) #brx-footer .kt-custom-floating-contact-bar {
    display: none !important;
  }
}

@media (max-width: 360px) {
  .kt-tpb-bar {
    gap: 8px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .kt-tpb-bar .kt-tpb-btn {
    padding: 12px 14px;
    font-size: 14px;
  }
}
