/**
 * Chrome Theme Pro 2.0 - Skeleton Loaders
 * CSS-only loading state components
 */

/* ========================================
   BASE SKELETON STYLES
   ======================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 0%,
    rgba(255, 255, 255, 0.06) 20%,
    rgba(255, 255, 255, 0.1) 40%,
    rgba(255, 255, 255, 0.06) 60%,
    rgba(255, 255, 255, 0.03) 100%
  );
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-md, 8px);
  position: relative;
  overflow: hidden;
}

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

/* Dark variant */
.skeleton-dark {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(0, 0, 0, 0.15) 20%,
    rgba(0, 0, 0, 0.2) 40%,
    rgba(0, 0, 0, 0.15) 60%,
    rgba(0, 0, 0, 0.1) 100%
  );
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

/* Glow variant (for dark themes) */
.skeleton-glow {
  background: linear-gradient(
    90deg,
    rgba(var(--sf-primary-rgb, 122, 162, 255), 0.05) 0%,
    rgba(var(--sf-primary-rgb, 122, 162, 255), 0.1) 40%,
    rgba(var(--sf-primary-rgb, 122, 162, 255), 0.05) 100%
  );
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}


/* ========================================
   SKELETON SHAPES
   ======================================== */

.skeleton-text {
  height: 14px;
  border-radius: var(--radius-sm, 4px);
}

.skeleton-text-sm {
  height: 12px;
  border-radius: var(--radius-sm, 4px);
}

.skeleton-text-lg {
  height: 18px;
  border-radius: var(--radius-sm, 4px);
}

.skeleton-title {
  height: 24px;
  border-radius: var(--radius-md, 8px);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full, 9999px);
  flex-shrink: 0;
}

.skeleton-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full, 9999px);
}

.skeleton-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full, 9999px);
}

.skeleton-button {
  height: 40px;
  border-radius: var(--radius-lg, 12px);
  min-width: 100px;
}

.skeleton-button-sm {
  height: 32px;
  border-radius: var(--radius-md, 8px);
  min-width: 80px;
}

.skeleton-image {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg, 12px);
}

.skeleton-image-wide {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg, 12px);
}

.skeleton-image-portrait {
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-lg, 12px);
}

.skeleton-badge {
  height: 24px;
  width: 60px;
  border-radius: var(--radius-full, 9999px);
}


/* ========================================
   PRODUCT CARD SKELETON
   ======================================== */

.skeleton-product-card {
  background: var(--sf-card-bg, rgba(11, 19, 41, 0.45));
  border: 1px solid var(--sf-glass-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--sf-radius, 18px);
  overflow: hidden;
  padding: 0;
}

.skeleton-product-card .skeleton-product-image {
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: 0;
}

.skeleton-product-card .skeleton-product-content {
  padding: var(--space-4, 16px);
}

.skeleton-product-card .skeleton-product-title {
  height: 20px;
  width: 85%;
  margin-bottom: var(--space-2, 8px);
}

.skeleton-product-card .skeleton-product-subtitle {
  height: 14px;
  width: 60%;
  margin-bottom: var(--space-4, 16px);
}

.skeleton-product-card .skeleton-product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3, 12px);
}

.skeleton-product-card .skeleton-product-price {
  height: 24px;
  width: 70px;
}

.skeleton-product-card .skeleton-product-button {
  height: 36px;
  width: 90px;
  border-radius: var(--radius-lg, 12px);
}


/* ========================================
   CHAT MESSAGE SKELETON
   ======================================== */

.skeleton-chat-message {
  display: flex;
  gap: var(--space-3, 12px);
  padding: var(--space-3, 12px);
  max-width: 80%;
}

.skeleton-chat-message.user {
  margin-inline-start: auto;
  flex-direction: row-reverse;
}

.skeleton-chat-message .skeleton-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full, 9999px);
  flex-shrink: 0;
}

.skeleton-chat-message .skeleton-chat-bubble {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 8px);
  background: rgba(255, 255, 255, 0.05);
  padding: var(--space-3, 12px) var(--space-4, 16px);
  border-radius: var(--radius-xl, 16px);
}

.skeleton-chat-message .skeleton-chat-line {
  height: 14px;
  border-radius: var(--radius-sm, 4px);
}

.skeleton-chat-message .skeleton-chat-line:last-child {
  width: 70%;
}


/* ========================================
   LIST ITEM SKELETON
   ======================================== */

.skeleton-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-4, 16px);
  padding: var(--space-3, 12px);
}

.skeleton-list-item .skeleton-list-image {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md, 8px);
  flex-shrink: 0;
}

.skeleton-list-item .skeleton-list-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 8px);
}

