/*
 * The card styles/spacing come directly from plus/venueBookingDesign.
 * This file only adapts the existing Kiosk list DOM and retail card tokens.
 */
.booking-ui .venue-booking-catalog {
  --pisell-color-primary: var(--primary);
  --pisell-color-text-on-primary: var(--on-primary);
  --ps-color-primary: var(--primary);
  --ps-color-text: var(--ink);
  --ps-color-text-secondary: var(--muted);
  --ps-card-bg: var(--cream);
  --ps-card-hover-bg: var(--primary-soft);
  --ps-card-selected-bg: var(--primary-soft);
  --ps-card-selected-text-color: var(--ink);
  --Primary-600: var(--primary);
  --Primary-100: var(--primary-soft);
  --adm-color-primary: var(--primary);
  --adm-color-weak: var(--muted);
  background: transparent;

  .pisell-big-sale-product-list {
    background: transparent;
    border-radius: 0;
    overflow: visible;
  }
  .list-content-vertical { overflow: visible; }
  .list-content-vertical .list-items { padding: 0; }
  .list-group-items { gap: var(--grid-gap) !important; }
  .list-item:hover { box-shadow: none; transform: none; }
  .list-item > .product-card, .list-item > .party-package { height: 100%; }

  /* Keep the same 16:9 cover in PC/H5 and one/multiple-column catalogs.
     Override the demo's fixed image heights without changing retail thumbnails. */
  &--tickets .product-card > .product-image,
  &--party .product-card > .product-image {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
    flex-shrink: 0;
    align-self: start;

    > img, > .venue-catalog-text-cover {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
    }
  }

  /* Match sunny-play's natural-height copy. Keep the shared three-line clamp
     and full-description action, without reserving three lines for short copy. */
  .product-card .product-description-text { min-height: 0; }
  .product-card .product-description:has(> .product-description-text:empty) { display: none; }
  /* TicketRights in the demo has no outer margins. The heading/description
     tokens already provide the gaps around this production metadata row. */
  .product-card .venue-booking-sales__facts { margin: 0; }
  .venue-catalog-text-cover {
    border: 0;
    border-radius: 0;
    background: var(--line);
    color: var(--muted);
  }

  /* The skeleton/cards communicate loading visually; keep announcements out
     of the layout so refreshing never inserts a text row above the list. */
  .pisell-big-sale-product-list__catalog-status {
    min-height: 0;
    margin: 0;
  }
  .venue-catalog-skeleton-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .venue-catalog-skeleton-grid--extras { grid-template-columns: minmax(0, 1fr); }
  .venue-catalog-skeleton-card .product-copy { gap: var(--space-md); }
  .venue-catalog-skeleton-copy { display: grid; gap: var(--space-sm); flex: 1; min-width: 0; }
  .venue-catalog-skeleton-block {
    display: block;
    width: 100%;
    min-height: 1em;
    border-radius: var(--radius-control);
    background: var(--line);
  }
  .venue-catalog-skeleton-short { width: 65%; }
  .venue-catalog-skeleton-price { width: 30%; }
  .venue-catalog-skeleton-action { width: 55%; min-height: var(--control-compact-height); }
  .venue-catalog-skeleton-extra { display: flex; align-items: center; gap: var(--space-sm); }
  .venue-catalog-skeleton-extra-image { width: 96px; height: 96px; flex-shrink: 0; }
  .venue-catalog-skeleton-control { width: 44px; height: 44px; flex-shrink: 0; }

  /* List writes its grid columns inline. Match the original product-grid and
     party-package-grid breakpoints without replacing category/catalog handling. */
  &--tickets .list-group-items { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  &--party .list-group-items { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  @media (max-width: 1100px) {
    &--tickets .list-group-items, &--party .list-group-items { grid-template-columns: 1fr !important; }
  }

  .pisell-list-header {
    margin-bottom: var(--heading-content-gap);
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }
  .pisell-list-header--top .pisell-tabbar {
    display: inline-flex;
    max-width: 100%;
    width: fit-content;
    padding: var(--space-2xs);
    border: var(--border-width) solid #d9e2dd;
    border-radius: 999px;
    background: #fff;
    // Search is an inline overlay and needs the whole catalogue width.
    &:has(.pisell-lookup-modal-custom-container:not([style*='display: none'])) { width: 100%; }
    .text-card--active {
      background: var(--primary) !important;
      color: var(--on-primary) !important;
      .text-card__content { color: inherit !important; }
    }
  }

  /* Find is mounted inside the tabbar. Keep its containing block full-width
     when search hides the category labels, and scope the retained controls. */
  .pisell-list-header--top .pisell-lookup-modal-container {
    .pisell-lowcode-modal-body { padding: 0 !important; overflow: visible; }
    .pisell-lookup-modal-wrapper-top { margin-top: 0; padding: 0; }
    .pisell-lookup-search-area-with-close {
      --pisell-list-find-control-height: var(--control-height);
      gap: var(--space-xs);
    }
    .comprehensive-search__search-input-wrapper {
      border-radius: var(--radius-control);
      background: var(--cream);
      border-color: var(--line);
    }
    .comprehensive-search__search-input-wrapper:focus-within {
      border-color: var(--primary-border);
      box-shadow: 0 0 0 2px var(--primary-soft);
    }
    .comprehensive-search__search-input > input {
      min-width: 0;
      min-height: 0;
      height: auto;
      padding: 0;
      border: 0;
      border-radius: 0;
      background: transparent;
      font-size: var(--font-small);
      box-shadow: none;
    }
    .comprehensive-search__search-input > input:focus { outline: none; }
    .comprehensive-search__cancel-button { color: var(--primary-text); font-size: var(--font-small); }
    .pisell-lookup-modal-close-btn {
      flex-shrink: 0;
      padding-inline: var(--space-sm);
      border-radius: var(--radius-control);
      color: var(--ink);
      background: var(--cream);
      border-color: var(--line);
      font-size: var(--font-small);
    }
  }

  /* Live-data states absent from the prototype's fixture products. */
  .product-unavailable { color: var(--muted); font-size: var(--font-small); }
  .product-card.is-disabled, .product-card[aria-disabled='true'], .party-package[aria-disabled='true'] { opacity: .6; }
  /* Only a settled unavailable main product receives the grayscale treatment.
     Loading and global interaction locks continue to use the ordinary disabled state. */
  &--tickets .product-card.is-unavailable,
  &--party .product-card.is-unavailable {
    // Keep the reason badge outside the faded/grayscale content layers.
    filter: none;
    opacity: 1;

    > .product-copy,
    > .product-selected-count,
    > .product-image > :not(.product-unavailable-badge) {
      filter: grayscale(1);
      opacity: .6;
    }

    .product-select:disabled {
      opacity: 1;
      background: var(--line);
      border-color: var(--line);
      color: var(--muted);
    }
  }
  &--tickets .product-unavailable-badge,
  &--party .product-unavailable-badge {
    position: absolute;
    left: var(--space-md);
    bottom: var(--space-md);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    max-width: calc(100% - var(--space-md) * 2);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-control);
    background: var(--ink);
    color: #fff;
    font-size: var(--font-small);
    font-weight: var(--weight-strong);
    line-height: var(--line-body);
    pointer-events: none;
    > svg { flex-shrink: 0; }
    > span { min-width: 0; overflow-wrap: anywhere; }
  }
  .venue-catalog-promotions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    color: var(--primary-text);
    font-size: var(--font-small);
  }
  .venue-catalog-promotions > span {
    max-width: 100%;
    padding: 2px 8px;
    border: var(--border-width) solid var(--primary-border);
    border-radius: 999px;
    overflow-wrap: anywhere;
  }

  /* Keep Kiosk's promotion rendering; only Venue cards inherit this brand.
     The PC tag writes its legacy colors inline, so override those locally. */
  .venue-catalog-promotions > span,
  &--extras .pisell-product-sku__card-promotions .pisell-tags,
  &--extras .pisell-plus-sales-product-card__promotion-tag {
    color: var(--primary-text) !important;
    background: var(--primary-soft) !important;
    border-color: var(--primary-border) !important;
  }
  &--extras .pisell-product-sku__card-promotions .pisell-tags > span {
    color: inherit !important;
  }
  &--extras .pisell-product-sku__card-promotions .pisell-product-sku__card-tags-remaining {
    color: var(--primary-text);
  }

  /* sunny-play extra-item surface on the retained retail CardPro. CardPro writes
     these values inline; keep the override local to this extras list. */
  &--extras .pisell-product-sku__card-wrapper-card,
  &--extras .pisell-plus-sales-product-card,
  &--extras .venue-catalog-skeleton-extra {
    border: var(--border-width) solid var(--line) !important;
    border-radius: var(--radius-card) !important;
    padding: var(--compact-padding) !important;
    background: var(--white, #fff) !important;
    box-shadow: none;
  }

  /* PC CardCom stretches the last (action) wrapper via inline rightStyle.
     Center that wrapper, as well as the phone card's action, within the row. */
  &--extras .pisell-product-sku__card-row > .pisell-product-sku__card-right > div:last-child,
  &--extras .pisell-plus-sales-product-card__action {
    align-self: center;
    flex-shrink: 0;
  }

  /* CardPro clips its right column. Reserve room for the Options badge's 9px overhang. */
  &--extras .pisell-product-sku__card-right .pisell-plus-sales-product-card__options-button {
    margin-right: 9px;
  }

  &--extras .venue-extra-subtitle .product-description-text {
    min-height: 0;
  }

  &--extras .numeric-stepper-button:not(.numeric-stepper-button-disabled) {
    background: var(--primary);
    color: var(--on-primary);
  }
  &--extras .numeric-stepper-button:focus-visible {
    outline: 2px solid var(--primary-border);
    outline-offset: 2px;
  }

  /* Extras retain the existing retail card and stepper. */
  .pisell-plus-sales-product-card {
    border: var(--border-width) solid var(--line);
    border-radius: var(--radius-card);
    padding: var(--compact-padding);
    background: var(--cream);
    box-shadow: none;
  }
  .pisell-product-sku__card-wrapper-card { box-shadow: none; }
  .pisell-product-presentation__action .pisell-lowcode-btn {
    border-radius: var(--radius-button);
    min-height: var(--control-compact-height);
    color: var(--primary-text);
  }
  @media (max-width: 700px) {
    .pisell-list-header--top .pisell-lookup-modal-container {
      .comprehensive-search__camera-activator { padding: 4px !important; min-width: 32px; }
      .comprehensive-search__camera-activator-icon { font-size: 18px; }
      .comprehensive-search__cancel-button { padding-inline: 4px; }
    }
  }
}

@media (max-width: 700px) {
  // Party has no category bar: keep the demo heading gap without an extra
  // reserved status line or empty category-header margin after loading.
  .booking-ui .venue-booking-sales--party .venue-booking-catalog--party > .pisell-big-sale-product-list__catalog-status:empty,
  .booking-ui .venue-booking-sales--party .venue-booking-catalog--party .list-content-vertical > .pisell-list-header:empty {
    display: none;
  }
}
.booking-ui .venue-booking-catalog--extras .venue-extra-action-pending {
  display: inline-flex;
  min-width: 40px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  .pisell-lowcode-spin { color: inherit; }
}
