/* Botón flotante Volver arriba — Print2List */

.back-to-top {
  position: fixed;
  right: max(1.1rem, env(safe-area-inset-right));
  bottom: max(1.25rem, calc(env(safe-area-inset-bottom) + 1rem));
  z-index: 10050;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(15, 92, 76, 0.18);
  border-radius: 14px;
  background:
    linear-gradient(180deg, #12705d 0%, var(--accent, #0f5c4c) 100%);
  color: #fff;
  box-shadow:
    0 10px 28px rgba(15, 92, 76, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.18) inset;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(0.96);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

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

.back-to-top[hidden]:not(.is-visible) {
  display: none !important;
}

.back-to-top.is-visible {
  display: inline-flex !important;
}

.back-to-top:hover {
  background:
    linear-gradient(180deg, #15856e 0%, #0d5345 100%);
  box-shadow:
    0 14px 32px rgba(15, 92, 76, 0.34),
    0 1px 0 rgba(255, 255, 255, 0.2) inset;
  transform: translateY(-2px) scale(1);
}

.back-to-top:active {
  transform: translateY(0) scale(0.98);
}

.back-to-top:focus-visible {
  outline: 2px solid rgba(196, 92, 38, 0.75);
  outline-offset: 3px;
}

.back-to-top svg {
  display: block;
  pointer-events: none;
}

@media (max-width: 1080px) {
  .back-to-top {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    right: max(0.85rem, env(safe-area-inset-right));
    bottom: max(1.15rem, calc(env(safe-area-inset-bottom) + 1rem));
  }
}

/* Evitar solaparse con el drawer móvil abierto */
body.mm-lock .back-to-top {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
