/*
 Theme Name: GamesOn4Kids
 Theme URI: https://gameson4kids.com
 Author: GamesOn4Kids Team
 Author URI: https://gameson4kids.com
 Description: A modern, fast, and kid-friendly browser games theme with built-in game management features.
 Version: 1.0.0
 License: GNU General Public License v2 or later
 License URI: http://www.gnu.org/licenses/gpl-2.0.html
 Text Domain: gameson4kids
 Tags: games, gaming, kids, entertainment, dark-mode, responsive
*/

/* Reset body for sidebar layout */
body {
  margin: 0 !important;
  padding: 0 !important;
  max-width: 100% !important;
  overflow-x: hidden;
}

/* Force single posts to be full-width */
body.single-post,
body.single-post #content,
body.single-post .site-content,
body.single-post .content-area,
body.single-post .site-main {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
}

/* Make sure our Tailwind container still centers properly */
body.single-post .max-w-\[1600px\] {
  margin-left: auto;
  margin-right: auto;
}

/* Admin bar offset for sticky nav */
.admin-bar nav.sticky {
  top: 32px;
}

.admin-bar #categories-sidebar {
  top: 32px;
  height: calc(100vh - 32px);
}

/* Make all game thumbnails square (1:1 aspect ratio) */
.game-thumbnail,
.game-thumbnail img,
img[alt*="Game"]:not(.site-logo),
img[alt*="game"]:not(.site-logo) {
  aspect-ratio: 1 / 1 !important;
  object-fit: cover !important;
}

/* Logo should maintain its natural aspect ratio */
.site-logo {
  aspect-ratio: auto !important;
  object-fit: contain !important;
}

/* Specific overrides for game thumbnails in grids */
.grid img[src*="thumbnail"],
.grid img[alt*="Game"],
.grid img[alt*="game"],
.category-page img,
.archive-page img,
.search-results img {
  aspect-ratio: 1 / 1 !important;
  width: 100% !important;
  height: auto !important;
  object-fit: cover !important;
}

/* Home page game thumbnails */
#hp-scroll img,
.front-page .grid img {
  aspect-ratio: 1 / 1 !important;
  object-fit: cover !important;
}

@media (max-width: 782px) {
  .admin-bar nav.sticky {
    top: 46px;
  }
  .admin-bar #categories-sidebar {
    top: 46px;
    height: calc(100vh - 46px);
  }
}

/* Lists inside the prose block */
.prose.prose-invert ul {
  list-style: disc;
  padding-left: 1.25rem;
}

/* Sidebar transition and states */
#categories-sidebar {
  transition: width 0.3s ease-in-out;
  will-change: width;
}

#categories-sidebar .sidebar-content {
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
}

#categories-sidebar nav a:hover {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.15) 0%, transparent 100%);
}

/* Smooth focus states for inputs */
input:focus,
textarea:focus {
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

/* Game player fullscreen mode */
.fullscreen-mode {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
  background: #000 !important;
  aspect-ratio: unset !important;
}

.fullscreen-mode > div {
  height: 100% !important;
  aspect-ratio: unset !important;
}

.fullscreen-mode #gp-player {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
}

.fullscreen-mode #gp-player iframe {
  width: 100% !important;
  height: 100% !important;
}

/* Loading animation for comments */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Notification animation */
@keyframes slide-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.animate-slide-up {
  animation: slide-up 0.3s ease-out;
}

/* Improve button active states */
button:active {
  transform: scale(0.98);
}

/* Comment avatars gradient backgrounds */
.comment-avatar {
  background: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
}

/* Smooth transitions for vote buttons */
#likeBtn,
#dislikeBtn {
  transition: all 0.2s ease;
}

#likeBtn:active,
#dislikeBtn:active {
  transform: scale(0.95);
}

/* Ensure game container maintains aspect ratio */
.game-player-container {
  min-height: 300px;
}

@media (min-width: 768px) {
  .game-player-container {
    min-height: 400px;
  }
}

@media (min-width: 1024px) {
  .game-player-container {
    min-height: 500px;
  }
}

/* Prose content improvements */
.prose.prose-invert p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.prose.prose-invert a {
  color: #a78bfa;
}

.prose.prose-invert a:hover {
  color: #c4b5fd;
}

/* Smooth scrollbar for horizontal scrollers */
#hp-scroll {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar for cleaner look on mobile */
@media (max-width: 768px) {
  #hp-scroll::-webkit-scrollbar {
    display: none;
  }
  #hp-scroll {
    scrollbar-width: none;
  }
}

/* Custom scrollbar for sidebar */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: #374151;
  border-radius: 9999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: #4b5563;
}

.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: #374151 transparent;
}

/* Collapsed sidebar state */
#categories-sidebar.collapsed {
  width: 60px !important;
}

#categories-sidebar.collapsed .sidebar-content {
  opacity: 0;
  visibility: hidden;
}

#categories-sidebar.collapsed #collapse-sidebar {
  display: none;
}

#categories-sidebar.collapsed nav a {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

/* Mobile: Hide sidebar by default, show as overlay */
@media (max-width: 768px) {
  #categories-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    z-index: 60;
    width: 280px !important;
  }

  #categories-sidebar.mobile-open {
    transform: translateX(0);
  }

  #expand-sidebar {
    display: flex !important;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 55;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
  }

  .sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
  }
}

/* SEO section simple styling */
.seo-section {
  background-color: #1a1f29;
}

/* Game card hover effects */
.group:hover .game-play-overlay {
  opacity: 1;
}

/* Tooltip positioning fix */
#shareBtn,
#expandBtn {
  position: relative;
}

/* Ensure main content doesn't overflow */
main {
  min-width: 0;
}

/* Category link active state */
#categories-sidebar nav a.active {
  background-color: rgba(139, 92, 246, 0.2);
  color: white;
}

#categories-sidebar nav a.active i {
  color: #a78bfa;
}

/* Admin styles for game importer */
.go4k-admin-wrap {
  max-width: 1200px;
}

.go4k-admin-wrap .card {
  background: #fff;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
}

.go4k-admin-wrap .card h3 {
  margin-top: 0;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.go4k-import-log {
  background: #1d2327;
  color: #50c878;
  padding: 15px;
  border-radius: 4px;
  max-height: 400px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 13px;
}

/* Game description show more/less */
.game-description-collapsed {
  transition: max-height 0.3s ease-out;
  overflow: hidden;
}

.game-description-expanded {
  transition: max-height 0.3s ease-in;
  overflow: visible;
}

/* Mobile responsiveness for game page */
@media (max-width: 640px) {
  .game-player-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto;
    padding: 0;
  }
  
  .game-player-container iframe {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block;
  }
  
  /* Ensure content doesn't overflow on mobile */
  .prose {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }
  
  /* Make meta info grid responsive */
  .grid.grid-cols-2.md\:grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
  
  /* Center and constrain content on mobile */
  .max-w-\[1600px\] {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  /* Make breadcrumb wrap properly */
  .flex.items-start.gap-2 {
    flex-wrap: wrap;
  }
  
  /* Ensure h1 doesn't overflow */
  h1.text-3xl {
    font-size: 1.5rem;
    line-height: 1.2;
    word-wrap: break-word;
  }
}