/* ===== CATÁLOGO POKÉMON TCG ===== */
 
:root {
  --bg: #f8f8f8;
  --surface: #ffffff;
  --surface2: #f5f5f7;
  --surface3: #ebebef;
  --border: rgba(0,0,0,0.08);
  --border2: rgba(0,0,0,0.15);
  --text: #111118;
  --muted: rgba(17,17,24,0.7);
  --muted2: rgba(17,17,24,0.6);
  --accent: #7c3aed;
  --accent-bg: rgba(124,58,237,0.08);
  --accent-border: rgba(124,58,237,0.25);
  --gold: #d97706;
  --gold-bg: rgba(217,119,6,0.08);
  --green: #059669;
  --green-bg: rgba(5,150,105,0.08);
  --red: #dc2626;
  --blue: #2563eb;
  --blue-bg: rgba(37,99,235,0.08);
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
}
 
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Space Grotesk', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
 
/* ===== FILTER BAR ===== */
.filter-bar {
  margin-top: 0px;
  padding: 0.6rem 1.5rem;
  border-bottom: none;
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
  background: rgba(255,255,255,1);
  backdrop-filter: blur(12px);
  position: sticky; top: 52px; z-index: 50;
  overflow: visible;
}
 
select.fsel {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--r); color: var(--text); font-family: inherit;
  font-size: 13px; padding: 7px 28px 7px 10px; outline: none; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23555' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  transition: border-color .15s;
}
select.fsel:focus { border-color: var(--accent); }
 
.count-badge {
  font-size: 16px; color: var(--muted); white-space: nowrap;
}
 
.stock-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r);
  border: 1px solid var(--border2); background: var(--surface2);
  color: var(--muted2); font-family: inherit; font-size: 13px;
  font-weight: 500; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.stock-btn:hover { border-color: var(--green); color: var(--green); }
.stock-btn.active { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.stock-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
 
.currency-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r);
  border: 1px solid var(--border2); background: var(--surface2);
  color: var(--muted2); font-family: inherit; font-size: 13px;
  font-weight: 500; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.currency-btn:hover { border-color: var(--accent); color: var(--accent); }
.currency-btn.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
 
/* ===== SKELETON LOADER ===== */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 600px 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 6px;
}
.cat-card.loading .cat-img-box {
  background: #f0f0f0;
  animation: shimmer 1.3s infinite;
  background-size: 600px 100%;
  background-image: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
}
.cat-card.loading .cat-info { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.skel-line { background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%); background-size: 600px 100%; animation: shimmer 1.3s infinite; border-radius: 4px; height: 12px; }
 
/* ===== GRID ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(10px, 1.5vw, 24px);
  padding: clamp(1rem, 2vw, 2rem) clamp(1rem, 3vw, 3rem);
  max-width: 100%;
  margin: 0 auto;
}
 
/* ===== CARD ===== */
.cat-card {
  cursor: pointer;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
}
.cat-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}
 
.cat-img-box {
  width: 100%;
  aspect-ratio: 2.5 / 3.5;
  background: var(--surface2);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.cat-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}
 
.cat-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.cat-nombre {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Space Grotesk', sans-serif;
}
.cat-set {
  font-size: 11px;
  color: var(--muted2);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-meta {
  font-size: 11px;
  color: var(--muted2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-precios { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.cat-precio-row { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.cat-precio-label { color: var(--muted2); font-weight: 500; white-space: nowrap; }
.cat-precio-mio { font-weight: 700; color: rgb(0, 180, 216); }
.cat-precio-mercado { font-weight: 700; color: rgb(5, 150, 105); }
.cat-precio-sin { color: var(--muted); font-weight: 400; }
 
.cat-stock-badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--green);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 99px;
}
 
/* ===== PAGINACIÓN ===== */
.paginacion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}
.pag-btn {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  transition: all .15s;
}
.pag-btn:hover { border-color: var(--accent); color: var(--accent); }
.pag-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pag-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.pag-info { font-size: 13px; color: var(--muted2); padding: 0 8px; }
 
/* ===== MODAL CARTA ===== */
.modal-overlay.open { display: flex; }
 
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r-xl);
  width: 100%; max-width: 1000px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
 
.modal-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  height: 800px;
}
 
