/* /shop storefront — card grid. Tokens are theme-scoped by [data-server] in site.css. */

main.shop {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}
.shop .loading { color: var(--muted); padding: 2.5rem; text-align: center; }

.shop-head { margin: 0 0 0.4rem; }
.shop-head h1 { margin: 0; font-size: 1.6rem; font-weight: 700; color: var(--gold); }
.shop-sub { color: var(--muted); font-size: 0.92rem; margin: 0.25rem 0 1.4rem; line-height: 1.5; }

/* Pre-go-live banner (also live-state banner when available). No arrow/em-dash characters (UI copy rule). */
.shop-banner {
  background: var(--panel-inset); border: 1px dashed var(--border-bright);
  border-radius: 10px; padding: 0.75rem 1rem; margin: 0 0 1.5rem;
  color: var(--muted); font-size: 0.88rem; line-height: 1.5;
}
.shop-banner strong { color: var(--gold); }

.shop-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  align-items: start;
}

.shop-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column;
}
.shop-card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem;
  padding: 0.9rem 1.1rem 0.6rem;
}
.shop-card-head h2 {
  margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--text);
}
.shop-pill {
  flex-shrink: 0; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--gold);
  border: 1px solid var(--gold-deep); border-radius: 999px; padding: 0.15rem 0.5rem;
}
.shop-desc {
  margin: 0; padding: 0 1.1rem 0.75rem; color: var(--muted);
  font-size: 0.86rem; line-height: 1.5;
}
.shop-meta {
  padding: 0 1.1rem 0.75rem; color: var(--muted); font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

/* Item preview: self-hosted icon tiles (/api/item-icon proxy). On a load error the
   capture-phase listener in shop.js swaps the tile for a .shop-item-chip text fallback. */
.shop-items {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0 1.1rem 0.9rem;
}
.shop-item {
  position: relative; width: 44px; height: 44px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.shop-item-icon { width: 38px; height: 38px; object-fit: contain; display: block; }
.shop-item .qty {
  position: absolute; right: -4px; bottom: -5px;
  background: var(--panel-inset); border: 1px solid var(--border-bright); border-radius: 6px;
  color: var(--text); font-size: 0.62rem; font-weight: 700; padding: 0 0.25rem;
  font-variant-numeric: tabular-nums;
}
.shop-item-chip {
  display: inline-flex; align-items: baseline; gap: 0.25rem;
  background: var(--panel-inset); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.2rem 0.6rem;
  color: var(--text); font-size: 0.76rem; line-height: 1.3;
}

/* Buy actions footer. */
.shop-actions {
  margin-top: auto; border-top: 1px solid var(--border);
  background: var(--panel-inset); padding: 0.85rem 1.1rem 1rem;
  display: flex; flex-direction: column; gap: 0.7rem;
}
.shop-mode { display: flex; flex-direction: column; gap: 0.4rem; }
.shop-mode-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem;
}
.shop-mode-label { color: var(--text); font-size: 0.86rem; font-weight: 600; }
.shop-price { color: var(--gold); font-size: 0.95rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.shop-price-unit { color: var(--muted); font-size: 0.74rem; font-weight: 500; }

/* Credit qty stepper. */
.shop-qty { display: flex; align-items: center; gap: 0.5rem; }
.shop-qty button {
  width: 1.9rem; height: 1.9rem; border-radius: 6px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border-bright); color: var(--text);
  font-size: 1rem; font-weight: 700; line-height: 1;
}
.shop-qty button:hover { border-color: var(--gold); color: var(--gold); }
.shop-qty .qty-val { min-width: 1.6rem; text-align: center; color: var(--text); font-variant-numeric: tabular-nums; font-weight: 700; }
.shop-subtotal { color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }

/* Disabled buy button (pre-go-live). */
.shop-buy {
  width: 100%; padding: 0.6rem; border-radius: 8px; font: inherit;
  font-size: 0.86rem; font-weight: 700;
  background: var(--panel); border: 1px dashed var(--border-bright); color: var(--muted);
  cursor: not-allowed;
}

/* Enabled buy button (available:true). Active style overrides the disabled base above. */
.shop-buy.shop-buy-enabled {
  background: transparent; border: 1px solid var(--sky); color: var(--sky);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.shop-buy.shop-buy-enabled:hover {
  background: color-mix(in srgb, var(--sky) 10%, transparent);
}
.shop-buy.shop-buy-enabled:active { opacity: 0.85; }

/* QSS link-style buy button (renders as <a> but styled identically to .shop-buy-enabled). */
.shop-buy.shop-buy-link {
  display: block; text-align: center; text-decoration: none;
  background: transparent; border: 1px solid var(--sky); color: var(--sky);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.shop-buy.shop-buy-link:hover {
  background: color-mix(in srgb, var(--sky) 10%, transparent);
}

.shop-soon { text-align: center; color: var(--muted); font-size: 0.74rem; font-style: italic; }

.shop-empty {
  background: var(--panel); border: 1px dashed var(--border);
  border-radius: 14px; padding: 2.25rem 1.5rem; text-align: center;
  color: var(--muted); font-size: 0.95rem; line-height: 1.6;
}
.shop-error { color: var(--err); }

/* Caps kits — redeemed with the playtime caps currency. Gold accent (theme-independent,
   matches the nav wallet pill); status line shows the redeem result above the button. */
.shop-pill-caps { color: #ffcc4d; border-color: rgba(255,204,77,0.55); background: rgba(255,204,77,0.12); }
.shop-caps-status { font-size: 0.8rem; min-height: 1em; margin-bottom: 0.45rem; color: var(--muted); }
.shop-caps-status.ok { color: #57d364; }
.shop-caps-status.err { color: var(--err); }
/* Caps category intro banner — subtle gold edge to set it apart from the GCash banner. */
.shop-banner-caps { border-color: rgba(255,204,77,0.30); }

/* ===== Shop category tabs (Paid / Caps) — underline tab bar (reads as navigation, not
   filter chips); active tab carries the per-server accent underline. ===== */
.shop-tabs { display: flex; gap: 0.3rem; border-bottom: 1px solid var(--border); margin: 0 0 1.2rem; }
.shop-tab {
  font-family: inherit; font-size: 0.95rem; font-weight: 700; letter-spacing: 0.02em;
  cursor: pointer; padding: 0.55rem 1.15rem;
  background: none; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -1px;            /* sit the active underline on top of the container border */
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
}
.shop-tab:hover { color: var(--text); border-bottom-color: var(--border); }
.shop-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ===== Kit payment modal (.sk-* prefix to avoid collision with .bp-* on /me) ===== */

.sk-dlg {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 0; max-width: 440px; width: 92%;
}
.sk-dlg::backdrop { background: rgba(0,0,0,0.55); }
.sk-body { padding: 1.5rem 1.5rem 1.25rem; }

.sk-header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem;
  margin: 0 0 0.6rem;
}
.sk-headline {
  margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--sky);
  flex: 1; min-width: 0; word-break: break-word;
}
.sk-expires {
  color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.sk-expires strong { color: var(--text); font-weight: 600; }

.sk-loading { color: var(--muted); text-align: center; font-size: 0.9rem; padding: 2.5rem 0; }

.sk-qr {
  background: #fff; padding: 0.6rem; border-radius: 10px;
  margin: 0 auto 0.6rem; max-width: 220px; line-height: 0;
}
.sk-qr svg { width: 100%; height: auto; display: block; }
.sk-scan-hint { text-align: center; color: var(--muted); font-size: 0.8rem; margin: 0 0 0.7rem; }

.sk-meta-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.45rem 0.75rem; border-radius: 8px;
  background: var(--panel-inset); border: 1px solid var(--border);
  margin: 0.3rem 0; font-size: 0.9rem;
}
.sk-meta-row .lbl { color: var(--muted); font-size: 0.78rem; }
.sk-meta-row .val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.sk-amount-val { color: var(--sky); font-size: 1rem; }

.sk-ref-label { display: block; color: var(--muted); font-size: 0.78rem; margin: 0.5rem 0 0.25rem; }
.sk-input {
  width: 100%; padding: 0.55rem 0.75rem; border-radius: 8px;
  background: var(--panel-inset); border: 1px solid var(--border);
  color: var(--text); font-size: 1rem; font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em; box-sizing: border-box;
}
.sk-input:focus { outline: none; border-color: var(--sky); }

/* Awaiting-payment hint shown under the recipient row. Matching by amount is
   automatic (forwarder captures sender + ref), so the buyer just waits. */
.sk-wait-hint {
  text-align: center; color: var(--muted); font-size: 0.82rem;
  line-height: 1.45; margin: 0.6rem 0 0.4rem;
}

.sk-result {
  min-height: 1.2em; margin: 0.4rem 0 0.9rem;
  color: var(--muted); font-size: 0.9rem;
}

/* Payment-confirmed state: the .sk-paid class is added to #skPay once the poll
   reports a match. The QR, scan hint, amount/recipient rows and the "waiting for
   payment" hint are dropped, leaving only the confirmation and the Done button.
   The dialog stays open until the buyer dismisses it. */
#skPay.sk-paid .sk-qr,
#skPay.sk-paid .sk-scan-hint,
#skPay.sk-paid .sk-meta-row,
#skPay.sk-paid .sk-wait-hint { display: none; }

#skPay.sk-paid .sk-result {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  text-align: center; margin: 1.5rem 0 1.25rem;
}
.sk-paid-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: #34d399; font-weight: 700; font-size: 1.05rem;
}
.sk-paid-badge svg { width: 1rem; height: 1rem; flex: none; }
.sk-paid-detail { color: var(--muted); font-size: 0.85rem; line-height: 1.45; max-width: 30ch; }

.sk-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }
/* The UA `[hidden]{display:none}` loses to the `.sk-actions` class rule above, so JS setting
   `.hidden = true` wouldn't hide skLoadingActions (caused a duplicate Close in the pay state).
   Restore it with a higher-specificity rule. */
