/* 
 * Estilos de Animação Avançados para o Tema 33Store
 * Efeitos visuais e transições para melhorar a experiência do usuário
 */

/* Animações básicas */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideInUp {
  from {
    transform: translate3d(0, 100%, 0);
    opacity: 0;
  }
  to {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

@keyframes slideInDown {
  from {
    transform: translate3d(0, -100%, 0);
    opacity: 0;
  }
  to {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

@keyframes slideInLeft {
  from {
    transform: translate3d(-100%, 0, 0);
    opacity: 0;
  }
  to {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translate3d(100%, 0, 0);
    opacity: 0;
  }
  to {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

@keyframes bounceIn {
  from,
  20%,
  40%,
  60%,
  80%,
  to {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  }

  0% {
    opacity: 0;
    transform: scale3d(0.3, 0.3, 0.3);
  }

  20% {
    transform: scale3d(1.1, 1.1, 1.1);
  }

  40% {
    transform: scale3d(0.9, 0.9, 0.9);
  }

  60% {
    opacity: 1;
    transform: scale3d(1.03, 1.03, 1.03);
  }

  80% {
    transform: scale3d(0.97, 0.97, 0.97);
  }

  to {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
}

@keyframes pulse {
  from {
    transform: scale3d(1, 1, 1);
  }
  50% {
    transform: scale3d(1.05, 1.05, 1.05);
  }
  to {
    transform: scale3d(1, 1, 1);
  }
}

@keyframes shake {
  from,
  to {
    transform: translate3d(0, 0, 0);
  }

  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translate3d(-10px, 0, 0);
  }

  20%,
  40%,
  60%,
  80% {
    transform: translate3d(10px, 0, 0);
  }
}

@keyframes wobble {
  from {
    transform: none;
  }

  15% {
    transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
  }

  30% {
    transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
  }

  45% {
    transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
  }

  60% {
    transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
  }

  75% {
    transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
  }

  to {
    transform: none;
  }
}

/* Animações para produtos */
.product-card {
  animation: fadeIn 0.6s ease-out;
}

.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.2s; }
.product-card:nth-child(3) { animation-delay: 0.3s; }
.product-card:nth-child(4) { animation-delay: 0.4s; }
.product-card:nth-child(5) { animation-delay: 0.5s; }
.product-card:nth-child(6) { animation-delay: 0.6s; }

/* Animações para botões */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: width 0.6s, height 0.6s;
  transform: translate(-50%, -50%);
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

/* Efeito de brilho no passar do mouse */
.btn-brilliance {
  position: relative;
  overflow: hidden;
}

.btn-brilliance::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40px;
  height: 200%;
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(25deg);
  transition: all 0.6s;
}

.btn-brilliance:hover::after {
  left: 120%;
}

/* Animações para ícones */
.icon-animated {
  transition: transform 0.3s ease;
}

.icon-animated:hover {
  transform: scale(1.2);
}

.icon-rotate {
  transition: transform 0.5s ease;
}

.icon-rotate:hover {
  transform: rotate(360deg);
}

.icon-bounce {
  animation: pulse 2s infinite;
}

/* Animações para imagens */
.image-hover-zoom {
  overflow: hidden;
  border-radius: var(--border-radius);
}

.image-hover-zoom img {
  transition: transform 0.5s ease;
}

.image-hover-zoom:hover img {
  transform: scale(1.1);
}

.image-fade-in {
  opacity: 0;
  animation: fadeIn 1s ease-out forwards;
}

/* Animações para cards */
.card-elevate {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-elevate:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
}

.card-grow {
  transition: transform 0.3s ease;
}

.card-grow:hover {
  transform: scale(1.03);
}

/* Animações para carregamento */
.loading-dots::after {
  content: '.';
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60% { content: '...'; }
  80%, 100% { content: ''; }
}

/* Animações para notificações */
.notification-slide-in {
  animation: slideInRight 0.3s ease-out;
}

.notification-fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* Animações para modais */
.modal-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.modal-slide-up {
  animation: slideInUp 0.3s ease-out;
}

/* Animações para scroll */
.scroll-animation {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-animation.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Animações para hover em links */
.link-underline {
  position: relative;
}

.link-underline::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background-color: var(--color-primary);
  transition: width 0.3s ease;
}

.link-underline:hover::after {
  width: 100%;
}

/* Animações para progress bars */
.progress-bar-animated {
  position: relative;
  overflow: hidden;
}

.progress-bar-animated::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Animações para tooltips */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--color-text);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Animações para efeitos de loading */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-left-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.dual-ring {
  position: relative;
  display: inline-block;
  width: 64px;
  height: 64px;
}

.dual-ring::after {
  content: " ";
  display: block;
  width: 46px;
  height: 46px;
  margin: 1px;
  border-radius: 50%;
  border: 5px solid var(--color-primary);
  border-color: var(--color-primary) transparent var(--color-primary) transparent;
  animation: dualSpin 1.2s linear infinite;
}

@keyframes dualSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Animações para micro-interações */
.micro-interaction {
  transition: all 0.2s ease;
}

.micro-interaction:active {
  transform: scale(0.95);
}

/* Animações para efeito de parallax */
.parallax-element {
  transform: translateZ(0);
  will-change: transform;
}

/* Animações para efeitos de destaque */
.highlight {
  animation: highlight 2s ease-in-out;
}

@keyframes highlight {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
  70% { box-shadow: 0 0 0 15px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* Animações específicas para diferentes breakpoints */
@media (min-width: 768px) {
  .animation-delayed {
    animation: fadeIn 0.8s ease-out;
    animation-fill-mode: both;
  }
  
  .animation-delayed:nth-child(1) { animation-delay: 0.1s; }
  .animation-delayed:nth-child(2) { animation-delay: 0.2s; }
  .animation-delayed:nth-child(3) { animation-delay: 0.3s; }
  .animation-delayed:nth-child(4) { animation-delay: 0.4s; }
  .animation-delayed:nth-child(5) { animation-delay: 0.5s; }
  .animation-delayed:nth-child(6) { animation-delay: 0.6s; }
}

/* Animações para elementos de formulário */
.form-field:focus-within {
  animation: wobble 0.5s ease;
}

.input-shake {
  animation: shake 0.5s ease;
}

/* Animações para feedback visual */
.visual-feedback {
  animation: pulse 0.5s ease;
}

/* Classes utilitárias para animações */
.animate-fade-in { animation: fadeIn 0.5s ease-out; }
.animate-slide-up { animation: slideInUp 0.5s ease-out; }
.animate-slide-down { animation: slideInDown 0.5s ease-out; }
.animate-slide-left { animation: slideInLeft 0.5s ease-out; }
.animate-slide-right { animation: slideInRight 0.5s ease-out; }
.animate-bounce-in { animation: bounceIn 0.7s ease-out; }

/* Transições personalizadas */
.ease-spring {
  transition: all 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.ease-bounce {
  transition: all 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.ease-circ {
  transition: all 0.6s cubic-bezier(0.645, 0.045, 0.355, 1);
}

/* Efeitos de hover específicos para diferentes tipos de elementos */
.product-card .add_to_cart_button {
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.product-card:hover .add_to_cart_button {
  transform: translateY(0);
  opacity: 1;
}

/* Animação para badge de "Novo" */
.new-badge {
  animation: bounceIn 0.8s ease-out;
}

/* Animação para estrelas de avaliação */
.star-rating .star {
  transition: transform 0.2s ease;
}

.star-rating .star:hover {
  transform: scale(1.2);
}

/* Animações para galeria de imagens */
.woocommerce-product-gallery__wrapper {
  transition: transform 0.5s ease;
}

.woocommerce-product-gallery--columns .woocommerce-product-gallery__wrapper {
  transition: transform 0.5s ease;
}

/* Animação para carrinho flutuante */
.floating-cart-animation {
  animation: slideInUp 0.4s ease-out;
}

/* Animações para carrossel de produtos */
.product-carousel .product {
  opacity: 0.7;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.product-carousel .product.active {
  opacity: 1;
  transform: scale(1.05);
}

/* Animação para loading de conteúdo */
.content-loader {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loadingShimmer 1.5s infinite;
}

@keyframes loadingShimmer {
  0% { background-position-x: -200%; }
  100% { background-position-x: 200%; }
}

/* Animação para botão de adicionar ao carrinho */
.add_to_cart_button.adding {
  position: relative;
}

.add_to_cart_button.adding::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  right: 10px;
  margin-top: -10px;
  border: 2px solid transparent;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}