/*
 * fp2-order-desktop.css - desktop (>= 992px) design of the home order card (member right column + guest card) and the
 * "Pilih produk" category dialog. Below 992px everything new is hidden and nothing existing is changed: the phone
 * flow (chips, bottom sheets, nominal grid, select) is exactly the old one.
 * Behaviour: public/assets/fp2/fp2-order-desktop.js.
 */

/* ---- phones / tablets: the new elements do not exist */
@media (max-width: 991px) {
  .fp2-od-only,
  .fp2-cd {
    display: none !important;
  }

  .fp2-od-sumbox {
    display: contents;
  }
}

@media (min-width: 992px) {

  /* ---------------------------------------------------- step labels */
  .fp2-order-card {
    counter-reset: fp2-od-step;
  }

  .fp2-od-label,
  .fp2-order-card .fp2-id-field > .fp2-label,
  .fp2-order-card .fp2-number > .fp2-label,
  .fp2-order-card .fp2-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0 0 10px;
    padding: 0;
    border: 0;
    font-size: 13.5px;
    font-weight: 800;
    color: var(--fp2-text);
    counter-increment: fp2-od-step;
  }

  .fp2-od-label::before,
  .fp2-order-card .fp2-id-field > .fp2-label::before,
  .fp2-order-card .fp2-number > .fp2-label::before,
  .fp2-order-card .fp2-legend::before {
    content: counter(fp2-od-step);
    flex: none;
    width: 20px;
    height: 20px;
    border-radius: 10px;
    background: var(--fp2-primary-soft);
    color: var(--fp2-primary-dark);
    font-size: 11.5px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .fp2-order-card .fp2-number {
    gap: 0;
  }

  /* ------------------------------------------- step 1: product tiles */
  .fp2-order-card .fp2-order-chips {
    display: none;
  }

  .fp2-od-step {
    display: block;
  }

  .fp2-od-step .fp2-od-label {
    margin-bottom: 10px;
  }

  .fp2-od-tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  .fp2-od-tile {
    position: relative;
    min-width: 0;
    padding: 12px 6px 10px;
    border: 1.5px solid var(--fp2-border);
    border-radius: 10px;
    background: #fff;
    color: var(--fp2-body);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    transition: border-color .15s, background-color .15s;
  }

  .fp2-od-tile:hover {
    border-color: var(--fp2-primary);
  }

  .fp2-od-tile:focus-visible,
  .fp2-od-pc:focus-visible,
  .fp2-cd-item:focus-visible {
    outline: 2px solid var(--fp2-primary);
    outline-offset: 2px;
  }

  .fp2-od-tile-ico {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--fp2-page);
    color: var(--fp2-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .fp2-od-tile-ico svg {
    width: 26px;
    height: 26px;
  }

  .fp2-od-tile-name {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--fp2-text);
    min-height: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-wrap: anywhere;
  }

  .fp2-od-tile.is-active {
    border-color: var(--fp2-primary);
    background: var(--fp2-primary-soft);
  }

  .fp2-od-tile.is-active .fp2-od-tile-ico {
    background: #fff;
  }

  .fp2-od-tile.is-locked .fp2-od-tile-ico,
  .fp2-od-tile.is-locked .fp2-od-tile-name {
    color: var(--fp2-muted);
  }

  .fp2-od-lock {
    position: absolute;
    top: 8px;
    right: 8px;
    color: var(--fp2-muted);
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .fp2-od-tile-more .fp2-od-tile-ico {
    color: var(--fp2-body);
  }

  /* ------------------------------------------------ step 3: nominals */
  .fp2-order-card .fp2-nominals {
    position: relative;
  }

  .fp2-od-search-toggle {
    margin: -4px -8px -4px auto;
    height: 28px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--fp2-primary-dark);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .fp2-od-search-toggle svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
  }

  .fp2-od-search-toggle:hover,
  .fp2-nominals.is-searching .fp2-od-search-toggle {
    background: var(--fp2-primary-soft);
  }

  .fp2-order-card .fp2-nominal-tools {
    display: none;
    margin: 0 0 10px;
  }

  .fp2-order-card .fp2-nominals.is-searching .fp2-nominal-tools {
    display: flex;
  }

  .fp2-order-card .fp2-nominal-tools .fp2-search .fp2-input {
    height: 40px;
  }

  .fp2-order-card .fp2-nominal-scroll {
    max-height: 300px;   /* about 4 rows of cards, then it scrolls inside the card */
    overflow-y: auto;
    padding: 2px 6px 2px 2px;
    margin: -2px -6px -2px -2px;
    overscroll-behavior: contain;
  }

  .fp2-order-card .fp2-nominal {
    min-height: 64px;
    padding: 11px 12px;
    gap: 3px;
    justify-content: center;
  }

  .fp2-order-card .fp2-nominal-title {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.2;
  }

  .fp2-order-card .fp2-nominal-price {
    font-size: 13px;
    font-weight: 600;
  }

  .fp2-order-card .fp2-nominal-empty {
    padding: 4px 0;
    border: 0;
    border-radius: 0;
    text-align: left;
    font-size: 13.5px;
  }

  /* ---------------------------------------------- step 4: pay cards */
  .fp2-order-card .fp2-field:has(select[name="pembayaran"]) {
    position: relative;
    gap: 0;
  }

  .fp2-order-card .fp2-field:has(select[name="pembayaran"]) > .fp2-label {
    display: none;
  }

  /* the real select stays in the page (the order script reads and drives it), just not seen */
  .fp2-order-card .fp2-field select[name="pembayaran"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    overflow: hidden;
    clip-path: inset(50%);
    pointer-events: none;
  }

  .fp2-od-pay {
    display: block;
  }

  /* --------------------------------------------------------- summary */
  .fp2-member-home .fp2-member-right .fp2-summary,
  .fp2-od-sumbox {
    flex: none;
    background: var(--fp2-page);
    border: 0;
    border-radius: 10px;
    padding: 16px 18px 14px;
    gap: 10px;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .fp2-order-card .fp2-summary > h3 {
    display: none;
  }

  .fp2-order-card .fp2-summary-list {
    display: grid;
    grid-template-columns: minmax(0, max-content) minmax(0, 1fr) auto;
    column-gap: 8px;
    row-gap: 6px;
    align-items: baseline;
    font-size: 14px;
  }

  .fp2-order-card .fp2-summary-list > div {
    display: block;
    min-width: 0;
  }

  .fp2-order-card .fp2-summary-list dt {
    display: none;
  }

  .fp2-order-card .fp2-summary-list dd {
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .fp2-order-card .fp2-summary-list > div:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .fp2-order-card .fp2-summary-list > div:nth-child(1) dd {
    font-size: 15px;
    font-weight: 800;
  }

  .fp2-order-card .fp2-summary-list > div:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
  }

  .fp2-order-card .fp2-summary-list > div:nth-child(2) dd {
    font-weight: 600;
    color: var(--fp2-muted);
  }

  .fp2-order-card .fp2-summary-list > div:nth-child(2) dd::before {
    content: "\00b7\00a0";
  }

  .fp2-order-card .fp2-summary-list > div:nth-child(3) {
    grid-column: 3;
    grid-row: 1;
  }

  .fp2-order-card .fp2-summary-list > div:nth-child(3) dd {
    font-size: 15px;
    font-weight: 800;
    text-align: right;
  }

  .fp2-order-card .fp2-summary-list > .fp2-sum-disc {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13.5px;
  }

  .fp2-order-card .fp2-summary-list > .fp2-sum-disc[hidden] {
    display: none;
  }

  .fp2-order-card .fp2-summary-list > .fp2-sum-disc dt {
    display: block;
    color: var(--fp2-muted);
  }

  .fp2-order-card .fp2-summary-list > .fp2-sum-disc dd {
    color: var(--fp2-success-text);
    font-weight: 800;
  }

  /* the static "Sisa Saldo" row: the balance is already on the Saldo Akun card */
  .fp2-order-card .fp2-summary-list > div:last-child:nth-child(5) {
    display: none;
  }

  .fp2-order-card .fp2-summary .fp2-pay {
    gap: 10px;
  }

  .fp2-order-card .fp2-remaining {
    font-size: 13.5px;
  }

  .fp2-order-card .fp2-qris-note,
  .fp2-order-card .fp2-price-note {
    margin: 0;
  }

  .fp2-order-card .fp2-total-row {
    padding-top: 12px;
    border-top: 1px solid var(--fp2-border-strong);
  }

  .fp2-order-card .fp2-total-value {
    font-size: 24px;
  }

  .fp2-order-card .fp2-order-extra {
    margin: 2px 0 0;
  }

  .fp2-od-guestsum {
    display: grid;
  }

  /* nothing chosen yet: one quiet line instead of "- . - -" */
  .fp2-order-card .fp2-summary-list.is-empty > div:nth-child(-n+3) {
    display: none;
  }

  .fp2-order-card .fp2-summary-list.is-empty::before {
    content: "Belum ada nominal dipilih.";
    grid-column: 1 / -1;
    color: var(--fp2-muted);
    font-weight: 600;
  }

  /* guest card: the pay step and the summary block stack with the same rhythm as the main column */
  .fp2-guest-home .fp2-order-card > .fp2-pay {
    gap: 20px;
  }

  /* ------------------------------------------------ category dialog */
  .fp2-cd {
    position: fixed;
    inset: 0;
    z-index: 95;
    background: rgba(11, 42, 63, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
  }

  .fp2-cd[hidden] {
    display: none;
  }

  .fp2-cd-panel {
    width: min(680px, 100%);
    max-height: 80vh;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 24px 64px rgba(11, 42, 63, .28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .fp2-cd-panel:focus {
    outline: none;
  }

  .fp2-cd-head {
    flex: none;
    padding: 18px 20px 14px;
    background: #fff;
    border-bottom: 1px solid var(--fp2-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .fp2-cd-headrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .fp2-cd-headrow h2 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.3px;
  }

  .fp2-cd-search {
    flex: none;
  }

  .fp2-cd-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 6px 20px 20px;
    overscroll-behavior: contain;
  }

  .fp2-cd-group {
    padding-top: 14px;
  }

  .fp2-cd-group[hidden],
  .fp2-cd-item[hidden],
  .fp2-cd-empty[hidden] {
    display: none;
  }

  .fp2-cd-group h3 {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--fp2-muted);
  }

  .fp2-cd-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
  }

  .fp2-cd-item {
    min-width: 0;
    padding: 9px 12px 9px 10px;
    border: 1.5px solid var(--fp2-border);
    border-radius: 8px;
    background: #fff;
    color: var(--fp2-text);
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .fp2-cd-item:hover {
    border-color: var(--fp2-primary);
    background: var(--fp2-primary-soft);
  }

  .fp2-cd-ico {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--fp2-page);
    color: var(--fp2-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .fp2-cd-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
  }

  .fp2-cd-lock {
    flex: none;
    color: var(--fp2-muted);
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .fp2-cd-item.is-locked {
    background: var(--fp2-page);
    color: var(--fp2-muted);
  }

  .fp2-cd-item.is-locked:hover {
    background: var(--fp2-page);
    border-color: var(--fp2-border-strong);
  }

  .fp2-cd-item.is-locked .fp2-cd-ico {
    background: #fff;
    color: var(--fp2-muted);
  }

  .fp2-cd-empty {
    margin: 24px 0 8px;
    text-align: center;
    color: var(--fp2-muted);
    font-size: 14px;
  }

  /* the "Khusus member" explanation, opened by a locked tile or item: a centered window on desktop */
  #fp2-locked.fp2-sheet {
    align-items: center;
    padding: 24px;
  }

  #fp2-locked .fp2-sheet-panel {
    border-radius: var(--fp2-radius-lg);
    max-width: 440px;
  }
}

/* Group image ("Gambar" instead of the icon): fills the same rounded tile as the icon, contained, on white and on the tinted tile. */
.fp2-gimg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  box-sizing: border-box;
  padding: 4px;
  border-radius: inherit;
}

.fp2-od-tile-ico:has(.fp2-gimg),
.fp2-cd-ico:has(.fp2-gimg) {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--fp2-border);
  overflow: hidden;
}

.fp2-od-tile-ico .fp2-gimg {
  padding: 5px;
}
