/* ==========================================================================
   Tasador y Buscador de Cartas Coleccionables (TCG) - Fijate Tools
   Estilos específicos: 3D Holo Sheen, modo oscuro/claro y responsivo
   Integrado con common/header.css, common/ads.css y common/footer.css
   ========================================================================== */

:root {
  --bg-card: #131b2e;
  --bg-card-hover: #18233c;
  --bg-surface: #1e293b;
  --bg-input: #0f172a;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;
  --border-card: rgba(255, 255, 255, 0.12);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;
  
  /* Acentos temáticos por juego */
  --accent-poke: #f59e0b;
  --accent-poke-bg: rgba(245, 158, 11, 0.15);
  --accent-mtg: #8b5cf6;
  --accent-mtg-bg: rgba(139, 92, 246, 0.15);
  --accent-ygo: #ef4444;
  --accent-ygo-bg: rgba(239, 68, 68, 0.15);
  
  --gold-primary: #fbbf24;
  --gold-glow: rgba(251, 191, 36, 0.35);
  --green-success: #10b981;
  --blue-primary: #2563eb;
  --blue-hover: #1d4ed8;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-card: 0 8px 24px -6px rgba(0, 0, 0, 0.5);
  
  /* Fuentes corporativas oficiales Fijate Tools */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-title: var(--font-heading);
  --font-mono: 'JetBrains Mono', monospace;
}

body {
  font-family: var(--font-sans);
}

[data-theme="light"], body.light-theme {
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-surface: #f1f5f9;
  --bg-input: #f8fafc;
  
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-card: rgba(0, 0, 0, 0.1);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --shadow-card: 0 8px 24px -6px rgba(0, 0, 0, 0.08);
}

/* Base de layout */
.tool-main-content {
  padding-bottom: 2rem;
}

.tcg-hero-box {
  text-align: center;
  margin: 1.5rem 0 1.25rem;
}

.tcg-hero-title {
  font-family: var(--font-title);
  font-size: clamp(1.6rem, 3.5vw, 2.3rem);
  font-weight: 800;
  margin: 8px 0 6px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.tcg-hero-desc {
  font-size: 0.98rem;
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Barra de navegación de Modos (Buscador vs Mi Colección) */
.tcg-modes-nav {
  display: flex;
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 5px;
  gap: 6px;
  margin: 1.25rem 0 2rem;
  box-shadow: var(--shadow-card);
}

.tcg-mode-btn {
  flex: 1 1 0%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  min-height: 44px;
}

.tcg-mode-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.tcg-mode-btn.active {
  background-color: var(--blue-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.collection-badge {
  background-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.collection-value-pill {
  background-color: var(--gold-primary);
  color: #000;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: #10b981;
  border-radius: 50%;
  animation: pulseAnim 2s infinite;
}

@keyframes pulseAnim {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Secciones de la Aplicación */
.app-section {
  display: none;
}
.app-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Selector de Juegos (Pills)
   ========================================================================== */

.game-selector-container {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.selector-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.game-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.game-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 42px;
}

.game-pill:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.game-pill.active[data-game="pokemon"] {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.25));
  border-color: var(--accent-poke);
  color: #fbbf24;
}

.game-pill.active[data-game="magic"] {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(124, 58, 237, 0.25));
  border-color: var(--accent-mtg);
  color: #c084fc;
}

.game-pill.active[data-game="yugioh"] {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.25));
  border-color: var(--accent-ygo);
  color: #f87171;
}

/* ==========================================================================
   Panel de Búsqueda y Filtros
   ========================================================================== */

.search-panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 48px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 46px 0 48px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.clear-btn {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  padding: 6px;
  cursor: pointer;
}
.clear-btn:hover {
  color: var(--text-primary);
}

.filters-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) 160px;
  gap: 14px;
  align-items: flex-end;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.filter-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 42px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--blue-primary);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  height: 42px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background-color: var(--blue-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-card-hover);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   Resultados y Grid de Cartas
   ========================================================================== */

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.results-title {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.results-count {
  font-size: 13px;
  color: var(--text-muted);
}

.tip-badge {
  font-size: 12px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

/* Grid de cartas */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 22px;
}

/* Tarjeta individual */
.card-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.card-item:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.6);
}

.card-img-wrap {
  width: 100%;
  aspect-ratio: 2.5 / 3.5;
  background-color: #0b0e14;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  perspective: 800px;
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
  will-change: transform;
}

.card-img-wrap.is-active {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(245, 158, 11, 0.3);
  z-index: 5;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
  pointer-events: none;
}

.card-img-wrap:hover .card-img {
  transform: scale(1.02);
}

.card-badges-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.game-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(8px);
}

