﻿/* ========================================================
   CRO SPECIFIC ANIMATIONS
   ======================================================== */

/* --------------------------------------------------------
   Card 2: Conversion Funnel
   -------------------------------------------------------- */
.funnel-anim {
  position: relative;
  height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
}

.funnel-layer {
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.funnel-layer--1 { width: 100%; height: 28px; }
.funnel-layer--2 { width: 75%; height: 28px; }
.funnel-layer--3 { width: 50%; height: 28px; }
.funnel-layer--4 { width: 35%; height: 32px; background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.3); color: #10b981; }

.funnel-dots {
  position: absolute;
  top: -10px;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.funnel-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  animation: funnel-drop 3s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

.funnel-dot:nth-child(1) { left: 20%; animation-delay: 0.1s; }
.funnel-dot:nth-child(2) { left: 40%; animation-delay: 1.2s; background: #10b981; }
.funnel-dot:nth-child(3) { left: 60%; animation-delay: 0.5s; }
.funnel-dot:nth-child(4) { left: 80%; animation-delay: 2.1s; }
.funnel-dot:nth-child(5) { left: 50%; animation-delay: 2.8s; background: #10b981; }

@keyframes funnel-drop {
  0% { transform: translateY(-10px) scale(0); opacity: 0; }
  20% { transform: translateY(10px) scale(1); opacity: 0.8; }
  80% { transform: translateY(110px) scale(0.8); opacity: 0.8; }
  100% { transform: translateY(140px) scale(0); opacity: 0; }
}

.funnel-glow {
  position: absolute;
  bottom: -20px;
  width: 60px;
  height: 30px;
  background: radial-gradient(ellipse, rgba(16,185,129,0.4) 0%, rgba(16,185,129,0) 70%);
  animation: funnel-pulse 1.5s infinite alternate;
}

@keyframes funnel-pulse {
  from { opacity: 0.3; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1.2); }
}


/* --------------------------------------------------------
   Card 3: A/B Testing
   -------------------------------------------------------- */
.ab-test-anim {
  position: relative;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 15px;
}

.ab-variant {
  width: 70px;
  height: 90px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  padding: 8px;
  position: relative;
}

.ab-variant__header {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  margin-bottom: 8px;
  text-align: center;
}

.ab-variant__btn {
  margin-top: auto;
  height: 16px;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
}

.ab-variant.winner {
  border-color: rgba(16,185,129,0.3);
  background: rgba(16,185,129,0.05);
}

.ab-variant.winner .ab-variant__btn {
  background: #10b981;
}

.ab-cursor {
  position: absolute;
  width: 16px;
  height: 16px;
  fill: #fff;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  z-index: 10;
  animation: cursor-ab-test 4s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

.ab-winner-badge {
  position: absolute;
  top: -15px;
  right: -10px;
  background: #10b981;
  color: #fff;
  font-size: 9px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  opacity: 0;
  transform: scale(0.5);
  animation: winner-pop 4s infinite cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cursor-ab-test {
  0% { transform: translate(-30px, 60px); }
  15% { transform: translate(-30px, 60px); }
  25% { transform: translate(-25px, 62px) scale(0.9); } /* Click A */
  35% { transform: translate(-30px, 60px) scale(1); }
  55% { transform: translate(50px, 60px); }
  65% { transform: translate(52px, 62px) scale(0.9); } /* Click B */
  75% { transform: translate(50px, 60px) scale(1); }
  100% { transform: translate(-30px, 60px); }
}

@keyframes winner-pop {
  0%, 65% { opacity: 0; transform: scale(0.5); }
  75%, 90% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.5); }
}


/* --------------------------------------------------------
   Card 4: Heatmap Tracking
   -------------------------------------------------------- */
.heatmap-anim {
  position: relative;
  width: 100%;
  height: 110px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.05);
  margin-top: 15px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
}
body.dark .heatmap-anim {
  background: rgba(255,255,255,0.02);
  border-color: rgba(255,255,255,0.05);
}

.heatmap-anim__nav {
  height: 20px;
  background: rgba(0,0,0,0.03);
  border-bottom: 1px solid rgba(0,0,0,0.03);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 4px;
  position: relative;
  z-index: 10;
}
body.dark .heatmap-anim__nav { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.03); }

.heatmap-anim__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0,0,0,0.1);
}
body.dark .heatmap-anim__dot { background: rgba(255,255,255,0.1); }

.heatmap-anim__body {
  flex: 1;
  padding: 8px 10px;
  position: relative;
  display: flex;
  flex-direction: column;
  z-index: 1;
  overflow: hidden;
  border-radius: 0 0 8px 8px;
}

/* Mock Website Elements */
.hm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
body.dark .hm-header { border-color: rgba(255,255,255,0.05); }

.hm-logo {
  width: 24px;
  height: 8px;
  background: rgba(0,0,0,0.1);
  border-radius: 2px;
}
body.dark .hm-logo { background: rgba(255,255,255,0.1); }

.hm-links {
  display: flex;
  gap: 4px;
}
.hm-link {
  width: 12px;
  height: 4px;
  background: rgba(0,0,0,0.06);
  border-radius: 2px;
}
body.dark .hm-link { background: rgba(255,255,255,0.06); }

