/**
 * Sugal777 Gaming Website CSS Design System
 * Mobile-first responsive design with dynamic prefixes
 * Color palette: #87CEFA, #273746, #4682B4, #FFF176, #FF9500
 */

/* CSS Variables for consistent theming */
:root {
  /* Primary color palette */
  --pg31-primary: #87CEFA; /* Sky Blue */
  --pg31-secondary: #273746; /* Dark Blue */
  --pg31-accent: #4682B4; /* Steel Blue */
  --pg31-highlight: #FFF176; /* Light Yellow */
  --pg31-warning: #FF9500; /* Orange */

  /* Extended color palette */
  --pg31-bg-dark: #1a1a1a;
  --pg31-bg-light: #f8f9fa;
  --pg31-text-dark: #333333;
  --pg31-text-light: #ffffff;
  --pg31-text-muted: #6c757d;
  --pg31-border: #dee2e6;

  /* Typography */
  --pg31-font-primary: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --pg31-font-secondary: 'Arial', sans-serif;
  --pg31-font-size-base: 1.6rem;
  --pg31-line-height: 1.5;

  /* Spacing */
  --pg31-spacing-xs: 0.5rem;
  --pg31-spacing-sm: 1rem;
  --pg31-spacing-md: 1.5rem;
  --pg31-spacing-lg: 2rem;
  --pg31-spacing-xl: 3rem;

  /* Border radius */
  --pg31-radius-sm: 0.3rem;
  --pg31-radius-md: 0.5rem;
  --pg31-radius-lg: 1rem;

  /* Shadows */
  --pg31-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
  --pg31-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --pg31-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);

  /* Transitions */
  --pg31-transition: all 0.3s ease;
  --pg31-transition-fast: all 0.15s ease;
}

/* Base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 62.5%; /* 1rem = 10px for easy calculations */
  scroll-behavior: smooth;
}

body {
  font-family: var(--pg31-font-primary);
  font-size: var(--pg31-font-size-base);
  line-height: var(--pg31-line-height);
  color: var(--pg31-text-light);
  background: linear-gradient(135deg, var(--pg31-secondary) 0%, var(--pg31-bg-dark) 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Typography */
.pg31-h1 {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--pg31-highlight);
  margin-bottom: var(--pg31-spacing-md);
  text-align: center;
}

.pg31-h2 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--pg31-primary);
  margin-bottom: var(--pg31-spacing-sm);
}

.pg31-h3 {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--pg31-accent);
  margin-bottom: var(--pg31-spacing-sm);
}

.pg31-p {
  font-size: 1.6rem;
  line-height: var(--pg31-line-height);
  color: var(--pg31-text-light);
  margin-bottom: var(--pg31-spacing-sm);
}

/* Layout containers */
.pg31-container {
  max-width: 430px;
  margin: 0 auto;
  padding: 0 var(--pg31-spacing-sm);
}

.pg31-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.pg31-main {
  flex: 1;
  padding-bottom: 8rem; /* Space for bottom nav on mobile */
}

/* Header */
.pg31-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, var(--pg31-secondary) 0%, var(--pg31-accent) 100%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(135, 206, 250, 0.2);
  z-index: 1000;
  padding: 1rem 0;
}

.pg31-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 430px;
  margin: 0 auto;
  padding: 0 var(--pg31-spacing-sm);
}

.pg31-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.pg31-logo-icon {
  width: 2.4rem;
  height: 2.4rem;
  background: var(--pg31-highlight);
  border-radius: var(--pg31-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--pg31-secondary);
  font-weight: bold;
}

.pg31-logo-text {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--pg31-highlight);
  letter-spacing: 0.5px;
}

