/* =============================================
   LAYOUT — Gamefinder 2.0
   ============================================= */

/* ----------- HEADER ----------- */
#app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 32px;
  background: rgba(5, 18, 14, 0.85);
  border-bottom: var(--border-accent);
  backdrop-filter: blur(16px);
  box-shadow: 0 2px 24px rgba(0,0,0,0.5);
}

.header-logo {
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  background: var(--grad-metal);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 6px rgba(46, 230, 166, 0.45));
  margin-right: auto;
  cursor: pointer;
}

/* Boutons du header : icône seule, carrés */
#app-header .btn-neon {
  width: 40px;
  height: 40px;
  padding: 0;
  min-width: 0;
  flex-shrink: 0;
  justify-content: center;
}

.header-btn-icon {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}
.header-icon-btn:hover .header-btn-icon { transform: translateY(-1px); }
.header-icon-btn.active {
  background: rgba(46, 230, 166, 0.12);
  box-shadow: inset 0 0 12px rgba(46, 230, 166, 0.16);
}
.header-icon-btn.silver.active {
  background: rgba(200, 212, 208, 0.1);
  box-shadow: inset 0 0 12px rgba(200, 212, 208, 0.18);
}
.header-icon-btn.jade.active {
  background: rgba(23, 181, 124, 0.14);
  box-shadow: inset 0 0 12px rgba(23, 181, 124, 0.2);
}

/* Dropdown Données dans le header */
.header-dropdown {
  position: relative;
  flex-shrink: 0;
}
/* Pont invisible entre le bouton et le menu : évite que le survol du
   « gap » ne referme le menu avant d'atteindre un élément. */
.header-dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 10px;
}
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: rgba(5, 18, 14, 0.97);
  border: var(--border-accent);
  border-radius: var(--radius-md);
  backdrop-filter: blur(16px);
  z-index: var(--z-dropdown);
  overflow: hidden;
  animation: fadeInDown var(--transition-fast) ease;
}
.header-dropdown:hover .dropdown-menu,
.header-dropdown.open .dropdown-menu {
  display: block;
}
.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 18px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  text-align: left;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(46,230,166,0.06);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover {
  background: rgba(46, 230, 166, 0.08);
  color: var(--accent);
}

/* ----------- MAIN CONTENT ----------- */
#app-main {
  flex: 1;
  padding: 40px 32px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ----------- HOME / HERO ----------- */
#home-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  gap: 48px;
  text-align: center;
  animation: fadeInUp 0.8s ease both;
}

.hero-title {
  font-family: var(--font-main);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  line-height: 1.15;
  background: linear-gradient(100deg, var(--accent) 0%, var(--mint) 35%, var(--pearl) 60%, var(--silver) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(46, 230, 166, 0.35));
}
.hero-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
  margin-top: 8px;
}

.cta-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
}

/* ----------- FOOTER ----------- */
#app-footer {
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  border-top: var(--border-accent);
  background: rgba(5, 18, 14, 0.7);
  backdrop-filter: blur(12px);
}
#app-footer a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  transition: color var(--transition-fast), text-shadow var(--transition-fast);
}
#app-footer a:hover {
  color: var(--accent);
  text-shadow: var(--glow-accent);
}
.footer-sep {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ----------- PAGE GÉNÉRIQUE (detail, list) ----------- */
#page-view {
  animation: fadeInUp 0.5s ease both;
}

.page-title {
  font-family: var(--font-main);
  font-size: 1.6rem;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
  background: linear-gradient(95deg, var(--accent), var(--mint) 45%, var(--silver));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 10px rgba(46, 230, 166, 0.3));
}
.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

/* ----------- BARRE RECHERCHE LISTE ----------- */
.list-search-bar {
  position: relative;
  margin-bottom: 24px;
}
.list-search-bar .search-input {
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
}

/* ----------- GRID LISTE ----------- */
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.list-item-card {
  background: var(--bg-card);
  border: var(--border-accent);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: box-shadow var(--transition-med), transform var(--transition-med), border-color var(--transition-med);
  backdrop-filter: blur(8px);
}
.list-item-card:hover {
  box-shadow: 0 0 18px rgba(46,230,166,0.2);
  border-color: var(--accent);
  transform: translateY(-3px);
}
.list-item-id {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.list-item-name {
  font-family: var(--font-main);
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.3;
}
.list-item-cover {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  opacity: 0.85;
  border: var(--border-accent);
}

/* Logo carré pour plateformes et développeurs dans les listes */
.list-item-logo-box {
  width: 100%;
  aspect-ratio: 1/1;
  background: var(--bg-elevated, rgba(200,212,208,0.04));
  border: var(--border-accent);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px;
  box-sizing: border-box;
}
.list-item-logo {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.9;
}

/* ----------- GAME DETAIL ----------- */
.game-detail-hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
@media (max-width: 640px) {
  .game-detail-hero { grid-template-columns: 1fr; }
}
.game-cover-img {
  width: 100%;
  border-radius: var(--radius-md);
  border: var(--border-accent);
  box-shadow: 0 0 24px rgba(46,230,166,0.15);
}

/* Logo carré (détail développeur / plateforme) */
.entity-logo-wrapper {
  width: 220px;
  aspect-ratio: 1/1;
  background: var(--bg-card);
  border: var(--border-accent);
  border-radius: var(--radius-md);
  box-shadow: 0 0 24px rgba(46,230,166,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  overflow: hidden;
  align-self: start;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .entity-logo-wrapper { width: 100%; aspect-ratio: 2/1; }
}
.entity-logo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.entity-logo-placeholder {
  font-size: 4rem;
  color: var(--text-muted);
}

.game-info-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.game-detail-title {
  font-family: var(--font-main);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  background: linear-gradient(95deg, var(--pearl), var(--accent) 55%, var(--silver));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 12px rgba(46, 230, 166, 0.3));
}
.game-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.game-meta-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 120px;
}
.game-meta-value {
  font-size: 0.9rem;
  color: var(--text-primary);
}
.game-section {
  margin-top: 28px;
}
.game-section-title {
  font-family: var(--font-main);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--silver);
  margin-bottom: 12px;
}
.game-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.screenshots-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.screenshots-row img {
  height: 140px;
  border-radius: var(--radius-sm);
  border: var(--border-accent);
  opacity: 0.85;
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
  cursor: zoom-in;
}
.screenshots-row img:hover { opacity: 1; }

/* ----------- HEADER MOBILE ----------- */
@media (max-width: 600px) {
  #app-header { padding: 10px 12px; gap: 8px; }
}

/* Très petits écrans : garder les cinq icônes sur une ligne */
@media (max-width: 480px) {
  #app-header { padding: 8px 10px; gap: 6px; }
  #app-header .btn-neon { width: 34px; height: 34px; }
  .header-btn-icon { width: 18px; height: 18px; }
  .header-logo { font-size: 0.8rem; letter-spacing: 0.12em; }
}

/* ----------- LIGHTBOX MOBILE ----------- */
@media (max-width: 600px) {
  .lightbox-inner {
    gap: 6px;
    max-width: 100vw;
    padding: 0 4px;
  }
  .lightbox-img {
    max-width: calc(100vw - 90px);
    max-height: 60vh;
  }
  .lightbox-nav {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    flex-shrink: 0;
  }
}

/* ----------- ANIMATIONS ----------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Observer scroll — éléments avec .reveal */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Respecte la préférence système « réduire les animations » */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