.hm-main {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.hm-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hm-title {
  width: 70%;
  height: 8px;
  background: rgba(0,0,0,0.1);
  border-radius: 2px;
  margin-bottom: 2px;
}
body.dark .hm-title { background: rgba(255,255,255,0.1); }

.hm-desc {
  width: 100%;
  height: 4px;
  background: rgba(0,0,0,0.05);
  border-radius: 2px;
}
body.dark .hm-desc { background: rgba(255,255,255,0.05); }

.hm-img {
  width: 32px;
  height: 24px;
  background: rgba(0,0,0,0.05);
  border-radius: 4px;
}
body.dark .hm-img { background: rgba(255,255,255,0.05); }

.heatmap-anim__cta {
  width: 80px;
  height: 16px;
  background: #10b981;
  border-radius: 4px;
  margin: auto auto 0;
  position: relative;
}

/* Heat Zones */
.heat-zone {
  position: absolute;
  border-radius: 50%;
  filter: blur(4px);
  mix-blend-mode: multiply;
  pointer-events: none;
  opacity: 0;
  animation: heat-fade 4s infinite;
}
body.dark .heat-zone { mix-blend-mode: screen; }

/* Over CTA */
.heat-zone--1 { 
  width: 50px; height: 24px; 
  bottom: 4px; left: 50%; transform: translateX(-50%); 
  background: radial-gradient(circle, rgba(239,68,68,0.9) 0%, rgba(245,158,11,0.6) 40%, rgba(252,211,77,0) 70%);
  animation-delay: 2s; 
}
/* Over Image */
.heat-zone--2 { 
  width: 40px; height: 40px; 
  top: 25px; right: 4px; 
  background: radial-gradient(circle, rgba(245,158,11,0.8) 0%, rgba(252,211,77,0.5) 40%, rgba(252,211,77,0) 70%);
  animation-delay: 0.5s; 
}
/* Over Nav */
.heat-zone--3 { 
  width: 30px; height: 20px; 
  top: 2px; right: 10px; 
  background: radial-gradient(circle, rgba(239,68,68,0.7) 0%, rgba(252,211,77,0.4) 50%, rgba(252,211,77,0) 70%);
  animation-delay: 3.5s; 
}

@keyframes heat-fade {
  0%, 10% { opacity: 0; transform: scale(0.8); }
  20%, 80% { opacity: 1; transform: scale(1); }
  90%, 100% { opacity: 0; transform: scale(0.8); }
}

/* Cursor Animation */
.heatmap-cursor {
  position: absolute;
  width: 14px;
  height: 14px;
  fill: #111;
  stroke: #fff;
  stroke-width: 1.5;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
  z-index: 10;
  pointer-events: none;
  animation: cursor-browse 4s infinite cubic-bezier(0.4, 0, 0.2, 1);
}
body.dark .heatmap-cursor { fill: #fff; stroke: #111; }

@keyframes cursor-browse {
  0% { transform: translate(10px, 60px); }
  /* Go to image */
  15% { transform: translate(90px, 35px); }
  20% { transform: translate(90px, 35px) scale(0.9); }
  25% { transform: translate(90px, 35px) scale(1); }
  /* Go to CTA */
  45% { transform: translate(60px, 80px); }
  50% { transform: translate(60px, 80px) scale(0.9); }
  55% { transform: translate(60px, 80px) scale(1); }
  /* Go to Nav */
  75% { transform: translate(100px, 12px); }
  80% { transform: translate(100px, 12px) scale(0.9); }
  85% { transform: translate(100px, 12px) scale(1); }
  100% { transform: translate(10px, 60px); }
}


/* --------------------------------------------------------
   Card 5: Speed Optimization Gauge
   -------------------------------------------------------- */
.speed-anim {
  position: relative;
  width: 120px;
  height: 60px;
  margin: 20px auto 0;
  overflow: hidden;
  box-sizing: border-box;
}

.speed-anim * {
  box-sizing: border-box;
}

.speed-anim__bg {
  position: absolute;
  top: 0; left: 0; width: 120px; height: 120px;
  border-radius: 50%;
  border: 12px solid rgba(0,0,0,0.05);
  border-bottom-color: transparent;
  border-right-color: transparent;
  transform: rotate(45deg);
}
body.dark .speed-anim__bg { border-color: rgba(255,255,255,0.05) transparent transparent rgba(255,255,255,0.05); }

.speed-anim__fill {
  position: absolute;
  top: 0; left: 0; width: 120px; height: 120px;
  border-radius: 50%;
  border: 12px solid #10b981;
  border-bottom-color: transparent;
  border-right-color: transparent;
  transform: rotate(-135deg); /* Start at 0 */
  animation: speed-sweep 3s infinite cubic-bezier(0.2, 0.8, 0.2, 1);
}

.speed-anim__needle {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 4px;
  height: 44px;
  background: #333;
  border-radius: 4px;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(-90deg);
  animation: needle-sweep 3s infinite cubic-bezier(0.2, 0.8, 0.2, 1);
}
body.dark .speed-anim__needle { background: #fff; }

.speed-anim__needle::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: -2px;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
}

@keyframes speed-sweep {
  0% { transform: rotate(-135deg); border-color: #ef4444 transparent transparent #ef4444; }
  20% { transform: rotate(-90deg); border-color: #f59e0b transparent transparent #f59e0b; }
  50% { transform: rotate(40deg); border-color: #10b981 transparent transparent #10b981; }
  80%, 100% { transform: rotate(40deg); border-color: #10b981 transparent transparent #10b981; }
}

@keyframes needle-sweep {
  0% { transform: translateX(-50%) rotate(-90deg); }
  20% { transform: translateX(-50%) rotate(-45deg); }
  50% { transform: translateX(-50%) rotate(85deg); }
  80%, 100% { transform: translateX(-50%) rotate(85deg); }
}

.speed-anim__score {
  position: absolute;
  bottom: 10px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #10b981;
  font-family: monospace;
  background: #fff;
  padding: 0 4px;
  display: inline-block;
  margin: 0 auto;
  width: max-content;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 4px;
}
body.dark .speed-anim__score { background: #1a1a1a; }