.pg31-header-actions {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.pg31-btn {
  padding: 0.8rem 1.6rem;
  border: none;
  border-radius: var(--pg31-radius-md);
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--pg31-transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 4.4rem; /* Touch-friendly size */
  white-space: nowrap;
}

.pg31-btn-primary {
  background: linear-gradient(45deg, var(--pg31-warning), var(--pg31-highlight));
  color: var(--pg31-secondary);
  box-shadow: var(--pg31-shadow-sm);
}

.pg31-btn-primary:hover {
  background: linear-gradient(45deg, var(--pg31-highlight), var(--pg31-warning));
  transform: translateY(-2px);
  box-shadow: var(--pg31-shadow-md);
}

.pg31-btn-secondary {
  background: transparent;
  color: var(--pg31-primary);
  border: 2px solid var(--pg31-primary);
}

.pg31-btn-secondary:hover {
  background: var(--pg31-primary);
  color: var(--pg31-secondary);
  transform: translateY(-2px);
}

.pg31-hamburger {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  cursor: pointer;
  padding: 0.5rem;
  border: none;
  background: none;
  color: var(--pg31-highlight);
  font-size: 2rem;
}

.pg31-hamburger span {
  width: 2rem;
  height: 0.2rem;
  background: currentColor;
  transition: var(--pg31-transition);
  border-radius: 1px;
}

.pg31-hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(0.5rem, 0.5rem);
}

.pg31-hamburger.active span:nth-child(2) {
  opacity: 0;
}

.pg31-hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(0.5rem, -0.5rem);
}

/* Mobile Navigation Menu */
.pg31-mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(39, 55, 70, 0.95);
  backdrop-filter: blur(10px);
  z-index: 9999;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.pg31-mobile-menu.active {
  transform: translateX(0);
}

.pg31-mobile-menu-content {
  padding-top: 8rem; /* Space for header */
  padding-bottom: 2rem;
}

.pg31-mobile-menu-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--pg31-highlight);
  font-size: 2.4rem;
  cursor: pointer;
}

.pg31-mobile-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pg31-mobile-nav li {
  border-bottom: 1px solid rgba(135, 206, 250, 0.1);
}

.pg31-mobile-nav a {
  display: block;
  padding: 1.5rem var(--pg31-spacing-sm);
  color: var(--pg31-text-light);
  text-decoration: none;
  font-size: 1.6rem;
  font-weight: 500;
  transition: var(--pg31-transition);
}

.pg31-mobile-nav a:hover {
  background: rgba(135, 206, 250, 0.1);
  color: var(--pg31-highlight);
}

/* Carousel */
.pg31-carousel {
  position: relative;
  overflow: hidden;
  border-radius: var(--pg31-radius-lg);
  margin: 2rem 0;
  box-shadow: var(--pg31-shadow-lg);
}

.pg31-carousel-container {
  display: flex;
  transition: transform 0.5s ease;
}

.pg31-carousel-slide {
  min-width: 100%;
  position: relative;
  cursor: pointer;
}

.pg31-carousel-slide img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.pg31-carousel-indicators {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
}

.pg31-carousel-indicator {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: var(--pg31-transition);
}

.pg31-carousel-indicator.active {
  background: var(--pg31-highlight);
  transform: scale(1.2);
}

/* Game Grid */
.pg31-game-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 2rem 0;
}

.pg31-game-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--pg31-radius-md);
  padding: 1rem;
  text-align: center;
  transition: var(--pg31-transition);
  cursor: pointer;
  border: 1px solid rgba(135, 206, 250, 0.1);
}

.pg31-game-card:hover {
  background: rgba(135, 206, 250, 0.1);
  transform: translateY(-3px);
  box-shadow: var(--pg31-shadow-md);
}

.pg31-game-icon {
  width: 100%;
  height: 6rem;
  object-fit: contain;
  margin-bottom: 0.5rem;
  border-radius: var(--pg31-radius-sm);
}

.pg31-game-name {
  font-size: 1.2rem;
  color: var(--pg31-text-light);
  margin: 0;
  line-height: 1.3;
  font-weight: 500;
}

/* Sections */
.pg31-section {
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--pg31-radius-lg);
  padding: var(--pg31-spacing-lg);
  margin: 2rem 0;
  border: 1px solid rgba(135, 206, 250, 0.1);
}

.pg31-section-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--pg31-primary);
  margin-bottom: var(--pg31-spacing-md);
  text-align: center;
}

/* Bottom Navigation */
.pg31-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, var(--pg31-secondary) 0%, var(--pg31-accent) 100%);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(135, 206, 250, 0.2);
  z-index: 1000;
  height: 6rem;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0.5rem 0;
}

.pg31-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.7);
  transition: var(--pg31-transition);
  min-width: 6rem;
  padding: 0.5rem;
  border-radius: var(--pg31-radius-md);
}