.skeleton-list-item .skeleton-list-title {
  height: 16px;
  width: 70%;
}

.skeleton-list-item .skeleton-list-subtitle {
  height: 12px;
  width: 50%;
}


/* ========================================
   CART ITEM SKELETON
   ======================================== */

.skeleton-cart-item {
  display: flex;
  gap: var(--space-3, 12px);
  padding: var(--space-3, 12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.skeleton-cart-item .skeleton-cart-image {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md, 8px);
  flex-shrink: 0;
}

.skeleton-cart-item .skeleton-cart-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.skeleton-cart-item .skeleton-cart-name {
  height: 16px;
  width: 80%;
}

.skeleton-cart-item .skeleton-cart-price {
  height: 14px;
  width: 40%;
}

.skeleton-cart-item .skeleton-cart-qty {
  height: 32px;
  width: 100px;
  border-radius: var(--radius-md, 8px);
}


/* ========================================
   HEADER SKELETON
   ======================================== */

.skeleton-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4, 16px);
  gap: var(--space-4, 16px);
}

.skeleton-header .skeleton-logo {
  width: 120px;
  height: 40px;
  border-radius: var(--radius-md, 8px);
}

.skeleton-header .skeleton-nav {
  display: flex;
  gap: var(--space-4, 16px);
}

.skeleton-header .skeleton-nav-item {
  width: 60px;
  height: 16px;
}


/* ========================================
   HERO SKELETON
   ======================================== */

.skeleton-hero {
  aspect-ratio: 21 / 9;
  min-height: 300px;
  border-radius: var(--sf-radius, 18px);
  position: relative;
  overflow: hidden;
}

.skeleton-hero .skeleton-hero-content {
  position: absolute;
  bottom: var(--space-8, 32px);
  left: var(--space-8, 32px);
  right: var(--space-8, 32px);
  display: flex;
  flex-direction: column;
  gap: var(--space-3, 12px);
}

.skeleton-hero .skeleton-hero-title {
  height: 40px;
  width: 60%;
  border-radius: var(--radius-md, 8px);
}

.skeleton-hero .skeleton-hero-subtitle {
  height: 20px;
  width: 40%;
  border-radius: var(--radius-md, 8px);
}

.skeleton-hero .skeleton-hero-button {
  height: 48px;
  width: 150px;
  border-radius: var(--radius-lg, 12px);
  margin-top: var(--space-4, 16px);
}


/* ========================================
   FORM SKELETON
   ======================================== */

.skeleton-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4, 16px);
}

.skeleton-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 8px);
}

.skeleton-form-label {
  height: 14px;
  width: 100px;
}

.skeleton-form-input {
  height: 44px;
  border-radius: var(--radius-lg, 12px);
}

.skeleton-form-textarea {
  height: 100px;
  border-radius: var(--radius-lg, 12px);
}

.skeleton-form-submit {
  height: 48px;
  border-radius: var(--radius-lg, 12px);
  margin-top: var(--space-4, 16px);
}


/* ========================================
   GRID LAYOUTS
   ======================================== */

.skeleton-grid {
  display: grid;
  gap: var(--space-4, 16px);
}

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

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

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

@media (max-width: 768px) {
  .skeleton-grid-3,
  .skeleton-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .skeleton-grid-2,
  .skeleton-grid-3,
  .skeleton-grid-4 {
    grid-template-columns: 1fr;
  }
}


/* ========================================
   ANIMATION VARIANTS
   ======================================== */

/* Wave animation variant */
.skeleton-wave {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.03) 100%
  );
  background-size: 200% 100%;
  animation: skeletonWave 1.8s ease-in-out infinite;
}

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

/* Fade animation variant */
.skeleton-fade {
  animation: skeletonFade 1.5s ease-in-out infinite alternate;
}

@keyframes skeletonFade {
  from {
    opacity: 0.4;
  }
  to {
    opacity: 0.8;
  }
}


/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .skeleton-dark,
  .skeleton-glow,
  .skeleton-wave,
  .skeleton-fade {
    animation: none !important;
    background: rgba(255, 255, 255, 0.06);
  }

  .skeleton-dark {
    background: rgba(0, 0, 0, 0.1);
  }
}


/* ========================================
   HIDE WHEN LOADED
   ======================================== */

.skeleton-container[data-loaded="true"] .skeleton,
.skeleton-container.loaded .skeleton {
  display: none;
}

.skeleton-container[data-loaded="true"] .skeleton-hidden-until-load,
.skeleton-container.loaded .skeleton-hidden-until-load {
  display: block;
}

.skeleton-hidden-until-load {
  display: none;
}
