/* ============================================================
   SCROLL-TO-TOP BUTTON — global component
   ============================================================
   Pojawia się po przewinięciu o > SCROLL_THRESHOLD (350px).
   Lokalizacja: prawy dolny róg (poza index.html — przy floating
   CTA "Zarezerwuj termin" obowiązuje pozycja przesunięta).
   Mobile: zawsze nad floating CTA (jeśli jest).
   ============================================================ */

.scroll-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #FFB646 0%, #ff9a4a 100%);
  color: #111;
  cursor: pointer;
  box-shadow: 0 8px 24px -6px rgba(255, 154, 74, 0.45),
              0 4px 10px -2px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.85);
  transition: opacity 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
              visibility 0.35s,
              bottom 0.3s ease,
              box-shadow 0.25s ease;
  z-index: 999;
  pointer-events: none;
}

.scroll-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.scroll-to-top:hover {
  background: linear-gradient(135deg, #ffc970 0%, #ffaa5e 100%);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 14px 30px -6px rgba(255, 154, 74, 0.55),
              0 6px 14px -2px rgba(0, 0, 0, 0.18);
}

.scroll-to-top:focus-visible {
  outline: 2px solid #111;
  outline-offset: 3px;
}

.scroll-to-top:active {
  transform: translateY(-1px) scale(0.98);
}

.scroll-to-top__icon {
  width: 20px;
  height: 20px;
  display: block;
  pointer-events: none;
}

/* ===== POZYCJA NA STRONIE Z FLOATING CTA "Zarezerwuj termin" =====
   Gdy widoczny jest "floatingCTA" na desktopie (prawy dolny róg
   ~88px wysokości), scroll-to-top musi być wyżej, by nie zachodziły. */
.scroll-to-top.is-stacked {
  bottom: 96px;
}

/* ===== MOBILE ===== */
@media (max-width: 576px) {
  .scroll-to-top {
    right: 16px;
    bottom: 16px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  /* Na mobile floating CTA staje się full-width na samym dole.
     Scroll-to-top musi być WYŻEJ niż FAB — jeśli FAB widoczny. */
  .scroll-to-top.is-stacked {
    bottom: 88px;  /* nad full-width FAB */
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  .scroll-to-top,
  .scroll-to-top.is-visible,
  .scroll-to-top:hover {
    transition: opacity 0.15s ease, visibility 0.15s ease;
    transform: none !important;
  }
}
