/* Pokescam Cartes TCG v3 — scoped, !important pour résister au thème */

/* ── Toolbar ─────────────────────────────────────────────── */
/*
  Structure HTML :
    .pstcg > .pstcg-bar
      a.pstcg-ext-btn       → Extensions
      div.pstcg-searchbox   → Recherche
      button.pstcg-sort-btn → Tri

  Mobile  (<601px) :
    Ligne 1 : [Extensions ←]  [→ Tri]
    Ligne 2 : [Recherche pleine largeur]

  Desktop (≥601px) :
    Ligne 1 : [Extensions] [Recherche flex:1] [Tri]

  Spécificité .pstcg devant chaque règle pour résister au thème.
*/

.pstcg .pstcg-bar {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin-bottom: 20px !important;
  padding: 0 !important;
  background: none !important;
  border: none !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

/* Bouton Extensions */
.pstcg .pstcg-ext-btn {
  order: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  height: 40px !important;
  padding: 0 14px !important;
  background: #fff !important;
  border: 1.5px solid #e5e7eb !important;
  border-radius: 8px !important;
  font-size: .85rem !important;
  font-weight: 600 !important;
  color: #374151 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  text-decoration: none !important;
  transition: border-color .15s, color .15s !important;
  box-shadow: none !important;
}
.pstcg .pstcg-ext-btn:hover {
  border-color: #f36001 !important;
  color: #f36001 !important;
}

/* Bouton Tri */
.pstcg .pstcg-sort-btn {
  order: 2 !important;
  margin-left: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  height: 40px !important;
  padding: 0 16px !important;
  background: #fff !important;
  border: 1.5px solid #e5e7eb !important;
  border-radius: 8px !important;
  font-size: .85rem !important;
  font-weight: 600 !important;
  color: #374151 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
  outline: none !important;
  box-shadow: none !important;
  transition: border-color .15s, color .15s, background .15s !important;
}
.pstcg .pstcg-sort-btn .pstcg-sort-arrow {
  fill: #9ca3af !important;
  transition: transform .25s ease, fill .15s !important;
  flex-shrink: 0 !important;
  display: block !important;
}
.pstcg .pstcg-sort-btn:hover {
  border-color: #f36001 !important;
  color: #f36001 !important;
  background: #fff8f5 !important;
}
.pstcg .pstcg-sort-btn:hover .pstcg-sort-arrow { fill: #f36001 !important; }
.pstcg .pstcg-sort-btn.is-desc {
  border-color: #f36001 !important;
  color: #f36001 !important;
  background: #fff8f5 !important;
}
.pstcg .pstcg-sort-btn.is-desc .pstcg-sort-arrow {
  transform: rotate(180deg) !important;
  fill: #f36001 !important;
}

/* Recherche */
.pstcg .pstcg-searchbox {
  order: 3 !important;
  position: relative !important;
  width: 100% !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}
.pstcg .pstcg-searchbox svg {
  position: absolute !important;
  left: 12px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  pointer-events: none !important;
  display: block !important;
  stroke: #9ca3af !important;
  fill: none !important;
}
.pstcg .pstcg-searchbox input {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
  height: 40px !important;
  padding: 0 14px 0 38px !important;
  background: #fff !important;
  border: 1.5px solid #e5e7eb !important;
  border-radius: 8px !important;
  font-size: .88rem !important;
  color: #111 !important;
  outline: none !important;
  box-shadow: none !important;
  transition: border-color .15s !important;
  -webkit-appearance: none !important;
  margin: 0 !important;
}
.pstcg .pstcg-searchbox input::placeholder { color: #9ca3af !important; }
.pstcg .pstcg-searchbox input:focus { border-color: #f36001 !important; }

/* Desktop ≥601px : tout sur une ligne */
@media (min-width: 601px) {
  .pstcg .pstcg-bar      { flex-wrap: nowrap !important; }
  .pstcg .pstcg-sort-btn { order: 3 !important; margin-left: 0 !important; }
  .pstcg .pstcg-searchbox {
    order: 2 !important;
    width: auto !important;
    flex: 1 !important;
    max-width: 320px !important;
  }
}

/* ── Grille ──────────────────────────────────────────────── */
.pstcg-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 8px !important;
  padding: 0 !important;
  margin: 0 !important;
  list-style: none !important;
}
@media (min-width: 560px) {
  .pstcg-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 10px !important; }
}
@media (min-width: 900px) {
  .pstcg-grid { grid-template-columns: repeat(7, 1fr) !important; gap: 12px !important; }
}

/* ── Carte ───────────────────────────────────────────────── */
.pstcg-card {
  aspect-ratio: 2.5 / 3.5 !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  cursor: pointer !important;
  background: #f3f4f6 !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: block !important;
  position: relative !important;
  transition: transform .18s ease, box-shadow .18s ease !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.12) !important;
}
.pstcg-card:hover,
.pstcg-card:focus-visible {
  transform: scale(1.04) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.18) !important;
  outline: none !important;
  z-index: 2 !important;
}
.pstcg-card img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  border-radius: 10px !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.pstcg-card__ph {
  width: 100% !important;
  height: 100% !important;
  background: #e5e7eb !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #9ca3af !important;
  font-weight: 700 !important;
  border-radius: 10px !important;
}
.pstcg-card--hidden { display: none !important; }

