/**
 * Launch Offer Badge - Modern Floating Design
 * Professional 3D badge with Three.js integration
 * 
 * @version 2.0.0
 */

/* ==================== Main Container ==================== */
.launch-offer-badge {
  position: fixed;
  bottom: 30px;
  left: 30px;
  z-index: var(--badge-z-index, 1500);
  opacity: 0;
  transform: translateY(100px) scale(0.8);
  animation: badgeEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s forwards;
}

@keyframes badgeEntrance {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.badge-link {
  display: block;
  text-decoration: none;
  cursor: pointer;
}

/* ==================== Badge Wrapper ==================== */
.badge-wrapper {
  position: relative;
  width: 280px;
  height: 100px;
  perspective: 1500px;
  transform-style: preserve-3d;
}

/* ==================== 3D Canvas Background ==================== */
.badge-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  pointer-events: none;
  z-index: 1;
}

/* ==================== Badge Inner Content ==================== */
.badge-inner {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, 
    rgba(118, 75, 162, 0.95) 0%, 
    rgba(96, 87, 222, 0.95) 100%);
  border-radius: 20px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 
    0 20px 60px rgba(118, 75, 162, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset,
    0 10px 30px rgba(0, 0, 0, 0.3);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateZ(0);
  z-index: 2;
}

.badge-link:hover .badge-inner {
  transform: translateZ(20px) scale(1.05);
  box-shadow: 
    0 30px 80px rgba(118, 75, 162, 0.5),
    0 0 0 2px rgba(255, 255, 255, 0.3) inset,
    0 15px 40px rgba(0, 0, 0, 0.4);
}

/* ==================== Shine Effect ==================== */
.badge-shine {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 70%
  );
  animation: shine 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shine {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

/* ==================== Icon Wrapper ==================== */
.badge-icon-wrapper {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  animation: iconFloat 3s ease-in-out infinite;
  transition: all 0.3s ease;
}

@keyframes iconFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-5px) rotate(5deg);
  }
}

.badge-link:hover .badge-icon-wrapper {
  transform: scale(1.1) rotate(10deg);
  background: rgba(255, 255, 255, 0.25);
}

.badge-icon {
  width: 28px;
  height: 28px;
  fill: white;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* ==================== Content Text ==================== */
.badge-content-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: white;
}

.badge-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
  
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.badge-value {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  background: linear-gradient(180deg, #ffffff 0%, #e0e0e0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.badge-cta {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
  margin-top: 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.badge-link:hover .badge-cta {
  opacity: 1;
  transform: translateX(3px);
}

/* ==================== Pulse Ring ==================== */
.badge-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  pointer-events: none;
}

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0;
  }
}


/* ==================== Responsive Design ==================== */

/* Tablet */
@media (max-width: 1024px) {
  .launch-offer-badge {
    bottom: 20px;
    left: 20px;
  }
  
  .badge-wrapper {
    width: 240px;
    height: 90px;
  }
  
  .badge-icon-wrapper {
    width: 45px;
    height: 45px;
  }
  
  .badge-icon {
    width: 24px;
    height: 24px;
  }
  
  .badge-value {
    font-size: 24px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .launch-offer-badge {
    bottom: 15px;
    left: 15px;
  }
  
  .badge-wrapper {
    width: 200px;
    height: 75px;
  }
  
  .badge-inner {
    padding: 12px 16px;
    gap: 12px;
    border-radius: 16px;
  }
  
  .badge-icon-wrapper {
    width: 40px;
    height: 40px;
  }
  
  .badge-icon {
    width: 22px;
    height: 22px;
  }
  
  .badge-label {
    font-size: 9px;
  }
  
  .badge-value {
    font-size: 20px;
  }
  
  .badge-cta {
    font-size: 10px;
  }
  
  /* Disable 3D canvas on mobile for performance */
  .badge-canvas {
    display: none;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .launch-offer-badge {
    bottom: 10px;
    left: 10px;
  }
  
  .badge-wrapper {
    width: 170px;
    height: 65px;
  }
  
  .badge-inner {
    padding: 10px 12px;
    gap: 10px;
  }
  
  .badge-icon-wrapper {
    width: 35px;
    height: 35px;
  }
  
  .badge-value {
    font-size: 18px;
  }
}

/* ==================== Accessibility ==================== */

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .launch-offer-badge,
  .badge-inner,
  .badge-icon-wrapper,
  .badge-shine,
  .badge-pulse-ring {
    animation: none !important;
    transition: none !important;
  }
  
  .badge-link:hover .badge-inner {
    transform: scale(1.02);
  }
}

/* High Contrast */
@media (prefers-contrast: high) {
  .badge-inner {
    border: 2px solid white;
  }
}

/* Focus Styles */
.badge-link:focus {
  outline: none;
}

.badge-link:focus .badge-inner {
  outline: 3px solid #6057DE;
  outline-offset: 4px;
}

.badge-link:focus:not(:focus-visible) .badge-inner {
  outline: none;
}

/* Print */
@media print {
  .launch-offer-badge {
    display: none;
  }
}

/* ==================== Loading State ==================== */
.launch-offer-badge.loading .badge-inner {
  opacity: 0.5;
  pointer-events: none;
}

/* ==================== Hidden State ==================== */
.launch-offer-badge.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(100px) scale(0.8);
}


