/* vehicle-cards.css - Estilos específicos para las tarjetas de vehículos */

/* Forzar pintado de imágenes lazy al entrar en vista (evita que queden en blanco hasta scroll) */
.vehicle-item img.lazy-in-view {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Contenedor principal de la tarjeta */
.vehicle-item {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 100%;
}

.vehicle-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* Insignia de estado (nuevo/usado) */
.vehicle-status-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 0.3rem 0.5rem;
  background-color: #28a745;
  color: white;
  border-radius: 0.5rem;
  z-index: 1;
  font-size: 0.7rem;
}

.vehicle-status-badge.used-vehicle {
  background-color: #ffc107;
}

/* Badge de ENVÍO GRATIS - Posicionado en esquina inferior derecha de la imagen */
.free-shipping-badge-card {
  position: absolute;
  top: 159px; /* Posicionado justo antes del final de la imagen (180px - 5px) */
  right: 5px;
  z-index: 3;
  background-color: #28a745; /* Igual a vehicle-status-badge */
  color: white;
  padding: 0.3rem 0.5rem; /* Igual a vehicle-status-badge */
  border-radius: 0.5rem; /* Igual a vehicle-status-badge */
  font-weight: 700;
  font-size: 0.7rem; /* Igual a vehicle-status-badge */
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  pointer-events: none;
}

.free-shipping-badge-card i {
  font-size: 0.7rem;
}

/* Animaciones eliminadas para consistencia con vehicle-status-badge */

/* (sin animación) */

/* Estilos responsivos - Posicionado según altura de imagen */
@media (max-width: 1023px) {
  .free-shipping-badge-card {
    top: 141px; /* 160px - 5px para altura de imagen de 160px */
    right: 5px;
    padding: 0.25rem 0.45rem;
    font-size: 0.65rem;
  }
}

@media (max-width: 768px) {
  .free-shipping-badge-card {
    top: 135px; /* 140px - 5px para altura de imagen de 140px en móviles */
    right: 3px;
    padding: 0.2rem 0.4rem;
    font-size: 0.6rem; /* Consistente con badge responsive */
  }

  .free-shipping-badge-card i {
    font-size: 0.65rem;
  }
}

@media (max-width: 480px) {
  .free-shipping-badge-card {
    top: 120px; /* Mantener misma altura en pantallas muy pequeñas */
    right: 3px;
    padding: 0.2rem 0.35rem;
    font-size: 0.55rem;
  }

  .free-shipping-badge-card i {
    font-size: 0.6rem;
  }
}

/* Imagen del vehículo */
.vehicle-item img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background-color: #f8f9fa;
  transition: opacity 0.3s ease;
  display: block;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0;
}

.vehicle-item:hover img {
  opacity: 0.9;
}

@media (max-width: 767px) {
  .vehicle-item img,
  .garaje-main .garaje-container .main-content .vehicles-grid .vehicle-item img,
  .vehicles-grid .vehicle-item img {
    height: 160px !important;
  }
}

@media (min-width: 768px) {
  .vehicle-item img,
  .garaje-main .garaje-container .main-content .vehicles-grid .vehicle-item img,
  .vehicles-grid .vehicle-item img {
    height: 160px !important;
  }
}

@media (min-width: 1024px) {
  .vehicle-item img,
  .garaje-main .garaje-container .main-content .vehicles-grid .vehicle-item img,
  .vehicles-grid .vehicle-item img {
    height: 180px !important;
  }
}

/* Contenido informativo */
.vehicle-content {
  padding: 0.7rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: 40px;
}

.vehicle-content h3 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: #333;
  line-height: 1.2;
  text-align: center;
}

@media (min-width: 768px) {
  .vehicle-content h3 {
    font-size: 1.1rem;
  }
}

@media (min-width: 1024px) {
  .vehicle-content h3 {
    font-size: 1.3rem;
  }
}

/* Especificaciones del vehículo */
.vehicle-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
  font-size: 0.7rem;
  color: #666;
  justify-content: center;
}

