/*
 * fp2-kategori.css - step 3 "Pilih kategori" of the home order form (fp2-home.js): one card per operator that fits the typed
 * number, "Terlaris" first, then step 4 "Pilih nominal" with a "Ganti kategori" bar. Reuses the nominal row look (fp2.css
 * "Home order form: nominal list") and the fp2 tokens; nothing here applies while the form lists nominals directly.
 */

.fp2-nominals {
  scroll-margin-top: 72px;   /* "Ganti kategori" / a card tap brings the list back under the fixed top bar */
}

/* ------------------------------------------------------- kategori cards */
#order_form #nominal .fp2-kat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

#order_form #nominal .fp2-kat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 64px;
  padding: 10px 12px;
  border: 1.5px solid var(--fp2-border);
  border-radius: 10px;
  background: #fff;
  color: var(--fp2-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

#order_form #nominal .fp2-kat-card:hover {
  border-color: var(--fp2-primary);
}

#order_form #nominal .fp2-kat-card:focus-visible {
  outline: 2px solid var(--fp2-primary);
  outline-offset: 2px;
}

#order_form #nominal .fp2-kat-card.is-last {
  border-color: var(--fp2-primary);
  background: var(--fp2-primary-soft);
}

#order_form #nominal .fp2-kat-card.is-top {
  border-color: #f3d98b;
  background: var(--fp2-amber-soft);
}

#order_form #nominal .fp2-kat-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--fp2-primary-soft);
  color: var(--fp2-primary-dark);
}

#order_form #nominal .fp2-kat-card.is-top .fp2-kat-ico {
  background: #fff;
  color: var(--fp2-amber-text);
}

#order_form #nominal .fp2-kat-card.is-paket .fp2-kat-ico {
  background: var(--fp2-success-soft);
  color: var(--fp2-success-text);
}

#order_form #nominal .fp2-kat-ico svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#order_form #nominal .fp2-kat-card.is-top .fp2-kat-ico svg {
  fill: currentColor;
  stroke-width: 1.4;
}

#order_form #nominal .fp2-kat-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

#order_form #nominal .fp2-kat-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1.25;
}

#order_form #nominal .fp2-kat-meta {
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--fp2-muted);
}

#order_form #nominal .fp2-kat-min {
  font-weight: 800;
  color: var(--fp2-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#order_form #nominal .fp2-kat-tag {
  flex: none;
  padding: 2px 8px;
  border-radius: 10px;
  background: #fff;
  color: var(--fp2-primary-dark);
  font-size: 11.5px;
  font-weight: 800;
}

#order_form #nominal .fp2-kat-chev {
  flex: none;
  fill: none;
  stroke: var(--fp2-muted);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ------------------------------------- step 4: "Ganti kategori" bar */
.fp2-kat-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 0 10px;
}

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

.fp2-kat-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 14px 0 8px;
  border: 1.5px solid var(--fp2-border-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--fp2-primary-dark);
  font: inherit;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}

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

.fp2-kat-back:focus-visible {
  outline: 2px solid var(--fp2-primary);
  outline-offset: 2px;
}

.fp2-kat-back svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fp2-kat-current {
  flex: 1 1 140px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--fp2-text);
}

/* a row that came from "Terlaris" or a search names its kategori */
#order_form #nominal .fp2-nominal-kat {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--fp2-primary-dark);
}

/* ------------------------------------------------- desktop order card */
@media (min-width: 992px) {
  /* step 3 has its own search: no "Cari" toggle, the box is always there */
  .fp2-order-card .fp2-nominals.is-kat .fp2-nominal-tools {
    display: flex;
  }

  .fp2-order-card .fp2-nominals.is-kat .fp2-od-search-toggle {
    display: none;
  }

  /* kategori was step 3, the nominals after it are step 4 */
  .fp2-order-card .fp2-nominals.is-after-kat .fp2-legend {
    counter-increment: fp2-od-step 2;
  }

  .fp2-order-card .fp2-kat-bar {
    margin-bottom: 8px;
  }

  .fp2-order-card .fp2-kat-back {
    min-height: 36px;
  }
}
