/* ============================================================
   FileDrop FX — Shared interaction effects
   - Card hover glow (mouse-following spotlight)
   - Tap ripple (click + touch)

   Usage:
   - Add class .fx-glow to any element to enable hover spotlight
   - Add class .fx-ripple to enable tap ripples
   - Combine both as needed

   Variables (set automatically by JS):
   --mx, --my  →  cursor position relative to element (px)
   ============================================================ */

/* ===== Card Hover Glow ===== */
.fx-glow {
  position: relative;
  isolation: isolate;
}

.fx-glow::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    180px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.08),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 0;
}

.fx-glow:hover::before,
.fx-glow.fx-glow-active::before {
  opacity: 1;
}

/* Ensure children are above the glow */
.fx-glow > * {
  position: relative;
  z-index: 1;
}

/* Stronger glow variant for important elements (drop zone, primary buttons) */
.fx-glow-strong::before {
  background: radial-gradient(
    240px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.12),
    transparent 60%
  );
}

/* Subtle border glow that lights up too */
.fx-glow-border::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(
    300px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.25),
    transparent 60%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 0;
}

.fx-glow-border:hover::after,
.fx-glow-border.fx-glow-active::after {
  opacity: 1;
}

/* ===== Tap Ripple ===== */
.fx-ripple {
  position: relative;
  overflow: hidden;
}

.fx-ripple .ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.35),
    rgba(255, 255, 255, 0)
  );
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  animation: ripple-spread 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
  z-index: 2;
}

@keyframes ripple-spread {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
}

/* On dark buttons (with light text on white bg), use dark ripple */
.fx-ripple-dark .ripple {
  background: radial-gradient(
    circle,
    rgba(0, 0, 0, 0.18),
    rgba(0, 0, 0, 0)
  );
}

/* ===== Reduced motion: respect user preferences ===== */
@media (prefers-reduced-motion: reduce) {
  .fx-glow::before,
  .fx-glow::after,
  .fx-glow-border::after {
    transition: none;
  }
  .fx-ripple .ripple {
    animation-duration: 0.01s;
    opacity: 0 !important;
  }
}

/* ===== Focus glow ===== */
/* Subtle ring on focused inputs/textareas — refined Apple-ish feel */
.fx-focus:focus,
input.fx-focus:focus,
textarea.fx-focus:focus,
select.fx-focus:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
  transition: box-shadow 0.2s ease;
}

/* ===== Press scale ===== */
/* Tactile feedback: subtle scale-down when pressed */
.fx-press {
  transition: transform 0.1s ease;
}
.fx-press:active {
  transform: scale(0.97);
}
@media (prefers-reduced-motion: reduce) {
  .fx-press { transition: none; }
  .fx-press:active { transform: none; }
}

/* ============================================================
   v8 NEW EFFECTS
   ============================================================ */

/* ===== Logo (inline SVG) animated hover ===== */
.logo-svg {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo:hover .logo-svg {
  transform: scale(1.05);
}

.logo-arrow {
  transform-origin: center;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo:hover .logo-arrow {
  animation: logo-arrow-drop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes logo-arrow-drop {
  0% { transform: translateY(0); }
  40% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

/* ===== Page load reveal — staggered fade-up ===== */
.fx-reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: fx-reveal-anim 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.fx-reveal[data-delay="1"] { animation-delay: 0.08s; }
.fx-reveal[data-delay="2"] { animation-delay: 0.16s; }
.fx-reveal[data-delay="3"] { animation-delay: 0.24s; }
.fx-reveal[data-delay="4"] { animation-delay: 0.32s; }
.fx-reveal[data-delay="5"] { animation-delay: 0.40s; }

@keyframes fx-reveal-anim {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Shimmer effect on text ===== */
.fx-shimmer {
  background: linear-gradient(
    90deg,
    var(--ink) 0%,
    var(--ink) 35%,
    rgba(255, 255, 255, 0.4) 50%,
    var(--ink) 65%,
    var(--ink) 100%
  );
  background-size: 200% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fx-shimmer-anim 3.5s ease-in-out infinite;
  animation-delay: 0.6s;
}

@keyframes fx-shimmer-anim {
  0% { background-position: 200% 0; }
  50% { background-position: -100% 0; }
  100% { background-position: -100% 0; }
}

/* ===== Drop zone active pulse ===== */
.drop.dragover {
  animation: drop-pulse 1.2s ease-in-out infinite;
}

@keyframes drop-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.12),
                inset 0 0 24px rgba(255, 255, 255, 0.04);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(255, 255, 255, 0),
                inset 0 0 48px rgba(255, 255, 255, 0.08);
  }
}

.drop.dragover .drop-icon {
  animation: drop-icon-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

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

/* ===== Magnetic drop zone (icon follows cursor subtly) ===== */
.drop {
  --icon-x: 0px;
  --icon-y: 0px;
}

.drop .drop-icon {
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translate(var(--icon-x), var(--icon-y));
}

/* Disable magnetic effect on dragover (pulse takes over) */
.drop.dragover .drop-icon {
  transition: none;
}

/* ===== Confetti container ===== */
.confetti-burst {
  position: absolute;
  top: 50%; left: 50%;
  pointer-events: none;
  z-index: 50;
}

.confetti-particle {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 1px;
  pointer-events: none;
  animation: confetti-fly 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
}

@keyframes confetti-fly {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: var(--confetti-end) rotate(var(--confetti-rot, 360deg)) scale(0);
    opacity: 0;
  }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .fx-reveal {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .fx-shimmer {
    animation: none;
    -webkit-text-fill-color: var(--ink);
    background: none;
  }
  .drop.dragover,
  .drop.dragover .drop-icon,
  .logo:hover .logo-arrow {
    animation: none;
  }
  .confetti-particle { display: none; }
  .drop .drop-icon { transform: none !important; }
}

/* ============================================================
   v9 — Polished Modern Effects (subtle, fluid)
   ============================================================ */

/* ===== Animated background gradient ===== */
.fx-bg-gradient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  opacity: 0.7;
}

.fx-bg-gradient::before,
.fx-bg-gradient::after {
  content: '';
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  will-change: transform;
}

.fx-bg-gradient::before {
  background: radial-gradient(circle, rgba(120, 180, 255, 0.4), transparent 70%);
  top: -20vmax;
  left: -20vmax;
  animation: bg-drift-1 28s ease-in-out infinite;
}

.fx-bg-gradient::after {
  background: radial-gradient(circle, rgba(180, 140, 255, 0.3), transparent 70%);
  bottom: -20vmax;
  right: -20vmax;
  animation: bg-drift-2 32s ease-in-out infinite;
}

@keyframes bg-drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(8vmax, 4vmax) scale(1.1); }
  66% { transform: translate(-4vmax, 8vmax) scale(0.95); }
}

