/* ============================================================
   CardXchange — Shared components  (v2 · elevated)
   Buttons · pills · cards · brand tiles (ticket-notch) · forms ·
   tabs · tables · logo · toasts
   ============================================================ */

/* ---------------- Logo (official Cardtrxchange lockup) ---------------- */
.logo { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.logo:hover { text-decoration: none; }

.logo-mark {
  height: 42px; width: auto;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 10px rgba(76, 29, 149, 0.25));
  transition: transform 0.2s var(--ease-spring);
}
.logo:hover .logo-mark { transform: rotate(-4deg) scale(1.04); }
.logo-mark.sm { height: 32px; filter: none; }

.logo-tile {
  position: relative;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--grad-brand-tile);
  color: #fff;
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 6px 16px rgba(109, 40, 217, 0.4);
}
.logo-tile::after {           /* satellite dot from the brand mark */
  content: "";
  position: absolute; top: -3px; right: -3px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #cdb6f6;
  border: 2px solid #fff;
}
.theme-admin .logo-tile {
  background: linear-gradient(140deg, var(--blue-500), var(--blue-800));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 16px rgba(37, 99, 235, 0.4);
}

/* Wordmark mirrors the official logotype: bold sans, violet "trx" */
.logo-name {
  font-family: var(--font-body);
  font-size: 19px; font-weight: 700; line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.logo-name em { font-style: normal; color: var(--violet-600); }
.logo.on-dark .logo-name em { color: var(--violet-400); }
.logo-sub {
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.17em; text-transform: uppercase;
  color: var(--ink-3);
}
.logo.on-dark .logo-name { color: #fff; }
.logo.on-dark .logo-sub  { color: rgba(255, 255, 255, 0.55); }

/* ---------------- Buttons ---------------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 24px;
  border-radius: var(--r-sm);
  font-family: var(--font-display);
  font-size: 15px; font-weight: 700;
  letter-spacing: 0.005em;
  text-decoration: none;
  overflow: hidden;
  transition:
    transform 0.16s var(--ease-out),
    box-shadow 0.16s var(--ease-out),
    background 0.16s ease,
    color 0.16s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.99); }

.btn .arrow { transition: transform 0.18s var(--ease-out); }
.btn:hover .arrow { transform: translateX(3px); }

.btn-primary {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), var(--btn-shadow);
}
.btn-primary:hover {
  background: var(--grad-accent-hover);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), var(--btn-shadow-hover);
}
/* light sweep across primary buttons on hover */
.btn-primary::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.28) 50%, transparent 62%);
  transform: translateX(-120%);
  transition: transform 0.05s;
  pointer-events: none;
}
.btn-primary:hover::after { transform: translateX(120%); transition: transform 0.55s var(--ease-out); }

.btn-light {
  background: var(--surface); color: var(--ink);
  border: var(--edge);
  box-shadow: var(--shadow-sm);
}
.btn-light:hover { box-shadow: var(--shadow-card); }

.btn-ghost { background: var(--accent-soft); color: var(--accent); }
.btn-ghost:hover { background: var(--accent-line); color: var(--accent-deep); }
.btn-outline { background: var(--surface); color: var(--accent); border: 1.5px solid var(--line-2); }

.btn-success {
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 24px rgba(22, 163, 74, 0.32);
}
.btn-success:hover { color: #fff; }
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 10px 24px rgba(220, 38, 38, 0.28);
}
.btn-danger-outline { background: var(--surface); color: var(--red-600); border: 1.5px solid #f3c1c1; }

.btn-block { width: 100%; }
.btn-sm { padding: 9px 17px; font-size: 14px; }
.btn-lg { padding: 16px 30px; font-size: 16.5px; border-radius: 13px; }

.btn[disabled], .btn.is-disabled {
  background: #cbc7d8; color: #fff;
  box-shadow: none; cursor: not-allowed; transform: none;
}
.btn[disabled]::after, .btn.is-disabled::after { display: none; }

/* ---------------- Pills / badges ---------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4.5px 13px;
  border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 600;
  white-space: nowrap;
}
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-green  { background: var(--green-bg); color: var(--green-700); }
.pill-amber  { background: var(--amber-bg); color: var(--amber-700); }
.pill-red    { background: var(--red-bg); color: var(--red-700); }
.pill-info   { background: var(--info-bg); color: var(--info-700); }
.pill-neutral{ background: #edeaf5; color: var(--ink-2); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* Soft pulsing dot — "live" indicators */
.dot-live { position: relative; }
.dot-live::after {
  content: "";
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
  animation: livePulse 2.2s ease-out infinite;
}
@keyframes livePulse {
  0%   { transform: scale(0.5); opacity: 0.6; }
  70%  { transform: scale(1.25); opacity: 0; }
  100% { opacity: 0; }
}

/* ---------------- Cards ---------------- */
.card {
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 24px;
  overflow: clip;                 /* nothing ever leaks past the rounded edge */
}

/* Guard rails: flex/grid children may shrink, long strings wrap, media stays inside */
.card > *, .entity > *, .tx-row > span:not(.tx-ic):not(.amt) { min-width: 0; }
/* break-word (not anywhere): wraps overflowing strings without zeroing
   min-content — `anywhere` let auto table layout starve columns (QA pass) */
.entity .t, .entity .s, .tx-row .t, .tx-row .s { overflow-wrap: break-word; }

/* A card that IS the scroller: horizontal swipe must beat the clip (QA pass) */
.card.scroll-x { overflow-x: auto; }

/* Inputs must be allowed to shrink inside grid/flex rows on phones (QA pass) */
.input, .select, .textarea { min-width: 0; }
.card-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; }

