/* ===== DESIGN SYSTEM ===== */

/* Typography */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700&display=swap');

:root {
  /* Font System */
  --font-primary: 'Fredoka', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;

  /* Color Palette */
  --color-primary: #3B82F6;      /* Blue 500 */
  --color-primary-dark: #2563EB; /* Blue 600 */
  --color-primary-darker: #1E40AF; /* Blue 700 */

  --color-secondary: #8B5CF6;    /* Purple 500 */
  --color-accent: #F59E0B;       /* Amber 500 */

  /* Semantic Colors */
  --color-success: #10B981;      /* Green 500 */
  --color-success-dark: #059669; /* Green 600 */
  --color-error: #EF4444;        /* Red 500 */
  --color-error-dark: #DC2626;   /* Red 600 */
  --color-warning: #F59E0B;      /* Amber 500 */

  /* Game Theme Colors */
  --color-animals: #F97316;      /* Orange 600 */
  --color-kitchen: #10B981;      /* Green 500 */
  --color-opposites: #8B5CF6;    /* Purple 500 */
  --color-piano: #EC4899;        /* Pink 500 */
  --color-puprescue: #0EA5E9;    /* Sky 500 */

  /* Neutral Colors */
  --color-gray-50: #F9FAFB;
  --color-gray-100: #F3F4F6;
  --color-gray-200: #E5E7EB;
  --color-gray-300: #D1D5DB;
  --color-gray-500: #6B7280;
  --color-gray-700: #374151;
  --color-gray-900: #111827;

  /* Spacing (8px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

  /* Animation Timing */
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 350ms;
  --duration-celebration: 800ms;

  /* Animation Easing */
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ===== MODERN BUTTON SYSTEM ===== */

.btn {
  font-family: var(--font-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  user-select: none;
}

/* Primary Button - Modern Gradient with 3D Effect */
.btn-primary {
  background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xl);
  box-shadow: 0 6px 0 var(--color-primary-darker), var(--shadow-lg);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--color-primary-darker), var(--shadow-xl);
}

.btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--color-primary-darker), var(--shadow-sm);
}

/* Success Button */
.btn-success {
  background: linear-gradient(180deg, var(--color-success) 0%, var(--color-success-dark) 100%);
  color: white;
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xl);
  box-shadow: 0 6px 0 #047857, var(--shadow-lg);
}

.btn-success:hover {
  transform: translateY(-2px);
}

.btn-success:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #047857, var(--shadow-sm);
}

/* Secondary Button - Outlined Style */
.btn-secondary {
  background: white;
  color: var(--color-primary);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xl);
  border: 3px solid var(--color-primary);
  box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
  background: var(--color-gray-50);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary:active {
  transform: scale(0.95);
}

/* Icon Button - Circular */
.btn-icon {
  background: white;
  color: var(--color-primary);
  width: 50px;
  height: 50px;
  padding: 0;
  border-radius: var(--radius-full);
  font-size: var(--font-size-2xl);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

.btn-icon:active {
  transform: scale(0.95);
}

/* Disabled State */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ===== MODERN CARD SYSTEM ===== */

.card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6);
  transition: all var(--duration-base) var(--ease-out);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* ===== ANIMATIONS ===== */

@keyframes bounce-in {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
  50% { box-shadow: 0 0 20px 10px rgba(59, 130, 246, 0); }
}

@keyframes shine {
  0% { left: -100%; }
  100% { left: 125%; }
}

@keyframes sparkle {
  0% { transform: scale(0) rotate(0deg); opacity: 0; }
  50% { transform: scale(1.2) rotate(180deg); opacity: 1; }
  100% { transform: scale(0) rotate(360deg); opacity: 0; }
}

/* Animation Classes */
.animate-bounce-in { animation: bounce-in 0.6s var(--ease-bounce); }
.animate-shake { animation: shake 0.5s var(--ease-out); }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-pulse-glow { animation: pulse-glow 2s ease-in-out infinite; }

/* ===== UTILITY CLASSES ===== */

.shine-effect {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  transition: left 0.7s;
}

.card:hover .shine-effect {
  left: 125%;
}

/* Icon Sizing */
.icon-xs { width: 16px; height: 16px; }
.icon-sm { width: 20px; height: 20px; }
.icon-md { width: 24px; height: 24px; }
.icon-lg { width: 32px; height: 32px; }
.icon-xl { width: 48px; height: 48px; }

/* ===== GAME NAVIGATION SIDEBAR ===== */

