/* MegaPanalo CSS Styles */
/* All classes use prefix "ui51-" for namespace isolation */

/* CSS Variables */
:root {
  --ui51-primary: #FFF8DC;
  --ui51-secondary: #EEE8AA;
  --ui51-dark: #1A1A2E;
  --ui51-text: #333333;
  --ui51-text-light: #666666;
  --ui51-white: #FFFFFF;
  --ui51-black: #000000;
  --ui51-accent: #FFD700;
  --ui51-success: #28A745;
  --ui51-warning: #FFC107;
  --ui51-danger: #DC3545;
  --ui51-border: #E0E0E0;
  --ui51-shadow: rgba(0, 0, 0, 0.1);
  --ui51-shadow-dark: rgba(0, 0, 0, 0.3);

  /* Spacing */
  --ui51-spacing-xs: 0.5rem;
  --ui51-spacing-sm: 1rem;
  --ui51-spacing-md: 1.5rem;
  --ui51-spacing-lg: 2rem;
  --ui51-spacing-xl: 3rem;

  /* Typography */
  --ui51-font-size-xs: 1.2rem;
  --ui51-font-size-sm: 1.4rem;
  --ui51-font-size-base: 1.6rem;
  --ui51-font-size-lg: 1.8rem;
  --ui51-font-size-xl: 2rem;
  --ui51-font-size-2xl: 2.4rem;
  --ui51-font-size-3xl: 3rem;

  /* Layout */
  --ui51-max-width: 430px;
  --ui51-header-height: 60px;
  --ui51-bottom-nav-height: 64px;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 62.5%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: var(--ui51-font-size-base);
  line-height: 1.5;
  color: var(--ui51-text);
  background-color: var(--ui51-primary);
  max-width: var(--ui51-max-width);
  margin: 0 auto;
  overflow-x: hidden;
}

/* Typography */
.ui51-h1 {
  font-size: var(--ui51-font-size-3xl);
  font-weight: 700;
  color: var(--ui51-dark);
  margin-bottom: var(--ui51-spacing-md);
  line-height: 1.2;
}

.ui51-h2 {
  font-size: var(--ui51-font-size-2xl);
  font-weight: 600;
  color: var(--ui51-dark);
  margin-bottom: var(--ui51-spacing-sm);
  line-height: 1.3;
}

.ui51-h3 {
  font-size: var(--ui51-font-size-xl);
  font-weight: 600;
  color: var(--ui51-dark);
  margin-bottom: var(--ui51-spacing-xs);
  line-height: 1.4;
}

.ui51-text {
  font-size: var(--ui51-font-size-base);
  color: var(--ui51-text);
  line-height: 1.6;
  margin-bottom: var(--ui51-spacing-sm);
}

.ui51-text-sm {
  font-size: var(--ui51-font-size-sm);
  color: var(--ui51-text-light);
  line-height: 1.5;
}

/* Layout Components */
.ui51-container {
  padding: 0 var(--ui51-spacing-sm);
  margin: 0 auto;
}

.ui51-wrapper {
  min-height: 100vh;
  padding-bottom: var(--ui51-bottom-nav-height);
}

.ui51-grid {
  display: grid;
  gap: var(--ui51-spacing-sm);
}

.ui51-flex {
  display: flex;
  align-items: center;
}

.ui51-flex-col {
  display: flex;
  flex-direction: column;
}

.ui51-flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ui51-flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Header */
.ui51-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--ui51-header-height);
  background: linear-gradient(135deg, var(--ui51-dark) 0%, #2A2A3E 100%);
  z-index: 1000;
  box-shadow: 0 2px 10px var(--ui51-shadow-dark);
}