/* ==================== Advanced 3D Effects ==================== */

/* Glass morphism overlay */
.badge-inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  border-radius: inherit;
  pointer-events: none;
}

/* Depth shadow */
.badge-inner::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 10%;
  right: 10%;
  height: 20px;
  background: radial-gradient(
    ellipse,
    rgba(118, 75, 162, 0.4) 0%,
    transparent 70%
  );
  filter: blur(15px);
  opacity: 0.6;
  transition: all 0.4s ease;
  z-index: -1;
}

.badge-link:hover .badge-inner::after {
  bottom: -20px;
  opacity: 0.8;
  filter: blur(20px);
}

/* Animated gradient border */
.badge-wrapper::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    45deg,
    #764BA2,
    #6057DE,
    #a78bfa,
    #6057DE,
    #764BA2
  );
  background-size: 300% 300%;
  border-radius: 22px;
  z-index: 0;
  opacity: 0;
  animation: gradientRotate 3s ease infinite;
  transition: opacity 0.3s ease;
}

.badge-link:hover .badge-wrapper::before {
  opacity: 1;
}

@keyframes gradientRotate {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Sparkle effect */
.badge-icon-wrapper::before,
.badge-icon-wrapper::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  opacity: 0;
  animation: sparkle 2s ease-in-out infinite;
}

.badge-icon-wrapper::before {
  top: 5px;
  right: 5px;
  animation-delay: 0s;
}

.badge-icon-wrapper::after {
  bottom: 5px;
  left: 5px;
  animation-delay: 1s;
}

@keyframes sparkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Hover glow effect */
.badge-link:hover .badge-icon-wrapper::before,
.badge-link:hover .badge-icon-wrapper::after {
  box-shadow: 0 0 10px white;
}

/* Text gradient animation */
@keyframes textShine {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

.badge-link:hover .badge-value {
  background: linear-gradient(
    90deg,
    #ffffff 0%,
    #e0e0e0 25%,
    #ffffff 50%,
    #e0e0e0 75%,
    #ffffff 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: textShine 2s linear infinite;
}

/* Floating animation */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.badge-wrapper {
  animation: float 4s ease-in-out infinite;
}

.badge-link:hover .badge-wrapper {
  animation-play-state: paused;
}


/* ==================== Lightning Icon Animation ==================== */
.badge-icon {
  fill: white;
  animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  }
  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 4px 8px rgba(255, 255, 255, 0.5));
  }
}

.badge-link:hover .badge-icon {
  animation: iconZap 0.6s ease-in-out;
  fill: #FFD700;
}

@keyframes iconZap {
  0%, 100% {
    transform: scale(1) rotate(0deg);
  }
  25% {
    transform: scale(1.2) rotate(-5deg);
  }
  50% {
    transform: scale(0.9) rotate(5deg);
  }
  75% {
    transform: scale(1.15) rotate(-3deg);
  }
}


/* ==================== Icon Wrapper Effects ==================== */
.badge-icon-wrapper {
  position: relative;
  overflow: visible;
}

.badge-link:hover .badge-icon-wrapper {
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}


/* ==================== Limited Badge Tag ==================== */
.badge-tag {
  position: absolute;
  top: 7px;
  left: 10px;
  background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 
    0 4px 12px rgba(255, 107, 107, 0.4),
    0 0 0 2px white;
  /* animation: tagBounce 2s ease-in-out infinite; */
  z-index: 10;
}

@keyframes tagBounce {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-3px) scale(1.05);
  }
}

.badge-link:hover .badge-tag {
  animation: tagShake 0.5s ease-in-out;
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
}

@keyframes tagShake {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-5deg);
  }
  75% {
    transform: rotate(5deg);
  }
}


/* ==================== Mini Countdown Timer ==================== */
.badge-mini-countdown {
  position: absolute;
  top: -45px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #764BA2 0%, #6057DE 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 6px 10px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 
    0 4px 15px rgba(118, 75, 162, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.15) inset;
  z-index: 3;
  animation: miniCountdownFloat 4s ease-in-out infinite;
  width: auto;
  display: inline-block;
}

@keyframes miniCountdownFloat {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-10px);
  }
}

.mini-timer {
  font-size: 13px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
}

.mini-timer span {
  display: inline-block;
  min-width: 18px;
  text-align: center;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px 4px;
  border-radius: 4px;
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  font-weight: 900;
}

/* Arrow pointing to badge */
.badge-mini-countdown::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid #6057DE;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Responsive Mini Countdown */
@media (max-width: 1024px) {
  .badge-mini-countdown {
    top: -32px;
    padding: 5px 12px;
  }
  
  .mini-timer {
    font-size: 12px;
  }
  
  .mini-timer span {
    min-width: 16px;
  }
}

@media (max-width: 768px) {
  .badge-mini-countdown {
    top: -40px;
    padding: 4px 10px;
  }
  
  .mini-timer {
    font-size: 11px;
  }
  
  .mini-timer span {
    min-width: 14px;
  }
}

@media (max-width: 480px) {
  .badge-mini-countdown {
    top: -38px;
    padding: 4px 8px;
  }
  
  .mini-timer {
    font-size: 10px;
  }
  
  .mini-timer span {
    min-width: 12px;
  }
}
