/* Estilos para el Rastreador de ofertas y mínimos históricos de videojuegos (CheapShark) */
:root {
  --primary-color: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-light: rgba(139, 92, 246, 0.15);
  --accent-color: #06b6d4;
  --discount-green: #10b981;
  --discount-bg: rgba(16, 185, 129, 0.15);
  --card-bg: #131826;
  --card-border: #232d42;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --input-bg: #090d16;
  --input-border: #334155;
  --input-focus: #8b5cf6;
  --radius-lg: 14px;
  --radius-md: 8px;
  --radius-sm: 4px;
  --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  --primary-color: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-light: rgba(124, 58, 237, 0.08);
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --input-bg: #f8fafc;
  --input-border: #cbd5e1;
  --input-focus: #7c3aed;
  --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-body, #090d16);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

.main-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.tool-header-block {
  text-align: center;
  margin-bottom: 28px;
}

.badge-gaming {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 12px;
}

[data-theme="light"] .badge-gaming {
  background: #f5f3ff;
  color: #7c3aed;
  border-color: #ddd6fe;
}

.tool-title {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 8px;
}

.tool-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 760px;
  margin: 0 auto;
}

/* Barra de filtros */
.filters-bar {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-main);
}

.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .search-row {
    flex-direction: column;
  }
}

.search-input-wrapper {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
}

.search-input-wrapper:focus-within {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.search-input-wrapper svg {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrapper input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  height: 44px;
  padding: 0 14px 0 42px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
}

.btn-search {
  height: 44px;
  padding: 0 22px;
  background: var(--primary-color);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.btn-search:hover {
  background: var(--primary-hover);
}

/* Grid de controles secundarios */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 900px) {
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 500px) {
  .filters-grid {
    grid-template-columns: 1fr;
  }
}

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

.filter-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
}

.select-custom {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.select-custom:focus {
  border-color: var(--input-focus);
}

/* Grid de ofertas de juegos */
.deals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.game-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-main);
  transition: transform 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.game-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-color);
}

.game-thumb-box {
  width: 100%;
  height: 140px;
  background: #020617;
  position: relative;
  overflow: hidden;
}

.game-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.game-card:hover .game-thumb-img {
  transform: scale(1.05);
}

.store-badge-icon {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.badge-historic-low {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.game-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.game-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.6em;
}

.game-ratings-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.8rem;
}

.metacritic-pill {
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.meta-high { background: #16a34a; color: #ffffff; }
.meta-med { background: #ca8a04; color: #ffffff; }
.meta-low { background: #dc2626; color: #ffffff; }

.steam-rating-pill {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.price-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--card-border);
}

.discount-tag {
  background: var(--discount-bg);
  color: var(--discount-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.price-numbers {
  text-align: right;
}

.old-price {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.sale-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.btn-compare-deal {
  width: 100%;
  margin-top: 12px;
  height: 38px;
  background: var(--primary-light);
  color: var(--primary-color);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

[data-theme="dark"] .btn-compare-deal {
  color: #c084fc;
}

.btn-compare-deal:hover {
  background: var(--primary-color);
  color: #ffffff;
}

/* Modal comparador de tiendas */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

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

.modal-container {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  padding: 24px;
  box-shadow: var(--shadow-main);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.store-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 0.9rem;
}

.store-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--card-border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.store-table td {
  padding: 12px;
  border-bottom: 1px solid var(--card-border);
  vertical-align: middle;
}

.btn-store-go {
  padding: 6px 12px;
  background: var(--primary-color);
  color: #ffffff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-store-go:hover {
  background: var(--primary-hover);
}

.loading-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(139, 92, 246, 0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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