/**
 * Skeleton Loading Animations
 */

/* Skeleton Base */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-skeleton, #e5e7eb) 25%,
    var(--color-skeleton-highlight, #f3f4f6) 50%,
    var(--color-skeleton, #e5e7eb) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite ease-in-out;
  border-radius: var(--radius-sm);
}

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

/* Skeleton Shapes */
.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
  margin-bottom: 0;
}

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

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

.skeleton-text-xl {
  height: 24px;
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: var(--space-3);
}

.skeleton-paragraph {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.skeleton-paragraph .skeleton-text:nth-child(1) {
  width: 100%;
}

.skeleton-paragraph .skeleton-text:nth-child(2) {
  width: 90%;
}

.skeleton-paragraph .skeleton-text:nth-child(3) {
  width: 75%;
}

/* Circle Skeleton */
.skeleton-circle {
  border-radius: var(--radius-full);
}

.skeleton-avatar-sm {
  width: 32px;
  height: 32px;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
}

.skeleton-avatar-lg {
  width: 64px;
  height: 64px;
}

.skeleton-avatar-xl {
  width: 100px;
  height: 100px;
}

/* Rectangle Skeleton */
.skeleton-rect {
  width: 100%;
}

.skeleton-image {
  height: 180px;
  border-radius: var(--radius-lg);
}

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

.skeleton-banner {
  height: 200px;
  border-radius: var(--radius-xl);
}

/* Button Skeleton */
.skeleton-button {
  height: 40px;
  width: 120px;
  border-radius: var(--radius-lg);
}

.skeleton-button-sm {
  height: 32px;
  width: 80px;
}

.skeleton-button-lg {
  height: 48px;
  width: 160px;
}

/* Input Skeleton */
.skeleton-input {
  height: 44px;
  width: 100%;
  border-radius: var(--radius-lg);
}

/* Badge Skeleton */
.skeleton-badge {
  height: 24px;
  width: 60px;
  border-radius: var(--radius-full);
}

/* KPI Card Skeleton */
.skeleton-kpi-card {
  padding: var(--space-5);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
}

.skeleton-kpi-card .skeleton-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
}

.skeleton-kpi-card .skeleton-value {
  height: 32px;
  width: 80px;
  margin-bottom: var(--space-2);
}

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

/* Card Skeleton */
.skeleton-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.skeleton-card-image {
  height: 180px;
}

.skeleton-card-body {
  padding: var(--space-4);
}

.skeleton-card-body .skeleton-text:nth-child(1) {
  width: 40%;
  height: 12px;
  margin-bottom: var(--space-2);
}

.skeleton-card-body .skeleton-text:nth-child(2) {
  width: 80%;
  height: 18px;
  margin-bottom: var(--space-2);
}

.skeleton-card-body .skeleton-text:nth-child(3) {
  width: 60%;
  height: 14px;
}

.skeleton-card-footer {
  display: flex;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
}

.skeleton-card-footer .skeleton-text {
  width: 60px;
  height: 16px;
}

/* List Item Skeleton */
.skeleton-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-2);
}

.skeleton-list-item:last-child {
  margin-bottom: 0;
}

.skeleton-list-item .skeleton-avatar {
  flex-shrink: 0;
}

.skeleton-list-item-content {
  flex: 1;
}

.skeleton-list-item-content .skeleton-text:first-child {
  width: 60%;
  height: 16px;
  margin-bottom: var(--space-2);
}

.skeleton-list-item-content .skeleton-text:last-child {
  width: 80%;
  height: 12px;
}

/* Message Skeleton */
.skeleton-message {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.skeleton-message-content {
  flex: 1;
  max-width: 70%;
}

.skeleton-message-bubble {
  padding: var(--space-4);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.skeleton-message.outgoing {
  flex-direction: row-reverse;
}

.skeleton-message.outgoing .skeleton-message-content {
  align-items: flex-end;
}

/* Table Skeleton */
.skeleton-table {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.skeleton-table-header {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-background);
  border-bottom: 1px solid var(--color-border);
}

.skeleton-table-header .skeleton-text {
  flex: 1;
  height: 14px;
}

.skeleton-table-row {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

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

.skeleton-table-row .skeleton-text {
  flex: 1;
  height: 16px;
}

/* Notification Skeleton */
.skeleton-notification {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
}

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

.skeleton-notification-content {
  flex: 1;
}

.skeleton-notification-content .skeleton-text:first-child {
  width: 80%;
  height: 14px;
  margin-bottom: var(--space-2);
}

.skeleton-notification-content .skeleton-text:last-child {
  width: 50%;
  height: 12px;
}

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

@keyframes skeleton-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Hide content while loading */
.is-loading > *:not(.skeleton-wrapper) {
  visibility: hidden;
}

.skeleton-wrapper {
  position: absolute;
  inset: 0;
  z-index: 1;
}

