/**
 * Favorites Button Styles
 * Estilos para o botão de favorito nos cards
 */

/* Wrapper da imagem */
.card-image-wrapper {
  display: block;
  position: relative;
}

/* Botão de favorito - posicionado SOBRE a imagem usando o card como referência */
.btn-favorite {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #666 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  user-select: none;
  -webkit-user-select: none;
  margin: 0;
  padding: 0;
  /* Importante: não permitir eventos de ponteiro no pseudo-elemento */
  pointer-events: auto;
}

.btn-favorite:hover {
  background: rgba(255, 255, 255, 1);
  color: #ff7919 !important;
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(255, 121, 25, 0.3);
}

.btn-favorite:active {
  transform: scale(0.9);
}

/* Estado favoritado */
.btn-favorite.favorited {
  /* background: rgba(255, 121, 25, 0.15); */
  color: #ff7919 !important;
}

.btn-favorite.favorited:hover {
  /* background: rgba(255, 121, 25, 0.25); */
  color: #ff7919 !important;
}

.btn-favorite i {
  font-size: 18px;
  transition: all 0.3s ease;
  pointer-events: none;
  color: inherit !important;
}

.btn-favorite i.favorited {
  color: #ff7919 !important;
}

/* Animação ao favoritar */
@keyframes heartBeat {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.3);
  }
  50% {
    transform: scale(1);
  }
  75% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.btn-favorite.favorited i {
  animation: heartBeat 0.5s ease-in-out;
}

/* Garantir que o botão receba cliques mesmo sobre o link */
.btn-favorite {
  pointer-events: auto !important;
}

/* Responsivo - mobile */
@media (max-width: 767px) {
  .btn-favorite {
    width: 38px;
    height: 38px;
    top: 8px;
    right: 8px;
  }

  .btn-favorite i {
    font-size: 17px;
  }
}

/* Garantir que a imagem não sobreponha o botão */
.card-img-top {
  position: relative;
  z-index: 1;
}

/* Link da imagem não deve interferir com o botão */
.card-image-wrapper {
  position: relative;
  z-index: 2;
}

/* Garantir que o card tenha position relative */
.card {
  position: relative;
  overflow: visible;
}

.carousel-cell .card {
  position: relative;
  overflow: visible;
}

/* Garantir que o rounded-3 não corte o botão */
.card.rounded-3 {
  overflow: visible;
}

/* Prevenir que o botão seja clicável quando desabilitado */
.btn-favorite[disabled],
.btn-favorite.disabled {
  pointer-events: none;
  opacity: 0.5;
  cursor: not-allowed;
}

/* Loading state */
.card.loading .btn-favorite {
  pointer-events: none;
  opacity: 0.5;
}

/* Melhorar contraste em imagens claras */
.btn-favorite::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.05) 0%, transparent 70%);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-favorite:hover::before {
  opacity: 1;
}

/* ========================================
   Botão de Favorito na Página de Detalhes
   ======================================== */

.btn-favorite-detail {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: transparent !important;
  border: 2px solid #ff7919 !important;
  border-radius: 8px;
  color: #ff7919 !important;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}

.btn-favorite-detail:hover {
  background: #ff7919 !important;
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 121, 25, 0.3);
}

.btn-favorite-detail:active {
  transform: translateY(0);
}

.btn-favorite-detail.favorited {
  background: #ff7919 !important;
  color: #fff !important;
  border-color: #ff7919 !important;
}

.btn-favorite-detail.favorited:hover {
  background: #e56910 !important;
  border-color: #e56910 !important;
  color: #fff !important;
}

.btn-favorite-detail i {
  font-size: 18px;
  transition: all 0.3s ease;
  color: inherit !important;
}

.btn-favorite-detail.favorited i {
  animation: heartBeat 0.5s ease-in-out;
  color: inherit !important;
}

.btn-favorite-detail[disabled],
.btn-favorite-detail.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Mobile - Botão em largura total */
@media (max-width: 991px) {
  .btn-favorite-detail {
    width: 100%;
    justify-content: center;
    padding: 12px 20px;
    font-size: 18px;
  }

  .btn-favorite-detail i {
    font-size: 20px;
  }
}
