/* Layout and colors are the migrated demo Dialog/reservation/package styles.
   These adapters only connect the existing SKU and host-owned footer to that shell. */
.booking-ui .pisell-booking-product-detail-modal {
  .pisell-booking-product-detail-steps {
    padding: 0 0 var(--space-md);
    .booking-navigation { position: static; }
    .steps { margin: 0; }
  }
  .pisell-booking-product-detail-body { overscroll-behavior: contain; }
  .booking-ticket-quantity {
    flex-shrink: 0;
    height: var(--control-compact-height);
    border: var(--border-width) solid var(--primary-border);
    border-radius: var(--radius-control);
    .numeric-stepper-button {
      width: var(--icon-target);
      height: var(--control-compact-height);
      color: var(--ink);
    }
    .numeric-stepper-display {
      border: 0;
      color: var(--ink);
      font-size: var(--font-label);
      font-weight: var(--weight-strong);
      min-width: 26px;
    }
  }
  /* Reuse the demo's quantity + priced action row in both detail flows. */
  > .booking-config-dialog-footer.pisell-booking-product-detail-footer {
    display: block;
    padding: var(--dialog-padding-y) var(--dialog-padding-x)
      calc(var(--dialog-padding-y) + env(safe-area-inset-bottom, 0px));
    border-top: 0;
    background: transparent;
    .booking-config-main { flex-wrap: nowrap; align-items: center; }
    .booking-config-amount,
    .booking-config-action-full { display: none; }
    .booking-config-action-compact { display: inline; }
    .booking-config-actions { flex: 1; min-width: 0; margin-inline-start: auto; }
    .booking-primary-action { flex: 1; min-width: 0; white-space: normal; }
  }
  // Match the Tickets body inset even though its shell already has horizontal padding.
  &.reservation-modal > .booking-config-dialog-footer.pisell-booking-product-detail-footer {
    width: calc(100% + var(--dialog-padding-x) * 2);
    margin-inline: calc(-1 * var(--dialog-padding-x));
  }
  .pisell-booking-product-detail-summary { margin-bottom: var(--space-lg); }
  .pisell-booking-product-detail-sku { min-width: 0; }
  .pisell-flat-sku-selection__list {
    padding-inline-start: var(--space-md);
  }
  .pisell-flat-sku-selection__badge[data-required='true'] {
    color: #fff;
    background-color: var(--error);
    &[data-complete='true'] { background-color: var(--green); }
  }
  .pisell-booking-product-detail-footer-content { flex: 1 1 auto; min-width: 0; }
  .pisell-booking-product-detail-actions { margin-inline-start: auto; }
  .pisell-booking-product-detail-error { flex-basis: 100%; grid-column: 1 / -1; overflow-wrap: anywhere; }
  @media (max-width: 700px) {
    &.party-package-dialog .pisell-booking-product-detail-actions { gap: var(--space-xs); }
    &.party-package-dialog .pisell-booking-product-detail-actions .secondary { display: inline-flex; }
  }
}

@media (max-width: 700px) {
  // Match the mobile demo sheet: leave a small top gap while keeping the actions above the safe area.
  .booking-ui:not([data-booking-presentation='kiosk']) .pisell-booking-product-detail-modal.dialog-framed.dialog-fullscreen {
    inset: auto 0 0;
    height: 98vh;
    max-height: 98vh;
    height: 98dvh;
    max-height: 98dvh;
    border-radius: 20px 20px 0 0;
  }
}

// Booking uses the checked indicator/quantity as selection feedback. Keep the
// shared flat selector's row surface neutral, including its nested options.
.booking-ui .pisell-booking-product-detail-modal .pisell-flat-sku-selection,
.pisell-booking-product-detail-options-modal.pisell-flat-sku-selection-modal {
  .pisell-sku-options-selection-option-item[data-selected='true'],
  .pisell-pro-card.pisell-pro-card-selected,
  .pisell-pro-cards-sku-card.pisell-pro-cards-sku-card-active {
    background: transparent;
  }
}

/* Nested SKU options are a body portal, not descendants of .booking-ui.
   Give this booking-only shell a definite viewport height: Safari must not
   resolve the scroll area through several percentage-height flex children. */
.pisell-sku-options-modal.pisell-booking-product-detail-options-modal {
  // This dedicated nested portal lives outside .booking-ui; keep its text in
  // the same demo body face instead of inheriting the host document's font.
  font-family: var(--booking-font-family, BookingDM, "PingFang SC", "Microsoft YaHei", sans-serif);
  height: 95vh !important;
  height: 95dvh !important;

  > .pisell-lowcode-floating-layer-content {
    flex: 1 1 0;
    min-height: 0;
  }

  .pisell-lowcode-floating-layer-body {
    flex: 1 1 0;
    min-height: 0;

    > .pisell-batch-selector {
      flex: 1 1 0;
      min-height: 0;
      height: auto !important;
      overflow-y: auto;
      overscroll-behavior-y: contain;
      -webkit-overflow-scrolling: touch;
    }
  }

  @media (max-width: 700px) {
    // Keep the title/actions within Safari's current viewport and safe area.
    height: calc(100vh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  }
}
