/**
 * UX Enhancement Styles
 * - Skeleton loading animations
 * - Button loading states
 * - Global loading indicator
 */

/* ========== Skeleton Loading ========== */
.skeleton {
  background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}

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

/* Skeleton card for lottery results */
.skeleton-card {
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.skeleton-card .skeleton-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.skeleton-card .skeleton-logo {
  width: 80px;
  height: 30px;
}

.skeleton-card .skeleton-date {
  width: 100px;
  height: 20px;
}

.skeleton-card .skeleton-prizes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.skeleton-card .skeleton-prize {
  height: 50px;
}

.skeleton-card .skeleton-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skeleton-card .skeleton-number {
  width: 50px;
  height: 30px;
}

/* Skeleton table row */
.skeleton-table-row {
  display: flex;
  gap: 1rem;
  padding: 0.8rem;
  border-bottom: 1px solid #222;
}

.skeleton-table-row .skeleton-cell {
  height: 24px;
  flex: 1;
}

.skeleton-table-row .skeleton-cell-sm {
  width: 60px;
  flex: none;
}

.skeleton-table-row .skeleton-cell-lg {
  flex: 2;
}

/* Skeleton text lines */
.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-text-sm {
  height: 12px;
  width: 60%;
}

.skeleton-text-lg {
  height: 20px;
}

/* Skeleton grid for multi-company */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.8rem;
}

.skeleton-grid-item {
  height: 80px;
  border-radius: 6px;
}

/* ========== Button Loading States ========== */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-top: -8px;
  margin-left: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btn-spin 0.8s linear infinite;
}

.btn-loading span,
.btn-loading .btn-text {
  visibility: hidden;
}

@keyframes btn-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Button with inline spinner */
.btn-with-spinner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btn-spin 0.8s linear infinite;
}

.btn-with-spinner.loading .btn-spinner {
  display: inline-block;
}

.btn-with-spinner.loading {
  pointer-events: none;
  opacity: 0.8;
}

/* ========== Global Loading Indicator ========== */
.global-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.global-loader.active {
  opacity: 1;
}

.global-loader::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 30%;
  height: 100%;
  background: linear-gradient(90deg, #FFAE00, #FFD700);
  animation: global-loader-move 1s ease-in-out infinite;
}

@keyframes global-loader-move {
  0% { left: -30%; }
  50% { left: 100%; }
  100% { left: -30%; }
}

/* ========== Loading Overlay ========== */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top-color: #FFAE00;
  border-radius: 50%;
  animation: btn-spin 0.8s linear infinite;
}

/* ========== Pulse Animation for Numbers ========== */
.number-pulse {
  animation: number-pulse 0.3s ease-out;
}

@keyframes number-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ========== Fade In Animation ========== */
.fade-in {
  animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== Stagger Animation for List Items ========== */
.stagger-item {
  opacity: 0;
  animation: fade-in 0.3s ease-out forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.4s; }
.stagger-item:nth-child(9) { animation-delay: 0.45s; }
.stagger-item:nth-child(10) { animation-delay: 0.5s; }

/* ========== Mobile Responsive ========== */
@media (max-width: 480px) {
  .skeleton-card .skeleton-prizes {
    grid-template-columns: 1fr;
  }

  .skeleton-card .skeleton-number {
    width: 45px;
    height: 28px;
  }

  .skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}