/* Фуллскрин-оверлей */
.christmasanimation-wrapper {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  pointer-events: none;

  display: flex;
  align-items: center;
  justify-content: center;

  background: transparent;
  opacity: 0;
  transition: opacity 0.6s ease, background 0.6s ease;
}

/* когда активна анимация */
.christmasanimation-wrapper.christmasanimation-active {
  opacity: 1;
  background: transparent;
}

.christmasanimation-santa {
  position: relative;
  z-index: 10001;
  width: min(50vw, 480px);
  max-width: 100%;
  will-change: transform;
  opacity: 0;
}

/* Полёт по дуге слева направо */
.christmasanimation-wrapper.christmasanimation-active .christmasanimation-santa {
  transform: translate(-100vw, 25vh) scale(0.8) rotate(-6deg);
  opacity: 1;
  animation: christmas-santa-flight 7s ease-in-out forwards;
}
.christmasanimation-wrapper:not(.christmasanimation-active) .christmasanimation-santa {
  opacity: 0;
}
/* Падающий подарок — старт: рядом с Сантой наверху */
.christmasanimation-gift {
  position: fixed;
  left: 20%;
  top: 25%;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #ff1744;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  z-index: 10000; 
}

/* ленточка */
.christmasanimation-gift::before,
.christmasanimation-gift::after {
  content: '';
  position: absolute;
  background: #ffeb3b;
}

