/* =========================================
   1. CONFIGURAÇÕES GERAIS (RESET)
   ========================================= */
:root {
  --bg-color: #0a0a0a; /* Fundo Preto */
  --card-bg: #1c1c1e; /* Fundo Cinza App */
  --text-color: #ffffff;
  --accent-color: #007aff; /* Azul iOS */
  --highlight: #ff9500; /* Laranja para destaques */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  font-family: "Inter", sans-serif;
  color: var(--text-color);
  min-height: 100vh;
  overflow-x: hidden; /* Evita rolagem lateral */
}

/* =========================================
   2. CABEÇALHO
   ========================================= */
header {
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: blur(20px);
  padding: 15px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-box {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 600px;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: white;
  width: 100%;
  font-size: 16px;
}

.search-icon,
.clear-icon {
  color: #888;
}
.clear-icon {
  cursor: pointer;
}
.clear-icon:hover {
  color: #fff;
}

/* =========================================
   3. SEÇÃO DE RECOMENDAÇÕES (NOVA)
   ========================================= */
.recommendations-section {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03) 0%,
    rgba(0, 0, 0, 0) 100%
  );
  padding: 20px 0;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.section-title {
  max-width: 1000px;
  margin: 0 auto 15px auto;
  padding: 0 20px;
  font-size: 16px;
  color: #ccc;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rec-grid {
  display: flex;
  gap: 15px;
  overflow-x: auto;
  padding: 10px 20px;
  max-width: 1000px;
  margin: 0 auto;
  scrollbar-width: none; /* Firefox */
}
.rec-grid::-webkit-scrollbar {
  display: none;
} /* Chrome */

/* Destaque visual nos recomendados */
.rec-grid .icon-shape {
  border: 2px solid var(--highlight);
  box-shadow: 0 0 15px rgba(255, 149, 0, 0.15);
}

/* =========================================
   4. GRADE DE JOGOS (PRINCIPAL)
   ========================================= */
.app-grid {
  padding: 20px;
  display: grid;
  /* CELULAR: 3 colunas fixas e alinhadas */
  grid-template-columns: repeat(3, 1fr);
  gap: 25px 10px;
  max-width: 1000px;
  margin: 0 auto;
  justify-items: center; /* Centraliza os itens na grade */
}

/* Título secundário */
.main-title {
  margin-top: 20px;
  font-size: 14px;
  opacity: 0.6;
}

/* =========================================
   5. ÍCONES DOS JOGOS (O FIX IMPORTANTE)
   ========================================= */
.app-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
  width: 80px; /* Largura fixa para alinhar texto */
  animation: popIn 0.5s ease;
}

.icon-shape {
  width: 70px; /* Tamanho FIXO no celular */
  height: 70px; /* Altura FIXA */
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden; /* ISSO CORTA A IMAGEM GIGANTE */
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  margin-bottom: 8px;
  position: relative;
}

/* Força a imagem a caber no quadrado */
.icon-shape img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Cobre o quadrado sem esticar */
  display: block;
}

.app-name {
  font-size: 12px;
  font-weight: 500;
  color: #e0e0e0;
  text-align: center;

  /* Corta texto muito longo */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Efeitos de Hover/Clique */
.app-icon:active .icon-shape {
  transform: scale(0.95);
  filter: brightness(0.7);
}

/* =========================================
   6. RESPONSIVIDADE (PC / TABLET)
   ========================================= */
@media (min-width: 768px) {
  .app-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 40px 20px;
  }

  .rec-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5 recomendados no PC */
    overflow-x: visible;
    justify-items: center;
  }

  .icon-shape {
    width: 90px; /* Maior no PC */
    height: 90px;
  }

  .app-icon {
    width: 100px;
  }

  .app-icon:hover .icon-shape {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
  }
}

/* =========================================
   7. MODAL (JANELA DO JOGO)
   ========================================= */
.game-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: black;
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  width: 100%;
  height: 90%;
  max-width: 1200px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid #333;
}

.modal-header {
  height: 40px;
  background: #1c1c1e;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px;
  border-bottom: 1px solid #333;
}

#modalGameTitle {
  font-weight: bold;
  font-size: 14px;
  color: white;
}

.close-btn {
  background: #ff3b30;
  color: white;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}
.close-btn:hover {
  background: #ff453a;
}

iframe {
  width: 100%;
  flex: 1;
  border: none;
  background: #000;
}

/* Ajuste Modal Mobile */
@media (max-width: 600px) {
  .game-modal {
    padding: 0;
  }
  .modal-content {
    height: 100%;
    border-radius: 0;
  }
}

/* Mensagens e Animações */
.no-results {
  text-align: center;
  margin-top: 50px;
  color: #555;
  grid-column: 1 / -1;
}
@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