.ui51-header-content {
  height: 100%;
  padding: 0 var(--ui51-spacing-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ui51-logo {
  display: flex;
  align-items: center;
  gap: var(--ui51-spacing-xs);
  text-decoration: none;
  color: var(--ui51-primary);
  font-weight: 700;
  font-size: var(--ui51-font-size-lg);
}

.ui51-logo-icon {
  width: 28px;
  height: 28px;
  background: var(--ui51-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ui51-font-size-sm);
  color: var(--ui51-dark);
}

.ui51-header-actions {
  display: flex;
  gap: var(--ui51-spacing-xs);
  align-items: center;
}

.ui51-btn {
  padding: 0.8rem 1.6rem;
  border: none;
  border-radius: 8px;
  font-size: var(--ui51-font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  touch-action: manipulation;
}

.ui51-btn-primary {
  background: linear-gradient(135deg, var(--ui51-accent) 0%, #FFA500 100%);
  color: var(--ui51-dark);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.ui51-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 215, 0, 0.4);
}

.ui51-btn-secondary {
  background: transparent;
  color: var(--ui51-primary);
  border: 2px solid var(--ui51-primary);
}

.ui51-btn-secondary:hover {
  background: var(--ui51-primary);
  color: var(--ui51-dark);
}

.ui51-menu-toggle {
  background: none;
  border: none;
  color: var(--ui51-primary);
  font-size: var(--ui51-font-size-xl);
  cursor: pointer;
  padding: var(--ui51-spacing-xs);
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.ui51-menu-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Mobile Menu */
.ui51-mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 80%;
  max-width: 300px;
  height: 100vh;
  background: var(--ui51-dark);
  z-index: 9999;
  transition: right 0.3s ease;
  overflow-y: auto;
}

.ui51-menu-active {
  right: 0;
}

.ui51-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.ui51-overlay-active {
  opacity: 1;
  visibility: visible;
}

.ui51-menu-header {
  padding: var(--ui51-spacing-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ui51-menu-close {
  background: none;
  border: none;
  color: var(--ui51-primary);
  font-size: var(--ui51-font-size-xl);
  cursor: pointer;
}

.ui51-menu-nav {
  padding: var(--ui51-spacing-sm) 0;
}

.ui51-menu-item {
  display: block;
  padding: var(--ui51-spacing-sm) var(--ui51-spacing-md);
  color: var(--ui51-primary);
  text-decoration: none;
  transition: background-color 0.3s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ui51-menu-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Main Content */
.ui51-main {
  padding-top: var(--ui51-header-height);
  min-height: 100vh;
}

/* Carousel */
.ui51-carousel {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  border-radius: 12px;
  margin-bottom: var(--ui51-spacing-lg);
}

.ui51-carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease;
  cursor: pointer;
}

.ui51-slide-active {
  opacity: 1;
}

.ui51-carousel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ui51-carousel-indicators {
  position: absolute;
  bottom: var(--ui51-spacing-sm);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--ui51-spacing-xs);
}

.ui51-carousel-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.ui51-indicator-active {
  background: var(--ui51-accent);
}

/* Game Cards */
.ui51-game-section {
  margin-bottom: var(--ui51-spacing-xl);
}

.ui51-game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--ui51-spacing-md);
}

.ui51-game-title {
  font-size: var(--ui51-font-size-xl);
  font-weight: 600;
  color: var(--ui51-dark);
}

.ui51-game-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--ui51-spacing-xs);
}

.ui51-game-card {
  background: var(--ui51-white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--ui51-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.ui51-game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--ui51-shadow-dark);
}

.ui51-game-image {
  width: 100%;
  height: 80px;
  object-fit: cover;
}

.ui51-game-name {
  padding: var(--ui51-spacing-xs);
  font-size: var(--ui51-font-size-xs);
  text-align: center;
  color: var(--ui51-text);
  font-weight: 500;
  line-height: 1.3;
}

/* Content Sections */
.ui51-section {
  background: var(--ui51-white);
  border-radius: 12px;
  padding: var(--ui51-spacing-md);
  margin-bottom: var(--ui51-spacing-lg);
  box-shadow: 0 4px 12px var(--ui51-shadow);
}

.ui51-section-title {
  font-size: var(--ui51-font-size-xl);
  font-weight: 600;
  color: var(--ui51-dark);
  margin-bottom: var(--ui51-spacing-md);
  text-align: center;
}

/* Buttons */
.ui51-btn-large {
  padding: 1.2rem 2.4rem;
  font-size: var(--ui51-font-size-base);
  border-radius: 12px;
  min-height: 50px;
}

.ui51-btn-block {
  width: 100%;
  display: block;
}

/* Links */
.ui51-link {
  color: var(--ui51-accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.ui51-link:hover {
  color: #FFA500;
  text-decoration: underline;
}

/* Footer */
.ui51-footer {
  background: var(--ui51-dark);
  color: var(--ui51-primary);
  padding: var(--ui51-spacing-lg) var(--ui51-spacing-sm) var(--ui51-spacing-xl);
  margin-top: var(--ui51-spacing-xl);
}

.ui51-footer-content {
  text-align: center;
}

.ui51-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--ui51-spacing-sm);
  margin-bottom: var(--ui51-spacing-md);
}

