/**
 * Responsive Media Styles for MyFans Platform
 * 
 * This stylesheet provides responsive design for images and videos
 * to ensure optimal display across all device sizes.
 */

/* Base responsive image styles */
.responsive-image {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Responsive video container */
.responsive-video-container {
  position: relative;
  width: 100%;
  max-width: 800px; /* Standard maximum width for videos */
  margin: 0 auto;
}

.responsive-video {
  width: 100%;
  height: auto;
  max-height: 70vh; /* Prevent videos from being too tall on mobile */
  display: block;
}

/* Image gallery responsive grid */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.image-gallery .gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-gallery .gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.image-gallery .gallery-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.image-gallery .gallery-item:hover img {
  transform: scale(1.05);
}

/* Content preview styles */
.content-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.content-preview .preview-item {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: #f8f9fa;
}

.content-preview .preview-item img,
.content-preview .preview-item video {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 6px;
}

/* Card image responsive styles */
.card-img-top {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card:hover .card-img-top {
  transform: scale(1.02);
}

/* Avatar and profile images */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.avatar-large {
  width: 80px;
  height: 80px;
}

.avatar-xl {
  width: 120px;
  height: 120px;
}

/* Story thumbnails */
.story-thumbnail {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #007bff;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.story-thumbnail:hover {
  transform: scale(1.1);
}

/* Media player enhancements */
.media-player {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.media-player video {
  width: 100%;
  height: auto;
  display: block;
}

/* Thumbnail grid for video previews */
.video-thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0;
}

.video-thumbnail {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: #000;
}

.video-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.video-thumbnail:hover img {
  opacity: 0.8;
}

.video-thumbnail .play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #333;
  transition: background 0.3s ease;
}

.video-thumbnail:hover .play-overlay {
  background: rgba(255, 255, 255, 1);
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
  .image-gallery {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
  }
  
  .image-gallery .gallery-item img {
    height: 150px;
  }
  
  .content-preview {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
  }
  
  .content-preview .preview-item img,
  .content-preview .preview-item video {
    height: 120px;
  }
  
  .card-img-top {
    height: 150px;
  }
  
  .responsive-video {
    max-height: 50vh;
  }
  
  .video-thumbnail-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
}

@media (max-width: 480px) {
  .image-gallery {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  
  .content-preview {
    grid-template-columns: 1fr 1fr;
  }
  
  .avatar-large {
    width: 60px;
    height: 60px;
  }
  
  .avatar-xl {
    width: 80px;
    height: 80px;
  }
  
  .story-thumbnail {
    width: 50px;
    height: 50px;
  }
}

/* Loading states */
.media-loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

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

/* Error states */
.media-error {
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  font-size: 0.875rem;
  min-height: 100px;
}

.media-error i {
  margin-right: 0.5rem;
  font-size: 1.25rem;
}

/* Accessibility improvements */
.media-player:focus-within {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

.gallery-item:focus-within {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .responsive-video,
  .video-thumbnail {
    display: none;
  }
  
  .responsive-image {
    max-width: 100%;
    page-break-inside: avoid;
  }
}

