/**
 * Category & Subcategory Navigation Screens Styling
 * Follows the EXACT Math Quest Arcade Dark LEGO Theme:
 * - Pitch Black Background (#000000) with subtle ambient glows
 * - 4-Column Tiled Grid (hub-grid-12) with 280px uniform boxes (hub-box)
 * - Glassmorphic headers and breadcrumb bars (var(--bg-glass))
 * - 3D tactile LEGO buttons with studs
 * - Glowing typography and vibrant neon accents
 */

/* Container screens - identical to .hub-container */
.categories-hub-screen,
.subcategories-hub-screen {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  background-color: transparent;
  color: var(--text-white, #FFFFFF);
  font-family: var(--font-main, 'Outfit', sans-serif);
  box-sizing: border-box;
}

/* Dark Glassmorphic Breadcrumb Navigation Bar */
.category-breadcrumb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 16px;
  box-sizing: border-box;
  background: var(--bg-glass, rgba(18, 18, 23, 0.85));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg, 20px);
  box-shadow: var(--shadow-subtle, 0 4px 20px rgba(0, 0, 0, 0.8));
  gap: 12px;
  margin-top: -6px;
  margin-bottom: 4px;
}

.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dim, #A1A1AA);
  flex-wrap: wrap;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: var(--radius-md, 14px);
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-white, #FFFFFF);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--font-mono, monospace);
  font-size: 0.9rem;
}

.breadcrumb-item:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-cyan, #00D2FF);
  color: var(--accent-cyan, #00D2FF);
  transform: translateY(-1px);
}