.vehicle-specs span {
  background-color: #f0f0f0;
  padding: 0.2rem 0.3rem;
  border-radius: 8px;
  display: inline-block;
  font-size: 0.5rem;
  font-weight: bold;
  color: #000000;
}

@media (min-width: 768px) {
  .vehicle-specs span {
    font-size: 0.8rem;
  }
}

/* Precio */
.vehicle-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: #007bff;
  margin-top: auto;
  text-align: center;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
  .vehicle-price {
    font-size: 1.3rem;
  }
}

@media (min-width: 1024px) {
  .vehicle-price {
    font-size: 1.4rem;
  }
}



  .vehicle-content {
    padding-bottom: 35px;
  }

/* Controles (botones de acción) */
.vehicle-controls {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
}

.vehicle-control-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.vehicle-control-btn:hover {
  transform: scale(1.1);
}

.vehicle-control-btn svg {
  width: 20px;
  height: 20px;
  stroke: #666;
  transition: stroke 0.3s ease, fill 0.3s ease;
}

/* Botón de me gusta */
.vehicle-like-btn:hover svg,
.vehicle-like-btn.active svg {
  fill: #ff6b6b;
  stroke: #ff6b6b;
}

/* Botón de favoritos */
.vehicle-favorite-btn:hover svg,
.vehicle-favorite-btn.active svg {
  fill: #feca57;
  stroke: #feca57;
}

/* Botón de compartir */
.vehicle-share-btn:hover svg {
  stroke: #54a0ff;
}

/* Contador de likes */
.vehicle-like-btn {
  position: relative;
}

.vehicle-likes-counter {
  position: absolute;
  top: 18px;
  right: -8px;
  color: rgb(0, 0, 0);
  border-radius: 50%;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: bold;
}

.vehicle-like-btn.active .vehicle-likes-counter {
  background-color: #ffffff;
}

/* Responsive para los controles */
@media (max-width: 768px) {
  .vehicle-controls {
    bottom: 5px;
    right: 5px;
  }

  .vehicle-control-btn svg {
    width: 18px;
    height: 18px;
  }

  .vehicle-content {
    padding-bottom: 35px;
  }
}

/* Animación para los botones */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.vehicle-control-btn:active {
  animation: pulse 0.3s ease-in-out;
}


/* NUEVO: Diseño compacto para móviles */
@media (max-width: 767px) {
  /* Ajustar el grid para mostrar 2 columnas en móviles */
  .vehicles-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  
  /* Hacer las tarjetas más compactas */
  .vehicle-item {
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  }
  
  /* Ajustar la imagen para que sea rectangular */
  .vehicle-item img,
  .garaje-main .garaje-container .main-content .vehicles-grid .vehicle-item img,
  .vehicles-grid .vehicle-item img {
    height: 140px !important;
    width: 100% !important;
    border-radius: 0 !important;
    margin: 0 auto !important;
    object-fit: contain !important;
    object-position: center !important;
    background-color: #f8f9fa !important;
    padding: 0 !important;
  }
  
  /* Contenedor de imagen con fondo claro */
  .vehicle-item {
    background-color: #f8f9fa;
    padding-top: 0;
    border: 1px solid #e0e0e0;
  }
  
  /* Ajustar el contenido */
  .vehicle-content {
    padding: 5px;
    /* padding-bottom: 30px; */ /* Reducir el padding inferior - LÍNEA COMENTADA */
    text-align: center;
  }
  
  /* Ajustar el título */
  .vehicle-content h3 {
    font-size: 0.85rem;
    margin-bottom: 2px;
    margin-top: 5px;
    color: #333333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 5px;
  }
  
  /* Ocultar las especificaciones en vista móvil compacta, excepto ciudad y kilometraje */
  .vehicle-specs {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin: 3px 0;
  }
  
  /* Ocultar todas las especificaciones por defecto */
  .vehicle-specs span {
    display: none;
    font-size: 0.65rem;
    padding: 1px 4px;
  }
  
  /* Mostrar solo ciudad y kilometraje */
  .vehicle-specs span:nth-child(2), /* Ciudad */
  .vehicle-specs span:nth-child(3) /* Kilometraje */ {
    display: inline-block;
  }
  
  /* Estilos específicos para repuestos en móvil */
  .part-number {
    font-size: 0.7em;
    margin: 2px 0;
  }
  
  /* Ajustar el precio */
  .vehicle-price {
    font-size: 0.9rem;
    margin-top: 2px;
    margin-bottom: 5px; /* Añadir margen inferior */
    color: #007bff;
    font-weight: bold;
  }
  
  /* Ajustar los controles */
  .vehicle-controls {
    position: static;
    display: flex;
    justify-content: center;
    gap: 15px; /* Aumentar el espacio entre botones */
    margin: 5px 0 8px;
  }
  
  /* Mostrar los botones de acción en la vista compacta */
  .vehicle-control-btn {
    display: block;
    padding: 3px;
  }
  
  .vehicle-control-btn svg {
    width: 16px;
    height: 16px;
  }
  
  /* Ajustar el contador de likes para la vista móvil */
  .vehicle-likes-counter {
    top: 12px;
    right: -6px;
    font-size: 10px;
    padding: 1px 4px;
  }
  
  /* Ajustar la insignia de estado */
  .vehicle-status-badge {
    top: 5px;
    right: 5px;
    bottom: auto;
    left: auto;
    transform: none;
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
    background-color: rgba(40, 167, 69, 0.9);
  }
  
  .vehicle-status-badge.used-vehicle {
    background-color: rgba(255, 193, 7, 0.9);
  }
}