/* Ticket-notch motif: punched circles on the sides of a card/tile.
   Notch color must match the surface behind the element. */
.notched { position: relative; }
.notched::before, .notched::after {
  content: "";
  position: absolute; top: 50%;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--notch-bg, var(--bg));
  box-shadow: inset 0 1px 2px rgba(23, 17, 49, 0.06);
  transform: translateY(-50%);
}
.notched::before { left: -9px; }
.notched::after  { right: -9px; }
.notched.on-card { --notch-bg: var(--surface); }

/* Perforated tear line — pair with .notched.on-card */
.perf-divider {
  border: 0;
  border-top: 2px dashed var(--line-2);
  margin: 20px 0 0;
}

/* ---------------- Brand tiles ---------------- */
.brand-badge {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 15px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 24px; font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -8px 16px rgba(0, 0, 0, 0.18),
    0 4px 10px rgba(23, 17, 49, 0.14);
}
.brand-badge.sm { width: 40px; height: 40px; font-size: 18px; border-radius: 12px; }

.brand-amazon    { background: var(--tile-amazon); }
.brand-itunes    { background: var(--tile-itunes); }
.brand-gplay     { background: var(--tile-gplay); }
.brand-steam     { background: var(--tile-steam); }
.brand-razer     { background: var(--tile-razer); }
.brand-netflix   { background: var(--tile-netflix); }
.brand-ebay      { background: var(--tile-ebay); }
.brand-sephora   { background: var(--tile-sephora); }
.brand-nordstrom { background: var(--tile-nordstrom); }
.brand-vanilla   { background: var(--tile-vanilla); }
.brand-apple     { background: var(--tile-apple); }
.brand-xbox      { background: var(--tile-xbox); }
.brand-usdt      { background: var(--tile-usdt); }

.brand-tile {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 24px 12px 20px;
  background: var(--surface);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  text-align: center;
  text-decoration: none; color: inherit;
  transition: transform 0.2s var(--ease-spring), border-color 0.15s ease, box-shadow 0.2s ease;
}
.brand-tile:hover {
  transform: translateY(-4px);
  text-decoration: none;
  border-color: var(--accent-line);
  box-shadow: var(--shadow-card);
}
.brand-tile .brand-badge { transition: transform 0.2s var(--ease-spring); }
.brand-tile:hover .brand-badge { transform: scale(1.08) rotate(-3deg); }
.brand-tile.is-selected { border-color: var(--accent-strong); }
.brand-tile .name { font-weight: 700; font-size: 15px; color: var(--ink); }
.brand-tile .meta { font-size: 12.5px; color: var(--ink-3); }

/* ---------------- Forms ---------------- */
.field { display: grid; gap: 7px; }
.field > label { font-weight: 600; font-size: 14px; color: var(--ink); }
.field .hint { font-size: 12.5px; color: var(--ink-3); }

.input, .select, .textarea {
  width: 100%;
  padding: 12.5px 15px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 15px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.input:hover, .select:hover, .textarea:hover { border-color: #c4bdd9; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 13%, transparent);
}
.textarea { min-height: 90px; resize: vertical; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237d7889' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

.input-wrap { position: relative; }
.input-wrap .suffix {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
}

.checkbox { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14.5px; }
.checkbox input { position: absolute; opacity: 0; }
.checkbox .box {
  width: 20px; height: 20px; flex: 0 0 auto;
  border-radius: 6px;
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  display: grid; place-items: center;
  color: transparent; font-size: 12px; font-weight: 700;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.checkbox input:checked + .box { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; }
.switch .track {
  position: absolute; inset: 0;
  border-radius: var(--r-pill);
  background: #d5d1e2;
  transition: background 0.16s ease;
}
.switch .track::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s var(--ease-spring);
}
.switch input:checked + .track { background: var(--accent-strong); }
.switch input:checked + .track::after { transform: translateX(20px); }

/* Radio-style option rows (funding methods, payout methods…) */
.option-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.option-row:hover { border-color: var(--line-2); }
.option-row.is-selected {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 9%, transparent);
}
.option-row .radio {
  width: 20px; height: 20px; flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  display: grid; place-items: center;
}
.option-row.is-selected .radio { border-color: var(--accent-strong); }
.option-row.is-selected .radio::after {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-strong);
}

