/**
 * Skeleton Loading Styles
 * Used for listing and detail page loading states
 */

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

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

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

/* ========================================
   Listing Page Skeletons
   ======================================== */
.vehicles-skeleton-list {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 1.5rem !important;
  width: 100% !important;
}

/* Hide skeleton when real tiles are loaded */
.col-lg-9:has(.audi-tile) .vehicles-skeleton-list { display: none !important; }
section:has(.audi-tile) .vehicles-skeleton-list { display: none !important; }

/* Fade-in animation for real cards */
.audi-tile {
  animation: fadeInUp 0.4s ease-out forwards;
  opacity: 0;
}

.audi-tile:nth-child(1) { animation-delay: 0s; }
.audi-tile:nth-child(2) { animation-delay: 0.05s; }
.audi-tile:nth-child(3) { animation-delay: 0.1s; }
.audi-tile:nth-child(4) { animation-delay: 0.15s; }
.audi-tile:nth-child(5) { animation-delay: 0.2s; }
.audi-tile:nth-child(6) { animation-delay: 0.25s; }
.audi-tile:nth-child(7) { animation-delay: 0.3s; }
.audi-tile:nth-child(8) { animation-delay: 0.35s; }
.audi-tile:nth-child(9) { animation-delay: 0.4s; }

.skeleton-col { 
  width: 100% !important; 
}

.vehicle-card-skeleton {
  height: 480px !important;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.skeleton-image {
  height: 260px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-content { 
  padding: 1.25rem; 
  flex: 1; 
  display: flex; 
  flex-direction: column; 
  gap: 0.75rem; 
}

.skeleton-title { height: 22px; width: 90%; }
.skeleton-subtitle { height: 18px; width: 70%; }
.skeleton-price { height: 32px; width: 50%; }
.skeleton-specs { display: flex; gap: 1rem; }
.skeleton-spec { height: 16px; width: 60px; }
.skeleton-info { height: 16px; width: 65%; }
.skeleton-button { height: 44px; width: 100%; margin-top: auto; border-radius: 6px; }

/* ========================================
   Detail Page Skeletons
   ======================================== */
.vehicle-detail-skeleton {
  padding: 2rem 0;
}

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

.skeleton-detail-title {
  height: 36px;
  width: 80%;
  margin-bottom: 1rem;
}

.skeleton-detail-price {
  height: 42px;
  width: 40%;
  margin-bottom: 1.5rem;
}

.skeleton-detail-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.skeleton-spec-item {
  height: 60px;
  width: 120px;
  border-radius: 8px;
}

.skeleton-detail-desc {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.skeleton-line {
  height: 16px;
  width: 100%;
}

.skeleton-line:nth-child(2) { width: 90%; }
.skeleton-line:nth-child(3) { width: 95%; }
.skeleton-line:nth-child(4) { width: 70%; }

/* Hide skeleton when content is loaded */
#vehicle-detail:has(.vehicle-detail-content) .vehicle-detail-skeleton { display: none !important; }
#vehicle-detail:has(.audi-detail) .vehicle-detail-skeleton { display: none !important; }

/* ========================================
   Responsive Listing Skeletons
   ======================================== */
@media (max-width: 991px) {
  .vehicles-skeleton-list { 
    grid-template-columns: repeat(2, 1fr) !important; 
  }
}

@media (max-width: 767px) {
  .vehicles-skeleton-list { 
    grid-template-columns: 1fr !important; 
  }
}
