/* ==========================================================================
   PrintGrid / PQRint – Comprehensive Multi-Page Printing Animations
   Tailored, GPU-accelerated, subtle visual printing motifs for EVERY page:
     - Landing Page: Phone, Printer, Paper, Moving QR Scanner, Dotted Paths
     - Customer Dashboard: Floating docs, phone/laptop silhouettes, upload indicators
     - Upload Page: Floating PDFs, cloud transfers, animated upload arrows
     - Payment Page: Secure payment shield, verification checks, UPI/card symbols
     - Print Queue & Tracking: Paper feeding out of printer, documents queued
     - QR Scanner & Posters: Smartphone frame, laser sweep beam, target corners
     - Shop Dashboard: Commercial printer with paper feed, status telemetry, ink drops
     - Admin Dashboard: Networked cloud nodes, server telemetry, micro-interactions
   ========================================================================== */

/* Universal Background Animation Stage */
.print-bg-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.print-bg-stage.is-fixed {
  position: fixed;
  inset: 0;
}

/* Universal Fullscreen 3D WebGL Background Canvas */
.print-3d-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  opacity: 0.88;
}

/* Ensure all interactive UI content stays clearly above background animations */
.pub-hero-container,
.pub-container,
.portal-content,
.cust-container,
.cust-shell,
.card,
.modal-box,
header,
footer,
nav {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   1. Universal Dotted Workflow Curves
   -------------------------------------------------------------------------- */
.print-bg-svg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.print-path-dots {
  stroke-dasharray: 6, 12;
  animation: printMarchDots 28s linear infinite;
}

.print-path-dots-fast {
  stroke-dasharray: 4, 10;
  animation: printMarchDots 18s linear infinite;
}

@keyframes printMarchDots {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -216; }
}

/* --------------------------------------------------------------------------
   2. Floating Printer with Paper Output Motion
   -------------------------------------------------------------------------- */
.floating-printer-wrap {
  position: absolute;
  pointer-events: none;
  filter: drop-shadow(0 14px 28px rgba(37, 99, 235, 0.08));
  animation: floatPrinter 14s ease-in-out infinite alternate;
}
.floating-printer-wrap.pos-right {
  top: 80px;
  right: 4%;
}
.floating-printer-wrap.pos-left {
  top: 80px;
  left: 4%;
}

@keyframes floatPrinter {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-16px) rotate(1.5deg); }
  100% { transform: translateY(8px) rotate(-1deg); }
}

/* Paper slowly emerging/feeding out of printer tray */
.printer-paper-eject {
  animation: paperFeedOut 8s ease-in-out infinite;
}

@keyframes paperFeedOut {
  0% { transform: translateY(-12px); opacity: 0.3; }
  40% { transform: translateY(0px); opacity: 1; }
  80% { transform: translateY(4px); opacity: 1; }
  95% { transform: translateY(6px); opacity: 0.5; }
  100% { transform: translateY(-12px); opacity: 0.3; }
}

.printer-led-pulse {
  animation: pulseLed 3s ease-in-out infinite alternate;
}