.breadcrumb-separator {
  color: var(--text-muted, #71717A);
  font-size: 0.85rem;
}

.breadcrumb-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-md, 14px);
  background: linear-gradient(135deg, var(--lego-blue, #0055BF), var(--lego-blue-dark, #003E8A));
  color: #FFFFFF;
  border: 1px solid rgba(0, 210, 255, 0.4);
  font-family: var(--font-mono, monospace);
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 0 0 15px rgba(0, 85, 191, 0.4);
}

/* Back Navigation Button */
.nav-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-white, #FFFFFF);
  font-family: var(--font-main, sans-serif);
  font-size: 0.9rem;
  font-weight: 800;
  padding: 7px 14px;
  border-radius: var(--radius-md, 14px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.nav-back-btn:hover {
  background: var(--lego-blue, #0055BF);
  border-color: var(--accent-cyan, #00D2FF);
  color: #FFFFFF;
  transform: translateX(-2px);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
}

/* Category & Subcategory Card Theming (Inherits .hub-box .active-game-box) */
.hub-box.category-box-item,
.hub-box.subcategory-box-item,
.hub-box.active-game-box {
  min-height: 300px;
  height: auto;
  border-radius: var(--radius-lg, 20px);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 22px 16px 18px 16px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: visible;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
}

/* Color Themes for Category / Subcategory Active Boxes */
.hub-box.theme-pink {
  background: linear-gradient(180deg, #260d1f 0%, #12050e 100%);
  border: 2px solid #EC4899;
  box-shadow: 0 6px 0 #9D174D, 0 10px 25px rgba(236, 72, 153, 0.35), 0 0 15px rgba(236, 72, 153, 0.3);
}
.hub-box.theme-pink:hover {
  border-color: #F472B6;
  box-shadow: 0 8px 0 #9D174D, 0 16px 35px rgba(236, 72, 153, 0.55), 0 0 30px rgba(244, 114, 182, 0.6);
  transform: translateY(-8px) scale(1.03);
}

.hub-box.theme-blue {
  background: linear-gradient(180deg, #0b1a2e 0%, #050d18 100%);
  border: 2px solid var(--lego-blue, #0055BF);
  box-shadow: 0 6px 0 #003E8A, 0 10px 25px rgba(0, 85, 191, 0.35), 0 0 15px rgba(0, 210, 255, 0.3);
}
.hub-box.theme-blue:hover {
  border-color: #00D2FF;
  box-shadow: 0 8px 0 #003E8A, 0 16px 35px rgba(0, 85, 191, 0.6), 0 0 30px rgba(0, 210, 255, 0.6);
  transform: translateY(-8px) scale(1.03);
}

.hub-box.theme-green {
  background: linear-gradient(180deg, #0e2215 0%, #07130b 100%);
  border: 2px solid var(--lego-green, #00A859);
  box-shadow: 0 6px 0 #006636, 0 10px 25px rgba(0, 168, 89, 0.35), 0 0 15px var(--lego-green-glow, rgba(0, 168, 89, 0.45));
}
.hub-box.theme-green:hover {
  border-color: #00E676;
  box-shadow: 0 8px 0 #006636, 0 16px 35px rgba(0, 168, 89, 0.55), 0 0 30px rgba(0, 230, 118, 0.6);
  transform: translateY(-8px) scale(1.03);
}

.hub-box.theme-amber {
  background: linear-gradient(180deg, #2a1b07 0%, #140d03 100%);
  border: 2px solid #F59E0B;
  box-shadow: 0 6px 0 #B45309, 0 10px 25px rgba(245, 158, 11, 0.35), 0 0 15px rgba(245, 158, 11, 0.3);
}
.hub-box.theme-amber:hover {
  border-color: #FBBF24;
  box-shadow: 0 8px 0 #B45309, 0 16px 35px rgba(245, 158, 11, 0.55), 0 0 30px rgba(251, 191, 36, 0.6);
  transform: translateY(-8px) scale(1.03);
}

.hub-box.theme-cyan {
  background: linear-gradient(180deg, #071e2e 0%, #030f17 100%);
  border: 2px solid #0284C7;
  box-shadow: 0 6px 0 #0369A1, 0 10px 25px rgba(2, 132, 199, 0.35), 0 0 15px rgba(56, 189, 248, 0.3);
}
.hub-box.theme-cyan:hover {
  border-color: #38BDF8;
  box-shadow: 0 8px 0 #0369A1, 0 16px 35px rgba(2, 132, 199, 0.55), 0 0 30px rgba(56, 189, 248, 0.6);
  transform: translateY(-8px) scale(1.03);
}

.hub-box.theme-purple {
  background: linear-gradient(180deg, #1b0e2e 0%, #0d0617 100%);
  border: 2px solid #8B5CF6;
  box-shadow: 0 6px 0 #6D28D9, 0 10px 25px rgba(139, 92, 246, 0.35), 0 0 15px rgba(139, 92, 246, 0.3);
}
.hub-box.theme-purple:hover {
  border-color: #A78BFA;
  box-shadow: 0 8px 0 #6D28D9, 0 16px 35px rgba(139, 92, 246, 0.55), 0 0 30px rgba(167, 139, 250, 0.6);
  transform: translateY(-8px) scale(1.03);
}

.hub-box.theme-orange {
  background: linear-gradient(180deg, #2a1207 0%, #140803 100%);
  border: 2px solid #EA580C;
  box-shadow: 0 6px 0 #C2410C, 0 10px 25px rgba(234, 88, 12, 0.35), 0 0 15px rgba(234, 88, 12, 0.3);
}
.hub-box.theme-orange:hover {
  border-color: #FB923C;
  box-shadow: 0 8px 0 #C2410C, 0 16px 35px rgba(234, 88, 12, 0.55), 0 0 30px rgba(251, 146, 60, 0.6);
  transform: translateY(-8px) scale(1.03);
}

.hub-box.theme-teal {
  background: linear-gradient(180deg, #07261e 0%, #03130e 100%);
  border: 2px solid #059669;
  box-shadow: 0 6px 0 #047857, 0 10px 25px rgba(5, 150, 105, 0.35), 0 0 15px rgba(16, 185, 129, 0.3);
}
.hub-box.theme-teal:hover {
  border-color: #34D399;
  box-shadow: 0 8px 0 #047857, 0 16px 35px rgba(5, 150, 105, 0.55), 0 0 30px rgba(52, 211, 153, 0.6);
  transform: translateY(-8px) scale(1.03);
}

.hub-box.theme-red {
  background: linear-gradient(180deg, #2a090b 0%, #140405 100%);
  border: 2px solid #E11D48;
  box-shadow: 0 6px 0 #BE123C, 0 10px 25px rgba(225, 29, 72, 0.35), 0 0 15px rgba(244, 63, 94, 0.3);
}
.hub-box.theme-red:hover {
  border-color: #FB7185;
  box-shadow: 0 8px 0 #BE123C, 0 16px 35px rgba(225, 29, 72, 0.55), 0 0 30px rgba(251, 113, 133, 0.6);
  transform: translateY(-8px) scale(1.03);
}

/* Category & Subcategory Ribbon Badges */
.category-box-item .box-ribbon-badge,
.subcategory-box-item .box-ribbon-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.65rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Avatar Stage in Cards */
.category-avatar-stage,
.subcategory-avatar-stage {
  width: 96px;
  height: 96px;
  min-width: 96px;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  transition: transform 0.25s ease;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7));
}

.category-avatar-stage svg,
.subcategory-avatar-stage svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
}
/* Multi-directional, Randomized Animal Idle Animations */

/* 1. Gentle Floating Drift (Bobs upward with clockwise tilt) */
@keyframes animalFloatRight {
  0% { transform: translateY(0px) rotate(0deg) scale(1); }
  50% { transform: translateY(-5px) rotate(2deg) scale(1.02); }
  100% { transform: translateY(0px) rotate(0deg) scale(1); }
}

/* 2. Playful Counter-Tilt (Sways left with breathing expansion) */
@keyframes animalSwayLeft {
  0% { transform: translateY(0px) rotate(0deg) scale(1); }
  50% { transform: translateY(-4px) rotate(-2.5deg) scale(1.03); }
  100% { transform: translateY(0px) rotate(0deg) scale(1); }
}

/* 3. Cheerful Hop & Perky Nod */
@keyframes animalPerkyHop {
  0% { transform: translateY(0px) scale(1); }
  40% { transform: translateY(-7px) scale(1.04) rotate(1deg); }
  60% { transform: translateY(-6px) scale(1.03) rotate(-1deg); }
  100% { transform: translateY(0px) scale(1); }
}

/* 4. Curious Side Peek & Lean */
@keyframes animalSidePeek {
  0% { transform: translateX(0px) rotate(0deg); }
  35% { transform: translateX(-3px) translateY(-3px) rotate(-2deg); }
  70% { transform: translateX(3px) translateY(-4px) rotate(2deg); }
  100% { transform: translateX(0px) rotate(0deg); }
}

/* 5. Weightless Balloon Drift */
@keyframes animalWeightlessDrift {
  0% { transform: translateY(0px) rotate(0deg) scale(1); }
  50% { transform: translateY(-6px) rotate(-1.5deg) scale(1.025); }
  100% { transform: translateY(0px) rotate(0deg) scale(1); }
}

/* 6. Energetic Pulse & Dip */
@keyframes animalPulseDip {
  0% { transform: translateY(0px) scale(1); }
  30% { transform: translateY(2px) scale(0.98); }
  70% { transform: translateY(-5px) scale(1.03) rotate(1.5deg); }
  100% { transform: translateY(0px) scale(1); }
}

/* Randomized multi-directional assignment across 12-grid boxes */
.hub-box:nth-child(6n+1) .category-avatar-stage svg,
.hub-box:nth-child(6n+1) .subcategory-avatar-stage svg,
.hub-box:nth-child(6n+1) .rando-avatar-stage svg {
  animation: animalFloatRight 4.1s ease-in-out infinite alternate;
  animation-delay: 0.1s;
}

.hub-box:nth-child(6n+2) .category-avatar-stage svg,
.hub-box:nth-child(6n+2) .subcategory-avatar-stage svg {
  animation: animalSwayLeft 3.7s ease-in-out infinite alternate;
  animation-delay: 0.8s;
}

.hub-box:nth-child(6n+3) .category-avatar-stage svg,
.hub-box:nth-child(6n+3) .subcategory-avatar-stage svg {
  animation: animalPerkyHop 3.2s ease-in-out infinite alternate;
  animation-delay: 1.4s;
}

.hub-box:nth-child(6n+4) .category-avatar-stage svg,
.hub-box:nth-child(6n+4) .subcategory-avatar-stage svg {
  animation: animalSidePeek 4.6s ease-in-out infinite alternate;
  animation-delay: 0.4s;
}

.hub-box:nth-child(6n+5) .category-avatar-stage svg,
.hub-box:nth-child(6n+5) .subcategory-avatar-stage svg {
  animation: animalWeightlessDrift 5.2s ease-in-out infinite alternate;
  animation-delay: 1.8s;
}

.hub-box:nth-child(6n+6) .category-avatar-stage svg,
.hub-box:nth-child(6n+6) .subcategory-avatar-stage svg {
  animation: animalPulseDip 3.5s ease-in-out infinite alternate;
  animation-delay: 0.9s;
}

/* Wing Flutter for Flying/Winged Mascots */
.animal-wings,
.wasp-wings {
  animation: wingFlutter 0.12s infinite alternate ease-in-out;
  transform-origin: 50% 40%;
}

@keyframes wingFlutter {
  0% { transform: scaleX(0.9) rotate(-3deg); }
  100% { transform: scaleX(1.1) rotate(4deg); }
}

/* Interactive Card Hover Dynamic Bounce */
.hub-box.active-game-box:hover .category-avatar-stage svg,
.hub-box.active-game-box:hover .subcategory-avatar-stage svg,
.hub-box.active-game-box:hover .rando-avatar-stage svg {
  animation: animalEnergeticBounce 0.55s ease-in-out infinite alternate !important;
}

@keyframes animalEnergeticBounce {
  0% {
    transform: translateY(0) scale(1.08) rotate(-2deg);
  }
  100% {
    transform: translateY(-7px) scale(1.14) rotate(2deg);
  }
}

/* Responsive grid adjustments matching main.css */
@media (max-width: 1024px) {
  .categories-hub-screen,
  .subcategories-hub-screen {
    padding: 16px 16px 40px;
  }
}

@media (max-width: 720px) {
  .category-breadcrumb-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
