/* ============================================================
   Admin > Commerce > Upgrades: product catalog and bundles, plus the
   bundle cards in the customer shop. Only .pc-* and .shop-bundle-* classes.
   The tab is often only 550-750px wide (sidebar + panel padding), so the
   layout follows the container width and nothing scrolls sideways.
   ============================================================ */

.pc {
  display: grid;
  gap: 16px;
  min-width: 0;
  container: catalog / inline-size;
}

.pc .sr-only,
.pc-modal .sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.pc [hidden] { display: none !important; }
.pc-sub { display: block; color: var(--td); font-size: 11px; line-height: 1.45; }

/* ── Header ── */
.pc-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.pc-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.pc-head h3 { margin: 3px 0 4px; color: #fff; font-size: 20px; letter-spacing: -.3px; }
.pc-head p { margin: 0; max-width: 70ch; color: var(--td); font-size: 12.5px; line-height: 1.6; }
.pc-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── View tabs ── */
.pc-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 12px;
  background: rgba(0, 0, 0, .18);
  width: fit-content;
  max-width: 100%;
}

.pc-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--td);
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
}

.pc-tabs button span {
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .07);
  font-size: 10.5px;
  text-align: center;
}

.pc-tabs button:hover { color: #fff; }
.pc-tabs button.active { background: rgba(240, 56, 75, .18); color: #fff; }
.pc-tabs button.active span { background: rgba(240, 56, 75, .3); }
.pc-tabs button:focus-visible { outline: 2px solid rgba(240, 56, 75, .7); outline-offset: 1px; }

/* ── Toolbar ── */
.pc-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(140px, 180px);
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(240, 56, 75, .11);
  border-radius: 12px;
  background: rgba(10, 4, 6, .34);
}

.pc-search {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  height: 42px;
  padding: 0 13px;
  border: 1px solid rgba(240, 74, 96, .3);
  border-radius: 8px;
  background: var(--g);
  color: var(--td);
  box-sizing: border-box;
}

.pc-search:focus-within { border-color: var(--p); box-shadow: 0 0 0 3px rgba(240, 56, 75, .2); }
.pc-search input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; color: #fff; font: inherit; font-size: 13px; }
.pc-search input::placeholder { color: #826a74; }

.pc-seg {
  display: flex;
  height: 42px;
  padding: 3px;
  box-sizing: border-box;
  border: 1px solid rgba(240, 74, 96, .3);
  border-radius: 8px;
  background: var(--g);
}

.pc-seg button {
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--td);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.pc-seg button:hover { color: #fff; }
.pc-seg button.active { background: rgba(240, 56, 75, .22); color: #fff; }
.pc-seg button:focus-visible { outline: 2px solid rgba(240, 56, 75, .7); outline-offset: 1px; }
.pc-game { min-width: 0; }

.pc-count { margin: 0 2px 10px; color: var(--td); font-size: 11.5px; }

/* ── Product cards ── */
.pc-products, .pc-bundles { display: grid; gap: 12px; }

.pc-product, .pc-bundle {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  background: rgba(255, 255, 255, .02);
  overflow: hidden;
}

.pc-bundle { display: grid; gap: 0; }
.pc-bundle.is-hidden { border-style: dashed; }

.pc-product-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  min-width: 0;
}

.pc-cover {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 11px;
  background: radial-gradient(circle at 50% 40%, rgba(240, 56, 75, .18), rgba(255, 255, 255, .03));
  color: #ff8c97;
  font-size: 18px;
}

.pc-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-product-main { flex: 1 1 auto; min-width: 0; }

.pc-title {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  min-width: 0;
}

.pc-title strong {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: #fff;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-title + .pc-sub { margin-top: 3px; }

.pc-product-actions, .pc-plan-actions, .pc-bundle-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.pc-game-pill {
  padding: 3px 8px;
  border: 1px solid rgba(240, 56, 75, .2);
  border-radius: 99px;
  background: rgba(240, 56, 75, .06);
  color: #ff8c97;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.pc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 9px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, .06);
  color: var(--tm);
  font-size: 10.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-chip i { font-size: 9px; }
.pc-chip-star { background: rgba(245, 158, 11, .13); color: #fbbf24; }
.pc-ok { background: rgba(96, 220, 130, .12); color: #8be3a5; }
.pc-off { background: rgba(255, 255, 255, .05); color: var(--td); }
.pc-warn { background: rgba(245, 158, 11, .13); color: #fbbf24; }

/* ── Plan rows ── */
.pc-plans { border-top: 1px solid rgba(255, 255, 255, .05); }

.pc-plan {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 76px minmax(0, 1fr) auto;
  grid-template-areas: "main dur price flags actions";
  align-items: center;
  gap: 8px 12px;
  padding: 11px 14px;
  border-top: 1px solid rgba(255, 255, 255, .035);
}

.pc-plan:first-child { border-top: 0; }
.pc-plan:hover { background: rgba(255, 255, 255, .02); }
.pc-plan.is-hidden .pc-plan-main, .pc-plan.is-hidden .pc-price { opacity: .55; }
.pc-plan-main { grid-area: main; min-width: 0; }
.pc-plan-main strong { display: block; overflow: hidden; color: #fff; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.pc-duration { grid-area: dur; justify-self: start; }
.pc-price { grid-area: price; color: #fff; font-family: var(--mn, inherit); font-size: 13px; white-space: nowrap; }
.pc-flags { grid-area: flags; display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.pc-plan-actions { grid-area: actions; justify-self: end; }

.pc-icon-btn {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 9px;
  background: rgba(255, 255, 255, .03);
  color: var(--tm);
  cursor: pointer;
}

.pc-icon-btn:hover { background: rgba(240, 56, 75, .14); border-color: rgba(240, 56, 75, .35); color: #fff; }
.pc-icon-btn:focus-visible { outline: 2px solid rgba(240, 56, 75, .7); outline-offset: 1px; }

.pc-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 44px 20px;
  border: 1px dashed rgba(255, 255, 255, .09);
  border-radius: 14px;
  color: var(--td);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.pc-empty i { color: rgba(240, 56, 75, .55); font-size: 26px; }
.pc-empty p { margin: 0; max-width: 46ch; }
.pc-empty strong { color: #fff; }

/* ── Bundle cards ── */
.pc-bundle-price { flex: 0 0 auto; text-align: right; }
.pc-bundle-price strong { display: block; color: #fff; font-size: 18px; }

.pc-bundle-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 8px;
  margin: 0;
  padding: 0 14px 14px;
  list-style: none;
}

.pc-bundle-items li {
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 10px;
  background: rgba(0, 0, 0, .18);
}

.pc-bundle-items li.is-hidden { border-color: rgba(245, 158, 11, .3); }
.pc-bundle-items strong { display: block; overflow: hidden; color: #fff; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.pc-bundle-items span { color: var(--td); font-size: 11px; }

.pc-problems {
  margin: 0 14px 12px;
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(245, 158, 11, .08);
  color: #fcd34d;
  font-size: 12px;
  line-height: 1.5;
}

.pc-bundle-actions {
  justify-content: flex-end;
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, .05);
}

/* ── Dialogs ── */
.mb.pc-modal-box {
  box-sizing: border-box;
  width: min(760px, calc(100vw - 24px));
  max-width: 760px;
  padding: 24px 26px;
  overflow-x: hidden;
}

.pc-modal { display: grid; gap: 14px; min-width: 0; }
.pc-modal > * { min-width: 0; }

.pc-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pc-modal-head > div { min-width: 0; }
.pc-modal-head h3 { margin: 3px 0 0; overflow-wrap: anywhere; font-size: 19px; }
.pc-hint { margin: 0; color: var(--td); font-size: 12px; line-height: 1.55; }
.pc-section .pc-hint { margin-bottom: 12px; }
.pc-help { display: block; margin-top: 7px; color: var(--td); font-size: 11px; line-height: 1.5; }
.pc-help code { padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, .08); }

.pc-section {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  background: rgba(255, 255, 255, .018);
}

.pc-section h4 {
  margin: 0 0 12px;
  color: rgba(255, 255, 255, .7);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.pc-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.pc-details summary::-webkit-details-marker { display: none; }
.pc-details summary h4 { margin: 0; }
.pc-details summary::after { content: "\f078"; font-family: "Font Awesome 6 Free"; font-weight: 900; color: var(--td); font-size: 10px; }
.pc-details[open] summary::after { content: "\f077"; }
.pc-details[open] summary { margin-bottom: 12px; }
.pc-details summary .pc-sub { margin-left: auto; }

.pc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pc-grid > label, .pc-grid > div { min-width: 0; }
.pc-grid > label { display: flex; flex-direction: column; gap: 6px; }
.pc-grid > label > span { color: rgba(255, 255, 255, .6); font-size: 11px; font-weight: 700; }
.pc-grid .wide { grid-column: 1 / -1; }
.pc-modal .ki { width: 100%; min-width: 0; margin: 0; box-sizing: border-box; }
.pc-modal .ki:disabled { opacity: .45; cursor: not-allowed; }
.pc-modal select.ki { padding-right: 12px; }

.pc-modal textarea.ki.pc-textarea {
  height: auto;
  min-height: 92px;
  padding: 11px 14px;
  line-height: 1.5;
  resize: vertical;
}

.pc-modal textarea.ki.pc-textarea.compact { min-height: 70px; }
.pc-modal textarea.ki.pc-textarea.tall { min-height: 150px; }
.pc-modal textarea.ki.pc-textarea:focus { transform: none; }

.pc-toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }

.pc-toggle {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 11px;
  background: rgba(0, 0, 0, .16);
  cursor: pointer;
}

.pc-toggle input { flex: 0 0 auto; width: 17px; height: 17px; margin: 1px 0 0; accent-color: #f0384b; }
.pc-toggle > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pc-toggle strong { color: #fff; font-size: 12.5px; }
.pc-toggle small { color: var(--td); font-size: 11px; line-height: 1.4; }
.pc-toggle:has(input:checked) { border-color: rgba(240, 56, 75, .35); background: rgba(240, 56, 75, .07); }
.pc-toggle-inline { align-self: end; }

.pc-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.pc-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(240, 56, 75, .1);
  color: #ff9aa4;
  font-size: 12.5px;
}

/* Bundle picker: one row per product with a plan select. */
.pc-picks { display: grid; gap: 8px; max-height: 330px; overflow-y: auto; overflow-x: hidden; padding-right: 2px; }

.pc-pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 11px;
  background: rgba(0, 0, 0, .14);
}

.pc-pick.is-on { border-color: rgba(240, 56, 75, .4); background: rgba(240, 56, 75, .07); }
.pc-pick-main { min-width: 0; }
.pc-pick-main strong { display: block; overflow: hidden; color: #fff; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.pc-pick .custom-select { min-width: 0; }
.pc-pick select { text-overflow: ellipsis; }

.pc-summary {
  align-self: end;
  min-height: 42px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--tm);
  font-size: 12.5px;
  line-height: 1.5;
}

.pc-summary strong { color: #fff; }
.pc-save { color: #8be3a5; font-weight: 700; }
.pc-warn-text { color: #fbbf24; font-weight: 700; }

/* ── Container: medium ── */
@container catalog (max-width: 720px) {
  .pc-plan {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "main price actions"
      "dur flags flags";
  }
  .pc-price { justify-self: end; }
}

/* ── Container: narrow (phones) ── */
@container catalog (max-width: 520px) {
  .pc-toolbar { grid-template-columns: minmax(0, 1fr); }
  .pc-seg button { flex: 1 1 0; }
  .pc-head-actions { width: 100%; }
  .pc-head-actions .btn { flex: 1 1 0; }
  .pc-tabs { width: 100%; }
  .pc-tabs button { flex: 1 1 0; justify-content: center; }
  .pc-product-head { flex-wrap: wrap; }
  .pc-product-actions { width: 100%; }
  .pc-product-actions .btn { flex: 1 1 0; }
  .pc-bundle-price { width: 100%; text-align: left; }
  .pc-plan {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main price"
      "dur dur"
      "flags flags"
      "actions actions";
  }
  .pc-plan-actions { justify-self: stretch; }
  .pc-plan-actions .btn { flex: 1 1 auto; }
}

@container catalog (min-width: 721px) and (max-width: 860px) {
  .pc-plan { grid-template-columns: minmax(0, 1fr) 90px 72px minmax(0, .8fr) auto; }
}

/* Dialogs live outside the tab and follow the window. */
@media (max-width: 640px) {
  .mb.pc-modal-box { padding: 18px 16px; }
  .pc-grid, .pc-toggles { grid-template-columns: minmax(0, 1fr); }
  .pc-grid .wide { grid-column: auto; }
  .pc-pick { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .pc-footer .btn { flex: 1 1 0; }
}

/* ── Shop: bundle cards ── */
.shop-bundle-card .shop-product-image.fallback { color: #ff8c97; }
.shop-bundle-includes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -6px 22px 16px;
  padding: 0;
  list-style: none;
}

.shop-bundle-includes li {
  max-width: 100%;
  padding: 5px 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 99px;
  background: rgba(255, 255, 255, .03);
  color: rgba(255, 255, 255, .72);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-bundle-was { margin-left: 8px; color: rgba(255, 255, 255, .38); font-size: 14px !important; font-weight: 600; text-decoration: line-through; }
.shop-bundle-save { color: #8be3a5 !important; font-weight: 700; }

.shop-bundle-list { display: grid; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }

.shop-bundle-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--gb);
  border-radius: 12px;
  background: rgba(255, 255, 255, .025);
}

.shop-bundle-list li > div { min-width: 0; }
.shop-bundle-list strong { display: block; overflow: hidden; color: #fff; font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.shop-bundle-list span { color: var(--td); font-size: 11.5px; }
.shop-bundle-list em { flex: 0 0 auto; color: rgba(255, 255, 255, .45); font-style: normal; font-size: 12px; }

.shop-bundle-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid rgba(240, 56, 75, .25);
  border-radius: 13px;
  background: rgba(240, 56, 75, .06);
}

.shop-bundle-total strong { display: block; color: #fff; font-size: 22px; }
.shop-bundle-total span { color: var(--td); font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .pc-tabs button, .pc-seg button, .pc-icon-btn { transition: none; }
}
