/**
 * Netra Technosys - Square Scroll Progress & Back-to-Top Button
 * Minimalist high-tech square button with SVG perimeter scroll progress border,
 * live percentage indicator, and smooth tactile elevation.
 */

.nt-square-scroll-btn {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.nt-square-scroll-btn:focus {
  outline: none;
}

/* Mini HUD Percentage Badge */
.nt-sq-badge {
  background: rgba(11, 15, 25, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(231, 32, 26, 0.35);
  border-radius: 9999px;
  padding: 2px 7px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: #FF5A52;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  opacity: 0.88;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
  pointer-events: none;
}

.nt-square-scroll-btn:hover .nt-sq-badge {
  opacity: 1;
  transform: translateY(-2px);
  color: #ffffff;
  background: #E7201A;
  border-color: #E7201A;
}

/* Square Box Container */
.nt-sq-box {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: rgba(14, 20, 36, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4), 0 0 16px rgba(231, 32, 26, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

/* Hover & Active States */
.nt-square-scroll-btn:hover .nt-sq-box {
  transform: translateY(-3px);
  background: rgba(20, 28, 48, 0.95);
  border-color: rgba(231, 32, 26, 0.5);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), 0 0 25px rgba(231, 32, 26, 0.35);
}

.nt-square-scroll-btn:active .nt-sq-box {
  transform: scale(0.92);
}

/* Square SVG Progress Border */
.nt-sq-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.nt-sq-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 2.5;
}

.nt-sq-progress {
  fill: none;
  stroke: url(#ntSquareGrad);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 160;
  stroke-dashoffset: 160;
  transition: stroke-dashoffset 0.1s ease-out;
  filter: drop-shadow(0 0 5px rgba(231, 32, 26, 0.75));
}

/* Center Icon */
.nt-sq-icon-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nt-sq-icon {
  font-size: 17px;
  color: #ffffff;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
}

.nt-square-scroll-btn:hover .nt-sq-icon {
  transform: translateY(-3px);
  color: #FF5A52;
}

/* Animated Click Wave */
.nt-square-scroll-btn.is-active .nt-sq-icon {
  animation: ntIconRocket 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes ntIconRocket {
  0% { transform: translateY(0); }
  35% { transform: translateY(-24px); opacity: 0; }
  36% { transform: translateY(24px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .nt-square-scroll-btn {
    right: 18px;
    bottom: 18px;
  }
  .nt-sq-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }
  .nt-sq-icon {
    font-size: 15px;
  }
  .nt-sq-badge {
    font-size: 9px;
    padding: 2px 6px;
  }
}

@media (max-width: 991.98px) {
  #nt-square-scroll-btn ~ #nt-back-to-top {
    display: none !important;
  }
}