/* Code boxes (OTP / PIN) */
.code-row { display: flex; gap: 10px; }
.code-box {
  width: 52px; height: 60px;
  text-align: center;
  font-family: var(--font-display); font-size: 24px; font-weight: 700;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}
.code-box:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 13%, transparent);
  transform: translateY(-1px);
}

/* ---------------- Tabs ---------------- */
.tabs {
  display: inline-flex; gap: 4px;
  padding: 5px;
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.tab {
  padding: 9px 20px;
  border-radius: 10px;
  font-family: var(--font-display); font-size: 15px; font-weight: 700;
  color: var(--ink-2);
  transition: color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent);
}

/* Filter chips (soft tabs) */
.chip {
  padding: 7px 16px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip.is-active { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

/* ---------------- Tables ---------------- */
.table { width: 100%; border-collapse: collapse; min-width: 700px; }
.table th {
  text-align: left;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 17px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 14.5px;
  transition: background 0.12s ease;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #faf8fe; }
.table .cell-strong { font-weight: 700; }
.table .money { white-space: nowrap; }

/* Row entity: badge + title + sub */
.entity { display: flex; align-items: center; gap: 12px; }
.entity .t { font-weight: 700; color: var(--ink); }
.entity .s { font-size: 12.5px; color: var(--ink-3); }

/* ---------------- Toast (proof-of-payment popup) ---------------- */
.toast {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  padding: 14px 18px;
}
.toast .tick {
  position: relative;
  width: 32px; height: 32px; flex: 0 0 auto;
  border-radius: 10px;
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #fff;
  display: grid; place-items: center;
  font-size: 14px;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.35);
}
.toast .t { font-weight: 700; font-size: 14px; }
.toast .s { font-size: 12.5px; color: var(--ink-3); }
.toast.is-swapping { animation: toastSwap 0.5s var(--ease-out); }
@keyframes toastSwap {
  0%   { opacity: 1; transform: translateY(0); }
  40%  { opacity: 0; transform: translateY(10px) scale(0.98); }
  60%  { opacity: 0; transform: translateY(-10px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ---------------- Board-style stat blocks ---------------- */
.stat .v {
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 700;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -0.02em;
}
.stat .l { font-size: 13px; color: var(--ink-2); margin-top: 2px; }

/* ---------------- Progress bar ---------------- */
.bar { height: 7px; border-radius: var(--r-pill); background: #e6e2f0; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--grad-accent); }

/* ------------------------------------------------------------
   FAQ / troubleshooting accordion.

   Lives here rather than in public.css because two different
   places use it: the homepage FAQ section and the Support page
   inside the app, and those two load different stylesheets.
   ------------------------------------------------------------ */
.faq-list { display: grid; gap: 12px; }

.faq-item {
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: clip;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}
.faq-item[open] { box-shadow: var(--shadow-card); border-color: var(--violet-100); }

.faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 24px;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700;
  color: var(--ink);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--violet-700); }

/* The Support page writes a plain <p>; the homepage uses
   .faq-answer. Style both the same way. */
.faq-item > p,
.faq-answer {
  padding: 0 24px 22px;
  font-size: 15.5px; line-height: 1.7;
  color: var(--ink-2);
  max-width: 68ch;
}

@media (max-width: 560px) {
  .faq-item summary { padding: 16px 18px; font-size: 15.5px; }
  .faq-item > p,
  .faq-answer { padding: 0 18px 18px; font-size: 14.5px; }
}

/* ------------------------------------------------------------
   A gift card that has a real logo uploaded.

   The badge keeps exactly the same size and shape as the letter
   version, so a row of cards looks even whether the logos have
   arrived yet or not. White background because most brand logos
   are drawn for one.
   ------------------------------------------------------------ */
.brand-badge.has-logo {
  background: #fff;
  border: 1px solid var(--line);
  padding: 4px;
  overflow: hidden;
}
.brand-badge.has-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
