/* Skeleton Loading Animations for Firestore Content */

/* Base skeleton shimmer animation */
@keyframes skeleton-shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0.05) 25%, 
    rgba(255, 255, 255, 0.15) 37%, 
    rgba(255, 255, 255, 0.05) 63%
  );
  background-size: 400px 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

/* Home Page Skeletons */
.skeleton-hero-image {
  width: 100%;
  max-width: 300px;
  height: 200px;
  margin: 0 auto 1rem;
  border-radius: 12px;
}

@media (min-width: 640px) {
  .skeleton-hero-image {
    height: 224px;
  }
}

@media (min-width: 768px) {
  .skeleton-hero-image {
    height: 256px;
  }
}

@media (min-width: 1024px) {
  .skeleton-hero-image {
    height: 288px;
  }
}

@media (min-width: 1280px) {
  .skeleton-hero-image {
    height: 320px;
  }
}

@media (min-width: 1536px) {
  .skeleton-hero-image {
    height: 384px;
  }
}

.skeleton-hero-title {
  height: 2rem;
  max-width: 400px;
  margin: 0 auto 0.75rem;
}

@media (min-width: 640px) {
  .skeleton-hero-title {
    height: 2.5rem;
  }
}

@media (min-width: 768px) {
  .skeleton-hero-title {
    height: 3rem;
  }
}

@media (min-width: 1024px) {
  .skeleton-hero-title {
    height: 3.5rem;
  }
}

.skeleton-hero-subtitle {
  height: 1.25rem;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

@media (min-width: 640px) {
  .skeleton-hero-subtitle {
    height: 1.5rem;
  }
}

@media (min-width: 768px) {
  .skeleton-hero-subtitle {
    height: 1.75rem;
  }
}

.skeleton-carousel-item {
  width: 200px;
  height: 280px;
  flex-shrink: 0;
  margin-right: 1rem;
  border-radius: 12px;
}

.skeleton-process-step {
  height: 200px;
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.skeleton-faq-item {
  height: 60px;
  margin-bottom: 0.75rem;
  border-radius: 8px;
}

/* Gallery Page Skeletons */
.skeleton-gallery-title {
  height: 2.5rem;
  max-width: 300px;
  margin: 0 auto 1rem;
}

/* Gallery subtitle skeleton - works when applied directly to the subtitle element */
.skeleton-gallery-subtitle {
  height: 1.25rem !important;
  min-height: 1.25rem !important;
  width: 100% !important;
  max-width: 500px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border-radius: 6px !important;
  /* Preserve original margin classes from HTML */
  /* margin: 0 auto 2rem; - let Tailwind classes handle this */
}

/* Ensure skeleton animation works on the subtitle element */
p.skeleton-gallery-subtitle {
  background: rgba(255, 255, 255, 0.1) !important;
  color: transparent !important;
}

/* Responsive adjustments for gallery subtitle skeleton */
@media (min-width: 640px) {
  .skeleton-gallery-subtitle {
    height: 1.5rem !important;
    min-height: 1.5rem !important;
  }
}

.skeleton-gallery-item {
  width: 100%;
  height: 240px;
  border-radius: 12px;
}

@media (min-width: 640px) {
  .skeleton-gallery-item {
    height: 280px;
  }
}

@media (min-width: 768px) {
  .skeleton-gallery-item {
    height: 320px;
  }
}

/* Services Page Skeletons */
.skeleton-service-card {
  height: 300px;
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

/* Shop Page Skeletons */
.skeleton-shop-title {
  height: 2.5rem;
  max-width: 400px;
  margin: 0 auto 0.5rem;
}

.skeleton-shop-subtitle {
  height: 1.25rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.skeleton-shop-item {
  width: 100%;
  height: 320px;
  border-radius: 12px;
}

/* Contact Page Skeletons - works when applied directly to contact elements */
.skeleton-contact-subtitle {
  height: 1.25rem !important;
  min-height: 1.25rem !important;
  width: 100% !important;
  max-width: 400px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border-radius: 6px !important;
  color: transparent !important;
  /* Preserve original margin classes from HTML */
}

.skeleton-contact-detail {
  height: 1.5rem !important;
  min-height: 1.5rem !important;
  width: 100% !important;
  max-width: 250px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border-radius: 6px !important;
  color: transparent !important;
  /* Preserve original margin classes from HTML */
}

/* Ensure skeleton animation works on contact elements */
div.skeleton-contact-subtitle,
span.skeleton-contact-detail,
a.skeleton-contact-detail {
  background: rgba(255, 255, 255, 0.1) !important;
  color: transparent !important;
}

/* Container styles for skeleton grids */
.skeleton-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.skeleton-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.skeleton-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.skeleton-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (min-width: 640px) {
  .skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .skeleton-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .skeleton-grid-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .skeleton-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .skeleton-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .skeleton-grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  .skeleton-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .skeleton-grid-4 {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Carousel skeleton container */
.skeleton-carousel-container {
  display: flex;
  overflow: hidden;
  padding: 1rem 0;
}

/* Hide skeleton when content is loaded */
.content-loaded .skeleton {
  display: none !important;
}

/* Ensure skeletons don't interfere with content */
.skeleton {
  position: relative;
  z-index: 1;
}

/* Ensure loaded content appears above skeletons */
.content-fade-in {
  position: relative;
  z-index: 2;
  opacity: 0;
  animation: fadeIn 0.5s ease-in-out forwards;
}

/* Force hide specific skeleton elements */
[data-skeleton-for] {
  position: relative;
  z-index: 1;
}

/* Override any potential conflicts */
.skeleton[data-skeleton-for] {
  display: block !important;
}

.skeleton[data-skeleton-for].hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Responsive adjustments for mobile */
@media (max-width: 639px) {
  .skeleton-hero-image {
    max-width: 280px;
    height: 180px;
  }
  
  .skeleton-carousel-item {
    width: 160px;
    height: 220px;
  }
  
  .skeleton-gallery-item {
    height: 200px;
  }
  
  .skeleton-shop-item {
    height: 280px;
  }
  
  .skeleton-service-card {
    height: 250px;
  }
}