/* ============================================================
   MODERN UI POLISH (Fase 5)
   Polesan visual: gradien, hover, focus, skeleton - tanpa
   mengubah struktur HTML atau logika JS.
   ============================================================ */

/* ---------- Game Card ---------- */
.game-card {
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.game-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, transparent, transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.game-card:hover::before {
  opacity: 1;
  background: linear-gradient(135deg, #a855f7, #ec4899, #f59e0b);
}

.game-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 48px rgba(139, 92, 246, 0.18), 0 8px 16px rgba(0, 0, 0, 0.08);
}

.game-icon {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(236, 72, 153, 0.12));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.game-icon img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  transition: transform 0.25s ease;
}

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

.game-card h3 {
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: background 0.25s ease;
}

.game-card:hover h3 {
  background: linear-gradient(135deg, #a855f7, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.game-card .mt-4 .text-sm {
  background: linear-gradient(135deg, #a855f7, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(236, 72, 153, 0.12));
  border: 1px solid rgba(168, 85, 247, 0.25);
  display: inline-block;
}

/* ---------- Category Chips ---------- */
.filter-chip {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  transition: all 0.2s ease;
}

.filter-chip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.filter-chip.aktif {
  color: white;
  border-color: transparent;
}

.filter-chip.aktif::before {
  opacity: 1;
  z-index: -1;
}

.filter-chip:not(.aktif):hover {
  border-color: #a855f7;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.15);
}

/* ---------- Buttons ---------- */
.btn-primary,
button.bg-purple-600,
button[type="submit"].bg-purple-600,
#submit-btn,
.pay-copy-btn {
  position: relative;
  background: linear-gradient(135deg, #a855f7, #7c3aed) !important;
  border: none;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-primary::before,
button.bg-purple-600::before,
#submit-btn::before,
.pay-copy-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #ec4899, #f59e0b);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.btn-primary:hover,
button.bg-purple-600:hover,
#submit-btn:hover,
.pay-copy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(168, 85, 247, 0.35);
  filter: brightness(1.05);
}

.btn-primary:active,
button.bg-purple-600:active,
#submit-btn:active,
.pay-copy-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.25);
}

.promo-tombol {
  background: linear-gradient(135deg, #a855f7, #7c3aed) !important;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.promo-tombol:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(168, 85, 247, 0.3);
}

.promo-tombol.lembut {
  background: transparent !important;
  border: 2px solid #a855f7 !important;
  color: #a855f7 !important;
}

.promo-tombol.lembut:hover {
  background: rgba(168, 85, 247, 0.1) !important;
  box-shadow: 0 8px 20px rgba(168, 85, 247, 0.15);
}

/* ---------- Inputs & Focus Rings ---------- */
input[type="text"],
input[type="tel"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25), 0 0 0 1px #a855f7;
  background: var(--bg-primary);
}

#search-katalog:focus {
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2), 0 0 0 1px #a855f7;
}

.promo-input:focus {
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25), 0 0 0 1px #a855f7;
}

/* ---------- Modal Polish ---------- */
#topup-modal,
#login-modal,
#register-modal {
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#topup-modal .modal-backdrop,
#login-modal .modal-backdrop,
#register-modal .modal-backdrop {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.6), rgba(15, 23, 42, 0.85));
  backdrop-filter: blur(8px);
}

#topup-form > div.mb-6:first-child,
#topup-form > div.mb-6:nth-child(2) {
  position: relative;
}

#topup-form > div.mb-6:first-child::before,
#topup-form > div.mb-6:nth-child(2)::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #a855f7, #ec4899);
  opacity: 0.6;
}

/* ---------- Navigation ---------- */
.nav-link {
  transition: color 0.2s ease;
}

.nav-link.active {
  position: relative;
}

.nav-link.active::after {
  box-shadow: 0 0 8px #a855f7, 0 0 16px rgba(168, 85, 247, 0.5);
}

/* ---------- Payment View ---------- */
#payment-success-view {
  animation: paymentViewIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes paymentViewIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#pay-promo {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.02));
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* ---------- Skeleton Loading ---------- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--border-color) 25%,
    rgba(168, 85, 247, 0.1) 50%,
    var(--border-color) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 12px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-card {
  display: grid;
  grid-template-rows: 72px 28px 16px 24px;
  gap: 12px;
  padding: 24px;
}

.skeleton-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  margin: 0 auto;
}

.skeleton-title {
  height: 28px;
  border-radius: 6px;
  width: 80%;
  margin: 0 auto;
}

.skeleton-desc {
  height: 16px;
  border-radius: 4px;
  width: 60%;
  margin: 0 auto;
}

.skeleton-price {
  height: 24px;
  border-radius: 6px;
  width: 50%;
  margin: 0 auto;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #a855f7, #ec4899);
  border-radius: 4px;
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #9333ea, #db2777);
}

::-webkit-scrollbar-corner {
  background: var(--bg-primary);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #a855f7 var(--bg-primary);
}

/* ---------- Toast ---------- */
.toast-container {
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0) translateY(0);
  }
}

/* ---------- Selection ---------- */
::selection {
  background: rgba(168, 85, 247, 0.3);
  color: var(--text-primary);
}

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

/* ---------- Dark Mode Tweaks ---------- */
[data-theme="dark"] .game-card::before {
  background: linear-gradient(135deg, transparent, transparent);
}

[data-theme="dark"] .game-card:hover::before {
  background: linear-gradient(135deg, #a855f7, #ec4899, #f59e0b);
}

[data-theme="dark"] .game-icon {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(236, 72, 153, 0.18));
}

[data-theme="dark"] .filter-chip {
  background: var(--bg-card);
  border-color: var(--border-color);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.3), 0 0 0 1px #a855f7;
}

[data-theme="dark"] .promo-tombol.lembut {
  border-color: #a855f7 !important;
  color: #a855f7 !important;
}

[data-theme="dark"] .promo-tombol.lembut:hover {
  background: rgba(168, 85, 247, 0.15) !important;
}

[data-theme="dark"] #pay-promo {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.03));
  border-color: rgba(34, 197, 94, 0.3);
}

/* Jumbotron dark mode fix */
[data-theme="dark"] .jumbotron-custom {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(236, 72, 153, 0.25));
  color: #f1f5f9;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .jumbotron-desc {
  color: rgba(241, 245, 249, 0.85);
}

[data-theme="dark"] .jumbotron-btn-outline:hover {
  background-color: #1e293b;
  color: #a855f7;
}

/* Jumbotron full-width override */
.jumbotron-custom {
  max-width: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  padding: 5rem 2rem !important;
}

.jumbotron-content {
  max-width: 1440px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .jumbotron-custom {
    padding: 3rem 1.5rem !important;
  }
  .jumbotron-title {
    font-size: 2rem !important;
  }
  .jumbotron-character-wrapper {
    display: none;
  }
}