/* Toggle Button - Fixed Right Side */
.game-nav-toggle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 48px;
  height: 56px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: none;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  z-index: 900;
  transition: all var(--duration-base) var(--ease-out);
}

.game-nav-toggle:hover {
  width: 54px;
  background: linear-gradient(180deg, #ffffff 0%, #e0f2fe 100%);
  box-shadow: -6px 0 16px rgba(59, 130, 246, 0.2);
}

.game-nav-toggle.active {
  background: var(--color-primary);
  color: white;
}

/* Overlay */
.game-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
  z-index: 950;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out);
}

.game-nav-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar Panel */
.game-nav-sidebar {
  position: fixed;
  top: 0;
  right: -320px;
  width: 280px;
  height: 100vh;
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: right var(--duration-slow) var(--ease-elastic);
}

.game-nav-sidebar.open {
  right: 0;
}

/* Header */
.game-nav-header {
  background: linear-gradient(135deg, var(--color-primary) 0%, #2563eb 100%);
  color: white;
  padding: var(--space-5) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.game-nav-title {
  font-family: var(--font-primary);
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.game-nav-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-out);
}

.game-nav-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Game List */
.game-nav-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Individual Game Item */
.game-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  text-decoration: none;
  background: white;
  border: 2px solid transparent;
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.game-nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
  transition: left 0.5s var(--ease-out);
}

.game-nav-item:hover::before {
  left: 100%;
}

.game-nav-item:hover {
  transform: translateX(-4px);
  border-color: var(--game-color);
  background: var(--game-bg);
  box-shadow: var(--shadow-md);
}

.game-nav-item.active {
  border-color: var(--game-color);
  background: var(--game-bg);
  box-shadow: 0 0 0 3px rgba(var(--game-color), 0.2), var(--shadow-md);
}

.game-nav-item.active::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--game-color);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Game Icon */
.game-nav-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  transition: all var(--duration-base) var(--ease-out);
}

.game-nav-item:hover .game-nav-icon {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: var(--shadow-md);
}

/* Game Name */
.game-nav-name {
  font-family: var(--font-primary);
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-gray-700);
  flex: 1;
}

.game-nav-item:hover .game-nav-name {
  color: var(--game-color);
}

/* Current Playing Badge */
.game-nav-current {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--game-color);
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  animation: pulse-glow 2s ease-in-out infinite;
}

/* Settings Section */
.game-nav-settings {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-gray-200);
  background: var(--color-gray-50);
  flex-shrink: 0;
}

.game-nav-settings-title {
  font-family: var(--font-primary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.game-nav-setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
}

.setting-label {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-gray-700);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Toggle Switch */
.setting-toggle {
  position: relative;
  width: 52px;
  height: 28px;
  background: var(--color-gray-300);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  padding: 0;
  transition: all var(--duration-base) var(--ease-out);
}

.setting-toggle:hover {
  background: var(--color-gray-400);
}

.setting-toggle.active {
  background: var(--color-success);
}

.setting-toggle.active:hover {
  background: var(--color-success-dark);
}

.toggle-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-base) var(--ease-out);
}

.setting-toggle.active .toggle-slider {
  left: 27px;
}

/* Footer */
.game-nav-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--color-gray-200);
  background: var(--color-gray-50);
  flex-shrink: 0;
}

.game-nav-home {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: white;
  border: 2px solid var(--color-gray-200);
  border-radius: var(--radius-full);
  color: var(--color-gray-600);
  text-decoration: none;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: var(--font-size-base);
  transition: all var(--duration-base) var(--ease-out);
}

.game-nav-home:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .game-nav-toggle {
    top: auto;
    bottom: 100px;
    width: 44px;
    height: 50px;
  }

  .game-nav-toggle:hover {
    width: 48px;
  }

  .game-nav-sidebar {
    width: 260px;
    right: -280px;
  }

  .game-nav-item {
    padding: var(--space-2) var(--space-3);
  }

  .game-nav-icon {
    width: 38px;
    height: 38px;
  }

  .game-nav-name {
    font-size: var(--font-size-base);
  }
}

@media (max-width: 480px) {
  .game-nav-toggle {
    bottom: 80px;
    width: 40px;
    height: 46px;
  }

  .game-nav-sidebar {
    width: 240px;
    right: -260px;
  }

  .game-nav-header {
    padding: var(--space-4) var(--space-3);
  }

  .game-nav-title {
    font-size: var(--font-size-lg);
  }
}