.ui51-footer-link {
  color: var(--ui51-primary);
  text-decoration: none;
  font-size: var(--ui51-font-size-sm);
  transition: color 0.3s ease;
}

.ui51-footer-link:hover {
  color: var(--ui51-accent);
}

.ui51-partners {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--ui51-spacing-sm);
  margin-bottom: var(--ui51-spacing-md);
}

.ui51-partner-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.ui51-partner-icon:hover {
  opacity: 1;
}

.ui51-copyright {
  font-size: var(--ui51-font-size-xs);
  color: rgba(255, 248, 220, 0.7);
  margin-top: var(--ui51-spacing-md);
}

/* Bottom Navigation */
.ui51-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--ui51-bottom-nav-height);
  background: linear-gradient(135deg, var(--ui51-dark) 0%, #2A2A3E 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 var(--ui51-spacing-sm);
}

.ui51-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  min-height: 60px;
  padding: var(--ui51-spacing-xs);
  background: none;
  border: none;
  color: rgba(255, 248, 220, 0.7);
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 8px;
  touch-action: manipulation;
}

.ui51-bottom-nav-item:hover {
  color: var(--ui51-primary);
  transform: scale(1.05);
}

.ui51-bottom-nav-item.ui51-nav-active {
  color: var(--ui51-accent);
  background: rgba(255, 215, 0, 0.1);
}

.ui51-bottom-nav-icon {
  font-size: 24px;
  margin-bottom: 2px;
}

.ui51-bottom-nav-text {
  font-size: 10px;
  font-weight: 500;
  text-align: center;
}

/* Scroll to Top Button */
.ui51-scroll-top {
  position: fixed;
  bottom: calc(var(--ui51-bottom-nav-height) + var(--ui51-spacing-sm));
  right: var(--ui51-spacing-sm);
  width: 50px;
  height: 50px;
  background: var(--ui51-accent);
  color: var(--ui51-dark);
  border: none;
  border-radius: 50%;
  font-size: var(--ui51-font-size-lg);
  cursor: pointer;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px var(--ui51-shadow-dark);
}

.ui51-scroll-top.ui51-scroll-visible {
  opacity: 1;
  visibility: visible;
}

.ui51-scroll-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--ui51-shadow-dark);
}

/* Responsive Design */
@media (max-width: 768px) {
  .ui51-main {
    padding-bottom: var(--ui51-bottom-nav-height);
  }

  .ui51-game-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .ui51-carousel {
    height: 180px;
  }

  .ui51-game-image {
    height: 70px;
  }
}

@media (max-width: 480px) {
  .ui51-game-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ui51-carousel {
    height: 160px;
  }

  .ui51-game-image {
    height: 60px;
  }
}

@media (min-width: 769px) {
  .ui51-bottom-nav {
    display: none;
  }

  .ui51-main {
    padding-bottom: 0;
  }
}

/* Utility Classes */
.ui51-text-center {
  text-align: center;
}

.ui51-text-left {
  text-align: left;
}

.ui51-text-right {
  text-align: right;
}

.ui51-mb-sm {
  margin-bottom: var(--ui51-spacing-sm);
}

.ui51-mb-md {
  margin-bottom: var(--ui51-spacing-md);
}

.ui51-mb-lg {
  margin-bottom: var(--ui51-spacing-lg);
}

.ui51-mt-sm {
  margin-top: var(--ui51-spacing-sm);
}

.ui51-mt-md {
  margin-top: var(--ui51-spacing-md);
}

.ui51-mt-lg {
  margin-top: var(--ui51-spacing-lg);
}

.ui51-hidden {
  display: none;
}

.ui51-visible {
  display: block;
}

/* Animations */
@keyframes ui51-fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ui51-fade-in {
  animation: ui51-fadeIn 0.6s ease-out;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for keyboard navigation */
.ui51-btn:focus,
.ui51-link:focus,
.ui51-menu-item:focus,
.ui51-bottom-nav-item:focus {
  outline: 2px solid var(--ui51-accent);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --ui51-shadow: rgba(0, 0, 0, 0.3);
    --ui51-text-light: #000000;
  }
}