/* ==========================================
   TAV NIT LANDING PAGE - ANIMATIONS
   Animation Keyframes & Effects
   ========================================== */

/* ==========================================
   LOADING & ENTRANCE ANIMATIONS
   ========================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==========================================
   PDF TO TABLE ANIMATION CORE
   ========================================== */

/* PDF Document Styles */
.pdf-doc {
  background: white;
  border: 2px solid #d1d5db;
  padding: 2.3rem;
  position: relative;
  border-radius: 12px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.1);
  min-width: 320px;
}

.pdf-field {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  margin-bottom: 1.15rem;
}

.pdf-label {
  height: 12px;
  width: 115px;
  background: #9ca3af;
  border-radius: 6px;
}

.pdf-value {
  height: 12px;
  width: 138px;
  background: #d1d5db;
  border-radius: 6px;
}

/* Arrow Styles */
.arrow-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding-top: 4rem;
}

@keyframes arrowBounce {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(11px);
  }
}

/* Table Styles */
.table-doc {
  background: white;
  border: 2px solid #d1d5db;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.1);
  min-width: 320px;
}

.table-doc table {
  width: 100%;
  font-size: 15px;
  border-collapse: collapse;
}

.table-doc th {
  text-align: left;
  padding: 1rem 1.5rem;
  background: #f9fafb;
  border-bottom: 2px solid #d1d5db;
  color: #4b5563;
  font-weight: 600;
}

