/* ==========================================================================
   Fijate Tools - Buscador de Trucos y Comandos de Videojuegos
   Estilo Canónico Corporativo (Inter, Outfit, JetBrains Mono)
   ========================================================================== */

:root {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Tema claro (base) */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-chip: #e2e8f0;
  --bg-chip-active: #0284c7;
  --text-chip-active: #ffffff;
  --border-card: #e2e8f0;
  --border-focus: #0284c7;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --accent-color: #0284c7;
  --accent-hover: #0369a1;
  --accent-light: #e0f2fe;
  --badge-warning-bg: #fef3c7;
  --badge-warning-text: #92400e;
  --badge-warning-border: #fcd34d;
  --code-bg: #0f172a;
  --code-text: #38bdf8;
  --btn-copy-bg: #e2e8f0;
  --btn-copy-hover: #cbd5e1;
  --btn-copy-text: #0f172a;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --radius-card: 16px;
  --radius-pill: 9999px;
  --radius-btn: 10px;
}

[data-theme="dark"] {
  --bg-page: #0b0f17;
  --bg-card: #111827;
  --bg-card-subtle: #1e293b;
  --bg-chip: #1e293b;
  --bg-chip-active: #38bdf8;
  --text-chip-active: #0b0f17;
  --border-card: #1f293d;
  --border-focus: #38bdf8;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --accent-color: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-light: rgba(56, 189, 248, 0.12);
  --badge-warning-bg: rgba(245, 158, 11, 0.15);
  --badge-warning-text: #fde68a;
  --badge-warning-border: rgba(245, 158, 11, 0.3);
  --code-bg: #030712;
  --code-text: #38bdf8;
  --btn-copy-bg: #1e293b;
  --btn-copy-hover: #334155;
  --btn-copy-text: #f8fafc;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Contención canónica del Layout
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.cheats-hero-title,
.faq-section-title {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
}

code, pre, .mono-code {
  font-family: var(--font-mono);
}

.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Sidebar AdSense canónica */
.tool-ad-sidebar {
  display: none;
}

@media (min-width: 1536px) {
  .tool-ad-sidebar {
    display: block;
    width: 300px;
    flex-shrink: 0;
  }
}

.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Cabecera interactiva / Hero de búsqueda
   ========================================================================== */

.cheats-header-area {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.cheats-badge-hero {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-light);
  color: var(--accent-color);
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  width: fit-content;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-color);
  box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(56, 189, 248, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

.cheats-hero-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  line-height: 1.25;
}

.cheats-hero-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* Barra de búsqueda */
.search-bar-wrapper {
  position: relative;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-subtle);
  pointer-events: none;
}

.cheat-search-input {
  width: 100%;
  height: 50px;
  padding: 0 2.85rem 0 3rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  font-size: 1rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.cheat-search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: var(--bg-card);
}

.btn-clear-search {
  position: absolute;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.btn-clear-search:hover {
  color: var(--text-main);
}

/* ==========================================================================
   Selector de Juegos en Chips
   ========================================================================== */

.games-selector-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.selector-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.selector-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: none;
  color: var(--text-main);
}

.games-count-badge {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-subtle);
  background: var(--bg-card-subtle);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
}

.games-chips-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.games-chips-scroll::-webkit-scrollbar {
  height: 6px;
}

.games-chips-scroll::-webkit-scrollbar-thumb {
  background: var(--border-card);
  border-radius: 3px;
}

.game-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  user-select: none;
  min-height: 40px;
}

.game-chip-btn:hover {
  background: var(--border-card);
  border-color: var(--text-subtle);
}

.game-chip-btn.active {
  background: var(--bg-chip-active);
  color: var(--text-chip-active);
  border-color: var(--bg-chip-active);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

.game-chip-btn svg {
  flex-shrink: 0;
}

/* ==========================================================================
   Filtros secundarios: Plataforma y Categoría
   ========================================================================== */

.filters-bar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.platform-tabs {
  display: flex;
  gap: 0.35rem;
  background: var(--bg-card);
  padding: 0.25rem;
  border-radius: 10px;
  border: 1px solid var(--border-card);
}

.btn-filter-tab {
  background: transparent;
  border: none;
  padding: 0.4rem 0.85rem;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 34px;
}

.btn-filter-tab:hover {
  color: var(--text-main);
}

.btn-filter-tab.active {
  background: var(--accent-color);
  color: #ffffff;
}

[data-theme="dark"] .btn-filter-tab.active {
  color: #0b0f17;
}

.category-filter-group {
  flex: 1 1 240px;
  max-width: 320px;
}

.filter-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  height: 40px;
  padding: 0 40px 0 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border-card);
  background-color: var(--bg-card);
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 500;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

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

.filter-select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

/* ==========================================================================
   Ficha de información del juego activo (Ayuda y Logros)
   ========================================================================== */

.game-info-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-left: 4px solid var(--accent-color);
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .game-info-card {
    grid-template-columns: 1.4fr 1fr;
    align-items: center;
  }
}

.game-info-left {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.game-badge-genre {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-color);
  letter-spacing: 0.04em;
}