.pstcg-empty {
  text-align: center !important;
  color: #9ca3af !important;
  padding: 40px 0 !important;
  font-size: .95rem !important;
}

/* ══════════════════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════════════════ */
.pstcg-lb {
  position: fixed !important;
  inset: 0 !important;
  z-index: 999999 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
}
.pstcg-lb[hidden] { display: none !important; }

.pstcg-lb__bd {
  position: absolute !important;
  inset: 0 !important;
  background: rgba(0,0,0,.88) !important;
  backdrop-filter: blur(8px) !important;
}
.pstcg-lb__btn {
  position: absolute !important;
  z-index: 10 !important;
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  background: rgba(20,20,20,.85) !important;
  border: 1.5px solid rgba(255,255,255,.15) !important;
  color: #fff !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: 0 2px 10px rgba(0,0,0,.4) !important;
  transition: background .15s !important;
  outline: none !important;
}
.pstcg-lb__btn svg {
  width: 18px !important;
  height: 18px !important;
  stroke: #fff !important;
  fill: none !important;
  display: block !important;
  flex-shrink: 0 !important;
}
.pstcg-lb__btn:hover { background: #f36001 !important; border-color: #f36001 !important; }
.pstcg-lb__close { top: 16px !important; right: 16px !important; }
.pstcg-lb__prev  { left: 18px !important;  top: 50% !important; transform: translateY(-50%) !important; }
.pstcg-lb__next  { right: 18px !important; top: 50% !important; transform: translateY(-50%) !important; }

.pstcg-lb__stage {
  position: relative !important;
  z-index: 2 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 20px 80px 80px !important;
}
.pstcg-lb__wrap { position: relative !important; }
.pstcg-lb__wrap img {
  max-height: calc(100vh - 180px) !important;
  max-width: min(460px, 74vw) !important;
  width: auto !important;
  height: auto !important;
  border-radius: 10px !important;
  box-shadow: 0 24px 60px rgba(0,0,0,.8) !important;
  display: block !important;
  transition: opacity .2s !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}
.pstcg-lb__wrap img.loading { opacity: 0 !important; }

.pstcg-lb__spin {
  position: absolute !important;
  inset: 0 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
}
.pstcg-lb__spin.on { display: flex !important; }
.pstcg-lb__spin div {
  width: 30px !important;
  height: 30px !important;
  border: 3px solid rgba(255,255,255,.15) !important;
  border-top-color: #f36001 !important;
  border-radius: 50% !important;
  animation: pstcg-spin .7s linear infinite !important;
}
@keyframes pstcg-spin { to { transform: rotate(360deg); } }

.pstcg-lb__name {
  color: #fff !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  margin: 0 !important;
  text-align: center !important;
}
.pstcg-lb__num {
  color: rgba(255,255,255,.45) !important;
  font-size: .78rem !important;
  margin: 0 !important;
  text-align: center !important;
}

.pstcg-lb__strip {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 3 !important;
  display: flex !important;
  gap: 4px !important;
  overflow-x: auto !important;
  padding: 10px 80px 12px !important;
  background: linear-gradient(to top, rgba(0,0,0,.75) 50%, transparent) !important;
  scrollbar-width: none !important;
}
.pstcg-lb__strip::-webkit-scrollbar { display: none !important; }

.pstcg-strip-thumb {
  flex-shrink: 0 !important;
  width: 42px !important;
  height: 59px !important;
  border-radius: 4px !important;
  overflow: hidden !important;
  border: 2px solid transparent !important;
  cursor: pointer !important;
  opacity: .5 !important;
  transition: opacity .15s, border-color .15s, transform .15s !important;
}
.pstcg-strip-thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}
.pstcg-strip-thumb.on,
.pstcg-strip-thumb:hover {
  border-color: #f36001 !important;
  opacity: 1 !important;
  transform: scale(1.1) !important;
}

@media (max-width: 600px) {
  .pstcg-lb__prev { left: 8px !important; }
  .pstcg-lb__next { right: 8px !important; }
  .pstcg-lb__stage { padding: 16px 16px 72px !important; }
  .pstcg-lb__strip { padding: 8px 12px 10px !important; }
}
