/**
 * PlayNest - Custom Styles
 * Additional styles beyond the Tailwind-like framework
 */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
}

/* Game card hover effects */
.game-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

/* Header blur effect fallback */
@supports not (backdrop-filter: blur(8px)) {
  header {
    background-color: rgba(255, 255, 255, 0.95);
  }
}

/* Mobile menu animation */
#mobile-nav {
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
}

#mobile-nav:not(.hidden) {
  max-height: 500px;
  opacity: 1;
}

/* Mobile search animation */
#mobile-search {
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
}

#mobile-search:not(.hidden) {
  max-height: 100px;
  opacity: 1;
}

/* Button press effect */
button:active,
.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.98);
}

/* Link underline animation */
a {
  position: relative;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--brand-400);
  transition: width 0.2s ease, left 0.2s ease;
}

nav a:hover::after {
  width: 100%;
  left: 0;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

/* Notification styles */
.notification {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  color: white;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.notification.success {
  background: linear-gradient(135deg, #10b981, #34d399);
}

.notification.error {
  background: linear-gradient(135deg, #ef4444, #f87171);
}

/* Prose content styling */
.prose h2 {
  scroll-margin-top: 100px;
}

.prose h3 {
  scroll-margin-top: 100px;
}

/* Responsive image container */
.aspect-video img,
.aspect-square img {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

/* Category badge colors */
.badge-action {
  background-color: #dbeafe;
  color: #1d4ed8;
}

.badge-puzzle {
  background-color: #fce7f3;
  color: #be185d;
}

.badge-racing {
  background-color: #fef3c7;
  color: #b45309;
}

.badge-sports {
  background-color: #d1fae5;
  color: #047857;
}

.badge-strategy {
  background-color: #e0e7ff;
  color: #4338ca;
}

.badge-casual {
  background-color: #f3e8ff;
  color: #7c3aed;
}

/* Print styles */
@media print {
  header,
  footer,
  #mobile-nav,
  #mobile-search {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .game-card {
    break-inside: avoid;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* Dark mode support (optional, for future) */
@media (prefers-color-scheme: dark) {
  /* Dark mode styles can be added here if needed */
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .game-card {
    border: 2px solid currentColor;
  }

  button,
  a {
    text-decoration: underline;
  }
}

/* Touch device optimizations */
@media (hover: none) {
  .game-card:hover {
    transform: none;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  }

  nav a::after {
    display: none;
  }
}

/* Safe area insets for mobile devices */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }

  footer {
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }
}
