/* 全局样式 */
:root {
  --primary-color: #6366f1;
  --secondary-color: #10b981;
  --dark-color: #111827;
  --light-color: #f9fafb;
  --gradient-primary: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.8) 0%,
    rgba(16, 185, 129, 0.8) 100%
  );
  --gradient-dark: linear-gradient(
    135deg,
    rgba(17, 24, 39, 0.95) 0%,
    rgba(31, 41, 55, 0.95) 100%
  );
}

/* 通用动画 */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes softGlow {
  0%,
  100% {
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
  }
  50% {
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.3);
  }
}

/* 通用组件样式 */
.gradient-bg {
  background: var(--gradient-primary);
  background-size: 200% 200%;
  animation: gradientShift 10s ease infinite;
}

.dark-gradient-bg {
  background: var(--gradient-dark);
  background-size: 200% 200%;
}

/* 游戏卡片样式 */
.game-card {
  position: relative;
  background: rgba(31, 41, 55, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(99, 102, 241, 0.1);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s ease;
  display: block;
  text-decoration: none;
}

.game-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(99, 102, 241, 0) 0%,
    rgba(99, 102, 241, 0.3) 50%,
    rgba(99, 102, 241, 0) 100%
  );
}

.game-card:hover {
  transform: translateY(-8px);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2), 0 0 20px rgba(99, 102, 241, 0.2);
}

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

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

.game-card-content {
  padding: 1.25rem;
  background: linear-gradient(
    to bottom,
    rgba(31, 41, 55, 0.8) 0%,
    rgba(17, 24, 39, 0.95) 100%
  );
}

.game-title {
  color: #f9fafb;
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-rating {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  color: #f59e0b;
  font-size: 0.875rem;
}

.game-rating i {
  margin-right: 2px;
}

.game-rating span {
  color: #9ca3af;
  margin-left: 0.5rem;
  font-size: 0.875rem;
}

.play-button {
  width: 100%;
  padding: 0.75rem;
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-button:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}

.play-button i {
  margin-right: 0.5rem;
}

/* 搜索框样式 */
.search-container {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.search-input:focus {
  outline: none;
  background: rgba(31, 41, 55, 0.8);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-input::placeholder {
  color: #9ca3af;
}

/* 页面容器 */
.container-game {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (max-width: 768px) {
  .container-game {
    padding: 0 1rem;
  }

  .game-card img {
    height: 160px;
  }
}

/* 搜索功能样式 */
.search-container {
  position: relative;
  max-width: 400px;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.search-input:focus {
  outline: none;
  background: rgba(31, 41, 55, 0.8);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-input::placeholder {
  color: #9ca3af;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 1.125rem;
  pointer-events: none;
  transition: color 0.3s ease;
}

.search-input:focus + .search-icon {
  color: #6366f1;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(31, 41, 55, 0.95);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  margin-top: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.search-results.show {
  opacity: 1;
  transform: translateY(0);
}

.search-result-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(99, 102, 241, 0.1);
}

.search-result-item.selected {
  background: rgba(99, 102, 241, 0.2);
}

.search-result-item img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  margin-right: 1rem;
  object-fit: cover;
}

.search-result-content {
  flex: 1;
}

.search-result-title {
  color: #f9fafb;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.search-result-rating {
  color: #9ca3af;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
}

.search-result-rating i {
  color: #f59e0b;
  margin-right: 0.25rem;
}

.no-results {
  padding: 1.5rem;
  text-align: center;
  color: #9ca3af;
  font-size: 0.875rem;
}

.search-loading {
  padding: 1rem;
  text-align: center;
  color: #9ca3af;
  font-size: 0.875rem;
}

.search-loading i {
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
}

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

/* 搜索历史样式 */
.search-history {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
  color: #9ca3af;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.search-history-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #d1d5db;
  font-size: 0.875rem;
}

.search-history-item:hover {
  background: rgba(99, 102, 241, 0.1);
  color: #f9fafb;
}

.search-history-item i {
  margin-right: 0.5rem;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* 响应式搜索 */
@media (max-width: 768px) {
  .search-container {
    max-width: 100%;
  }

  .search-results {
    max-height: 300px;
  }

  .search-result-item {
    padding: 0.75rem;
  }

  .search-result-item img {
    width: 32px;
    height: 32px;
    margin-right: 0.75rem;
  }
}
