/**
 * Top Rated Packages CSS
 * Copiado EXACTO de travel-search/assets/css/front.css
 * Usa selectores propios .trp-block en vez de .ts-packages-results
 */

/* Wrapper del bloque */
.trp-block {
  padding: 20px 0;
  position: relative;
  width: 100%;
}

/* Título del bloque */
.trp-block-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 20px 0;
  padding: 0;
  line-height: 1.2;
}

@media(max-width: 768px) {
  .trp-block-title {
    font-size: 19px;
    text-align: center;
  }
}

/* === Desktop: Grid Layout (4 columnas) === */
@media (min-width: 1024px) {
  .trp-block .swiper-wrapper {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px !important;
  }

  .trp-block .swiper-slide {
    width: auto !important;
    height: auto !important;
  }

  /* OCULTAR controles en desktop */
  .trp-block .trp-swiper-controls {
    display: none !important;
  }
}

/* === Mobile: Swiper activo === */
@media (max-width: 1023px) {
  /* Forzar que el swiper-wrapper NO sea grid en mobile */
  .trp-block .swiper-wrapper {
    display: flex !important;
    flex-direction: row !important;
    grid-template-columns: none !important;
    gap: 0 !important;
  }

  /* Cada slide debe ocupar el 100% del ancho en mobile */
  .trp-block .swiper-slide {
    width: 100% !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Centrar el contenido */
  .trp-block .trp-swiper {
    width: 100%;
    overflow: hidden;
    padding: 0;
    margin: 0;
  }

  /* Asegurar que las cards no tengan margin extra */
  .trp-block .swiper-slide .trp-package-card {
    margin: 0 auto;
    max-width: 100%;
  }

  .trp-package-card .card-thumb {
    height: 430px;
  }
}

/* Swiper Controls Container */
.trp-swiper-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 25px;
  height: 40px;
  width: 100%;
}

/* Navigation Buttons */
.trp-swiper-button-prev,
.trp-swiper-button-next {
  margin-top: -20px !important;
  position: static;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  margin-top: 0;
  cursor: pointer;
}

.trp-swiper-button-prev:hover,
.trp-swiper-button-next:hover {
  background: #E78C85;
}

.trp-swiper-button-prev:after,
.trp-swiper-button-next:after {
  font-size: 14px;
  color: #333;
}

.trp-swiper-button-prev:hover:after,
.trp-swiper-button-next:hover:after {
  color: #fff;
}

/* Pagination */
.trp-swiper-pagination {
  position: static !important;
  display: flex !important;
  align-items: center !important;
  margin-top: -15px;
  justify-content: center !important;
  gap: 8px !important;
  width: auto !important;
}

.trp-swiper-pagination .swiper-pagination-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  opacity: .4;
  transition: opacity 0.3s ease;
}

.trp-swiper-pagination .swiper-pagination-bullet-active {
  opacity: 1;
  background: #E78C85;
}

/* Hide controls when only 1 slide */
.trp-swiper-single-slide .trp-swiper-controls {
  display: none !important;
}

/* === CARD === */
.trp-package-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.trp-package-card:hover {
  transform: translateY(-4px);
}

/* === CONTENEDOR IMAGEN === */
.trp-package-card .card-thumb {
  position: relative;
  width: 100%;
  height: 430px !important;
  overflow: hidden;
}

.trp-package-card .card-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.trp-package-card:hover .card-thumb img {
  transform: scale(1.05);
}

/* === TAG === */
.trp-package-card .card-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #311A42;
  color: #fff;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 3;
}

/* === FAVORITO === */
.trp-package-card .favorite-wrapper {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
}

.trp-package-card .favorite-btn {
  background: rgba(255, 255, 255, 0.85);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.trp-package-card .favorite-btn svg {
  width: 18px;
  height: 18px;
  fill: #777;
  transition: fill 0.3s ease;
}

.trp-package-card .favorite-btn.active {
  background-color: #E30614;
  border-color: #E30614;
  transform: scale(1.1);
}

.trp-package-card .favorite-btn.active svg {
  fill: #fff;
  animation: pulse 0.25s ease;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
  }
}

