/* Carrusel minimalista para publicaciones */
.publication-carousel {
    position: relative;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    background: #f8f9fa;
}

.publication-carousel .carousel-inner {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.publication-carousel .carousel-item {
    position: relative;
    display: none;
    float: left;
    width: 100%;
    margin-right: -100%;
    backface-visibility: hidden;
    transition: transform 0.6s ease-in-out;
}

.publication-carousel .carousel-item.active {
    display: block;
}

.publication-carousel .carousel-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Controles del carrusel */
.publication-carousel .carousel-control-prev,
.publication-carousel .carousel-control-next {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 15%;
    padding: 0;
    color: #fff;
    text-align: center;
    background: none;
    border: 0;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.publication-carousel:hover .carousel-control-prev,
.publication-carousel:hover .carousel-control-next {
    opacity: 0.8;
}

.publication-carousel .carousel-control-prev:hover,
.publication-carousel .carousel-control-next:hover {
    opacity: 1;
    color: #fff;
    text-decoration: none;
    outline: 0;
}

.publication-carousel .carousel-control-prev {
    left: 0;
    background: linear-gradient(90deg, rgba(0,0,0,0.5) 0%, transparent 100%);
}

.publication-carousel .carousel-control-next {
    right: 0;
    background: linear-gradient(270deg, rgba(0,0,0,0.5) 0%, transparent 100%);
}

.publication-carousel .carousel-control-prev-icon,
.publication-carousel .carousel-control-next-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: 50%;
    background-size: 100% 100%;
}

.publication-carousel .carousel-control-prev-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='m3.86 8.753 5.482 4.796c.646.566 1.658.106 1.658-.753V3.204a1 1 0 0 0-1.659-.753l-5.48 4.796a1 1 0 0 0 0 1.506z'/%3e%3c/svg%3e");
}

.publication-carousel .carousel-control-next-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z'/%3e%3c/svg%3e");
}

/* Indicadores circulares */
.publication-carousel .carousel-indicators {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    display: flex;
    justify-content: center;
    padding: 0;
    margin-right: 15%;
    margin-bottom: 10px;
    margin-left: 15%;
    list-style: none;
}

.publication-carousel .carousel-indicators button {
    box-sizing: content-box;
    flex: 0 1 auto;
    width: 8px;
    height: 8px;
    padding: 0;
    margin-right: 3px;
    margin-left: 3px;
    text-indent: -999px;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.5);
    background-clip: padding-box;
    border: 0;
    border-radius: 50%;
    opacity: 0.5;
    transition: opacity 0.6s ease;
}

.publication-carousel .carousel-indicators button.active {
    opacity: 1;
    background-color: #fff;
}

/* Contador de imágenes */
.image-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    z-index: 3;
}

/* Grid responsivo - las tarjetas ocupan todo el ancho de su columna */
#vehiclesGrid .card, 
#boatsGrid .card, 
#transfersGrid .card {
    width: 100%;
    max-width: none;
}

/* Ajuste especial base para filas con menos de 3 tarjetas */
.row-few .publication-carousel .carousel-item img,
.row-few img.card-img-top {
    height: 200px !important;
    object-fit: cover !important; /* que llene la columna en horizontal */
    background:#f8f9fa;
}

/* Para contenedores con ratio 4x3 (si existieran) */
.row-few .ratio.ratio-4x3 {
    height: 200px !important;
}
.row-few .ratio.ratio-4x3 img {
    height: 100% !important;
    width: 100% !important;
    object-fit: cover !important;
    background:#f8f9fa;
}

/* Ampliar ancho útil para filas con 1 o 2 items: aplicar a columnas dentro de la fila en desktop */
.row-one, .row-two { width: 100%; }
@media (min-width: 992px) {
  .row-one > [class^="col-"], .row-one > [class*=" col-"] { flex: 0 0 80%; max-width: 80%; margin-left: auto; margin-right: auto; }
  .row-two > [class^="col-"], .row-two > [class*=" col-"] { flex: 0 0 40%; max-width: 40%; }

  /* Alto de tarjeta para filas con 1 o 2 items (general) */
  .row-one .card, .row-two .card { display: flex; flex-direction: column; height: 460px; }
  .row-two .card { height: 440px; }

  /* Área de imagen flexible: ocupa el espacio disponible (mínimo 65%) */
  .row-one .publication-carousel, .row-two .publication-carousel,
  .row-one img.card-img-top, .row-two img.card-img-top {
      flex: 1 1 auto;
      height: auto !important;
      min-height: 65% !important;
      width: 100% !important;
      object-fit: cover !important;
  }

  /* Las imágenes internas del carrusel rellenan su contenedor (80% de la tarjeta) */
  .row-one .publication-carousel .carousel-item img,
  .row-two .publication-carousel .carousel-item img {
      height: 100% !important;
      width: 100% !important;
      object-fit: cover !important;
  }

  /* No escalar por encima del tamaño natural: preservar nitidez */
  .row-one .publication-carousel .carousel-item img.no-upscale,
  .row-two .publication-carousel .carousel-item img.no-upscale {
      height: auto !important;
      width: auto !important;
      max-height: 100% !important;
      max-width: 100% !important;
      object-fit: contain !important;
      margin: auto;
      display: block;
  }

  /* Zona de descripción con altura mínima suficiente para botones */
  .row-one .card-body, .row-two .card-body {
      flex: 0 0 auto;
      height: auto !important;
      min-height: 140px;
      overflow: visible;
  }

  /* Separación de filas reducidas para que no se toquen con la anterior */
  .row-one, .row-two { margin-top: 1.25rem; }

  /* Vehículos: usar cover por defecto; la clase no-upscale evita pixelado en imágenes pequeñas */
  #vehiclesContainer .row-one .publication-carousel .carousel-item img,
  #vehiclesContainer .row-two .publication-carousel .carousel-item img,
  #vehiclesContainer .row-one img.card-img-top,
  #vehiclesContainer .row-two img.card-img-top {
      object-fit: cover !important;
      background: #f8f9fa;
  }

  /* Vehículos: asegurar espacio para precio y botones en filas 1-2 */
  #vehiclesContainer .row-one .card, 
  #vehiclesContainer .row-two .card { height: 480px; }
  #vehiclesContainer .row-one .card-body, 
  #vehiclesContainer .row-two .card-body { 
      flex: 0 0 auto; 
      height: auto !important; 
      min-height: 140px; 
      overflow: visible; 
  }
  #vehiclesContainer .row-one .card-body .card-text,
  #vehiclesContainer .row-two .card-body .card-text {
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
  }
}

/* Responsive */
@media (max-width: 768px) {
    .publication-carousel .carousel-item img {
        height: 200px;
    }
}

@media (max-width: 576px) {
    .publication-carousel .carousel-control-prev,
    .publication-carousel .carousel-control-next {
        width: 20%;
    }
    
    .publication-carousel .carousel-item img {
        height: 180px;
    }
}
