/* Standalone Search styles (safe & scoped) */
.search-section-standalone {
  padding: 16px 12px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
  border-radius: 0;
  margin: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  animation: mobileSlideIn 0.5s ease-out;
}

.standalone-search-wrapper {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
  position: relative;
}

#standalone-search-input {
  flex: 1;
  padding: 16px 14px;
  border-radius: 12px;
  border: 2px solid #e1e8f0;
  font-size: 16px; /* Larger font for mobile */
  background: white;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  -webkit-appearance: none; /* Remove iOS shadow */
  min-height: 54px; /* Better touch target */
}

/* Remove focus glow on iOS */
#standalone-search-input:focus {
  border-color: #4a90e2;
  box-shadow: 0 4px 16px rgba(74, 144, 226, 0.2);
  transform: translateY(-1px);
  outline: none;
}

/* Mobile-optimized placeholder */
#standalone-search-input::placeholder {
  color: #94a3b8;
  font-size: 15px;
}

#standalone-search-clear {
  padding: 14px 16px;
  border-radius: 10px;
  border: 2px solid #e1e8f0;
  background: white;
  cursor: pointer;
  transition: all 0.25s ease;
  font-weight: bold;
  color: #718096;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 54px; /* Better touch target */
  min-height: 54px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  font-size: 18px; /* Larger X icon */
}

#standalone-search-clear:hover {
  background: #4a90e2;
  color: white;
  border-color: #4a90e2;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

/* Active state for mobile touch */
#standalone-search-clear:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}

.search-hint {
  text-align: center;
  font-size: 13px;
  color: #64748b;
  margin-top: 12px;
  opacity: 0;
  animation: mobileFadeIn 0.6s ease 0.3s forwards;
  line-height: 1.4;
  padding: 0 8px;
}

/* Game card animation for mobile */
.game-card {
  transition: all 0.3s ease;
}

.game-card:hover {
  transform: translateY(-2px);
}

/* Mobile-optimized animation keyframes */
@keyframes mobileSlideIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes mobileFadeIn {
  0% {
    opacity: 0;
    transform: translateY(3px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile-optimized pulse animation */
@keyframes mobilePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.3);
  }
  70% {
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(74, 144, 226, 0);
  }
}

/* No results animation for mobile */
#no-results:not(.hidden) {
  animation: mobileBounceIn 0.5s ease;
}

@keyframes mobileBounceIn {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.hidden { 
  display: none !important; 
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
  .search-section-standalone {
    padding: 12px 10px;
    margin: 0;
    border-radius: 0;
    position: relative;
    z-index: 100;
  }
  
  .standalone-search-wrapper {
    flex-direction: row; /* Keep horizontal on mobile */
    gap: 8px;
    align-items: stretch;
  }
  
  #standalone-search-input {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 14px 16px;
    border-radius: 10px;
    min-height: 52px;
  }
  
  #standalone-search-clear {
    min-width: 52px;
    min-height: 52px;
    padding: 14px;
    font-size: 16px;
    border-radius: 8px;
  }
  
  .search-hint {
    font-size: 12px;
    margin-top: 10px;
    padding: 0 4px;
  }
  
  /* Reduce animation intensity on mobile for performance */
  .game-card {
    transition: transform 0.2s ease;
  }
}

/* Very small screens */
@media (max-width: 360px) {
  .search-section-standalone {
    padding: 10px 8px;
  }
  
  .standalone-search-wrapper {
    gap: 6px;
  }
  
  #standalone-search-input {
    padding: 12px 14px;
    font-size: 15px;
    min-height: 48px;
  }
  
  #standalone-search-clear {
    min-width: 48px;
    min-height: 48px;
    padding: 12px;
    font-size: 15px;
  }
  
  .search-hint {
    font-size: 11px;
  }
}

/* Desktop styles - only apply on larger screens */
@media (min-width: 769px) {
  .search-section-standalone {
    padding: 20px 0;
    border-radius: 16px;
    margin: 15px auto;
    max-width: 920px;
    animation: slideInUp 0.6s ease-out;
  }
  
  .standalone-search-wrapper {
    max-width: 900px;
    margin: 8px auto;
  }
  
  #standalone-search-input {
    padding: 14px 18px;
    font-size: 15px;
    min-height: auto;
    border-radius: 12px;
  }
  
  #standalone-search-input:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.25);
  }
  
  #standalone-search-clear {
    padding: 10px 14px;
    min-width: 44px;
    min-height: 44px;
    font-size: 16px;
  }
  
  #standalone-search-clear:hover {
    transform: scale(1.05) rotate(90deg);
  }
  
  .search-hint {
    font-size: 12px;
    animation: fadeIn 0.8s ease 0.4s forwards;
  }
  
  /* Desktop-only animations */
  @keyframes slideInUp {
    0% {
      opacity: 0;
      transform: translateY(20px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  @keyframes fadeIn {
    0% {
      opacity: 0;
      transform: translateY(5px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* Safe area support for notch phones */
@supports (padding: max(0px)) {
  .search-section-standalone {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}