/* ============================================================
   SendDrop — Effects & Animations
   Cyberpunk visual effects: glitch, scanlines, neon pulses
   ============================================================ */

/* ----- Keyframe Animations ----- */

/* 1. Neon pulse — peer card idle breathing glow */
@keyframes neonPulse {
  0%, 100% {
    box-shadow: 0 0 4px rgba(0, 240, 255, 0.1), 0 0 8px rgba(0, 240, 255, 0.05);
  }
  50% {
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.3), 0 0 20px rgba(0, 240, 255, 0.1);
  }
}

/* 2. Glitch — title hover effect with clip-path slices */
@keyframes glitch {
  0% {
    clip-path: inset(0 0 100% 0);
    transform: translate(0);
  }
  5% {
    clip-path: inset(40% 0 20% 0);
    transform: translate(-3px, 1px);
  }
  10% {
    clip-path: inset(70% 0 5% 0);
    transform: translate(3px, -1px);
  }
  15% {
    clip-path: inset(10% 0 60% 0);
    transform: translate(-2px, 0);
  }
  20% {
    clip-path: inset(0 0 100% 0);
    transform: translate(0);
  }
  100% {
    clip-path: inset(0 0 100% 0);
    transform: translate(0);
  }
}

/* 3. Scanlines — subtle moving scanline overlay */
@keyframes scanlines {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 4px;
  }
}

/* 4. Shimmer — holographic progress bar effect */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* 5. Float — empty state icon gentle bob */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* 6. Fade in up — peer card entrance */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 7. Fade out down — peer card exit */
@keyframes fadeOutDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(16px);
  }
}

/* 8. Ripple — click effect */
@keyframes ripple {
  from {
    transform: scale(0);
    opacity: 0.5;
  }
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* 9. Slide in right — toast notifications */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 10. Border glow — cycling neon border colors */
@keyframes borderGlow {
  0%, 100% {
    border-color: rgba(0, 240, 255, 0.4);
  }
  33% {
    border-color: rgba(178, 78, 255, 0.4);
  }
  66% {
    border-color: rgba(233, 69, 96, 0.4);
  }
}

/* 11. Fade out — toast dismiss */
@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* 12. Status dot pulse */
@keyframes statusPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}


/* ----- Scanline Overlay ----- */

#app::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 240, 255, 0.03) 2px,
    rgba(0, 240, 255, 0.03) 4px
  );
  pointer-events: none;
  z-index: 1000;
  animation: scanlines 0.4s linear infinite;
}


/* ----- Title Glitch Effect ----- */

.title {
  position: relative;
}

.title::before,
.title::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}

.title::before {
  color: #ff0040;
  text-shadow: 0 0 7px rgba(255, 0, 64, 0.8);
  animation: glitch 3s infinite linear;
}

.title::after {
  color: #0ff;
  text-shadow: 0 0 7px rgba(0, 255, 255, 0.8);
  animation: glitch 3s infinite linear reverse;
}

.title:hover::before,
.title:hover::after {
  opacity: 0.8;
}


/* ----- Peer Card Animations ----- */

.peer-card {
  animation: neonPulse 3s ease-in-out infinite, fadeInUp 0.4s ease backwards;
}

/* Stagger entrance for peer cards */
.peer-card:nth-child(1) { animation-delay: 0s, 0s; }
.peer-card:nth-child(2) { animation-delay: 0s, 0.08s; }
.peer-card:nth-child(3) { animation-delay: 0s, 0.16s; }
.peer-card:nth-child(4) { animation-delay: 0s, 0.24s; }
.peer-card:nth-child(5) { animation-delay: 0s, 0.32s; }
.peer-card:nth-child(6) { animation-delay: 0s, 0.4s; }
.peer-card:nth-child(7) { animation-delay: 0s, 0.48s; }
.peer-card:nth-child(8) { animation-delay: 0s, 0.56s; }

/* Exit animation class (applied by JS) */
.peer-card.exiting {
  animation: fadeOutDown 0.3s ease forwards;
}

/* Ripple on click */
.peer-card .ripple {
  animation: ripple 0.6s ease-out forwards;
}


/* ----- Empty State Float ----- */

.empty-icon {
  animation: float 3s ease-in-out infinite;
}


/* ----- Progress Bar Shimmer ----- */

.progress-fill {
  animation: shimmer 2s linear infinite;
}


/* ----- Drop Zone Glow ----- */

.drop-zone {
  animation: borderGlow 6s ease-in-out infinite;
}

.drop-zone:hover,
.drop-zone.dragover {
  animation: none;
  border-color: var(--neon-cyan);
}


/* ----- Toast Animations ----- */

.toast {
  animation: slideInRight 0.3s ease forwards;
}

.toast.dismissing {
  animation: fadeOut 0.3s ease forwards;
}


/* ----- Status Dot Pulse ----- */

.status-dot.connected {
  animation: statusPulse 2s ease-in-out infinite;
}

.status-dot.disconnected {
  animation: statusPulse 1s ease-in-out infinite;
}


/* ----- File Items ----- */

.file-item {
  animation: fadeInUp 0.3s ease backwards;
}


/* ----- Receive Info Entrance ----- */

.receive-info {
  animation: fadeInUp 0.4s ease backwards;
}


/* ----- Modal Entrance ----- */

.modal-overlay:not([hidden]) .modal {
  animation: fadeInUp 0.25s ease;
}


/* ----- Transition Defaults ----- */

.btn,
.btn-icon-only,
.peer-card,
.drop-zone,
.input-field,
.file-item {
  transition: all 0.3s ease;
}


/* ----- No-Effects Mode ----- */
/* Applied via settings toggle: document.body.classList.toggle('no-effects') */

body.no-effects *,
body.no-effects *::before,
body.no-effects *::after {
  animation: none !important;
  transition: none !important;
}

body.no-effects #particles {
  display: none;
}

body.no-effects #app::before {
  display: none;
}

body.no-effects .title::before,
body.no-effects .title::after {
  display: none;
}

/* Keep status dot colors visible even with no-effects */
body.no-effects .status-dot.connected {
  background: var(--neon-green);
}

body.no-effects .status-dot.disconnected {
  background: var(--neon-pink);
}


/* ----- Mobile: Reduce Effects ----- */

@media (max-width: 600px) {
  /* Hide scanlines on small screens for performance */
  #app::before {
    display: none;
  }

  /* Reduce glitch effect */
  .title::before,
  .title::after {
    display: none;
  }

  /* Simplify peer card animations */
  .peer-card {
    animation: fadeInUp 0.3s ease backwards;
  }

  .peer-card:hover {
    transform: none;
  }
}

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

  #app::before {
    display: none;
  }

  .title::before,
  .title::after {
    display: none;
  }
}