.pg31-bottom-nav-item:hover,
.pg31-bottom-nav-item.active {
  color: var(--pg31-highlight);
  background: rgba(255, 241, 118, 0.1);
  transform: translateY(-2px);
}

.pg31-bottom-nav-icon {
  font-size: 2.4rem;
  margin-bottom: 0.2rem;
}

.pg31-bottom-nav-text {
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
}

/* Footer */
.pg31-footer {
  background: var(--pg31-bg-dark);
  border-top: 1px solid rgba(135, 206, 250, 0.1);
  padding: 3rem 0 8rem; /* Extra bottom padding for mobile nav */
  margin-top: 4rem;
}

.pg31-footer-content {
  text-align: center;
}

.pg31-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.pg31-footer-links a {
  color: var(--pg31-primary);
  text-decoration: none;
  font-size: 1.4rem;
  transition: var(--pg31-transition);
}

.pg31-footer-links a:hover {
  color: var(--pg31-highlight);
}

.pg31-partners {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
}

.pg31-partner-logo {
  width: 4rem;
  height: 4rem;
  object-fit: contain;
  opacity: 0.7;
  transition: var(--pg31-transition);
  filter: grayscale(100%);
}

.pg31-partner-logo:hover {
  opacity: 1;
  filter: grayscale(0%);
  transform: scale(1.1);
}

.pg31-copyright {
  color: var(--pg31-text-muted);
  font-size: 1.2rem;
  margin-top: 2rem;
}

/* Utility classes */
.pg31-text-center { text-align: center; }
.pg31-text-left { text-align: left; }
.pg31-text-right { text-align: right; }

.pg31-mb-sm { margin-bottom: var(--pg31-spacing-sm); }
.pg31-mb-md { margin-bottom: var(--pg31-spacing-md); }
.pg31-mb-lg { margin-bottom: var(--pg31-spacing-lg); }

.pg31-mt-sm { margin-top: var(--pg31-spacing-sm); }
.pg31-mt-md { margin-top: var(--pg31-spacing-md); }
.pg31-mt-lg { margin-top: var(--pg31-spacing-lg); }

.pg31-flex { display: flex; }
.pg31-flex-col { flex-direction: column; }
.pg31-items-center { align-items: center; }
.pg31-justify-center { justify-content: center; }
.pg31-justify-between { justify-content: space-between; }

.pg31-hidden { display: none; }
.pg31-visible { display: block; }

/* Responsive breakpoints */
@media (max-width: 768px) {
  .pg31-container {
    padding: 0 var(--pg31-spacing-sm);
  }

  .pg31-game-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
  }

  .pg31-main {
    padding-bottom: 8rem; /* Ensure space for bottom nav */
  }

  /* Hide desktop elements */
  .pg31-desktop-only {
    display: none !important;
  }
}

@media (min-width: 769px) {
  /* Hide mobile elements on desktop */
  .pg31-bottom-nav {
    display: none !important;
  }

  .pg31-hamburger {
    display: none !important;
  }

  .pg31-mobile-menu {
    display: none !important;
  }

  /* Adjust main content padding */
  .pg31-main {
    padding-bottom: 2rem;
  }
}

/* Loading states */
.pg31-loading {
  position: relative;
  overflow: hidden;
}

.pg31-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Scroll to top button */
.pg31-scroll-top {
  position: fixed;
  bottom: 8rem;
  right: 2rem;
  width: 4rem;
  height: 4rem;
  background: var(--pg31-primary);
  color: var(--pg31-secondary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: var(--pg31-shadow-lg);
  transition: var(--pg31-transition);
  z-index: 999;
}

.pg31-scroll-top:hover {
  background: var(--pg31-highlight);
  transform: translateY(-3px);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 0.6rem;
}

::-webkit-scrollbar-track {
  background: var(--pg31-bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--pg31-primary);
  border-radius: 0.3rem;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--pg31-accent);
}

/* Focus styles for accessibility */
.pg31-btn:focus,
.pg31-bottom-nav-item:focus,
a:focus {
  outline: 2px solid var(--pg31-highlight);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --pg31-text-light: #ffffff;
    --pg31-text-dark: #000000;
    --pg31-border: #ffffff;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}