/* Styles for enhanced loader with destination images */

.image-previews {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 25px;
  flex-wrap: wrap;
  max-width: 100%;
  overflow: hidden;
  position: relative;
  min-height: 60%;
  padding: 0 10px;
}

.preview-carousel {
  display: flex;
  width: 100%;
  overflow-x: hidden;
  margin: 25px 0;
  position: relative;
  height: 160px;
  min-height: 160px;
}

.preview-image-container {
  position: relative;
  width: 130px;
  height: 130px;
  min-width: 130px;
  min-height: 130px;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.5s ease;
  margin: 0 10px;
  animation: fadeInUp 0.5s ease forwards, floatAnimation 3s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.15s), calc(var(--i) * 0.15s + 0.5s);
  opacity: 0;
  transform: translateY(20px);
  background-color: #f0f0f0;
  flex-shrink: 0;
  aspect-ratio: 1 / 1; /* Ensure perfect square */
}

@keyframes floatAnimation {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0);
  }
}

.preview-image-container:hover {
  transform: translateY(-8px) scale(1.08);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.25);
  z-index: 10;
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s ease;
  filter: brightness(0.9);
  display: block;
  background-color: #e0e0e0;
  aspect-ratio: 1 / 1; /* Maintain square aspect ratio */
}

/* Fallback styling for broken images */
.preview-image::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%), 
              linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), 
              linear-gradient(45deg, transparent 75%, #f0f0f0 75%), 
              linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  z-index: -1;
}

.preview-image-container:hover .preview-image {
  transform: scale(1.1);
  filter: brightness(1.1);
}

.image-tooltip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
  color: white;
  padding: 15px 5px 5px;
  font-size: 11px;
  text-align: center;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none; /* Prevent tooltip from interfering with hover */
}

.preview-image-container:hover .image-tooltip {
  opacity: 1;
}

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

/* Loading state for preview images */
.preview-image-container.loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 50% 50%;
  animation: loading 1.5s infinite;
}

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

/* Ensure images are visible even if they fail to load */
.preview-image-container::after {
  content: attr(data-name);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #666;
  font-size: 10px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.preview-image-container.error::after {
  opacity: 1;
}

/* Loader logo styles */
.loader-logo {
  margin-bottom: 20px;
  text-align: center;
}

.loader-logo-image {
  width: 200px;
  height: auto;
  margin-bottom: 20px;
}

/* Enhanced loader animation */
.loader-animation {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
}

.spinner {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 4px solid rgba(74, 108, 247, 0.1);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1.5s linear infinite;
}

.location-pin {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  color: var(--primary-color);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.7;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.7;
  }
}

/* Progress bar styles */
.progress-container {
  width: 100%;
  height: 6px;
  background-color: rgba(74, 108, 247, 0.1);
  border-radius: 10px;
  margin: 0 0 20px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  border-radius: 10px;
  animation: progressAnimation 8s ease-in-out forwards;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 2s infinite;
  transform: translateX(-100%);
}

@keyframes progressAnimation {
  0% { width: 5%; }
  20% { width: 25%; }
  50% { width: 50%; }
  75% { width: 75%; }
  100% { width: 95%; }
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

/* Loader footer styles */
.loader-footer {
  margin-top: 20px;
  width: 100%;
  border-top: 1px solid rgba(74, 108, 247, 0.1);
  padding-top: 15px;
}

.loader-tip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-light);
  font-style: italic;
}

.loader-tip i {
  color: #ffc107;
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

/* Cancel button styles */
.cancel-button {
  background-color: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 100;
  margin-top: 15px;
  margin-bottom: 15px;
  display: block;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.cancel-button:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 108, 247, 0.2);
}

.cancel-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(74, 108, 247, 0.1);
}

.cancel-button i {
  margin-right: 6px;
  font-size: 12px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cancel-button {
  animation: fadeIn 0.3s ease forwards;
}

/* Responsive styles for different screen sizes */
@media (max-width: 1200px) {
  .preview-image-container {
    width: 120px;
    height: 120px;
    min-width: 120px;
    min-height: 120px;
  }
  
  .preview-carousel {
    height: 150px;
    min-height: 150px;
  }
}

@media (max-width: 992px) {
  .preview-image-container {
    width: 110px;
    height: 110px;
    min-width: 110px;
    min-height: 110px;
    margin: 0 8px;
  }
  
  .preview-carousel {
    height: 140px;
    min-height: 140px;
  }
  
  .image-previews {
    gap: 15px;
    padding: 0 8px;
  }
}

@media (max-width: 768px) {
  .preview-image-container {
    width: 120px;
    height: 120px;
    min-width: 120px;
    min-height: 120px;
    margin: 0 8px;
    border-radius: 12px;
  }
  
  .preview-carousel {
    height: 150px;
    min-height: 150px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }
  
  .image-previews {
    gap: 12px;
    margin-top: 15px;
    padding: 0 10px;
    position: relative;
    z-index: 1;
  }
  
  .preview-image-container:hover {
    transform: translateY(-6px) scale(1.06);
  }
}

@media (max-width: 576px) {
  .preview-image-container {
    width: 110px;
    height: 110px;
    min-width: 110px;
    min-height: 110px;
    margin: 0 6px;
    border-radius: 10px;
  }
  
  .preview-carousel {
    height: 140px;
    min-height: 140px;
    margin: 12px 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 5px;
  }
  
  .image-previews {
    gap: 10px;
    margin-top: 12px;
    padding: 0 8px;
    position: relative;
    z-index: 1;
  }
  
  .preview-image-container:hover {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  }
}

@media (max-width: 480px) {
  .preview-image-container {
    width: 100px;
    height: 100px;
    min-width: 100px;
    min-height: 100px;
    margin: 0 5px;
    border-radius: 8px;
  }
  
  .preview-carousel {
    height: 130px;
    min-height: 130px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 5px;
  }
  
  .image-previews {
    gap: 8px;
    margin-top: 10px;
    padding: 0 5px;
    position: relative;
    z-index: 1;
  }
}

@media (max-width: 360px) {
  .preview-image-container {
    width: 90px;
    height: 90px;
    min-width: 90px;
    min-height: 90px;
    margin: 0 4px;
    border-radius: 6px;
  }
  
  .preview-carousel {
    height: 120px;
    min-height: 120px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 3px;
  }
  
  .image-previews {
    gap: 6px;
    margin-top: 8px;
    padding: 0 3px;
    position: relative;
    z-index: 1;
  }
  
  .image-tooltip {
    font-size: 9px;
    padding: 10px 3px 3px;
  }
}

/* Ensure images maintain square aspect ratio on all devices */
@media (orientation: landscape) and (max-height: 600px) {
  .preview-image-container {
    width: 70px;
    height: 70px;
    min-width: 70px;
    min-height: 70px;
  }
  
  .preview-carousel {
    height: 100px;
    min-height: 100px;
  }
  
  .image-previews {
    margin-top: 10px;
  }
}
