/* ==========================================================================
   xgames.id - Modern Bright Gaming Portal Styles & Animations
   ========================================================================== */

:root {
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Rajdhani', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --color-primary: #0284c7;
  --color-primary-light: #38bdf8;
  --color-secondary: #6366f1;
  --color-accent: #f43f5e;
  --color-bg-light: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-soft: #f1f5f9;
  --color-border: #e2e8f0;
  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-bg-light);
  color: var(--color-text-main);
  overflow-x: hidden;
}

::selection {
  background-color: #0284c7;
  color: #ffffff;
}

.font-display {
  font-family: var(--font-display);
}

/* Custom Scrollbar - Bright & Sleek */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Focus Indicators for Keyboard Navigation (A11y) */
:focus-visible {
  outline: 2px solid #0284c7 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.2) !important;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
  outline: none;
}

/* Glassmorphism - Bright Modern */
.glass-nav {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.04);
}

.glass-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.04), 0 8px 10px -6px rgba(15, 23, 42, 0.02);
}

.glass-modal {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid #e2e8f0;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.18);
}

/* Modern Game Card Hover & Image Auto-Crop */
.game-grid-item {
  content-visibility: auto;
  contain-intrinsic-size: auto 340px;
}

.game-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), 
              box-shadow 0.28s ease, 
              border-color 0.28s ease;
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.03);
}

.game-card:hover {
  transform: translateY(-6px);
  border-color: #38bdf8;
  box-shadow: 0 20px 30px -8px rgba(2, 132, 199, 0.16), 0 8px 12px -4px rgba(15, 23, 42, 0.06);
}

.game-thumb-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: #e2e8f0;
}

.game-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

/* Hero Slider Styles */
.hero-slider-wrapper {
  position: relative;
  width: 100%;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 40px -15px rgba(2, 132, 199, 0.15), 0 10px 20px -8px rgba(15, 23, 42, 0.08);
}

.hero-slider-track {
  position: relative;
  width: 100%;
  min-height: 420px;
}

@media (min-width: 768px) {
  .hero-slider-track {
    min-height: 480px;
  }
}

@media (min-width: 1280px) {
  .hero-slider-track {
    min-height: 520px;
  }
}

.hero-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.65s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.65s ease;
  z-index: 1;
}

.hero-slide.active {
  opacity: 1;
  visibility: visible;
  z-index: 2;
}

.hero-slide-content {
  transform: translateY(16px);
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s, opacity 0.6s ease 0.15s;
}

.hero-slide.active .hero-slide-content {
  transform: translateY(0);
  opacity: 1;
}

/* Category Card Tile Styles */
.category-card {
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid #e2e8f0;
  background: #ffffff;
}

.category-card:hover {
  transform: translateY(-4px);
  border-color: #38bdf8;
  box-shadow: 0 14px 25px -6px rgba(2, 132, 199, 0.12);
}

.category-card.active-category {
  border-color: #0284c7;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  box-shadow: 0 10px 20px -4px rgba(2, 132, 199, 0.2);
}

/* Pulse Badge Animation */
@keyframes pulse-glow {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.05);
  }
}
.animate-pulse-glow {
  animation: pulse-glow 2.5s infinite ease-in-out;
}

/* Shimmer Loading Effect */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.shimmer-bg {
  background: linear-gradient(90deg, rgba(0,0,0,0.03) 25%, rgba(0,0,0,0.07) 50%, rgba(0,0,0,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Iframe Game Player Responsive Container */
.game-iframe-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f172a;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.2);
  border: 1px solid #e2e8f0;
}

.game-iframe-wrapper.portrait-mode {
  aspect-ratio: 9 / 16;
  max-width: 480px;
  margin: 0 auto;
}

.game-iframe-wrapper.theater-mode {
  aspect-ratio: 21 / 9;
  max-width: 100%;
}

.game-iframe-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Category Nav Slider */
.category-scrollbar::-webkit-scrollbar {
  height: 5px;
}
.category-scrollbar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* Toast Container */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 90vw;
  width: 380px;
  pointer-events: none;
}
.toast-item {
  pointer-events: auto;
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .animate-pulse-glow,
  .shimmer-bg,
  .animate-spin,
  .animate-ping {
    animation: none !important;
  }

  .game-card:hover {
    transform: none !important;
  }

  .game-thumb-img {
    transition: none !important;
  }

  .game-card:hover .game-thumb-img {
    transform: none !important;
  }

  .hero-slide {
    transition: none !important;
  }

  .toast-item {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
