/* ==========================================================================
   NuGame - Modern & Clean Gaming UI Stylesheet
   ========================================================================== */

:root {
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Rajdhani', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  
  /* NuGame Color Palette - Clean, Brighter Dark/Slate & Indigo-Teal Accents */
  --color-bg: #0b1120;
  --color-bg-card: #131d33;
  --color-bg-elevated: #1e293b;
  --color-border: #293548;
  --color-border-subtle: #1e293b;
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-primary-light: #818cf8;
  --color-accent: #06b6d4;
  --color-accent-hover: #0891b2;
  --color-teal: #14b8a6;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #f43f5e;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
}

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

::selection {
  background-color: var(--color-primary);
  color: #ffffff;
}

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

/* Custom Clean Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: #0b1120;
}
::-webkit-scrollbar-thumb {
  background: #243048;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b4c68;
}

/* Focus Indicators (A11y) */
:focus-visible {
  outline: 2px solid var(--color-primary-light) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25) !important;
}

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

/* Glassmorphism & Modern Panels */
.glass-nav {
  background: rgba(11, 17, 32, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.glass-panel {
  background: rgba(19, 29, 51, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-modal {
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(99, 102, 241, 0.25);
}

/* ==========================================================================
   Hero Featured Carousel / Slider
   ========================================================================== */
.hero-slider-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 1.25rem;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
}

.hero-slides-container {
  position: relative;
  width: 100%;
  min-height: 500px;
}

@media (min-width: 640px) {
  .hero-slides-container {
    min-height: 460px;
  }
}

@media (min-width: 768px) {
  .hero-slides-container {
    min-height: 430px;
  }
}

.hero-slide-item {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, transform 0.5s ease;
  transform: scale(0.98);
  display: flex;
  align-items: center;
}

.hero-slide-item.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  z-index: 10;
}

.hero-slide-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(40px) brightness(0.35);
  transform: scale(1.15);
  pointer-events: none;
}

.hero-slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(11, 17, 32, 0.95) 0%, rgba(11, 17, 32, 0.75) 50%, rgba(11, 17, 32, 0.4) 100%);
  pointer-events: none;
}

@media (max-width: 767px) {
  .hero-slide-overlay {
    background: linear-gradient(180deg, rgba(11, 17, 32, 0.55) 0%, rgba(11, 17, 32, 0.95) 80%);
  }
}

/* Slider Controls */
.hero-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}
.hero-nav-btn:hover {
  background: rgba(99, 102, 241, 0.9);
  border-color: #818cf8;
  color: #ffffff;
  transform: translateY(-50%) scale(1.08);
}
.hero-prev-btn { left: 16px; }
.hero-next-btn { right: 16px; }

@media (min-width: 768px) {
  .hero-prev-btn { left: 20px; }
  .hero-next-btn { right: 20px; }
}

@media (max-width: 639px) {
  .hero-nav-btn {
    width: 36px;
    height: 36px;
  }
  .hero-prev-btn { left: 8px; }
  .hero-next-btn { right: 8px; }
}

/* Dot Pagination */
.hero-dots-container {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  padding: 0;
}

.hero-dot.active {
  width: 24px;
  background: #6366f1;
}

/* ==========================================================================
   Game Cards & Grid
   ========================================================================== */
.game-grid-item {
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
}

.game-card {
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.22s ease, box-shadow 0.22s ease;
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 12px 24px -6px rgba(99, 102, 241, 0.18);
}

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

.game-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}

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

/* Category Filter Tabs Scrollbar */
.category-scrollbar::-webkit-scrollbar {
  height: 4px;
}
.category-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

/* Iframe Game Player Responsive Container */
.game-iframe-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-iframe-wrapper.portrait-mode {
  aspect-ratio: 9 / 16;
  max-width: 460px;
  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;
}

/* Toast Notification */
#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 (WCAG 2.1 Compliant) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.1s !important;
    scroll-behavior: auto !important;
  }

  .hero-slide-item {
    transition: opacity 0.15s ease !important;
    transform: none !important;
  }

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

  .game-thumb-img {
    transition: opacity 0.15s ease !important;
    transform: none !important;
  }

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

/* ==========================================================================
   Mobile & Device Adaptation (Safe Area & Touch Ergonomics)
   ========================================================================== */

/* Safe Area Insets (Notch, Home Bar on iOS & Modern Android) */
body {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

footer {
  padding-bottom: max(2rem, calc(1.5rem + env(safe-area-inset-bottom, 0px)));
}

/* Touch Screen Ergonomics (Coarse Pointer) */
@media (pointer: coarse) {
  .category-tab-btn {
    min-height: 44px;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Hilangkan flash highlight biru default pada perangkat mobile webkit */
  button, a {
    -webkit-tap-highlight-color: transparent;
  }
}