.game-info-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.game-info-help {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

.game-info-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem;
  background: var(--badge-warning-bg);
  border: 1px solid var(--badge-warning-border);
  border-radius: 10px;
  color: var(--badge-warning-text);
  font-size: 0.825rem;
  line-height: 1.4;
}

.warning-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

/* ==========================================================================
   Barra de resultados y Rejilla de Trucos
   ========================================================================== */

.results-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.results-count-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-reset-filters {
  background: transparent;
  border: none;
  color: var(--accent-color);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.cheats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .cheats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tarjeta individual de truco */
.cheat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.cheat-card:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.cheat-card-top {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cheat-badges-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cheat-category-badge {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent-color);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
}

.cheat-game-badge {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-card-subtle);
  color: var(--text-subtle);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
}

.cheat-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
  line-height: 1.3;
}

.cheat-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

/* Área de inputs / secuencias de la tarjeta */
.cheat-inputs-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 0.85rem;
}

.input-platform-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-platform-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Código de comando PC con botón de copia */
.code-action-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--code-bg);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  overflow: hidden;
}

.code-snippet {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--code-text);
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.code-snippet::-webkit-scrollbar {
  display: none;
}

.btn-copy-code {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--btn-copy-bg);
  border: none;
  border-radius: 6px;
  color: var(--btn-copy-text);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  min-height: 32px;
}

.btn-copy-code:hover {
  background: var(--btn-copy-hover);
}

.btn-copy-code svg {
  flex-shrink: 0;
}

/* Secuencia de botones de mando */
.gamepad-sequence-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Botones virtuales de consola */
.gp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 0.35rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  font-family: var(--font-heading);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  user-select: none;
}

/* PlayStation */
.gp-ps-x { background: #1e3a8a; color: #60a5fa; border: 1px solid #3b82f6; border-radius: 50%; width: 28px; }
.gp-ps-circle { background: #881337; color: #f43f5e; border: 1px solid #e11d48; border-radius: 50%; width: 28px; }
.gp-ps-square { background: #581c87; color: #c084fc; border: 1px solid #a855f7; border-radius: 6px; width: 28px; }
.gp-ps-triangle { background: #064e3b; color: #34d399; border: 1px solid #10b981; border-radius: 50%; width: 28px; }
.gp-ps-shoulder { background: #334155; color: #f8fafc; border: 1px solid #475569; border-radius: 6px; padding: 0 0.5rem; }

/* Xbox */
.gp-xb-a { background: #064e3b; color: #34d399; border: 1px solid #10b981; border-radius: 50%; width: 28px; }
.gp-xb-b { background: #881337; color: #f43f5e; border: 1px solid #e11d48; border-radius: 50%; width: 28px; }
.gp-xb-x { background: #1e3a8a; color: #60a5fa; border: 1px solid #3b82f6; border-radius: 50%; width: 28px; }
.gp-xb-y { background: #78350f; color: #fbbf24; border: 1px solid #f59e0b; border-radius: 50%; width: 28px; }
.gp-xb-shoulder { background: #334155; color: #f8fafc; border: 1px solid #475569; border-radius: 6px; padding: 0 0.5rem; }

/* D-Pad Direccional */
.gp-dpad {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #475569;
  border-radius: 5px;
  width: 28px;
  font-size: 0.85rem;
}

[data-theme="light"] .gp-dpad {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

/* Estado vacío */
.empty-state-card {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--bg-card-subtle);
  border: 1px dashed var(--border-card);
  border-radius: 14px;
}

.empty-state-icon {
  color: var(--text-subtle);
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text-main);
}

.empty-state-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 1.5rem;
  line-height: 1.5;
}

.btn-empty-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  background: var(--accent-color);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s;
}

[data-theme="dark"] .btn-empty-reset {
  color: #0b0f17;
}

.btn-empty-reset:hover {
  background: var(--accent-hover);
}

/* ==========================================================================
   Acordeón SEO y Guía técnica
   ========================================================================== */

.tool-seo-guide-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.faq-section-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.faq-item[open] {
  border-color: var(--accent-color);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-arrow {
  color: var(--text-subtle);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.faq-item[open] .faq-arrow {
  transform: rotate(180deg);
  color: var(--accent-color);
}

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.faq-answer p {
  margin: 0 0 0.75rem;
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

.faq-answer code {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.825rem;
}

/* ==========================================================================
   Toast flotante accesible (sin window.alert)
   ========================================================================== */

.toast-notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #38bdf8;
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 9999;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  pointer-events: none;
}

.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-notification svg {
  color: #38bdf8;
  flex-shrink: 0;
}

[data-theme="light"] .toast-notification {
  background: #0f172a;
  color: #ffffff;
}

/* ==========================================================================
   Adaptabilidad móvil estricta (Regla 10)
   ========================================================================== */

@media (max-width: 640px) {
  .card-main {
    padding: 1.25rem 1rem;
  }

  .cheats-hero-title {
    font-size: 1.4rem;
  }

  .filters-bar-row {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .platform-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.25rem;
    width: 100%;
  }

  .btn-filter-tab {
    text-align: center;
    padding: 0.5rem 0.25rem;
    width: 100%;
  }

  .category-filter-group {
    max-width: 100%;
    width: 100%;
  }

  .filter-select {
    width: 100%;
  }

  .toast-notification {
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    justify-content: center;
  }
}