.sk-actions[hidden] { display: none; }
.sk-btn {
  padding: 0.5rem 1rem; border-radius: 8px; font-weight: 600;
  cursor: pointer; font-size: 0.92rem; font-family: inherit;
}
.sk-btn-secondary { background: var(--panel-inset); border: 1px solid var(--border); color: var(--text); }
.sk-btn-primary { background: transparent; border: 1px solid var(--sky); color: var(--sky); }
.sk-btn-primary:hover { background: color-mix(in srgb, var(--sky) 10%, transparent); }

/* ===== Cart panel ===== */

.shop-cart {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  margin: 0 0 1.25rem;
}
.shop-cart-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem;
  padding: 0.75rem 1.1rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.shop-cart-title {
  font-size: 0.95rem; font-weight: 700; color: var(--gold);
}
.shop-cart-count {
  font-size: 0.76rem; color: var(--muted);
}

.shop-cart-lines {
  padding: 0.4rem 1.1rem;
}
.shop-cart-line {
  display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
}
.shop-cart-line:last-child { border-bottom: none; }
.shop-cart-line-name {
  color: var(--text); font-weight: 600; flex: 1; min-width: 0;
}
.shop-cart-line-mode {
  color: var(--muted); font-size: 0.78rem; white-space: nowrap;
}
.shop-cart-line-price {
  color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.shop-cart-remove {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 0.78rem; padding: 0 0.2rem;
  line-height: 1; flex-shrink: 0;
}
.shop-cart-remove:hover { color: var(--err, #e05c5c); }

.shop-cart-footer {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.75rem 1.1rem 0.85rem;
  background: var(--panel-inset); border-top: 1px solid var(--border);
}
.shop-cart-total-label {
  color: var(--muted); font-size: 0.82rem; font-weight: 600;
}
.shop-cart-total {
  color: var(--gold); font-size: 1rem; font-weight: 700;
  font-variant-numeric: tabular-nums; flex: 1;
}
.shop-cart-checkout {
  /* Inherits .shop-buy.shop-buy-enabled; just needs spacing override */
  width: auto; padding: 0.5rem 1.1rem;
}