@keyframes bg-drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-10vmax, -6vmax) scale(1.15); }
}

/* ===== Card 3D tilt (subtle) ===== */
.fx-tilt {
  transform-style: preserve-3d;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --tilt-x: 0deg;
  --tilt-y: 0deg;
}

.fx-tilt:hover {
  transform: perspective(800px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
}

/* ===== Counter animation (number reveal) ===== */
.fx-counter {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* ===== Quota bar fill animation ===== */
.fx-quota-animate {
  width: 0% !important;
  animation: quota-fill 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
  --fill-target: 0%;
}

@keyframes quota-fill {
  to { width: var(--fill-target) !important; }
}

/* ===== Table row stagger reveal ===== */
.fx-row-stagger {
  opacity: 0;
  transform: translateY(8px);
  animation: row-stagger 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes row-stagger {
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Row hover indicator (left accent line) ===== */
tbody tr {
  position: relative;
}

/* Use box-shadow inset on first td so we don't conflict with td content */
tbody tr td:first-child {
  position: relative;
  transition: box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

tbody tr:hover td:first-child {
  box-shadow: inset 2px 0 0 0 rgba(255,255,255,0.6);
}

/* ===== File icon float (download page) ===== */
.fx-float {
  animation: float 4s ease-in-out infinite;
}

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

/* ===== Download button aura pulse ===== */
.fx-aura {
  position: relative;
}

.fx-aura::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  opacity: 0.4;
  z-index: -1;
  animation: aura-pulse 2.4s ease-in-out infinite;
}

@keyframes aura-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.08);
    opacity: 0;
  }
}

/* ===== Card breathing (login) ===== */
.fx-breathe {
  animation: breathe 6s ease-in-out infinite;
}

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

/* ===== Background ambient particles ===== */
.fx-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.fx-particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  animation: particle-float linear infinite;
  will-change: transform;
}

@keyframes particle-float {
  from {
    transform: translateY(110vh) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  to {
    transform: translateY(-10vh) translateX(40px);
    opacity: 0;
  }
}

/* ===== Smooth scroll-reveal (intersection observer) ===== */
.fx-scroll-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.fx-scroll-reveal.fx-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Progress bar with glow trail ===== */
.progress-bar {
  position: relative;
  overflow: visible;
}

.upload-item:not(.done):not(.error) .progress-bar::after {
  content: '';
  position: absolute;
  right: -4px; top: -2px;
  width: 8px; height: 6px;
  background: var(--ink);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--ink), 0 0 20px rgba(255,255,255,0.5);
  opacity: 0.9;
  animation: progress-glow 1s ease-in-out infinite;
}

@keyframes progress-glow {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .fx-bg-gradient::before,
  .fx-bg-gradient::after,
  .fx-float,
  .fx-aura::after,
  .fx-breathe,
  .fx-particle,
  .fx-quota-animate,
  .fx-row-stagger {
    animation: none !important;
  }
  .fx-quota-animate { width: var(--fill-target) !important; }
  .fx-row-stagger { opacity: 1; transform: none; }
  .fx-scroll-reveal { opacity: 1; transform: none; transition: none; }
  .fx-tilt:hover { transform: none; }
}