.game-badge.pokemon { background: rgba(245, 158, 11, 0.85); color: #000; }
.game-badge.magic { background: rgba(139, 92, 246, 0.85); color: #fff; }
.game-badge.yugioh { background: rgba(239, 68, 68, 0.85); color: #fff; }

.rarity-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  backdrop-filter: blur(8px);
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.card-name {
  font-family: var(--font-title);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta-line {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.card-set-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}

.card-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.price-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.price-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold-primary);
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-card-action {
  height: 38px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  border: none;
}

.btn-quick-add {
  background-color: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.btn-quick-add:hover {
  background-color: var(--blue-primary);
  color: #fff;
}

.btn-view-detail {
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.btn-view-detail:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Scroll Infinito y Estados */
.infinite-scroll-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 36px;
  width: 100%;
  position: relative;
}

.infinite-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.spinner-small {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.infinite-manual-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

.btn-load-more {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  font-size: 14px;
  border-radius: var(--radius-full);
}

.load-more-badge {
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-secondary);
}

.infinite-end-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.infinite-sentinel {
  width: 100%;
  height: 20px;
  pointer-events: none;
  visibility: hidden;
}

.loading-state, .empty-state {
  text-align: center;
  padding: 50px 20px;
  background-color: var(--bg-card);
  border: 1px dashed var(--border-card);
  border-radius: var(--radius-lg);
  margin: 20px 0;
}

.custom-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--blue-primary);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 15px;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 44px;
  margin-bottom: 10px;
}

.empty-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 440px;
  margin: 0 auto 18px;
}

/* ==========================================================================
   Dashboard de la Cartera (Mi Colección)
   ========================================================================== */

.portfolio-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-card);
}

.metric-card.metric-hero {
  border-color: rgba(251, 191, 36, 0.3);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.06), var(--bg-card));
}

.metric-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gold-wrap { background: rgba(251, 191, 36, 0.15); color: var(--gold-primary); }
.blue-wrap { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.purple-wrap { background: rgba(139, 92, 246, 0.15); color: #c084fc; }
.green-wrap { background: rgba(16, 185, 129, 0.15); color: #34d399; }

.metric-data {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.metric-value-huge {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--gold-primary);
  line-height: 1.1;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-value-highlight {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.game-breakdown-bar {
  display: flex;
  height: 8px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background-color: var(--bg-surface);
  margin: 6px 0;
  width: 100%;
}

.bar-seg {
  height: 100%;
  transition: width 0.4s ease;
}
.poke-seg { background-color: var(--accent-poke); }
.mtg-seg { background-color: var(--accent-mtg); }
.ygo-seg { background-color: var(--accent-ygo); }

.breakdown-legend {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.leg-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.leg-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.poke-dot { background-color: var(--accent-poke); }
.mtg-dot { background-color: var(--accent-mtg); }
.ygo-dot { background-color: var(--accent-ygo); }

/* Toolbar de colección */
.collection-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 20px;
}

.toolbar-left {
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: 260px;
}

.mini-search { max-width: 240px; }
.mini-search .search-input { height: 38px; font-size: 13px; padding-left: 14px; }
.mini-select { max-width: 180px; height: 38px; font-size: 13px; }

.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.btn-action:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-action.btn-danger {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
}
.btn-action.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.15);
}

/* Tabla de Colección */
.collection-table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-card);
  background-color: var(--bg-card);
}

.collection-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.collection-table th {
  background-color: var(--bg-surface);
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.collection-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.collection-table tr:last-child td {
  border-bottom: none;
}

.table-card-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-card-thumb {
  width: 40px;
  height: 56px;
  border-radius: 4px;
  object-fit: cover;
  background-color: #000;
}

.table-card-title {
  font-weight: 700;
  color: var(--text-primary);
}

.table-price {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

.table-subtotal {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--gold-primary);
}

.table-qty-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
}

.table-qty-btn {
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
}
.table-qty-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.table-qty-num {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  padding: 0 8px;
  min-width: 24px;
  text-align: center;
}

.table-condition-select {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
}

/* ==========================================================================
   Efecto Holográfico 3D (Modal y Visor)
   ========================================================================== */

.holo-card-container {
  perspective: 1000px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}

.holo-card {
  width: 100%;
  aspect-ratio: 2.5 / 3.5;
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  background-color: #0b0e14;
  cursor: grab;
}

.holo-card:active {
  cursor: grabbing;
}

.holo-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.holo-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 0%,
    rgba(255, 0, 128, 0.3) 25%,
    rgba(0, 255, 255, 0.4) 50%,
    rgba(255, 255, 0, 0.3) 75%,
    transparent 100%
  );
  background-size: 200% 200%;
  mix-blend-mode: color-dodge;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.holo-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.6) 0%, transparent 60%);
  mix-blend-mode: overlay;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.holo-card.is-active .holo-sheen,