/* === OVERLAY === */
.trp-package-card .card-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.75) 100%);
  color: #fff;
  padding: 24px 16px 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  z-index: 2;
}

/* === CONTENEDOR IZQUIERDO === */
.trp-package-card .card-left {
  width: 100%;
  position: relative;
  padding-right: 0px;
}

/* === TÍTULO === */
.trp-package-card .card-title {
  font-size: 18px;
  font-weight: 900;
  margin-top: 0px !important;
  margin-bottom: 0px !important;
  color: #FFFFFF;
  position: relative;
  display: block;
}

.trp-filterable .trp-package-card .card-title::after {
  content: none;
}

/* === PÁRRAFO === */
.trp-package-card .card-paragraph {
  position: relative;
  margin-top: 8px;
  margin-bottom: 20px;
  font-size: 15px;
  line-height: 1.3;
  display: block;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}

.trp-package-card .card-paragraph::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -10px;
  width: 140px;
  height: 1px;
  background: #fff;
}

/* === INFO === */
.trp-package-card .card-info {
  font-size: 14px;
  color: #f0f0f0;
  opacity: 0.95;
}

.trp-package-card .card-info span {
  font-size: 14px;
}

.trp-package-card .card-locs {
  display: flex;
  align-items: center;
  margin-top: 4px;
  gap: 5px;
}

.trp-package-card .card-locs-icon {
  display: flex;
}

.trp-package-card .card-locs p {
  font-size: 12px;
  margin: 0;
}

/* === DESCUENTO === */
.trp-package-card .card-discount {
  position: absolute;
  top: 24px;
  right: -36px;
  z-index: 15;
  background: var(--offer-color, #E78C85);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 100%;
  text-align: center;
  padding: 6px 35px;
  transform: rotate(45deg);
  white-space: nowrap;
  text-transform: lowercase;
}

.trp-package-card .card-discount::before {
  content: "";
  position: absolute;
  left: 0;
  top: 31px;
  width: 0;
  height: 0;
  border-left: 1px solid transparent;
  border-right: 16px solid transparent;
  border-top: 16px solid var(--offer-color, #E78C85);
}

.trp-package-card .card-discount::after {
  content: "";
  position: absolute;
  left: 120px;
  top: 31px;
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 1px solid transparent;
  border-top: 16px solid var(--offer-color, #E78C85);
}

/* === BOTÓN === */
.trp-package-card .card-button {
  display: inline-block;
  background: #E78C85;
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 600;
  font-size: 16px;
  transition: background 0.3s ease, transform 0.2s ease;
  text-decoration: none;
  margin-top: 16px;
}

.card-price-info span {
  font-size: 20px !important;
  font-weight: 700;
  margin-top: 10px;
  color: #FFFFFF;
}

@media(max-width: 768px) {
  .card-price-info span {
    font-size: 17px !important;
  }
}

.trp-package-card .card-button:hover {
  background: #ff9b95;
  transform: scale(1.05);
}

/* No packages message */
.no-packages {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 16px;
}

/* === LOADING SPINNER === */
.trp-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 999;
}

.trp-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #E78C85;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: trp-spin 1s linear infinite;
}

@keyframes trp-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Opacity cuando está cargando */
.trp-block.trp-is-loading .trp-swiper {
  opacity: 0.5;
  pointer-events: none;
}

/* === FAVORITES GRID === */
/* Desktop: Grid de 4 columnas SIEMPRE */
@media (min-width: 1024px) {
  .trp-swiper.favorites-mode .favorites-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px;
  }

  .trp-swiper.favorites-mode .swiper-wrapper {
    display: none !important;
  }

  .trp-swiper.favorites-mode .favorites-grid .trp-package-card {
    width: 100%;
    height: auto;
  }
}

/* Mobile: Swiper activo */
@media (max-width: 1023px) {
  .trp-swiper.favorites-mode .favorites-grid {
    display: none !important;
  }

  .trp-swiper.favorites-mode .swiper-wrapper {
    display: flex !important;
  }
}
