/* (C)2025 Badger Commerce Limited, a subsidiary of Kedos Consulting Limited */

/* ============================================
   Christmas Mode Extension - Festive Styles
   ============================================ */

/* Snowflake Container */
#christmas-snowflakes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  overflow: hidden;
}

/* Individual Snowflake */
.christmas-snowflake {
  position: absolute;
  top: -100px;
  color: #e0f2fe;
  font-size: 1em;
  user-select: none;
  pointer-events: none;
  animation: snowfall linear infinite;
  text-shadow:
    0 0 8px rgba(96, 165, 250, 0.8),
    0 0 12px rgba(147, 197, 253, 0.6),
    0 0 2px rgba(59, 130, 246, 0.9);
}

/* Snowfall Animation */
@keyframes snowfall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0.8;
  }
}

/* Snow Accumulation on Cards and Elements */
[data-christmas-snow="true"] .card,
[data-christmas-snow="true"] .nova-product-card,
[data-christmas-snow="true"] .panel,
[data-christmas-snow="true"] .well,
[data-christmas-snow="true"] .product-card,
[data-christmas-snow="true"] .item-card {
  position: relative;
}

[data-christmas-snow="true"] .card::before,
[data-christmas-snow="true"] .nova-product-card::before,
[data-christmas-snow="true"] .panel::before,
[data-christmas-snow="true"] .well::before,
[data-christmas-snow="true"] .product-card::before,
[data-christmas-snow="true"] .item-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: linear-gradient(
    to bottom,
    rgba(224, 242, 254, 0.95) 0%,
    rgba(186, 230, 253, 0.8) 50%,
    rgba(147, 197, 253, 0.3) 100%
  );
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  animation: snowAccumulate 2s ease-in forwards;
  animation-delay: 3s;
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2);
}

@keyframes snowAccumulate {
  from {
    opacity: 0;
    height: 0;
  }
  to {
    opacity: 1;
    height: 8px;
  }
}

/* Festive Color Accents */
[data-christmas-colors="true"] {
  /* Subtle festive glow on hover states */
}

[data-christmas-colors="true"] .btn-primary,
[data-christmas-colors="true"] .nova-btn,
[data-christmas-colors="true"] button[type="submit"] {
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

[data-christmas-colors="true"] .btn-primary:hover,
[data-christmas-colors="true"] .nova-btn:hover,
[data-christmas-colors="true"] button[type="submit"]:hover {
  box-shadow: 0 0 20px rgba(220, 38, 38, 0.3), 0 0 40px rgba(34, 197, 94, 0.2);
}

[data-christmas-colors="true"] .navbar,
[data-christmas-colors="true"] .header,
[data-christmas-colors="true"] nav {
  position: relative;
}

[data-christmas-colors="true"] .navbar::after,
[data-christmas-colors="true"] .header::after,
[data-christmas-colors="true"] nav::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    #dc2626 0%,
    #22c55e 25%,
    #dc2626 50%,
    #22c55e 75%,
    #dc2626 100%
  );
  opacity: 0.3;
  animation: festiveShimmer 3s ease-in-out infinite;
}

@keyframes festiveShimmer {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
}

/* Festive Emoji Decorations */
[data-christmas-emojis="true"]::after {
  /* Applied to body via JS */
}

.christmas-emoji {
  position: fixed;
  font-size: 2rem;
  pointer-events: none;
  z-index: 9997;
  opacity: 0.4;
  user-select: none;
}

.christmas-emoji.top-left {
  top: 20px;
  left: 20px;
  animation: gentle-float 6s ease-in-out infinite;
}

.christmas-emoji.top-right {
  top: 20px;
  right: 20px;
  animation: gentle-float 7s ease-in-out infinite 0.5s;
}

.christmas-emoji.bottom-left {
  bottom: 20px;
  left: 20px;
  animation: gentle-float 8s ease-in-out infinite 1s;
}

.christmas-emoji.bottom-right {
  bottom: 20px;
  right: 20px;
  animation: gentle-float 5s ease-in-out infinite 1.5s;
}

@keyframes gentle-float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) rotate(5deg);
  }
}

/* Fairy Lights Container */
#christmas-fairy-lights {
  position: fixed;
  pointer-events: none;
  z-index: 9996;
}