.christmasanimation-gift::before {
  width: 8px;
  height: 100%;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

.christmasanimation-gift::after {
  height: 8px;
  width: 100%;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

/* когда запускается падение подарка */
.christmasanimation-wrapper.christmasanimation-active .christmasanimation-gift.christmasanimation-gift-drop {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: christmas-gift-fall 2.2s ease-in forwards;
}

/* Popup с товаром (в левом нижнем углу) */
.christmasanimation-popup {
  position: fixed;
  left: 15px;
  bottom: 15px;
  z-index: 10002;
  max-width: 260px;
  background: linear-gradient(145deg, #ffffff, #fff7fb);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
  position: fixed;
  overflow: visible;
}

/* когда показываем popup после падения подарка */
.christmasanimation-popup.christmasanimation-popup-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* содержимое popup */
.ca-popup-inner {
  position: relative;
  z-index: 1;
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ca-popup-top {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.ca-popup-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
  background: rgba(220, 0, 78, 0.12);
  color: #b0123f;
  font-weight: 600;
}

/* основной блок: картинка + инфо */
.ca-popup-body {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ca-popup-close {
  position: absolute;
  top: 4px;
  right: 8px;
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.ca-popup-image img {
  max-width: 80px;
  height: auto;
  display: block;
  border-radius: 8px;
}

.ca-popup-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ca-product-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #222;
  margin-bottom: 6px;
}

.ca-product-name:hover {
  text-decoration: underline;
}

.ca-product-price {
  font-size: 14px;
}

.ca-product-price .regular-price {
  font-size: 12px;
  text-decoration: line-through;
  color: #999;
  margin-left: 5px;
}

/* ===== Внутренние анимации SVG (как в loader'е) ===== */

.christmas-loader__santa {
  animation: 1.5s ease-in-out infinite alternate santa-bounce;
}

.christmas-loader__lead {
  animation: 1.5s ease-in-out infinite alternate lead-tighten;
}

.christmas-loader__sleigh {
  animation: 1.5s ease-in-out infinite alternate sleigh-ride;
}

.christmas-loader__reindeer {
  animation: 3s ease-in-out infinite alternate reindeer-fly;
}

.christmas-loader__shoe {
  animation: 1.5s cubic-bezier(0.5, 0.55, 0.5, 0.7) infinite alternate fly;
}

.christmas-loader__green-package {
  animation: 1.5s cubic-bezier(0.7, 0.5, 0.5, 0.75) infinite alternate fly;
}

.christmas-loader__yellow-package {
  animation: 1.5s cubic-bezier(0.6, 0.45, 0.5, 0.8) infinite alternate fly;
}

/* ===== KEYFRAMES ===== */

/* Полёт Санты по дуге слева направо */
@keyframes christmas-santa-flight {
  0% {
    transform: translate(-40vw, 25vh) scale(0.8) rotate(-6deg);
    opacity: 1;
  }
  35% {
    transform: translate(-25vw, 0vh) scale(1) rotate(-2deg);
    opacity: 1;
  }
  65% {
    transform: translate(35vw, -10vh) scale(1) rotate(2deg);
    opacity: 1;
  }
  100% {
    transform: translate(120vw, 20vh) scale(0.9) rotate(8deg);
    opacity: 0;
  }
}

/* Падение подарка в левый нижний угол (туда же, где popup) */
@keyframes christmas-gift-fall {
  0% {
    left: 15%;
    top: 50%;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    left: 10%;
    top: calc(100% - 60px);
    transform: translate(-50%, -50%) scale(0.98);
  }
}

/* Loader эффекты */

@keyframes reindeer-fly {
  0% { transform: translate(0, 5%) rotate(-2deg); }
  50% { transform: translate(-3%, -5%) rotate(2deg); }
  100% { transform: translate(-3%, 15%) rotate(-2deg); }
}

@keyframes santa-bounce {
  0% { transform: translateY(15%) scale(1.05, 0.95) rotate(-1deg); }
  100% { transform: translateY(-20%); }
}

@keyframes lead-tighten {
  0% { transform: translate(0, 10%) scaleX(1.05); }
  100% { transform: translate(0, -32%) rotate(12deg) scaleX(1.10); }
}

@keyframes fly {
  0% { transform: translateY(16%) scaleX(1.05); }
  33% { transform: translateY(2%); }
  100% { transform: translateY(-20%); }
}

@keyframes sleigh-ride {
  0% { transform: translateY(15%) rotate(-4deg); }
  100% { transform: translateY(-15%); }
}
/* Мобильная версия — уменьшаем Санту */
@media (max-width: 767px) {
  .christmasanimation-santa svg {
    height: 120px;
    width: 120px;
  }
  .christmasanimation-gift {
    width: 25px;
    height: 25px;
    border-radius: 3px;
  }
  .christmasanimation-gift::before {
    width: 3px;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    }

    .christmasanimation-gift::after {
    height: 3px;
    width: 100%;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    }
}
/* Снег над попапом */
.christmasanimation-popup::before {
  content: "";
  position: absolute;
  top: -40px;
  left: -20%;
  width: 140%;
  height: 70px;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255,255,255,0.95) 2px, transparent 2px),
    radial-gradient(circle at 30% 0%, rgba(255,255,255,0.9) 1.5px, transparent 2px),
    radial-gradient(circle at 70% 30%, rgba(255,255,255,0.9) 2px, transparent 2px),
    radial-gradient(circle at 90% 10%, rgba(255,255,255,0.8) 1.5px, transparent 2px);
  background-size: 40px 40px, 50px 50px, 45px 45px, 55px 55px;
  opacity: 0.9;
  animation: ca-snow-fall 8s linear infinite;
}
.christmasanimation-popup::after {
  content: "";
  position: absolute;
  top: -40px;
  left: -20%;
  width: 140%;
  height: 70px;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 15% 25%, rgba(255,255,255,0.85) 2px, transparent 2px),
    radial-gradient(circle at 35% 0%, rgba(255,255,255,0.8) 1.5px, transparent 2px),
    radial-gradient(circle at 75% 35%, rgba(255,255,255,0.85) 2px, transparent 2px),
    radial-gradient(circle at 95% 15%, rgba(255,255,255,0.75) 1.5px, transparent 2px);
  background-size: 37px 37px, 48px 48px, 43px 43px, 52px 52px;
  opacity: 0.8;
  animation: ca-snow-fall 8s linear infinite;
  animation-delay: 4s;  /* ← половина цикала — идеальный overlap */
  z-index: 11;
}

/* Анимация снега */
@keyframes ca-snow-fall {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  10% {
    opacity: 0.5;
    transform: translateY(-5px);
  }
  80% {
    opacity: 0.9;
    transform: translateY(0px);
  }
  90% {
    opacity: 0.5;
    transform: translateY(10px);
  }
  100% {
    opacity: 0;
    transform: translateY(18px);
  }
}
@media (max-width: 480px) {
  .christmasanimation-popup {
    max-width: 220px;
    left: 10px;
    bottom: 10px;
  }

  .ca-popup-image img {
    max-width: 70px;
  }

  .ca-popup-badge {
    font-size: 10px;
    padding: 2px 7px;
  }
}

/* === ГАРАНТИРОВАННЫЙ СНЕГ НАД POPUP === */

.christmasanimation-popup {
  position: fixed;
}

/* Слой со снегом */
.christmasanimation-popup .ca-snow {
  pointer-events: none;
  position: absolute;
  left: -10px;
  right: -10px;
  top: -40px;      /* начинается над попапом */
  height: 80px;    /* 40px над + ~40px на карточке */
  z-index: 10;     /* выше контента, ниже крестика если надо — его можно поднять z-index’ом */
  overflow: visible;
}

/* Частицы снега */
.christmasanimation-popup .ca-snow span {
  position: absolute;
  top: -10px;
  width: 4px;
  height: 4px;
  background: #ffffff;
  border-radius: 50%;
  opacity: 0.9;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); /* видно и на белом фоне */
}