.holo-card.is-active .holo-glare,
.card-img-wrap.is-active .holo-sheen,
.card-img-wrap.is-active .holo-glare,
.card-img-wrap:hover .holo-sheen,
.card-img-wrap:hover .holo-glare {
  opacity: 1;
}

.holo-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
}

/* ==========================================================================
   Modales (Detalle de Carta y Confirmación)
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 120;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-card-detail {
  max-width: 860px;
  width: 100%;
  padding: 28px;
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: pointer;
}

.modal-close-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.modal-body-detail {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 30px;
  align-items: start;
}

.detail-info-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-header {
  display: flex;
  gap: 8px;
}

.detail-card-name {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.detail-set-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.set-symbol-img {
  width: 18px;
  height: 18px;
  filter: invert(1);
}

.price-showcase-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.price-main-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.price-box-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.price-value-huge {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--gold-primary);
}

.price-box-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.price-variants-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

.price-var-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.var-label { font-size: 11px; color: var(--text-muted); }
.var-val { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--text-primary); }

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  font-size: 13px;
}

.meta-box {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}

.meta-box-label { font-size: 11px; color: var(--text-muted); display: block; }
.meta-box-val { font-weight: 600; color: var(--text-primary); }

.detail-text-box {
  background-color: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--blue-primary);
  padding: 8px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  font-size: 13px;
  color: var(--text-secondary);
}

.add-to-collection-panel {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), var(--bg-surface));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 14px;
}

.add-panel-title {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.add-panel-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-group-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  align-items: flex-end;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  display: block;
}

.qty-control {
  display: flex;
  height: 40px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--bg-input);
}

.btn-qty {
  width: 36px;
  background-color: var(--bg-surface);
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.qty-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
}

.btn-add-submit {
  width: 100%;
  height: 40px;
}

.external-market-links {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.ext-link {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.ext-link:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Modal de confirmación */
.modal-confirm {
  max-width: 380px;
  width: 100%;
  padding: 24px;
  text-align: center;
}

.confirm-icon-wrap { font-size: 32px; margin-bottom: 10px; }
.confirm-title { font-family: var(--font-title); font-size: 1.2rem; color: var(--text-primary); margin-bottom: 6px; }
.confirm-msg { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn-danger {
  background-color: #dc2626;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  height: 38px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
}
.btn-danger:hover { background-color: #b91c1c; }

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 150;
  pointer-events: none;
}

.toast {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 320px;
}

.toast.success { border-left: 4px solid var(--green-success); }
.toast.info { border-left: 4px solid var(--blue-primary); }
.toast.error { border-left: 4px solid #ef4444; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Sección Educativa y Guía de Coleccionista
   ========================================================================== */

.info-guide-section {
  margin-top: 48px;
  padding-top: 36px;
  border-top: 1px solid var(--border-subtle);
}

.guide-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 30px;
}

.guide-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.guide-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}

.guide-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-icon { font-size: 26px; }
.guide-card-title { font-family: var(--font-title); font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.guide-card-text { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.guide-list { font-size: 13px; color: var(--text-secondary); padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.guide-list li strong { color: var(--text-primary); }

/* ==========================================================================
   Adaptaciones Responsivas (Móvil y Tablets)
   ========================================================================== */

@media (max-width: 640px) {
  .tcg-modes-nav {
    flex-direction: column;
    padding: 6px;
    gap: 6px;
    margin: 1rem 0 1.5rem;
  }
  .tcg-mode-btn {
    width: 100%;
    justify-content: space-between;
    padding: 10px 14px;
    font-size: 13px;
    min-height: 44px;
  }

  .game-pills { width: 100%; }
  .game-pill { flex: 1; justify-content: center; font-size: 13px; padding: 8px 10px; }
  .filters-row { grid-template-columns: 1fr; }
  .btn-search { width: 100%; min-height: 42px; }
  .cards-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-item { padding: 10px; }
  .card-actions { grid-template-columns: 1fr; }
  .modal-body-detail { grid-template-columns: 1fr; gap: 20px; }
  .detail-card-column { display: flex; flex-direction: column; align-items: center; }
  .holo-card-container { max-width: 220px; }
  .form-group-row { grid-template-columns: 1fr; }
  .collection-toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-left { flex-direction: column; min-width: 100%; }
  .mini-search, .mini-select { max-width: 100%; }
  .toolbar-actions { display: grid; grid-template-columns: repeat(2, 1fr); width: 100%; }
  .btn-action { justify-content: center; width: 100%; min-height: 40px; }
}

@media (max-width: 480px) {
  .cards-grid { grid-template-columns: 1fr; }
  .metric-value-huge { font-size: 1.4rem; }
  .price-variants-grid { grid-template-columns: 1fr; }
}
