/* ============================================================
   Pack Point — Reservas TCG
   Tema escuro · acento teal · sobre Bootstrap 5.3
   ============================================================ */

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface-2: #1c2230;
  --surface-3: #232c3b;
  --border:    #2a313c;
  --border-2:  #384150;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --muted-2:   #6b7480;
  --teal:      #2dd4bf;
  --teal-dim:  #14b8a6;
  --teal-deep: #0f766e;
  --green:     #3fb950;
  --red:       #f85149;
  --amber:     #d8a02a;
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 6px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, .display-font {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  letter-spacing: -0.01em;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-dim); }

.text-muted-2 { color: var(--muted) !important; }
.text-teal { color: var(--teal) !important; }
.text-green { color: var(--green) !important; }
.text-red   { color: var(--red)   !important; }

::selection { background: rgba(45,212,191,.3); }

/* ---------- Barra de topo ---------- */
.topbar {
  background: rgba(13,17,23,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1030;
}
.brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -.02em;
  color: var(--text);
  display: inline-flex; align-items: center; gap: .55rem;
}
.brand .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(45,212,191,.18);
}
.brand small { color: var(--muted); font-weight: 400; font-size: .72rem; }

/* ---------- Superficies ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.panel-2 { background: var(--surface-2); }

/* ---------- Pills de jogo ---------- */
.game-pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.game-pill {
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: .5rem 1.05rem;
  font-weight: 600; font-size: .9rem;
  cursor: pointer; transition: .15s ease;
  white-space: nowrap;
}
.game-pill:hover { color: var(--text); border-color: var(--teal-deep); }
.game-pill.active {
  color: #052e2b; background: var(--teal); border-color: var(--teal);
}

/* ---------- Select de set ---------- */
.set-select {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: .6rem .9rem;
}
.set-select:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45,212,191,.15);
}

/* ---------- Grelha de cartas (loja) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}
.tcg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color .15s ease, transform .15s ease;
}
.tcg-card:hover { border-color: var(--border-2); transform: translateY(-2px); }
.tcg-card .thumb {
  aspect-ratio: 63/88;
  background: var(--surface-2) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.tcg-card .thumb .ph {
  color: var(--muted-2); font-size: .8rem; text-align: center; padding: 1rem;
}
.tcg-card .rarity-tag {
  position: absolute; top: 8px; left: 8px;
  background: rgba(13,17,23,.8); color: var(--teal);
  border: 1px solid var(--border-2);
  font-size: .65rem; font-weight: 700; letter-spacing: .03em;
  padding: .15rem .45rem; border-radius: 6px; text-transform: uppercase;
}
.tcg-card .body {
  padding: .7rem .75rem .85rem;
  display: flex; flex-direction: column; gap: .1rem; flex: 1;
}
.tcg-card .cname {
  font-weight: 600; font-size: .92rem; line-height: 1.25;
  color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tcg-card .cmeta { font-size: .74rem; color: var(--muted); }
.tcg-card .price {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 1.05rem; color: var(--text);
  margin-top: .35rem;
}
.tcg-card .stock { font-size: .72rem; color: var(--muted); }
.tcg-card .stock.low { color: var(--amber); }
.tcg-card .stock.out { color: var(--red); }

/* ---------- Stepper +/- ---------- */
.stepper {
  display: inline-flex; align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  overflow: hidden;
}
.stepper button {
  border: 0; background: transparent; color: var(--text);
  width: 34px; height: 34px; font-size: 1.15rem; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
  transition: background .12s ease;
}
.stepper button:hover:not(:disabled) { background: var(--surface-3); }
.stepper button:disabled { color: var(--muted-2); cursor: not-allowed; }
.stepper .val {
  min-width: 34px; text-align: center; font-weight: 600; font-size: .95rem;
  font-variant-numeric: tabular-nums;
}
.stepper.teal button.plus { color: var(--teal); }

