/* ========================================
   SISTEM LOADING
   Skeleton, Indikator Progress, Spinner
   ======================================== */

/* === LOADING OVERLAY === */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-smooth);
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* === LOADING SPINNER === */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #00f2ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-lg {
  width: 64px;
  height: 64px;
  border-width: 5px;
}

.spinner-sm {
  width: 24px;
  height: 24px;
  border-width: 3px;
}

/* Spinner Cincin Ganda */
.spinner-dual {
  display: inline-block;
  width: 64px;
  height: 64px;
}

.spinner-dual:after {
  content: " ";
  display: block;
  width: 48px;
  height: 48px;
  margin: 8px;
  border-radius: 50%;
  border: 5px solid #00f2ff;
  border-color: #00f2ff transparent #00f2ff transparent;
  animation: spin 1.2s linear infinite;
}

/* === PROGRESS BAR === */
.progress-bar-container {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #00f2ff, #00ff88);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-smooth);
  position: relative;
  overflow: hidden;
}

/* Efek Kilau di Progress */
.progress-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

/* Progress Gak Jelas (Indeterminate) */
.progress-bar.indeterminate {
  width: 40% !important;
  animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(350%);
  }
}

/* === SKELETON SCREENS (Bayangan Loading) === */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

/* Varian Skeleton */
.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-sm);
}

.skeleton-text:last-child {
  width: 80%;
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
}

.skeleton-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
}

.skeleton-card {
  height: 200px;
  border-radius: var(--radius-lg);
}

.skeleton-button {
  height: var(--button-height);
  width: 120px;
  border-radius: var(--radius-md);
}

/* === SKELETON KARTU GAME === */
.game-card-skeleton {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.game-card-skeleton .skeleton-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

/* === TEKS LOADING === */
.loading-text {
  color: #fff;
  font-size: var(--font-lg);
  font-weight: var(--fw-semibold);
  margin-top: var(--space-lg);
  text-align: center;
  animation: pulse 1.5s ease-in-out infinite;
}

.loading-dots::after {
  content: "";
  animation: loading-dots 1.5s steps(4) infinite;
}

@keyframes loading-dots {
  0%,
  20% {
    content: "";
  }
  40% {
    content: ".";
  }
  60% {
    content: "..";
  }
  80%,
  100% {
    content: "...";
  }
}

/* === PROGRESS LINGKARAN === */
.circular-progress {
  width: 80px;
  height: 80px;
  position: relative;
}

.circular-progress svg {
  transform: rotate(-90deg);
}

.circular-progress circle {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--duration-slow) var(--ease-smooth);
}

.circular-progress .progress-bg {
  stroke: rgba(255, 255, 255, 0.1);
}

.circular-progress .progress-bar {
  stroke: url(#gradient);
  stroke-dasharray: 251.2; /* 2 * PI * 40 */
  stroke-dashoffset: 251.2;
}

.circular-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--font-lg);
  font-weight: var(--fw-bold);
  color: #fff;
}

/* === EFEK SHIMMER (untuk gambar) === */
.shimmer {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
}

.shimmer::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shimmer 2s infinite;
}

/* === TOMBOL LOADING === */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* === TRANSISI HALAMAN === */
.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: all var(--duration-slow) var(--ease-smooth);
}

.page-transition-exit {
  opacity: 1;
}

.page-transition-exit-active {
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-smooth);
}

/* === LODAING MANTUL (Ceria) === */
.loading-bounce {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

.loading-bounce span {
  width: 12px;
  height: 12px;
  background: #00f2ff;
  border-radius: 50%;
  animation: bounce-loading 1.4s infinite ease-in-out both;
}

.loading-bounce span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-bounce span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce-loading {
  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* === RESPONSIF === */
@media (max-width: 768px) {
  .loading-text {
    font-size: var(--font-md);
  }

  .spinner-lg {
    width: 48px;
    height: 48px;
  }
}