#christmas-fairy-lights.fairy-lights-top {
  top: 10px;
  left: 0;
  width: 100%;
  height: 40px;
}

#christmas-fairy-lights.fairy-lights-side {
  right: 10px;
  top: 0;
  width: 40px;
  height: 100%;
}

/* Individual Fairy Light */
.fairy-light {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transition: opacity 0.3s ease, box-shadow 0.3s ease;
  z-index: 2;
}

#christmas-fairy-lights.fairy-lights-top .fairy-light {
  top: 0;
  /* Cable/wire connecting lights */
  box-shadow:
    0 0 15px currentColor,
    0 0 30px currentColor,
    0 2px 0 rgba(0, 0, 0, 0.2);
}

#christmas-fairy-lights.fairy-lights-top .fairy-light::before {
  /* Wire connecting lights */
  content: '';
  position: absolute;
  top: 50%;
  left: -50vw;
  width: 100vw;
  height: 2px;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0.15) 50%,
    rgba(0, 0, 0, 0.3) 100%
  );
  transform: translateY(-50%);
  z-index: -1;
  pointer-events: none;
}

#christmas-fairy-lights.fairy-lights-side .fairy-light {
  left: 0;
  /* Cable/wire connecting lights */
  box-shadow:
    0 0 15px currentColor,
    0 0 30px currentColor,
    2px 0 0 rgba(0, 0, 0, 0.2);
}

#christmas-fairy-lights.fairy-lights-side .fairy-light::before {
  /* Wire connecting lights */
  content: '';
  position: absolute;
  top: -50vh;
  left: 50%;
  width: 2px;
  height: 100vh;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0.15) 50%,
    rgba(0, 0, 0, 0.3) 100%
  );
  transform: translateX(-50%);
  z-index: -1;
  pointer-events: none;
}

/* Light states - always visible */
.fairy-light {
  opacity: 1 !important;
}

/* Light glow effect when on */
.fairy-light.light-on {
  filter: brightness(1.3);
  box-shadow: 0 0 20px currentColor, 0 0 40px currentColor !important;
}

/* Light dimmed effect when off - still visible but darker */
.fairy-light.light-off {
  filter: brightness(0.4);
  box-shadow: 0 0 5px currentColor !important;
}

/* Disable Button */
#christmas-disable-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  padding: 10px 16px;
  background: rgba(220, 38, 38, 0.9);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  user-select: none;
}

#christmas-disable-btn:hover {
  background: rgba(185, 28, 28, 1);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

#christmas-disable-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#christmas-disable-btn::before {
  content: '❄️ ';
  margin-right: 4px;
}

/* Hidden State */
.christmas-mode-disabled {
  display: none !important;
}

body[data-christmas-disabled="true"] #christmas-snowflakes,
body[data-christmas-disabled="true"] #christmas-fairy-lights,
body[data-christmas-disabled="true"] .christmas-emoji {
  display: none !important;
}

body[data-christmas-disabled="true"] [data-christmas-snow="true"] .card::before,
body[data-christmas-disabled="true"] [data-christmas-snow="true"] .nova-product-card::before,
body[data-christmas-disabled="true"] [data-christmas-snow="true"] .panel::before,
body[data-christmas-disabled="true"] [data-christmas-snow="true"] .well::before {
  display: none !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .christmas-snowflake {
    font-size: 0.8em;
  }

  .christmas-emoji {
    font-size: 1.5rem;
  }

  #christmas-disable-btn {
    bottom: 10px;
    right: 10px;
    padding: 8px 12px;
    font-size: 12px;
  }

  .fairy-light {
    width: 10px;
    height: 10px;
  }

  #christmas-fairy-lights.fairy-lights-top {
    height: 30px;
  }

  #christmas-fairy-lights.fairy-lights-side {
    width: 30px;
  }
}

/* Accessibility: Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .christmas-snowflake {
    animation: none;
    opacity: 0.3;
  }

  .christmas-emoji {
    animation: none;
  }

  .fairy-light.light-on,
  .fairy-light.light-off {
    filter: brightness(1) !important;
    transition: none;
  }

  [data-christmas-snow="true"] .card::before,
  [data-christmas-snow="true"] .nova-product-card::before,
  [data-christmas-snow="true"] .panel::before {
    animation: none;
    opacity: 1;
  }
}
