/* ==========================================================================
   PEPTIDESTX DESIGN SYSTEM — EMPTY, LOADING & SKELETON STATES
   ========================================================================== */

/* ---------------------------------------------------------------------
   EMPTY STATE
   Purpose: no-results / empty-cart / no-saved-COAs moments. Per the
   frontend-design principle, treated as "an invitation to act," not an
   apology — plain, direct, one clear next step.
   --------------------------------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-24) var(--space-6);
  max-width: 400px;
  margin-inline: auto;
}

.empty-state__icon {
  width: 40px;
  height: 40px;
  color: var(--color-graphite-300);
  margin-bottom: var(--space-6);
}

.empty-state__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  color: var(--color-obsidian);
  margin-bottom: var(--space-2);
}

.empty-state__text {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 22px;
  color: var(--color-graphite-500);
  margin-bottom: var(--space-6);
}

@media (max-width: 480px) {
  .empty-state {
    padding: var(--space-16) var(--space-4);
  }
}

/* ---------------------------------------------------------------------
   LOADING STATE (inline spinner / button loading)
   --------------------------------------------------------------------- */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-graphite-border-light-strong);
  border-top-color: var(--color-royal-violet);
  border-radius: 50%;
  animation: spinner-rotate 700ms linear infinite;
}

.spinner--on-dark {
  border-color: var(--color-graphite-border-dark);
  border-top-color: var(--color-white);
}

@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}

.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--color-white);
  border-radius: 50%;
  animation: spinner-rotate 700ms linear infinite;
}

.btn--primary-light.is-loading::after {
  border-color: rgba(11, 13, 15, 0.25);
  border-top-color: var(--color-obsidian);
}

@media (prefers-reduced-motion: reduce) {
  .spinner,
  .btn.is-loading::after {
    animation-duration: 1.4s;
  }
}

/* ---------------------------------------------------------------------
   SKELETON LOADER
   Purpose: content-shape placeholders for cards/tables while data
   (esp. live COA/batch lookups) resolves — quiet shimmer, never a
   flashy pulse, consistent with brand motion restraint.
   --------------------------------------------------------------------- */

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--color-cloud-grey);
  border-radius: var(--radius-sm);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent
  );
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after {
    animation: none;
    display: none;
  }
  .skeleton {
    background: var(--color-graphite-border-light);
  }
}

/* Skeleton primitives, composed to match real component shapes */
.skeleton--text {
  height: 14px;
  margin-bottom: 8px;
  width: 100%;
}

.skeleton--text.is-short {
  width: 40%;
}

.skeleton--title {
  height: 20px;
  width: 60%;
  margin-bottom: 12px;
}

.skeleton--image {
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: var(--radius-md);
}

.skeleton--badge {
  height: 22px;
  width: 90px;
  border-radius: var(--radius-sm);
}

/* Pre-composed skeleton card matching .product-card's structure exactly,
   so the loading→loaded transition doesn't cause layout shift. */
.product-card-skeleton {
  width: 288px;
  border: 1px solid var(--color-graphite-border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.product-card-skeleton__body {
  padding: var(--space-5);
}

@media (max-width: 767px) {
  .product-card-skeleton {
    width: 100%;
  }
}
