/* Enhanced Skeleton Loading System for CareGrid */

/* Base Skeleton Animation */
@keyframes skeleton-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Base Skeleton Classes */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}

.skeleton::before,
.skeleton::after {
  content: none !important;
}

/* Skeleton Text Elements */
.skeleton-text {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-text.large {
  height: 1.5em;
  width: 80%;
}

.skeleton-text.medium {
  height: 1.2em;
  width: 60%;
}

.skeleton-text.small {
  height: 1em;
  width: 40%;
}

.skeleton-text.full {
  width: 100%;
}

/* Skeleton Image */
.skeleton-image {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 8px;
  width: 100%;
  height: 200px;
}

.skeleton-image.small {
  height: 100px;
}

.skeleton-image.large {
  height: 300px;
}

.skeleton-image.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}

/* Skeleton Button */
.skeleton-button {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 6px;
  height: 40px;
  width: 120px;
  border: none;
}

.skeleton-button.large {
  height: 48px;
  width: 150px;
}

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

/* Skeleton Card Components */
.skeleton-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 20px;
  pointer-events: none;
}

.skeleton-card .skeleton-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.skeleton-card .skeleton-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin-right: 12px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-card .skeleton-title {
  height: 20px;
  width: 70%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-card .skeleton-subtitle {
  height: 16px;
  width: 40%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}

/* Skeleton Form Elements */
.skeleton-form {
  max-width: 400px;
  margin: 0 auto;
}

.skeleton-form .skeleton-input {
  height: 48px;
  width: 100%;
  margin-bottom: 16px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 8px;
}

.skeleton-form .skeleton-label {
  height: 16px;
  width: 30%;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}

/* Skeleton Table */
.skeleton-table {
  width: 100%;
  border-collapse: collapse;
}

.skeleton-table .skeleton-row {
  height: 60px;
  border-bottom: 1px solid #f0f0f0;
}

.skeleton-table .skeleton-cell {
  padding: 12px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
  height: 20px;
  margin: 8px 0;
}

/* Skeleton List */
.skeleton-list {
  list-style: none;
  padding: 0;
}

.skeleton-list .skeleton-list-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f5f5f5;
}

.skeleton-list .skeleton-list-item .skeleton-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  margin-right: 12px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}

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

.skeleton-list .skeleton-list-item .skeleton-primary {
  height: 18px;
  width: 60%;
  margin-bottom: 6px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-list .skeleton-list-item .skeleton-secondary {
  height: 14px;
  width: 40%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}

/* Skeleton Stats Grid */
.skeleton-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.skeleton-stat {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.skeleton-stat .skeleton-stat-value {
  height: 32px;
  width: 60%;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-stat .skeleton-stat-label {
  height: 16px;
  width: 80%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}

/* Skeleton Search Results */
.skeleton-search-results {
  margin-top: 20px;
}

.skeleton-search-item {
  display: flex;
  padding: 16px;
  border-bottom: 1px solid #f0f0f0;
  align-items: center;
}

.skeleton-search-item .skeleton-search-image {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  margin-right: 16px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}

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

.skeleton-search-item .skeleton-search-title {
  height: 20px;
  width: 70%;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-search-item .skeleton-search-description {
  height: 16px;
  width: 90%;
  margin-bottom: 6px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-search-item .skeleton-search-meta {
  height: 14px;
  width: 50%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}

/* Responsive Skeleton Adjustments */
@media (max-width: 768px) {
  .skeleton-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .skeleton-card {
    padding: 16px;
    margin-bottom: 16px;
  }
  
  .skeleton-search-item {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .skeleton-search-item .skeleton-search-image {
    width: 100%;
    height: 120px;
    margin-right: 0;
    margin-bottom: 12px;
  }
}

@media (max-width: 480px) {
  .skeleton-stats {
    grid-template-columns: 1fr;
  }
  
  .skeleton-image {
    height: 150px;
  }
  
  .skeleton-card {
    padding: 12px;
  }
}

/* Accessibility for Skeleton Loading */
.skeleton,
.skeleton-text,
.skeleton-image,
.skeleton-button,
.skeleton-card {
  position: relative;
}

.skeleton::after,
.skeleton-text::after,
.skeleton-image::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: inherit;
  border-radius: inherit;
}

/* Screen reader text for loading states */
.skeleton-sr-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Fade in animation when content loads */
.skeleton-fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

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

/* Dark mode skeleton support */
@media (prefers-color-scheme: dark) {
  .skeleton,
  .skeleton-text,
  .skeleton-image,
  .skeleton-button {
    background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    background-size: 200% 100%;
  }
  
  .skeleton-card {
    background: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
}