/**
 * DeMV Platform - Performance Optimizations CSS
 * Styles for performance optimizations
 */

/* Lazy Loading */
.vehicle-image-container.with-placeholder {
  position: relative;
  background: linear-gradient(135deg, rgba(30, 30, 45, 0.9), rgba(20, 20, 35, 0.9));
  overflow: hidden;
}

.vehicle-image-container.with-placeholder::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    rgba(30, 30, 45, 0) 0%, 
    rgba(40, 40, 60, 0.5) 50%, 
    rgba(30, 30, 45, 0) 100%);
  animation: shimmer 1.5s infinite;
  background-size: 200% 100%;
}

.vehicle-image-container.with-placeholder::after {
  content: '\f1b9'; /* car icon */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: rgba(108, 99, 255, 0.5);
}

.vehicle-image-container.image-loaded::before,
.vehicle-image-container.image-loaded::after {
  display: none;
}

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

/* Blockchain Badge */
.blockchain-verified-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.8), rgba(90, 80, 220, 0.8));
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 5px;
}

.blockchain-verified-badge::before {
  content: '\f058'; /* check-circle */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* Animation Optimizations */
.fade-in {
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
}

.slide-in {
  transform: translateY(20px);
  opacity: 0;
  animation: slideIn 0.5s ease forwards;
}

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

@keyframes slideIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Reduce Layout Shifts */
.vehicle-card {
  contain: layout style;
}

.vehicle-image {
  aspect-ratio: 16/9;
}

/* Optimize for Touch Devices */
@media (hover: none) {
  .vehicle-card:hover {
    transform: none !important;
  }
  
  .vehicle-card:hover .vehicle-image {
    transform: none !important;
  }
  
  .vehicle-card:active {
    transform: scale(0.98) !important;
  }
}

/* Reduce Motion */
@media (prefers-reduced-motion: reduce) {
  .fade-in,
  .slide-in,
  .modal,
  .modal *,
  .modal-content,
  .modal-content *,
  .popup,
  .popup *,
  .popup-content,
  .popup-content * {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
  
  .vehicle-card:hover,
  .vehicle-card:hover .vehicle-image {
    transform: none !important;
    transition: none !important;
  }
}
