/* ================================================= */
/* === ESTILOS UNIFICADOS PARA TARJETAS === */
/* Usado en index.html y resultados.html */
/* ================================================= */

/* --- Contenedor de resultados (grid) --- */
#results-container,
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 320px));
  gap: 80px;
  padding: 20px;
  justify-content: center;
}

/* --- Tarjeta principal (property-card) --- */
/* Bloque maestro para tarjetas en todo el sitio */
/* REJILLA DE IMPACTO: Todas las tarjetas idénticas */
.property-card {
  border: none;
  background: #fff;
  border-radius: 1.6rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 450px;
  margin: 0 auto;
  height: 100%;
  min-height: 380px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

/* Contenedor de contenido con padding-bottom para respiración */
.property-card .content,
.box .content {
  padding-bottom: 20px !important;
}

/* Ubicación con margin-top auto para empujar hacia abajo en flexbox */
.property-card .location,
.property-location,
.box .location {
  margin-top: auto !important;
}

/* --- Clase ad-card (alias para property-card) --- */
.ad-card {
  width: 100%;
  max-width: 450px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.property-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.1);
  border: none;
}

.property-card.card-premium {
  border: none;
  box-shadow: 0 4px 20px rgba(192,192,192,0.3);
}

.property-card.card-destacado {
  box-shadow: 0 4px 20px rgba(255,215,0,0.2);
}

/* Responsive para móvil */
@media (max-width: 768px) {
  .property-card {
    flex-direction: column;
    height: auto;
    max-width: 100%;
  }
}

/* Grid responsivo para resultados */
@media (max-width: 992px) {
  #results-container,
  .results-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (max-width: 768px) {
  #results-container,
  .results-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 15px;
  }
}

/* Optimización completa para móviles - Tarjetas */
@media (max-width: 768px) {
  /* Tarjetas responsivas - tamaño perfecto para móvil */
  .box, .property-card {
    border-radius: 12px;
    overflow: hidden;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  /* Imagen en móvil - altura optimizada */
  .property-image,
  .box .image-container {
    height: 200px;
    width: 100%;
  }
  
  /* Asegurar que las imágenes del carrusel ocupen todo el espacio */
  .property-image .swiper-slide img,
  .property-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Detalles de tarjeta en móvil */
  .property-details,
  .box .content {
    padding: 15px !important;
  }

  /* Títulos en móvil */
  .property-title,
  .box h3 {
    font-size: 1.6rem !important;
    margin-bottom: 6px !important;
  }

  /* Precios en móvil */
  .property-price,
  .box .price {
    font-size: 1.8rem !important;
    color: #008080 !important;
  }

  /* Ubicación en móvil */
  .property-location,
  .box .location {
    font-size: 1.2rem !important;
    color: #777 !important;
    margin-bottom: 6px !important;
  }

  /* Ocultar descripción en móvil */
  .property-description,
  .box .description {
    display: none !important;
  }

  /* Solo mostrar 3 atributos en móvil */
  .property-details span:nth-child(n+4),
  .box .property-details span:nth-child(n+4) {
    display: none !important;
  }

  /* Atributos en móvil */
  .property-details {
    gap: 0.6rem !important;
    margin-bottom: 8px !important;
    font-size: 1.3rem !important;
    color: #444 !important;
    font-weight: 500 !important;
  }
}

/* --- Imagen de la tarjeta --- */
.property-image,
.product-card-h .image-container {
  width: 100%;
  height: 220px;
  position: relative;
  overflow: hidden;
  background: #f0f0f0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 !important; /* Sin border-radius, el padre lo tiene */
}

.product-card-h .image-container {
  width: 200px;
  border-radius: 0 !important;
}

.property-image img,
.product-card-h .image-container img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 0 !important; /* Sin border-radius individual */
}

.product-card-h .image-container img {
  border-radius: 0 !important;
}

/* --- Contenido de la tarjeta --- */
.property-details,
.product-card-h .card-content {
  width: 100%;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-sizing: border-box;
  flex-grow: 1 !important; /* Esto obliga a la tarjeta a estirarse para que todos los botones queden abajo */
  justify-content: space-between;
}

.product-card-h .card-content {
  padding: 1rem;
  justify-content: space-between;
}

/* --- Título con control de 2 líneas y altura homogénea --- */
.property-title,
.product-card-h .card-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #2d2d2d;
  margin-bottom: 4px;
  line-height: 1.2;
  letter-spacing: -0.2px;
  word-spacing: normal !important;
  /* Regla de las 2 líneas - sin puntos suspensivos */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-shrink: 0;
  /* Altura homogénea: mínimo para 2 líneas */
  min-height: 2.4em;
}

/* Contenedor del título para mantener altura homogénea */
.property-details .title-container,
.product-card-h .card-content .title-container {
  min-height: 2.4em;
  display: flex;
  align-items: flex-start;
}

