/* ==========================================================================
   xmain.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;
  }
}

/* ==========================================================================
   MOBILE APP EXPERIENCE (2026) — Bottom Navigation, Sheets, Favorites
   ========================================================================== */

:root {
  --bottom-nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 1023px) {
  body {
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 6px);
  }

  #toast-container {
    top: auto;
    bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 14px);
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }
}

/* ---------- Bottom Navigation Bar ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-top: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 -10px 28px -12px rgba(15, 23, 42, 0.18);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.bottom-nav.is-hidden {
  transform: translateY(calc(100% + 6px));
}

.bottom-nav-item {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 2px;
  border: 0;
  background: transparent;
  border-radius: 14px;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:active {
  transform: scale(0.94);
}

.bottom-nav-item .nav-ico {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.bottom-nav-item .nav-label {
  display: block;
  line-height: 1;
}

.bottom-nav-item.is-active,
.bottom-nav-item[aria-current="page"] {
  color: #0284c7;
}

.bottom-nav-item.is-active .nav-ico,
.bottom-nav-item[aria-current="page"] .nav-ico {
  background: #e0f2fe;
  color: #0284c7;
}

.bottom-nav-item.is-active::after,
.bottom-nav-item[aria-current="page"]::after {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0ea5e9, #6366f1);
}

.nav-avatar {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav-badge {
  position: absolute;
  top: -4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #f43f5e;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(244, 63, 94, 0.45);
}

/* ---------- Bottom Sheet ---------- */
.bottom-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: block;
}

.bottom-sheet[hidden] {
  display: none !important;
}

.bottom-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.bottom-sheet.is-open .bottom-sheet-backdrop {
  opacity: 1;
}

.bottom-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 16px calc(16px + var(--safe-bottom));
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -24px 48px -16px rgba(15, 23, 42, 0.3);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-sheet.is-open .bottom-sheet-panel {
  transform: translateY(0);
}

.bottom-sheet-grabber {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: #e2e8f0;
  margin: 0 auto 12px;
}

.sheet-close-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: #64748b;
  background: #f1f5f9;
  border: 0;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.sheet-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.sheet-category-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 9px 11px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
}

.sheet-category-link:active {
  transform: scale(0.97);
}

.sheet-category-link.is-active {
  background: #f0f9ff;
  border-color: #7dd3fc;
}

.sheet-category-ico {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e0f2fe;
  color: #0284c7;
}

.sheet-menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.sheet-menu-link:hover {
  background: #f8fafc;
}

.sheet-menu-ico {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ---------- Favorite Button ---------- */
.favorite-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #64748b;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.favorite-btn:active {
  transform: scale(0.88);
}

.favorite-btn .favorite-icon-on {
  display: none;
}

.favorite-btn.is-favorite {
  color: #f43f5e;
  background: #fff1f2;
}

.favorite-btn.is-favorite .favorite-icon-off {
  display: none;
}

.favorite-btn.is-favorite .favorite-icon-on {
  display: block;
}

/* ---------- Card Play Overlay (Hover desktop / selalu tampil di touch) ---------- */
.card-play-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  opacity: 0;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  transition: opacity 0.22s ease;
}

.game-card:hover .card-play-overlay,
.game-card:focus-within .card-play-overlay {
  opacity: 1;
}

.card-play-overlay .play-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 12px;
  background: #0ea5e9;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 0 12px 24px -8px rgba(2, 132, 199, 0.6);
  transform: scale(0.9);
  transition: transform 0.22s ease, background-color 0.2s ease;
}

.game-card:hover .card-play-overlay .play-pill {
  transform: scale(1);
}

@media (hover: none) {
  .card-play-overlay {
    align-items: flex-end;
    justify-content: flex-end;
    padding: 8px;
    opacity: 1;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.55) 0%, rgba(15, 23, 42, 0) 58%);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .card-play-overlay .play-pill {
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 11px;
    transform: none;
  }

  .game-card:hover .card-play-overlay .play-pill {
    transform: none;
  }

  .game-card:active {
    transform: scale(0.985);
  }
}

/* ---------- Horizontal Snap Row (Mobile) ---------- */
.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-none::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

@media (max-width: 767px) {
  .game-row-mobile.grid,
  .game-row-mobile {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 16px;
    -webkit-overflow-scrolling: touch;
    margin-inline: -16px;
    padding: 2px 16px 8px;
  }

  .game-row-mobile > * {
    flex: 0 0 46%;
    max-width: 46%;
    scroll-snap-align: start;
  }

  .game-row-mobile > * {
    margin-left: 0;
  }
}

/* ---------- Mobile Hero Compact ---------- */
@media (max-width: 1023px) {
  .hero-slider-wrapper {
    border-radius: 18px;
  }

  .hero-slider-track {
    min-height: 300px;
  }

  .hero-slide h1,
  .hero-slide h2 {
    line-height: 1.15;
  }
}

@media (max-width: 420px) {
  .hero-slider-track {
    min-height: 320px;
  }
}

/* Login modal harus berada di atas bottom sheet */
#login-modal {
  z-index: 70;
}

/* ---------- Misc Mobile Polish ---------- */
@media (max-width: 1023px) {
  .hero-slider-dot {
    min-width: 8px;
    min-height: 8px;
  }

  /* Kompensasi sticky header mobile (h-14 = 56px) + jarak aman anchor */
  .section-anchor {
    scroll-margin-top: 72px;
  }
}