/* Botao circular "+" grande (estilo referencia) */
.add-fab {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1.5px solid var(--teal);
  background: transparent; color: var(--teal);
  display: grid; place-items: center; font-size: 1.4rem; line-height: 1;
  cursor: pointer; transition: .15s ease;
}
.add-fab:hover { background: var(--teal); color: #052e2b; }

/* ---------- Botao carrinho flutuante ---------- */
.cart-toggle {
  position: fixed; right: 20px; bottom: 20px; z-index: 1040;
  background: var(--teal); color: #052e2b;
  border: 0; border-radius: 999px;
  padding: .8rem 1.2rem; font-weight: 700;
  box-shadow: var(--shadow); cursor: pointer;
  display: inline-flex; align-items: center; gap: .5rem;
}
.cart-toggle .badge-count {
  background: #052e2b; color: var(--teal);
  border-radius: 999px; padding: .1rem .5rem; font-size: .8rem;
  min-width: 24px; text-align: center;
}

/* ---------- Offcanvas carrinho ---------- */
.offcanvas.cart-panel {
  background: var(--surface); color: var(--text);
  border-left: 1px solid var(--border);
  width: 400px; max-width: 92vw;
}
.cart-line {
  display: flex; gap: .75rem; align-items: center;
  padding: .7rem 0; border-bottom: 1px solid var(--border);
}
.cart-line .ct-thumb {
  width: 42px; height: 58px; border-radius: 6px; flex: none;
  background: var(--surface-2) center/cover no-repeat;
  border: 1px solid var(--border);
}
.cart-line .ct-name { font-weight: 600; font-size: .88rem; line-height: 1.2; }
.cart-line .ct-meta { font-size: .72rem; color: var(--muted); }

/* ---------- Backoffice: 3 colunas ---------- */
.explorer {
  display: grid;
  grid-template-columns: 230px 260px 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 991px) {
  .explorer { grid-template-columns: 1fr; }
}
.col-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem;
}
.col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .1rem .25rem .6rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: .9rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.list-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem;
  padding: .55rem .65rem; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .12s ease;
  border: 1px solid transparent;
}
.list-row:hover { background: var(--surface-2); }
.list-row.active { background: var(--surface-2); border-color: var(--teal-deep); }
.list-row .lr-name { font-weight: 600; font-size: .9rem; }
.list-row .lr-sub  { font-size: .72rem; color: var(--muted); }
.list-row .lr-count {
  font-size: .7rem; color: var(--muted);
  background: var(--surface-3); border-radius: 999px;
  padding: .05rem .5rem; font-variant-numeric: tabular-nums;
}
.list-empty { color: var(--muted-2); font-size: .85rem; padding: 1rem .5rem; text-align: center; }

/* Inventory picker panel and collapse toggle */
.inventory-picker-panel {
  overflow: hidden;
}

.inventory-collapse-toggle {
  width: 100%;
  appearance: none;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  text-align: left;
  cursor: pointer;
  background: transparent;
}

.inventory-collapse-toggle::after {
  content: '⌃';
  color: var(--muted-2);
  font-size: .9rem;
  transition: transform .18s ease;
}

.inventory-collapse-toggle.collapsed::after {
  transform: rotate(180deg);
}

.inventory-selected {
  min-width: 0;
  max-width: 60%;
  overflow: hidden;
  color: var(--muted-2);
  font-size: .78rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
}

/* Layout de inventário admin */
.inventory-layout {
  display: block;
}

.inventory-top .col-panel,
.inventory-bottom .col-panel {
  min-height: 0;
}

#cardsPanel {
  align-items: stretch;
}

#cardsPanel.row {
  margin-left: 0;
  margin-right: 0;
}

#cardsPanel > .list-empty {
  width: 100%;
}

.inventory-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
}

.card-thumb {
  width: 100%;
  aspect-ratio: 63 / 88;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background-color: var(--surface-3);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.card-thumb.empty::after {
  content: 'Imagem';
  display: grid;
  min-height: 100%;
  place-items: center;
  color: var(--muted-2);
  font-size: .78rem;
}

.inventory-card-body {
  display: grid;
  gap: .55rem;
  padding: .65rem;
}

.inventory-card .inline-input {
  width: 100%;
  min-width: 0;
}

.inventory-card .inline-input.price {
  max-width: none;
  text-align: right;
}

.inventory-card .card-name {
  font-weight: 700;
  font-size: .86rem;
}

.inventory-card-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: .45rem;
}