.table-doc td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.target-bar {
  height: 12px;
  width: 138px;
  background: #d1d5db;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.target-bar.filled {
  background: linear-gradient(90deg, #667eea, #764ba2);
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.target-label {
  height: 12px;
  width: 115px;
  background: #d1d5db;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.target-label.filled {
  background: linear-gradient(90deg, #8b5cf6, #06b6d4);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

/* Particle Animations */
.particle {
  position: absolute;
  pointer-events: none;
  z-index: 50;
  display: flex;
  gap: 4px;
  opacity: 0;
}

.particle-bar {
  height: 8px;
  border-radius: 4px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.particle-label {
  position: absolute;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
}

.particle-label-bar {
  height: 8px;
  width: 80px;
  border-radius: 4px;
  background: linear-gradient(90deg, #8b5cf6, #06b6d4);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.5);
}

.particle-bar-1 {
  width: 50px;
  background: linear-gradient(90deg, #667eea, #764ba2);
}

.particle-bar-2 {
  width: 60px;
  background: linear-gradient(90deg, #764ba2, #f093fb);
}

@keyframes flyToTable {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) translateX(0) translateY(0) scale(0.7);
  }
  10% {
    opacity: 1;
    transform: translate(-50%, -50%) translateX(30px) translateY(-15px) scale(1.1);
  }
  85% {
    opacity: 1;
    transform: translate(-50%, -50%) translateX(var(--end-x)) translateY(var(--end-y)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translateX(var(--end-x)) translateY(var(--end-y)) scale(1);
  }
}

.scan-border {
  position: absolute;
  inset: 0;
  border: 2px solid #3b82f6;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
}

.processing-text {
  font-size: 12px;
  font-family: monospace;
  background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 600;
}

.complete-banner {
  background: #ecfdf5;
  border-top: 2px solid #a7f3d0;
  padding: 0.5rem 1rem;
  font-size: 12px;
  color: #047857;
  opacity: 0;
  font-weight: 600;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* ==========================================
   INTERACTIVE EFFECTS
   ========================================== */

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.6);
  }
}

.glow {
  animation: glow 2s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(30px, -50px) scale(1.1);
  }
  66% {
    transform: translate(-20px, 20px) scale(0.9);
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==========================================
   SCROLL-TRIGGERED ANIMATIONS
   ========================================== */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.animate-on-scroll-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.animate-on-scroll-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* ==========================================
   BUTTON HOVER ANIMATIONS
   ========================================== */

.btn-primary,
.btn-secondary,
.btn-secondary-nav,
.btn-secondary-light {
  position: relative;
  overflow: hidden;
}

.btn-primary::before,
.btn-secondary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before,
.btn-secondary:hover::before {
  width: 300px;
  height: 300px;
}

/* ==========================================
   CARD HOVER EFFECTS
   ========================================== */

.feature-card::after,
.integration-card::after,
.problem-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0) 0%,
    rgba(102, 126, 234, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  border-radius: inherit;
}

.feature-card:hover::after,
.integration-card:hover::after,
.problem-card:hover::after {
  opacity: 1;
}

/* ==========================================
   GRADIENT ANIMATIONS
   ========================================== */

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.gradient-animated {
  background-size: 200% 200%;
  animation: gradientShift 5s ease infinite;
}

/* ==========================================
   LOADING STATES
   ========================================== */

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  animation: spin 1s linear infinite;
}

@keyframes dots {
  0%, 20% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.loading-dots span {
  animation: dots 1.4s infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* ==========================================
   COUNTER ANIMATIONS
   ========================================== */

@keyframes countUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.stat-number {
  animation: countUp 1s ease-out;
}

/* ==========================================
   SCROLL INDICATOR
   ========================================== */

@keyframes scrollDown {
  0% {
    opacity: 0;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(20px);
  }
}

.scroll-indicator {
  animation: scrollDown 2s ease-in-out infinite;
}

/* ==========================================
   PROGRESS BAR ANIMATIONS
   ========================================== */

@keyframes progressFill {
  from {
    width: 0%;
  }
  to {
    width: 100%;
  }
}

.progress-bar-fill {
  animation: progressFill 1.5s ease-out forwards;
}

/* ==========================================
   TEXT EFFECTS
   ========================================== */

@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

.typewriter {
  overflow: hidden;
  white-space: nowrap;
  animation: typewriter 2s steps(40) forwards;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.cursor {
  animation: blink 1s step-end infinite;
}

/* ==========================================
   PARALLAX EFFECTS
   ========================================== */

.parallax {
  transition: transform 0.3s ease-out;
}

/* Applied via JS based on scroll position */
.parallax-slow {
  transform: translateY(calc(var(--scroll-y) * 0.2px));
}

.parallax-medium {
  transform: translateY(calc(var(--scroll-y) * 0.5px));
}

.parallax-fast {
  transform: translateY(calc(var(--scroll-y) * 1px));
}

/* ==========================================
   STAGGER ANIMATIONS
   ========================================== */

.stagger-1 {
  animation-delay: 0.1s;
}

.stagger-2 {
  animation-delay: 0.2s;
}

.stagger-3 {
  animation-delay: 0.3s;
}

.stagger-4 {
  animation-delay: 0.4s;
}

.stagger-5 {
  animation-delay: 0.5s;
}

.stagger-6 {
  animation-delay: 0.6s;
}

/* ==========================================
   WORKFLOW ANIMATION STYLES
   ========================================== */

.workflow-animation {
  margin: 2rem 0 3rem;
  width: 100%;
}

.workflow-animation-wrapper {
  position: relative;
}

.workflow-upload-zone:hover,
.workflow-export-zone:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.workflow-ai-processor {
  position: relative;
  overflow: hidden;
}

/* Step numbers */
.step-number {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  z-index: 10;
}

/* Scan line animation */
@keyframes scanLineMove {
  0% {
    top: 0%;
  }
  100% {
    top: 100%;
  }
}

.scan-line {
  animation: scanLineMove 2s ease-in-out infinite;
}

/* Export options slide in */
.export-option {
  will-change: transform, opacity;
}

/* Responsive workflow */
@media (max-width: 1024px) {
  .workflow-animation-wrapper {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  .workflow-arrow {
    transform: rotate(90deg);
  }

  .flying-document {
    display: none !important;
  }
}

/* ==========================================
   API ANIMATION STYLES
   ========================================== */

.api-animation {
  margin: 1.5rem 0;
  width: 100%;
}

.api-animation-wrapper {
  background: #f9fafb;
  border-radius: 8px;
  padding: 1rem;
}

.api-client,
.api-server {
  min-width: 140px;
}

.api-packet {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Smooth packet movement */
.api-packet-request,
.api-packet-response {
  will-change: left, top, opacity;
}

/* AI dots pulse animation */
@keyframes aiDotPulse {
  0%, 100% {
    transform: translateY(0);
    opacity: 1;
  }
  50% {
    transform: translateY(-4px);
    opacity: 0.7;
  }
}

.ai-dot {
  animation: aiDotPulse 0.9s ease-in-out infinite;
}

.ai-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.ai-dot:nth-child(3) {
  animation-delay: 0.3s;
}

/* Connection line animation */
@keyframes connectionPulse {
  0%, 100% {
    stroke-opacity: 0.3;
  }
  50% {
    stroke-opacity: 0.8;
  }
}

#connection-line {
  animation: connectionPulse 2s ease-in-out infinite;
}

/* ==========================================
   HERO ANIMATION - MOBILE RESPONSIVE
   Using actual size reductions instead of transform scaling
   ========================================== */

@media (max-width: 767px) {
  .pdf-doc,
  .table-doc {
    min-width: 160px;
    width: 160px;
    height: 210px;
    padding: 0.75rem;
    border-radius: 8px;
    box-sizing: border-box;
  }

  /* PDF header - reduce sizes */
  .pdf-doc > div:first-child {
    margin-bottom: 0.5rem !important;
    padding-bottom: 0.4rem !important;
  }

  .pdf-doc > div:first-child > div:first-child > div:first-child {
    height: 8px !important;
    width: 50px !important;
    margin-bottom: 3px !important;
  }

  .pdf-doc > div:first-child > div:first-child > div:last-child {
    height: 5px !important;
    width: 70px !important;
  }

  .pdf-doc > div:first-child > div:last-child {
    width: 24px !important;
    height: 24px !important;
  }

  /* PDF footer - reduce sizes */
  .pdf-doc > div:last-of-type:not(.scan-border) {
    margin-top: 0.5rem !important;
    padding-top: 0.4rem !important;
  }

  .pdf-doc > div:last-of-type:not(.scan-border) > div {
    height: 5px !important;
    margin-bottom: 3px !important;
  }

  .table-doc table {
    font-size: 10px;
  }

  .table-doc th,
  .table-doc td {
    padding: 0.35rem 0.5rem;
  }

  .pdf-field {
    gap: 0.4rem;
    margin-bottom: 0.4rem;
  }

  .pdf-label,
  .target-label {
    width: 50px;
    height: 8px;
  }

  .pdf-value,
  .target-bar {
    width: 70px;
    height: 8px;
  }

  .arrow-section {
    padding-top: 1.5rem;
    gap: 0.5rem;
  }

  .arrow-section svg {
    width: 20px;
    height: 20px;
  }

  .processing-text {
    font-size: 9px;
  }

  .particle-bar {
    height: 6px;
  }

  .particle-label-bar {
    height: 6px;
    width: 40px;
  }
}

@media (max-width: 479px) {
  .pdf-doc,
  .table-doc {
    min-width: 120px;
    width: 120px;
    height: 170px;
    padding: 0.5rem;
    border-radius: 6px;
    box-sizing: border-box;
  }

  /* PDF header - smaller for small mobile */
  .pdf-doc > div:first-child {
    margin-bottom: 0.4rem !important;
    padding-bottom: 0.3rem !important;
  }

  .pdf-doc > div:first-child > div:first-child > div:first-child {
    height: 6px !important;
    width: 40px !important;
    margin-bottom: 2px !important;
  }

  .pdf-doc > div:first-child > div:first-child > div:last-child {
    height: 4px !important;
    width: 55px !important;
  }

  .pdf-doc > div:first-child > div:last-child {
    width: 20px !important;
    height: 20px !important;
  }

  /* PDF footer - smaller for small mobile */
  .pdf-doc > div:last-of-type:not(.scan-border) {
    margin-top: 0.4rem !important;
    padding-top: 0.3rem !important;
  }

  .pdf-doc > div:last-of-type:not(.scan-border) > div {
    height: 4px !important;
    margin-bottom: 2px !important;
  }

  .table-doc table {
    font-size: 8px;
  }

  .table-doc th,
  .table-doc td {
    padding: 0.2rem 0.3rem;
  }

  .pdf-field {
    gap: 0.2rem;
    margin-bottom: 0.25rem;
  }

  .pdf-label,
  .target-label {
    width: 35px;
    height: 6px;
  }

  .pdf-value,
  .target-bar {
    width: 55px;
    height: 6px;
  }

  .arrow-section {
    padding-top: 0.75rem;
    gap: 0.3rem;
  }

  .arrow-section svg {
    width: 16px;
    height: 16px;
  }

  .processing-text {
    font-size: 7px;
  }

  .particle-bar {
    height: 4px;
  }

  .particle-label-bar {
    height: 4px;
    width: 28px;
  }

  .complete-banner {
    font-size: 8px;
    padding: 0.25rem 0.4rem;
  }
}

/* ==========================================
   ACCESSIBILITY - RESPECT REDUCED MOTION
   ========================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