@keyframes pulseLed {
  0% { opacity: 0.35; filter: drop-shadow(0 0 1px #06b6d4); }
  100% { opacity: 1; filter: drop-shadow(0 0 6px #06b6d4); }
}

/* --------------------------------------------------------------------------
   3. Floating Paper Sheets & Document Cards
   -------------------------------------------------------------------------- */
.floating-paper {
  position: absolute;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.07);
  backdrop-filter: blur(2px);
}

.paper-sheet-1 {
  width: 52px; height: 68px; top: 70px; left: 8%;
  animation: floatPaper1 16s ease-in-out infinite alternate;
}
.paper-sheet-2 {
  width: 44px; height: 58px; top: 140px; right: 18%;
  animation: floatPaper2 20s ease-in-out infinite alternate -3s;
}
.paper-sheet-3 {
  width: 38px; height: 50px; top: 420px; right: 7%;
  animation: floatPaper3 18s ease-in-out infinite alternate -7s;
}
.paper-sheet-4 {
  width: 48px; height: 62px; top: 480px; left: 14%;
  animation: floatPaper4 22s ease-in-out infinite alternate -11s;
}

@keyframes floatPaper1 {
  0% { transform: translate(0px, 0px) rotate(-6deg); }
  50% { transform: translate(10px, -20px) rotate(2deg); }
  100% { transform: translate(-8px, 10px) rotate(-4deg); }
}
@keyframes floatPaper2 {
  0% { transform: translate(0px, 0px) rotate(8deg); }
  50% { transform: translate(-14px, -24px) rotate(-2deg); }
  100% { transform: translate(12px, 14px) rotate(5deg); }
}
@keyframes floatPaper3 {
  0% { transform: translate(0px, 0px) rotate(-3deg); }
  50% { transform: translate(-8px, -16px) rotate(4deg); }
  100% { transform: translate(10px, 12px) rotate(-1deg); }
}
@keyframes floatPaper4 {
  0% { transform: translate(0px, 0px) rotate(5deg); }
  50% { transform: translate(14px, -18px) rotate(-3deg); }
  100% { transform: translate(-6px, 16px) rotate(2deg); }
}

.paper-lines {
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.paper-line {
  height: 2px;
  background: rgba(147, 197, 253, 0.45);
  border-radius: 2px;
}
.paper-line.w-80 { width: 80%; }
.paper-line.w-60 { width: 60%; }
.paper-line.w-90 { width: 90%; }
.paper-line.w-40 { width: 40%; }

.paper-fold-corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: linear-gradient(135deg, transparent 50%, rgba(56, 189, 248, 0.25) 50%);
  border-bottom-left-radius: 2px;
}

/* --------------------------------------------------------------------------
   4. Smartphone Device Illustration (Landing & Customer Pages)
   -------------------------------------------------------------------------- */
.anim-device-phone {
  position: absolute;
  width: 90px;
  height: 160px;
  background: #ffffff;
  border: 3px solid #1e293b;
  border-radius: 20px;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
  pointer-events: none;
  animation: floatPhone 15s ease-in-out infinite alternate;
  padding: 6px;
  display: flex;
  flex-direction: column;
}

@keyframes floatPhone {
  0% { transform: translateY(0px) rotate(-4deg); }
  50% { transform: translateY(-14px) rotate(1deg); }
  100% { transform: translateY(6px) rotate(-2deg); }
}

.phone-notch {
  width: 24px;
  height: 4px;
  background: #0f172a;
  border-radius: 2px;
  margin: 0 auto 6px;
}

.phone-screen {
  flex: 1;
  background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.phone-screen-doc {
  width: 100%;
  height: 38px;
  background: #ffffff;
  border-radius: 6px;
  border: 1px dashed #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #0284c7;
}

.phone-upload-progress {
  width: 100%;
  height: 4px;
  background: #bae6fd;
  border-radius: 2px;
  overflow: hidden;
}

.phone-upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #06b6d4);
  border-radius: 2px;
  animation: uploadProgressLoop 4s ease-in-out infinite;
}

@keyframes uploadProgressLoop {
  0% { width: 10%; }
  50% { width: 75%; }
  100% { width: 100%; }
}

/* --------------------------------------------------------------------------
   5. Laptop & Tablet Silhouettes (Customer & Admin Pages)
   -------------------------------------------------------------------------- */
.anim-device-laptop {
  position: absolute;
  width: 120px;
  height: 75px;
  pointer-events: none;
  animation: floatLaptop 18s ease-in-out infinite alternate;
}

@keyframes floatLaptop {
  0% { transform: translateY(0px) rotate(2deg); }
  50% { transform: translateY(-12px) rotate(-1deg); }
  100% { transform: translateY(6px) rotate(1deg); }
}

.anim-device-tablet {
  position: absolute;
  width: 70px;
  height: 94px;
  background: #ffffff;
  border: 2px solid #334155;
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
  pointer-events: none;
  animation: floatTablet 16s ease-in-out infinite alternate;
}

@keyframes floatTablet {
  0% { transform: translateY(0px) rotate(-2deg); }
  50% { transform: translateY(-15px) rotate(3deg); }
  100% { transform: translateY(8px) rotate(-1deg); }
}

/* --------------------------------------------------------------------------
   6. QR Scanner with Laser Sweep Beam
   -------------------------------------------------------------------------- */
.floating-qr-card {
  position: absolute;
  width: 72px;
  height: 72px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 10px 24px rgba(6, 182, 212, 0.12);
  pointer-events: none;
  animation: floatQr 16s ease-in-out infinite alternate;
}

@keyframes floatQr {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-14px) rotate(-2deg); }
  100% { transform: translateY(10px) rotate(1.5deg); }
}

.qr-scanner-line {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #06b6d4 30%, #38bdf8 70%, transparent 100%);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.8), 0 0 4px #06b6d4;
  border-radius: 2px;
  animation: qrScanningSweep 3.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes qrScanningSweep {
  0% { top: 6px; opacity: 0.1; }
  15% { opacity: 0.95; }
  50% { top: calc(100% - 8px); opacity: 0.95; }
  85% { opacity: 0.95; }
  100% { top: 6px; opacity: 0.1; }
}

/* Fullscreen/Component Dedicated QR Scanner Mockup */
.qr-scanner-viewport {
  position: relative;
  width: 140px;
  height: 140px;
  background: rgba(15, 23, 42, 0.03);
  border: 2px dashed rgba(6, 182, 212, 0.5);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.qr-viewfinder-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: #0284c7;
  border-style: solid;
}
.qr-viewfinder-corner.tl { top: 6px; left: 6px; border-width: 3px 0 0 3px; border-top-left-radius: 6px; }
.qr-viewfinder-corner.tr { top: 6px; right: 6px; border-width: 3px 3px 0 0; border-top-right-radius: 6px; }
.qr-viewfinder-corner.bl { bottom: 6px; left: 6px; border-width: 0 0 3px 3px; border-bottom-left-radius: 6px; }
.qr-viewfinder-corner.br { bottom: 6px; right: 6px; border-width: 0 3px 3px 0; border-bottom-right-radius: 6px; }

.scanner-laser-wide {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, #06b6d4 25%, #38bdf8 50%, #06b6d4 75%, transparent 100%);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.9), 0 0 4px #06b6d4;
  animation: laserWideSweep 3s ease-in-out infinite;
}

@keyframes laserWideSweep {
  0%, 100% { top: 6px; opacity: 0.3; }
  50% { top: calc(100% - 9px); opacity: 1; }
}

/* --------------------------------------------------------------------------
   7. Cloud File Transfer & Animated Upload Arrows (Upload Page)
   -------------------------------------------------------------------------- */
.anim-cloud-node {
  position: absolute;
  pointer-events: none;
  animation: floatCloud 16s ease-in-out infinite alternate;
}

@keyframes floatCloud {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
  100% { transform: translateY(5px); }
}

.anim-upload-arrow {
  position: absolute;
  pointer-events: none;
  animation: arrowFloatUp 2.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes arrowFloatUp {
  0% { transform: translateY(20px); opacity: 0; }
  30% { opacity: 0.9; }
  70% { opacity: 0.9; }
  100% { transform: translateY(-24px); opacity: 0; }
}

/* --------------------------------------------------------------------------
   8. Secure Payment Shield & Checkmark (Payment Page)
   -------------------------------------------------------------------------- */
.anim-payment-shield {
  position: absolute;
  pointer-events: none;
  filter: drop-shadow(0 12px 24px rgba(16, 185, 129, 0.12));
  animation: shieldGentlePulse 6s ease-in-out infinite alternate;
}

@keyframes shieldGentlePulse {
  0% { transform: translateY(0px) scale(0.96); opacity: 0.7; }
  100% { transform: translateY(-10px) scale(1.02); opacity: 0.95; }
}

.shield-check-glow {
  animation: checkPulse 3s ease-in-out infinite;
}

@keyframes checkPulse {
  0%, 100% { opacity: 0.6; filter: drop-shadow(0 0 1px #10b981); }
  50% { opacity: 1; filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.6)); }
}

.anim-pay-card-pill {
  position: absolute;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 20px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #047857;
  box-shadow: 0 8px 18px rgba(4, 120, 87, 0.08);
  pointer-events: none;
  animation: floatPill 14s ease-in-out infinite alternate;
}

@keyframes floatPill {
  0% { transform: translateY(0px) rotate(-1deg); }
  50% { transform: translateY(-12px) rotate(1.5deg); }
  100% { transform: translateY(6px) rotate(-1deg); }
}

/* --------------------------------------------------------------------------
   9. Print Queue Conveyor & Progress Indicators (Tracking & Queue Page)
   -------------------------------------------------------------------------- */
.anim-queue-stage {
  position: absolute;
  pointer-events: none;
}

.queue-doc-card {
  position: absolute;
  width: 36px;
  height: 46px;
  background: #ffffff;
  border: 1.5px solid #38bdf8;
  border-radius: 6px;
  box-shadow: 0 8px 16px rgba(56, 189, 248, 0.15);
  animation: queueDocTravel 10s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes queueDocTravel {
  0% { transform: translateX(-40px); opacity: 0; }
  15% { opacity: 0.9; }
  75% { opacity: 0.9; }
  100% { transform: translateX(80px); opacity: 0; }
}

/* Live status pulse dots */
.status-pulse-ring {
  position: relative;
  display: inline-block;
  width: 10px;
  height: 10px;
}
.status-pulse-ring::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: statusRingExpand 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes statusRingExpand {
  0% { transform: scale(0.8); opacity: 0.7; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* --------------------------------------------------------------------------
   10. Ink Drops & Print Marks (Shop & Admin Dashboards)
   -------------------------------------------------------------------------- */
.anim-ink-drop {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  pointer-events: none;
  animation: inkFloat 12s ease-in-out infinite alternate;
}

.anim-ink-cyan { background: linear-gradient(135deg, #06b6d4, #38bdf8); opacity: 0.5; }
.anim-ink-blue { background: linear-gradient(135deg, #2563eb, #60a5fa); opacity: 0.4; }

@keyframes inkFloat {
  0% { transform: translateY(0px) rotate(-45deg) scale(0.9); }
  50% { transform: translateY(-16px) rotate(-35deg) scale(1.1); }
  100% { transform: translateY(8px) rotate(-55deg) scale(0.95); }
}

.anim-print-crosshair {
  position: absolute;
  width: 22px;
  height: 22px;
  pointer-events: none;
  opacity: 0.35;
  animation: crosshairSpin 30s linear infinite;
}

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

/* --------------------------------------------------------------------------
   11. Admin Global Telemetry Network Nodes
   -------------------------------------------------------------------------- */
.admin-grid-nodes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
}

.admin-pulse-node {
  animation: adminNodePulse 4s ease-in-out infinite alternate;
}

@keyframes adminNodePulse {
  0% { opacity: 0.3; transform: scale(0.9); }
  100% { opacity: 0.9; transform: scale(1.2); }
}

/* --------------------------------------------------------------------------
   12. Ambient Breathing Glow Orbs
   -------------------------------------------------------------------------- */
.ambient-glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  opacity: 0.4;
  animation: ambientBreathe 12s ease-in-out infinite alternate;
}
.ambient-glow-orb.orb-1 {
  top: 10%; left: 15%; width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.25) 0%, transparent 70%);
}
.ambient-glow-orb.orb-2 {
  top: 30%; right: 10%; width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.15) 0%, transparent 70%);
  animation-delay: -6s;
}

@keyframes ambientBreathe {
  0% { transform: scale(0.9) translate(0, 0); opacity: 0.25; }
  100% { transform: scale(1.1) translate(15px, -15px); opacity: 0.45; }
}

/* --------------------------------------------------------------------------
   12b. Specific Upload & Scanner Micro-Elements
   -------------------------------------------------------------------------- */
.floating-pdf-card {
  position: absolute;
  width: 58px;
  height: 76px;
  background: #ffffff;
  border: 1.5px solid rgba(239, 68, 68, 0.4);
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(239, 68, 68, 0.08);
  padding: 6px;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  animation: floatPaper1 15s ease-in-out infinite alternate;
}

.pdf-corner-tag {
  align-self: flex-start;
  background: #ef4444;
  color: #ffffff;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  margin-bottom: 6px;
}

.queue-conveyor-track {
  position: absolute;
  height: 6px;
  background: repeating-linear-gradient(90deg, #38bdf8 0, #38bdf8 12px, transparent 12px, transparent 20px);
  border-radius: 3px;
  opacity: 0.45;
  animation: printMarchDots 12s linear infinite;
}

.scan-success-ring {
  position: absolute;
  border: 2px solid #10b981;
  border-radius: 50%;
  pointer-events: none;
  animation: scanSuccessPulse 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes scanSuccessPulse {
  0% { transform: scale(0.6); opacity: 0.9; }
  70% { transform: scale(1.6); opacity: 0.15; }
  100% { transform: scale(2.0); opacity: 0; }
}

@media print {
  .print-bg-stage,
  .print-3d-canvas {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   13. Reduced Motion Support & Mobile Adaptations
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .print-3d-canvas {
    display: none !important;
  }
  .print-path-dots,
  .print-path-dots-fast,
  .floating-printer-wrap,
  .printer-paper-eject,
  .printer-led-pulse,
  .floating-paper,
  .anim-device-phone,
  .phone-upload-progress-fill,
  .anim-device-laptop,
  .anim-device-tablet,
  .floating-qr-card,
  .qr-scanner-line,
  .scanner-laser-wide,
  .anim-cloud-node,
  .anim-upload-arrow,
  .anim-payment-shield,
  .shield-check-glow,
  .anim-pay-card-pill,
  .queue-doc-card,
  .status-pulse-ring::after,
  .anim-ink-drop,
  .anim-print-crosshair,
  .admin-pulse-node,
  .ambient-glow-orb {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 768px) {
  .floating-printer-wrap.pos-right {
    right: -20px;
    transform: scale(0.65);
    opacity: 0.4;
  }
  .floating-printer-wrap.pos-left,
  .paper-sheet-2,
  .paper-sheet-4,
  .anim-device-laptop {
    display: none;
  }
  .anim-device-phone {
    left: -15px;
    transform: scale(0.7);
    opacity: 0.55;
  }
  .floating-qr-card {
    left: -10px;
    transform: scale(0.7);
    opacity: 0.5;
  }
}