/* Actualización para vehicle-model para que se vea más discreto como part-number */
.vehicle-model {
  font-size: 0.95rem;
  color: #606060;
  margin: 0.25rem 0;
  font-weight: bold;
  font-style: italic;
  opacity: 0.85;
  display: block;
}

/* Si necesitas ajustar el espaciado */
.vehicle-content h3 + .vehicle-model {
  margin-top: -0.25rem;
  margin-bottom: 0.5rem;
}

/* Reducir tamaño del texto vehicle-model para llantas/rines solo en pantallas pequeñas */
@media (max-width: 767px) {
  .llanta-rin-model {
    font-size: 0.75rem !important;
  }
}

/* Estilos específicos para repuestos */
.part-number {
  color: #666;
  font-size: 0.8em;
  margin: 0;
  padding: 0;
  line-height: 1;
  text-align: center;
}

/* Asegurar que las imágenes se vean completas - mayor especificidad */
.vehicle-item img,
.garaje-main .garaje-container .main-content .vehicles-grid .vehicle-item img,
.vehicles-grid .vehicle-item img {

  object-fit: contain !important;
  background-color: #f8f9fa !important;
  transition: opacity 0.3s ease !important;
  display: block !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  padding: 0 !important;
}

/* Estilos para el modelo inline en vehículos */
.vehicle-model-inline {
  font-size: 0.85em;
  color: #6b7280;
  font-weight: 500;
  font-style: italic;
  margin-left: 0.3rem;
  opacity: 0.9;
}

/* Especificaciones adicionales para móvil */
.mobile-only-specs {
  display: none;
}

.mobile-spec {
  background-color: #f0f0f0;
  padding: 0.2rem 0.3rem;
  border-radius: 8px;
  display: inline-block;
  font-size: 0.5rem;
  font-weight: bold;
  color: #000000;
  margin-right: 0.2rem;
}

/* Mostrar especificaciones móviles solo en pantallas pequeñas */
@media (max-width: 767px) {
  .mobile-only-specs {
    display: block;
  }
  
  .mobile-spec {
    font-size: 0.65rem;
    padding: 1px 4px;
  }
}

/* Ocultar especificaciones móviles en pantallas grandes */
@media (min-width: 768px) {
  .garaje-main .vehicle-item .mobile-only-specs,
  .vehicle-item .mobile-only-specs {
    display: none !important;
  }
  
  .garaje-main .vehicle-item .mobile-spec,
  .vehicle-item .mobile-spec {
    display: none !important;
  }
}
