/* ===== Code Transform Section (Reversed Animation) ===== */
.code-transform-section {
  background: #0a0b0f;
  background-image: radial-gradient(circle at 15% 20%, rgba(255, 107, 53, 0.15) 0%, transparent 55%),
                    radial-gradient(circle at 85% 80%, rgba(102, 126, 234, 0.15) 0%, transparent 55%);
  min-height: 100vh;
  overflow: hidden;
  position: relative;
  padding: 4rem 0 0;
}

.code-transform-section .section-header {
  position: relative;
  z-index: 10;
  text-align: center;
  margin-bottom: 1rem;
}

.code-transform-section .section-title {
  color: var(--white);
  font-size: 2.5rem;
}

.code-transform-controls {
  position: absolute;
  top: 20px;
  left: 20px;
  display: none;
  gap: 10px;
  z-index: 100;
}

.code-control-btn {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 25px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
  font-size: 14px;
}

.code-control-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.code-speed-indicator {
  position: absolute;
  top: 20px;
  right: 20px;
  color: white;
  font-size: 16px;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 16px;
  border-radius: 20px;
  backdrop-filter: blur(5px);
  z-index: 100;
  display: none;
}

.code-transform-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.code-stream {
  position: absolute;
  width: 100vw;
  height: 180px;
  display: flex;
  align-items: center;
  overflow: visible;
}

.code-line {
  display: flex;
  align-items: center;
  gap: 60px;
  white-space: nowrap;
  cursor: grab;
  user-select: none;
  will-change: transform;
}

.code-line:active {
  cursor: grabbing;
}

.code-line.dragging {
  cursor: grabbing;
}

.code-line.css-animated {
  animation: scrollCodeCards 40s linear infinite;
}

@keyframes scrollCodeCards {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100vw);
  }
}

.code-card-wrapper {
  position: relative;
  width: 400px;
  height: 250px;
  flex-shrink: 0;
}

.code-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 400px;
  height: 250px;
  border-radius: 15px;
  overflow: hidden;
}

.code-card-ascii {
  background: transparent;
  z-index: 2;
  position: relative;
  overflow: hidden;
}

.code-card-normal {
  background: transparent;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
  color: white;
  z-index: 1;
  position: absolute;
  top: 0;
  left: 0;
  width: 400px;
  height: 250px;
  border-radius: 15px;
  overflow: hidden;
}

.code-module-card {
  width: 100%;
  height: 100%;
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.code-module-card .mockup-simple {
  width: 100%;
  height: 100%;
}

.code-module-card .mockup-screen {
  height: 100%;
}

.code-module-card .mockup-topbar {
  min-height: 100%;
}

.code-module-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.code-mockup-header {
  background: linear-gradient(135deg, var(--gray-100), var(--gray-50));
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--gray-200);
}

.code-mockup-dots {
  display: flex;
  gap: 6px;
}

.code-mockup-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.code-mockup-dots span:nth-child(1) { background: #EF4444; }
.code-mockup-dots span:nth-child(2) { background: #F59E0B; }
.code-mockup-dots span:nth-child(3) { background: #10B981; }

.code-mockup-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-600);
}

.code-mockup-body {
  padding: 1.25rem;
  background: var(--gray-50);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.code-module-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.code-module-title {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.code-module-description {
  font-size: 0.85rem;
  color: var(--gray-600);
  line-height: 1.4;
  margin-bottom: 1rem;
}

.code-module-stats {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.code-stat-box {
  flex: 1;
  background: var(--white);
  border-radius: var(--radius);
  padding: 0.5rem;
  border: 1px solid var(--gray-200);
}

.code-stat-label {
  font-size: 0.65rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.code-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.code-ascii-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  color: rgba(220, 210, 255, 0.6);
  font-family: "Courier New", monospace;
  font-size: 11px;
  line-height: 13px;
  overflow: hidden;
  white-space: pre;
  animation: glitch 0.1s infinite linear alternate-reverse;
  margin: 0;
  padding: 0;
  text-align: left;
  vertical-align: top;
  box-sizing: border-box;
  -webkit-mask-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 0.8) 30%,
    rgba(0, 0, 0, 0.6) 50%,
    rgba(0, 0, 0, 0.4) 80%,
    rgba(0, 0, 0, 0.2) 100%
  );
  mask-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 0.8) 30%,
    rgba(0, 0, 0, 0.6) 50%,
    rgba(0, 0, 0, 0.4) 80%,
    rgba(0, 0, 0, 0.2) 100%
  );
}

@keyframes glitch {
  0% {
    opacity: 1;
  }
  15% {
    opacity: 0.9;
  }
  16% {
    opacity: 1;
  }
  49% {
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
  99% {
    opacity: 0.9;
  }
  100% {
    opacity: 1;
  }
}

.code-scanner {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 300px;
  border-radius: 30px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 107, 53, 0.8),
    rgba(255, 107, 53, 1),
    rgba(255, 107, 53, 0.8),
    transparent
  );
  box-shadow: 0 0 20px rgba(255, 107, 53, 0.8), 0 0 40px rgba(255, 107, 53, 0.4);
  animation: scanPulse 2s ease-in-out infinite alternate;
  z-index: 10;
}

@keyframes scanPulse {
  0% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scaleY(1);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scaleY(1.1);
  }
}

.code-card-normal {
  clip-path: inset(0 0 0 calc(100% - var(--clip-left, 0%)));
}

.code-card-ascii {
  clip-path: inset(0 calc(100% - var(--clip-right, 0%)) 0 0);
}

.code-scan-effect {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 255, 0.4),
    transparent
  );
  animation: scanEffect 0.6s ease-out;
  pointer-events: none;
  z-index: 5;
}

@keyframes scanEffect {
  0% {
    transform: translateX(-100%);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateX(100%);
    opacity: 0;
  }
}

#codeParticleCanvas {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 100vw;
  height: 250px;
  z-index: 0;
  pointer-events: none;
}

#codeScannerCanvas {
  position: absolute;
  top: 50%;
  left: -3px;
  transform: translateY(-50%);
  width: 100vw;
  height: 300px;
  z-index: 15;
  pointer-events: none;
}
