/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
  --primary-color: #0f5132; /* Darker green */
  --primary-dark: #073f24; /* Even darker green */
  --primary-light: #157347; /* Slightly lighter dark green */
  --secondary-color: #052e16; /* Dark forest green */
  --text-color: #333;
  --text-light: #666;
  --background-color: #f8f9fa; /* Slightly lighter background */
  --card-color: #fff;
  --shadow-color: rgba(0, 0, 0, 0.08); /* Softer shadow */
  --border-color: #e9ecef; /* Softer border */
  --border-radius-sm: 8px; /* New border radius values */
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --transition: all 0.25s ease; /* Smoother transitions */
   --primary-green: #00cc33;
            --white: #ffffff;
            --dark-bg: #1a1a1a;
}

.dark-mode {
  --primary-color: #0f5132; /* Adjusted for dark mode */
  --primary-dark: #1a1c21;
  --primary-light: #20803c;
  --secondary-color: #052e16;
  --text-color: #e9ecef;
  --text-light: #adb5bd;
  --background-color: #0f172a;
  --card-color: #25272e;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --border-color: #2c2c2c;
  --back-button-color: white;
         
}

body {
  background-color: var(--background-color);
  color: var(--text-color);
  transition: var(--transition);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 60px;
  line-height: 1.5; /* Improved readability */
}

.container {
  padding: 15px;
  max-width: 100%;
  margin: 0 auto;
  padding-bottom: 70px;
}


/* Loader Styles */
.loader-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--background-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: var(--transition);
  backdrop-filter: blur(5px); /* Modern blur effect */
}

.m-loader {
  width: 60px;
  height: 60px;
  background-color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 30px;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.7;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}


/* Featured Game Styles */
.featured {
  position: relative;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  margin: 35px 0 25px;
  box-shadow: 0 8px 20px var(--shadow-color);
}

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

.featured:hover img {
  transform: scale(1.05);
}

.featured-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  padding: 25px 18px;
  color: white;
}

.featured-overlay h3 {
  font-size: 22px;
  margin-bottom: 8px;
  font-weight: 700;
}

.featured-overlay p {
  font-size: 14px;
  margin-bottom: 18px;
  opacity: 0.9;
}

.featured-btn {
  background-color: var(--primary-color);
  color: white;
  padding: 10px 22px;
  border-radius: 24px;
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  transition: var(--transition);
}

.featured-btn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Section Headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 28px 0 18px;
}

.section-header h2 {
  font-size: 19px;
  font-weight: 700;
  position: relative;
  padding-left: 12px;
}

.section-header h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 3px;
  height: 80%;
  width: 4px;
  background-color: var(--primary-color);
  border-radius: 2px;
}

.view-all {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
}

.view-all:hover {
  color: var(--primary-dark);
}

/* Categories Styles */
.categories {
  display: flex;
  overflow-x: auto;
  padding: 5px 0 15px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
  gap: 15px;
}

.categories::-webkit-scrollbar {
  display: none;
}

.category {
  min-width: 85px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-right: 15px;
  scroll-snap-align: start;
  transition: var(--transition);
}

.category:hover {
  transform: translateY(-3px);
}

.category i {
  width: 65px;
  height: 65px;
  background-color: var(--primary-light);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 24px;
  margin-bottom: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  transition: var(--transition);
}

.category:hover i {
  background-color: var(--primary-color);
}

.category p {
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

/* Game Grid Styles */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
  padding: 10px;
  max-width: 100%;
  margin: 0 auto;
}

.game-card {
  background-color: var(--card-color);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  position: relative;
  box-shadow: 0 5px 15px var(--shadow-color);
  transition: var(--transition);
  max-width: 100%;
}

.game-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px var(--shadow-color);
}

.game-card img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  transition: var(--transition);
}

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

.new-ribbon {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: var(--primary-color);
  color: white;
  font-size: 11px;
  font-weight: bold;
  padding: 4px 10px;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.game-info {
  padding: 14px;
}

.game-info p {
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.game-meta i {
  color: #FFD700;
}

.play-btn {
  background-color: var(--primary-color);
  color: white;
  padding: 8px 16px;
  border-radius: 18px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  display: inline-block;
  transition: var(--transition);
}

.play-btn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--card-color);
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  box-shadow: 0 -2px 10px var(--shadow-color);
  z-index: 100;
  border-top: 1px solid var(--border-color);
}

.bottom-nav a {
  color: var(--text-light);
  text-decoration: none;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  transition: var(--transition);
  position: relative;
}

.bottom-nav a::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background-color: var(--primary-color);
  transition: var(--transition);
}

.bottom-nav a i {
  font-size: 22px;
  margin-bottom: 4px;
}

.bottom-nav a.active {
  color: var(--primary-color);
}

.bottom-nav a.active::after {
  width: 25px;
}

/* Adblock Message */
.adblock-message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--card-color);
  box-shadow: 0 8px 20px var(--shadow-color);
  border-radius: var(--border-radius-md);
  padding: 18px 22px;
  width: 90%;
  max-width: 400px;
  z-index: 1000;
  border-left: 4px solid var(--primary-color);
  display: none;
  animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
  from {
    transform: translate(-50%, -20px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.adblock-message h3 {
  margin-bottom: 12px;
  color: var(--primary-color);
}

.adblock-message p {
  font-size: 14px;
  line-height: 1.6;
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-light);
  transition: var(--transition);
}

.close-button:hover {
  color: var(--primary-color);
}

/* Media Queries */
@media (min-width: 768px) {
  .container {
    max-width: 720px;
  }

  .featured img {
    height: 250px;
  }

  .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (max-width: 480px) {
  .game-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .featured-overlay h3 {
    font-size: 18px;
  }
}

/* Animation Keyframes */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Apply animations */
.main-content {
  animation: fadeIn 0.5s ease-out;
}

.featured {
  animation: slideUp 0.6s ease-out;
}

.section-header {
  animation: slideUp 0.7s ease-out;
}

.categories {
  animation: slideUp 0.8s ease-out;
}

.game-grid {
  animation: slideUp 0.9s ease-out;
}

/* Staggered game card animations */
.game-card {
  opacity: 0;
  animation: fadeIn 0.5s ease-out forwards;
}

.game-card:nth-child(1) { animation-delay: 0.1s; }
.game-card:nth-child(2) { animation-delay: 0.2s; }
.game-card:nth-child(3) { animation-delay: 0.3s; }
.game-card:nth-child(4) { animation-delay: 0.4s; }
.game-card:nth-child(5) { animation-delay: 0.5s; }
.game-card:nth-child(6) { animation-delay: 0.6s; }

/* PWA Styles */
@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Chat Toggle */
.chat-toggle {
  position: fixed;
  bottom: 80px;
  right: 30px;
  width: 60px;
  height: 60px;
  background-color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 90;
  font-size: 1.5rem;
  transition: all 0.3s;
}

.chat-toggle:hover {
  transform: scale(1.05);
  background-color: var(--secondary-color);
}

.chat-container.hidden {
  display: none;
}

.chat-container.visible {
  animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}