/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Optimized Image Styles */

/* Progressive image loading */
.progressive-image {
  position: relative;
  overflow: hidden;
  background-color: #f3f4f6;
}

.progressive-image .placeholder {
  filter: blur(20px);
  transform: scale(1.05);
  transition: opacity 0.3s ease-out;
}

.progressive-image .main-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

.progressive-image.loaded .placeholder {
  opacity: 0;
}

.progressive-image.loaded .main-image {
  opacity: 1;
  position: static;
}

/* Fade animations */
.progressive-image .fade-in {
  animation: fadeIn 0.3s ease-in forwards;
}

.progressive-image .fade-out {
  animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Responsive image container */
.responsive-image-container {
  display: block;
  width: 100%;
  height: auto;
}

.responsive-image-container img {
  width: 100%;
  height: auto;
  display: block;
}

/* Image upload preview */
.image-upload-container .upload-progress {
  margin: 1rem 0;
}

.image-upload-container .upload-progress .progress-bar {
  height: 4px;
  background-color: #3b82f6;
  border-radius: 2px;
  transition: width 0.3s ease;
}
  
.image-upload-container .upload-status {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
}
  
.image-upload-container .image-preview-item {
  display: flex;
  align-items: center;
  margin: 1rem 0;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
}

.image-upload-container .image-preview-item .preview-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 0.375rem;
  margin-right: 1rem;
}

.image-upload-container .image-preview-item .preview-info {
  display: flex;
  flex-direction: column;
}

.image-upload-container .image-preview-item .preview-info .file-name {
  font-weight: 500;
  color: #1f2937;
}

.image-upload-container .image-preview-item .preview-info .file-size {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.25rem;
}
  
.image-upload-container .upload-success {
  padding: 1rem;
  background-color: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

.image-upload-container .upload-success h4 {
  color: #16a34a;
  margin: 0 0 0.5rem 0;
}

.image-upload-container .upload-success ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.image-upload-container .upload-success ul li {
  padding: 0.25rem 0;
  color: #15803d;
}
  
.image-upload-container .upload-errors {
  padding: 1rem;
  background-color: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

.image-upload-container .upload-errors h4 {
  color: #dc2626;
  margin: 0 0 0.5rem 0;
}

.image-upload-container .upload-errors ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.image-upload-container .upload-errors ul li {
  padding: 0.25rem 0;
  color: #991b1b;
}

/* Avatar styles with optimized sizes */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background-color: #f3f4f6;
}

.avatar.micro {
  width: 32px;
  height: 32px;
}

.avatar.small {
  width: 64px;
  height: 64px;
}

.avatar.medium {
  width: 128px;
  height: 128px;
}

.avatar.large {
  width: 256px;
  height: 256px;
}

/* Default avatar placeholder */
.default-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 600;
}

.default-avatar .avatar-initial {
  font-size: 1.5em;
}

.default-avatar.micro .avatar-initial {
  font-size: 0.875rem;
}

.default-avatar.small .avatar-initial {
  font-size: 1.5rem;
}

.default-avatar.medium .avatar-initial {
  font-size: 3rem;
}

.default-avatar.large .avatar-initial {
  font-size: 6rem;
}

/* Responsive Avatar Styles */
.aspect-square {
  aspect-ratio: 1 / 1;
}

/* Mobile-specific adjustments - simplified */
@media (max-width: 640px) {
  /* Adjust font size for initials in smaller avatars */
  .h-5.w-5.text-sm { font-size: 0.625rem; }
  .h-6.w-6.text-sm { font-size: 0.75rem; }
  .h-8.w-8.text-sm { font-size: 0.875rem; }
}

/* Tablet and desktop avatar sizes (sm: prefix in Tailwind = 640px+) */
@media (min-width: 640px) {
  .sm\\:h-6 { height: 1.5rem !important; }
  .sm\\:w-6 { width: 1.5rem !important; }
  .sm\\:h-8 { height: 2rem !important; }
  .sm\\:w-8 { width: 2rem !important; }
  .sm\\:h-10 { height: 2.5rem !important; }
  .sm\\:w-10 { width: 2.5rem !important; }
}

/* Medium screen fixes - simplified now that avatar_image uses container approach */
@media (min-width: 768px) {
  /* Keep aspect-square utility working */
  .aspect-square {
    aspect-ratio: 1 / 1 !important;
  }
}

/* Placeholder image */
.placeholder-image {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f3f4f6;
  color: #9ca3af;
  min-height: 200px;
  border-radius: 0.5rem;
}

.placeholder-image .placeholder-text {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Gallery optimizations */
.gallery-grid picture {
  display: block;
  width: 100%;
  height: 100%;
}

.gallery-grid picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Lazy loading styles */
img[loading="lazy"] {
  background-color: #f3f4f6;
}

img[loading="lazy"]::before {
  content: "";
  display: block;
  padding-bottom: 100%;
}
