/* ============================================
   F9XR Skeleton Loading System
   Design System: Carbon-Black Theme
   ============================================ */

.skel {
  position: relative;
  background: linear-gradient(90deg, rgba(52,58,64,0.25) 25%, rgba(52,58,64,0.45) 50%, rgba(52,58,64,0.25) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.5s ease-in-out infinite;
  border-radius: 0.375rem;
  pointer-events: none;
  user-select: none;
}

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

.skel-inline {
  display: inline-block;
}

.skel-title {
  height: 2.5rem;
  width: 65%;
  margin-bottom: 1rem;
}

.skel-title--sm {
  height: 1.5rem;
  width: 40%;
}

.skel-title--lg {
  height: 4rem;
  width: 75%;
}

.skel-text {
  height: 0.875rem;
  width: 100%;
  margin-bottom: 0.625rem;
}

.skel-text:last-child {
  width: 60%;
}

.skel-text--sm {
  height: 0.6875rem;
  width: 50%;
}

.skel-text--narrow {
  width: 35%;
}

.skel-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.skel-avatar--sm {
  width: 2rem;
  height: 2rem;
}

.skel-avatar--lg {
  width: 4.5rem;
  height: 4.5rem;
}

.skel-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0.75rem;
}

.skel-thumb--square {
  aspect-ratio: 1 / 1;
}

.skel-thumb--portrait {
  aspect-ratio: 3 / 4;
}

.skel-btn {
  height: 3rem;
  width: 10rem;
  border-radius: 9999px;
}

.skel-btn--sm {
  height: 2.25rem;
  width: 7rem;
}

.skel-btn--lg {
  height: 3.5rem;
  width: 14rem;
}

.skel-badge {
  height: 1.5rem;
  width: 5rem;
  border-radius: 9999px;
}

.skel-badge--sm {
  height: 1.25rem;
  width: 3.5rem;
}

.skel-card {
  border-radius: 1.5rem;
  padding: 1.5rem;
  background: rgba(52, 58, 64, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.skel-card .skel:not(.skel-card) {
  background: linear-gradient(90deg, rgba(52,58,64,0.35) 25%, rgba(52,58,64,0.55) 50%, rgba(52,58,64,0.35) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.5s ease-in-out infinite;
}

.skel-table-row {
  display: flex;
  gap: 1rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  align-items: center;
}

.skel-table-row .skel-text {
  margin-bottom: 0;
}

.skel-table-row:last-child {
  border-bottom: none;
}

.skel-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
}

.skel-icon--sm {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
}

.skel-icon--lg {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
}

.skel-stat {
  height: 4rem;
  width: 6rem;
  border-radius: 0.5rem;
}

.skel-stat--lg {
  height: 5rem;
  width: 8rem;
}

/* --- Page Loader Overlay --- */
.skel-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #212529;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.skel-overlay.skel-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.skel-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.skel-overlay-logo {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(90deg, rgba(52,58,64,0.3) 25%, rgba(52,58,64,0.5) 50%, rgba(52,58,64,0.3) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.5s ease-in-out infinite;
  margin-bottom: 0.5rem;
}

.skel-overlay-bar {
  width: 12rem;
  height: 0.375rem;
  border-radius: 9999px;
  background: rgba(52, 58, 64, 0.4);
  overflow: hidden;
  position: relative;
}

.skel-overlay-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  border-radius: 9999px;
  background: rgba(59, 130, 246, 0.5);
  animation: skel-bar 1.5s ease-in-out infinite;
}

@keyframes skel-bar {
  0% { left: -40%; }
  100% { left: 100%; }
}

.skel-overlay-label {
  font-size: 0.75rem;
  color: rgba(248, 249, 250, 0.35);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* --- Content Skeleton Zones --- */
.skel-zone {
  padding: 2rem 1rem;
}

.skel-zone-hero {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
  gap: 1.5rem;
}

.skel-zone-hero .skel-badge {
  width: 8rem;
}

.skel-zone-hero .skel-title--lg {
  width: 55%;
}

.skel-zone-hero .skel-text {
  width: 40%;
}

.skel-zone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 2rem 1rem;
}

.skel-zone-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  padding: 2rem 1rem;
  flex-wrap: wrap;
}

/* --- Light Mode --- */
html.light-mode .skel {
  background: linear-gradient(90deg, rgba(200,200,205,0.3) 25%, rgba(200,200,205,0.5) 50%, rgba(200,200,205,0.3) 75%);
  background-size: 200% 100%;
}

html.light-mode .skel-card {
  background: rgba(240, 240, 245, 0.5);
  border-color: rgba(0, 0, 0, 0.05);
}

html.light-mode .skel-card .skel:not(.skel-card) {
  background: linear-gradient(90deg, rgba(200,200,205,0.4) 25%, rgba(200,200,205,0.6) 50%, rgba(200,200,205,0.4) 75%);
  background-size: 200% 100%;
}

html.light-mode .skel-overlay {
  background: #f8f9fa;
}

html.light-mode .skel-overlay-logo {
  background: linear-gradient(90deg, rgba(200,200,205,0.3) 25%, rgba(200,200,205,0.5) 50%, rgba(200,200,205,0.3) 75%);
  background-size: 200% 100%;
}

html.light-mode .skel-overlay-bar {
  background: rgba(200, 200, 205, 0.5);
}

html.light-mode .skel-overlay-label {
  color: rgba(0, 0, 0, 0.3);
}

html.light-mode .skel-table-row {
  border-bottom-color: rgba(0, 0, 0, 0.05);
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .skel,
  .skel-card .skel:not(.skel-card),
  .skel-overlay-logo {
    animation: none;
  }

  .skel-overlay-bar::after {
    animation: none;
    left: 0;
    width: 60%;
  }

  .skel-overlay {
    transition: opacity 0.15s ease;
  }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .skel-zone-hero .skel-title--lg {
    width: 80%;
  }

  .skel-zone-hero .skel-text {
    width: 70%;
  }

  .skel-zone-stats {
    gap: 1.5rem;
  }

  .skel-title--lg {
    height: 3rem;
  }

  .skel-stat--lg {
    height: 4rem;
    width: 6rem;
  }
}

@media (max-width: 480px) {
  .skel-title {
    height: 2rem;
  }

  .skel-title--lg {
    height: 2.5rem;
  }
}
