/**
 * CSS styles for the image caching system
 */

/* Loading skeleton animation */
.image-loading-skeleton {
  position: relative;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  width: 100%;
  height: 100%;
  min-height: 200px;
}

.shimmer-animation {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent
  );
  animation: shimmer-slide 2s infinite;
}

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

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

/* Cached image container */
.cached-image-container {
  position: relative;
  overflow: hidden;
}

.cached-image-container img {
  transition: opacity 0.3s ease;
}

/* Error fallback styles */
.image-error-fallback {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;
  color: #666;
  font-size: 14px;
}

/* Loading indicator for images being processed */
img[data-loading="true"] {
  opacity: 0.7;
  filter: blur(1px);
}

img[data-cached="true"] {
  border: 2px solid #4CAF50;
  border-radius: 4px;
}

/* Cache statistics display */
.cache-stats {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 15px;
  margin: 10px 0;
  font-family: monospace;
  font-size: 12px;
}

.cache-stats h4 {
  margin: 0 0 10px 0;
  color: #495057;
}

.cache-stats p {
  margin: 5px 0;
  color: #6c757d;
}

/* Demo page specific styles */
.cached-image-demo {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.cached-image-demo h2 {
  color: #333;
  margin-bottom: 20px;
}

.cached-image-demo button {
  background: #007bff;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  margin-right: 10px;
  margin-bottom: 10px;
}

.cached-image-demo button:hover {
  background: #0056b3;
}

.cached-image-demo button:disabled {
  background: #6c757d;
  cursor: not-allowed;
}

/* Responsive grid for demo images */
.demo-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.demo-image-item {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.demo-image-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.demo-image-info {
  padding: 15px;
}

.demo-image-info p {
  margin: 0;
  font-size: 12px;
  color: #666;
  word-break: break-all;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .cached-image-demo {
    padding: 10px;
  }
  
  .demo-image-grid {
    grid-template-columns: 1fr;
  }
  
  .cached-image-demo button {
    width: 100%;
    margin-right: 0;
  }
}