.modal-img-col {
  background: var(--surface2) url('../Img/mercado/FONDO.jpg') center/cover no-repeat;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.modal-img-col img {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: var(--r);
  object-fit: contain;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
 
.modal-right {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
 
.modal-info-row {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
 
.modal-bottom-row {
  display: grid;
  grid-template-columns: 1fr 260px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
 
.modal-chart-col {
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
}
.mc-chart-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mc-chart-wrap canvas { width: 100% !important; max-height: 200px; }
.mc-chart-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  display: none;
}
.mc-chart-empty.visible { display: block; }
 
.modal-panel-col {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
 
.mc-estados {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mc-estado-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface); cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--muted2);
  transition: all .15s;
}
.mc-estado-opt input[type=radio] { display: none; }
.mc-estado-opt:hover { border-color: var(--accent); color: var(--text); }
.mc-estado-opt.active { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); font-weight: 600; }
 
.mc-compra-info {
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mc-compra-dato {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mc-compra-label {
  font-size: 9px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em;
}
.mc-compra-val { font-size: 13px; font-weight: 700; color: var(--text); }
.mc-stat-mio { color: rgb(0,180,216); }
.mc-compra-info input[type=number] {
  width: 80px; height: 32px; text-align: center;
  border: 1px solid var(--border2); border-radius: 6px;
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 14px; font-weight: 600;
  outline: none; padding: 0 6px;
}
.mc-compra-info input[type=number]:focus { border-color: var(--accent); }
.mc-agregar-btn {
  background: #16a34a; color: #fff; border: none;
  border-radius: 8px; font-family: inherit; font-size: 13px;
  font-weight: 700; width: 100%; height: 32px;
  cursor: pointer; transition: background .15s;
  align-self: end;
}
.mc-agregar-btn:hover { background: #15803d; }
.mc-agregar-btn:disabled { background: #aaa; cursor: not-allowed; }
 
.modal-name { font-size: 1rem; font-weight: 700; line-height: 1.2; }
.modal-set  { font-size: 12px; color: var(--muted2); }
.modal-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.mbadge { font-size: 11px; padding: 3px 9px; border-radius: 99px; font-weight: 500; }
.mb-type   { background: var(--blue-bg);  color: var(--blue); }
.mb-rarity { background: var(--gold-bg);  color: var(--gold); }
.mb-series { background: var(--surface3); color: var(--muted2); }
.mc-artista { font-size: 11px; color: var(--muted); font-style: italic; }
.mc-variantes { margin: 0; }
.variant-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.variant-tab {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 99px; color: var(--muted2); font-family: inherit;
  font-size: 11px; font-weight: 500; padding: 4px 12px;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.variant-tab:hover { border-color: var(--accent); color: var(--accent); }
.variant-tab.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.mc-divider { border: none; border-top: 1px solid var(--border); }
 
.close-btn {
  position: absolute; top: 14px; right: 14px; z-index: 10;
  background: var(--surface3); border: none; border-radius: 99px;
  color: var(--muted2); cursor: pointer; font-size: 16px;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  transition: color .15s;
}
.close-btn:hover { color: var(--text); }
 
.mc-wishlist-btn {
  background: none; border: 1px solid #7c3aed; color: #7c3aed;
  border-radius: 8px; font-family: inherit; font-size: 12px;
  font-weight: 600; width: 100%; height: 32px;
  cursor: pointer; transition: all .15s;
}
.mc-wishlist-btn:hover { background: rgba(124,58,237,0.08); }
 
/* ===== EMPTY ===== */
.empty { text-align: center; padding: 5rem 1rem; color: var(--muted); grid-column: 1/-1; }
.empty-icon { font-size: 48px; margin-bottom: 1rem; }
.load-sentinel { height: 40px; }
 
/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px)  { .grid { grid-template-columns: repeat(3, 1fr); } }
 
@media (max-width: 800px) {
  /* Modal mobile: sheet desde abajo */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box {
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    max-height: 92vh;
    width: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }
  .modal-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
    flex: 1;
  }
  .modal-img-col {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px;
    max-height: none;
  }
  .modal-img-col img { max-width: 300px; }
  .modal-right {
    display: flex;
    flex-direction: column;
    overflow: visible;
    flex: 1;
  }
  .modal-bottom-row {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: visible;
  }
  .modal-chart-col {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: 160px;
    padding: 12px;
  }
  .mc-chart-wrap canvas { max-height: 140px; }
  .modal-panel-col { overflow: visible; }
  .mc-agregar-btn, .mc-wishlist-btn { height: 44px; font-size: 15px; }
}
 
@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 1rem; }
  .filter-bar { padding: 0.5rem 0.75rem; gap: 6px; }
  select.fsel { font-size: 12px; padding: 6px 24px 6px 8px; }
  .stock-btn { padding: 6px 10px; font-size: 12px; }
  .count-badge { font-size: 11px; padding: 5px 10px; }
}
 
@media (max-width: 480px) {
  .cat-info { padding: 8px; }
  .cat-nombre { font-size: 12px; }
  .cat-set { font-size: 10px; }
  .cat-meta { font-size: 10px; }
  .cat-precio-row { font-size: 11px; }
  .modal-info-row { padding: 12px 14px 10px; gap: 4px; }
  .modal-name { font-size: 15px; }
  .close-btn { top: 10px; right: 10px; }
}
/* ===== SET DROPDOWN CUSTOM ===== */
.set-dropdown {
  position: relative;
  flex-shrink: 0;
}
.set-dropdown-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--r); color: var(--text); font-family: inherit;
  font-size: 13px; padding: 7px 12px; outline: none; cursor: pointer;
  transition: border-color .15s; white-space: nowrap; min-width: 160px;
  justify-content: space-between;
}
.set-dropdown-btn:hover { border-color: var(--accent); }
.set-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 999;
  overflow: hidden;
}
.set-dropdown-menu.open { display: block; }
.set-dropdown-search-wrap {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.set-dropdown-search-wrap input {
  flex: 1; border: none; outline: none;
  font-family: inherit; font-size: 13px;
  color: var(--text); background: transparent;
}
.set-dropdown-search-wrap input::placeholder { color: var(--muted); }
.set-dropdown-list {
  max-height: 300px;
  overflow-y: auto;
}
.set-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background .1s;
  gap: 8px;
}
.set-dropdown-item span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.set-dropdown-item:hover { background: var(--surface2); }
.set-dropdown-item.active { color: var(--accent); font-weight: 600; background: var(--accent-bg); }
.set-count {
  font-size: 11px;
  color: var(--muted);
  background: var(--surface2);
  border-radius: 99px;
  padding: 1px 7px;
  flex-shrink: 0;
  font-weight: 500;
}
.set-dropdown-item.active .set-count {
  background: var(--accent-bg);
  color: var(--accent);
}