.product-card-h .card-title {
  margin-bottom: 0.5rem;
}

/* --- Precio --- */
.property-price,
.product-card-h .card-content .card-price {
  font-size: 2.5rem;
  font-weight: 700;
  color: #353636;
  letter-spacing: -0.2px;
}

@media (min-width: 992px) {
  .property-price,
  .product-card-h .card-content .card-price {
    font-size: 2rem;
  }
}

/* --- Ubicación --- */
.property-location,
.product-card-h .card-location {
  font-size: 14px;
  color: #555;
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  letter-spacing: normal !important;
  word-spacing: normal !important;
  font-weight: 500;
}

.product-card-h .card-location {
  font-size: 1.5rem;
  margin-bottom: 0.3rem;
}

.property-location i,
.product-card-h .card-location i {
  color: #555;
  margin-right: 8px;
}

/* --- Atributos --- */
.property-attributes,
.product-card-h .card-attributes {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 10px 0;
  font-size: 1.3rem;
  color: #444;
  letter-spacing: normal;
  word-spacing: normal;
  align-items: center;
  justify-content: flex-start;
}

.product-card-h .card-attributes {
  margin: 0.5rem 0;
  font-size: 1.1rem;
}

.property-attributes span,
.product-card-h .card-attributes span {
  color: #444;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

.product-card-h .card-attributes span {
  gap: 0.3rem;
  font-size: 1.1rem;
}

/* Mostrar solo 3 atributos principales */
.property-attributes span:nth-child(n+4),
.product-card-h .card-attributes span:nth-child(n+4) {
  display: none !important;
}

.property-attributes i,
.product-card-h .card-attributes i {
  color: #666;
  font-size: 1.2rem;
}

/* --- Vendedor --- */
.product-card-h .card-seller {
  font-size: 1.5rem;
  color: #555;
  margin-bottom: 0.3rem;
  font-weight: 500;
}

/* --- Descripción detallada (ocultar en tarjetas) --- */
.property-description,
.card-description {
  display: none !important;
}

/* --- Botón de contacto --- */
.btn-contact-card,
.product-card-h .btn-contact {
  background-color: #2da687;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 2rem 1.3rem;
  font-size: 1.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
  text-decoration: none;
  margin-top: auto;
  width: 100%;
  text-align: center;
}

.product-card-h .btn-contact {
  align-self: flex-start;
  margin-top: 1rem;
  padding: 1rem 2rem;
}

.btn-contact-card:hover,
.product-card-h .btn-contact:hover {
  background-color: #1a8a6a;
}

/* --- Estilos ocultos (legacy) --- */
.property-tags,
.tag-urgent,
.property-footer,
.property-seller,
.property-seller strong {
  display: none;
}

.property-price-section {
  display: none;
}

/* --- Tarjeta horizontal (legacy - para compatibilidad) --- */
.product-card-h {
  display: flex;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card-h:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

@media (max-width: 768px) {
  .product-card-h {
    flex-direction: column;
  }
  
  .product-card-h .image-container {
    width: 100%;
    height: 220px;
  }
}

/* ================================================= */
/* === ESTILOS PARA FILTRADO EN TIEMPO REAL === */
/* ================================================= */

/* Tarjeta oculta por filtro */
.card.card-hidden {
  display: none !important;
}

/* Mensaje de sin resultados */
.no-results-message {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4rem 2rem;
  text-align: center;
}

.no-results-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.no-results-content i {
  font-size: 4rem;
  color: #ccc;
}

.no-results-content h3 {
  font-size: 1.8rem;
  color: #555;
}

/* ================================================= */
/* === SLIDER CONTAINER PARA CARRUSEL DE TARJETAS === */
/* ================================================= */

/* 1. Forzar que NADA en la sección de tarjetas recorte contenido */
.featured-ads, 
.carousel-wrapper, 
.carousel-row-wrapper,
.slider-outer-container,
.box-container,
.products,
section {
    overflow: visible !important;
}

/* 2. El slider DEBE tener espacio lateral interno */
.slider-container {
    display: flex !important;
    justify-content: flex-start !important;
    padding: 20px 10px !important;
    gap: 25px !important; /* Espacio fijo entre tarjetas */
    overflow-x: auto !important;
    overflow-y: visible !important;
    width: auto !important;
    scroll-behavior: smooth !important;
    scroll-padding: 25px !important;
}

/* 3. Todas las tarjetas tienen el mismo margen */
.ad-card, 
.property-card,
.box,
.tarjeta-auto {
    margin: 0 !important;
}

/* 4. Asegurar que la tarjeta no se deforme - Ancho flexible para grid */
.ad-card, .property-card, .box, .tarjeta-auto {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 280px !important;
    max-width: 100% !important;
    margin: 0 !important; /* Sin márgenes que causen choques */
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
    overflow: hidden !important;
    border-radius: 20px !important;
    background: #fff;
}

/* 5. Swiper slide debe permitir overflow visible */
.swiper-slide {
    overflow: visible !important;
}

/* ================================================= */
/* === AJUSTE DE IMÁGENES EN TARJETAS === */
/* ================================================= */

/* Imágenes de tarjetas con altura fija para uniformidad */
.ad-card img,
.property-card img {
  width: 100%;
  height: 240px; /* Altura actualizada a 240px */
  object-fit: cover; /* Para que la foto no se estire */
  border-radius: 0 !important; /* Sin border-radius individual */
}

.no-results-content p {
  font-size: 1.4rem;
  color: #888;
  margin: 0;
}

.btn-clear-filters {
  background: #00bfae;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 1rem;
}

.btn-clear-filters:hover {
  background: #00a896;
}

/* ================================================= */
/* === SEGURO DE ALINEACIÓN - ESPACIO RESERVADO PARA AVATAR === */
/* Esto garantiza que si un usuario no sube foto, la tarjeta no se encoja */
/* ================================================= */

/* ESPACIO RESERVADO PARA EL AVATAR (Haya o no haya foto) */
.vendor-avatar-wrapper,
.price-row {
    min-height: 60px !important; /* Reservamos el hueco aunque esté vacío */
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

/* ============================================
   AVATAR - CAMISA DE FUERZA 48px
   Prohibido estirarse más allá del círculo
   ============================================ */



/* 2. LA IMAGEN (La que se estira) */
.vendor-avatar-img {
    width: 100% !important;
    height: 100% !important; /* OBLIGA A MEDIR 48PX, NO 240PX */
    object-fit: cover !important; /* RELLENA EL CÍRCULO SIN DEFORMAR */
    max-height: 100% !important;
    display: block !important;
}

/* Por defecto, el avatar es invisible pero ocupa espacio */
.vendor-avatar {
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
    min-width: 48px;
    min-height: 48px;
    flex-shrink: 0;
}

/* El botón de contactar siempre al fondo */
.btn-contact,
.btn-contact-card {
    margin-top: auto !important;
}

/* ================================================= */
/* === BOTÓN DE CONTACTO FULL-WIDTH === */
/* Botón que toca los bordes de la tarjeta */
/* ================================================= */

/* 1. LA TARJETA: Quitamos el espacio de abajo para que el botón pegue al borde */
.product-card,
.ad-card,
.box {
    border-radius: 20px 20px 0 0 !important; /* Arriba óvalo, abajo recto */
    overflow: hidden !important;
    padding: 0 !important; /* ELIMINA el margen que hace que el botón flote */
    display: flex !important;
    flex-direction: column !important;
}

/* 3. EL BOTÓN: Lo hacemos el "suelo" de la tarjeta */
.product-card .contact-btn,
.ad-card .btn-contact,
.box .btn-contact {
    width: 100% !important;   /* Que ocupe todo el ancho de lado a lado */
    border-radius: 0 !important; /* Totalmente cuadrado abajo */
    margin: 0 !important;     /* Sin espacios alrededor */
    padding: 18px !important; /* Que sea alto y profesional */
}

/* ================================================= */
/* === TÍTULO ELEGANTE "TOP SELECCIÓN" === */
/* Diseño de boutique: Línea - Título - Línea */
/* Versión premium para inversionistas */
/* ================================================= */

.section-divider-premium {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 60px 0 40px 0; /* Espacio quirúrgico para que respire */
    gap: 25px;
}

.line-gold-gradient {
    flex: 1;
    height: 2px;
    background: linear-gradient(to right, transparent, #c5a059 50%, transparent);
}

.content-gold-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.crown-svg-premium {
    width: 48px; /* Tamaño impactante como la imagen */
    height: 48px;
    filter: drop-shadow(0 4px 5px rgba(0,0,0,0.2));
}

.text-top-selection {
    font-size: 26px; /* Grande y autoritario */
    font-weight: 900;
    color: #3d3321; /* El tono oscuro elegante de la imagen */
    letter-spacing: 3px;
    text-transform: uppercase;
    margin: 0;
}

/* AJUSTE MÓVIL: Solo para pantallas menores a 768px */
@media (max-width: 768px) {
    .row-carousel .swiper-slide {
        width: 85% !important; /* Fuerza a la tarjeta a ser ancha */
    }

    .ad-card {
        min-width: unset !important; /* Quitamos restricciones de PC */
        max-width: 100% !important;
        margin: 0 auto;
    }

    /* Ocultamos flechas en móvil para ganar espacio (se usa el dedo) */
    .row-nav-prev, .row-nav-next {
        display: none !important;
    }
    
    /* Ajuste de imagen para que no se vea aplastada */
    .card-image-container {
        height: 200px !important;
    }
}