.inventory-card .stepper {
  width: 100%;
  justify-content: space-between;
}

.inventory-card .stepper button {
  width: 28px;
  height: 30px;
}

.inventory-card .stepper .val {
  width: 34px;
  min-width: 0;
  padding: 0;
  text-align: center;
  background: transparent;
  border: 0;
}

.inventory-card-delete {
  position: absolute;
  top: 7px;
  right: 7px;
  background: rgba(13,17,23,.78);
}

/* Tabela de cartas (admin) */
.cards-table { width: 100%; border-collapse: collapse; }
.cards-table th {
  text-align: left; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); font-weight: 600;
  padding: .4rem .6rem; border-bottom: 1px solid var(--border);
}
.cards-table td {
  padding: .55rem .6rem; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.cards-table tr:hover td { background: var(--surface-2); }
.cards-table .c-thumb {
  width: 34px; height: 47px; border-radius: 5px;
  background: var(--surface-2) center/cover no-repeat;
  border: 1px solid var(--border); flex: none;
}

/* Inputs inline (preco / campos) */
.inline-input {
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--text);
  border-radius: 7px;
  padding: .3rem .5rem; width: 100%;
  font-variant-numeric: tabular-nums;
}
.inline-input:hover { border-color: var(--border-2); }
.inline-input:focus {
  outline: none; border-color: var(--teal);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(45,212,191,.15);
}
.inline-input.price { max-width: 110px; text-align: right; }
.field-saved { animation: flashsave .9s ease; }
@keyframes flashsave {
  0%   { box-shadow: 0 0 0 3px rgba(63,185,80,.5); }
  100% { box-shadow: 0 0 0 3px rgba(63,185,80,0); }
}

/* ---------- Botoes ---------- */
.btn-teal {
  background: var(--teal); color: #052e2b; font-weight: 700;
  border: 0; border-radius: var(--radius-sm); padding: .55rem 1rem;
}
.btn-teal:hover { background: var(--teal-dim); color: #052e2b; }
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  padding: .5rem .9rem; font-weight: 600;
}
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); }
.btn-icon {
  background: transparent; border: 1px solid var(--border-2);
  color: var(--muted); border-radius: 8px;
  width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer;
}
.btn-icon:hover { border-color: var(--red); color: var(--red); }

/* ---------- Badges de estado (pedidos) ---------- */
.status-badge {
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  padding: .22rem .6rem; border-radius: 999px; text-transform: uppercase;
  display: inline-block;
}
.status-pending   { background: rgba(216,160,42,.15);  color: var(--amber); border: 1px solid rgba(216,160,42,.4); }
.status-ready     { background: rgba(45,212,191,.13);  color: var(--teal);  border: 1px solid rgba(45,212,191,.4); }
.status-collected { background: rgba(63,185,80,.13);   color: var(--green); border: 1px solid rgba(63,185,80,.4); }
.status-cancelled { background: rgba(248,81,73,.13);   color: var(--red);   border: 1px solid rgba(248,81,73,.4); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: 100%; max-width: 380px; }
.form-control-dark {
  background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--text); border-radius: var(--radius-sm); padding: .65rem .85rem;
}
.form-control-dark:focus {
  background: var(--surface-2); color: var(--text);
  border-color: var(--teal); box-shadow: 0 0 0 3px rgba(45,212,191,.15);
}

/* ---------- Toast ---------- */
.pp-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border-2); border-left: 3px solid var(--teal);
  border-radius: 10px; padding: .7rem 1.1rem; font-size: .9rem;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: .25s ease; z-index: 2000; max-width: 90vw;
}
.pp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.pp-toast.err  { border-left-color: var(--red); }

/* Utilidades */
.hide { display: none !important; }
.honeypot { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
