.jfb-wrapper {
  position: fixed;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  z-index: 999;
  pointer-events: none;

  opacity: 0;
  visibility: hidden;
  transition:
    opacity .45s ease,
    transform .6s cubic-bezier(.22,.61,.36,1),
    visibility 0s linear .6s;
}

.jfb-wrapper.jfb-right {
  transform: translateY(-50%) translateX(18px);
}

.jfb-wrapper.jfb-left {
  transform: translateY(-50%) translateX(-18px);
}

.jfb-wrapper.jfb-is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
  transition:
    opacity .45s ease,
    transform .6s cubic-bezier(.22,.61,.36,1),
    visibility 0s linear 0s;
}

.jfb-wrapper.jfb-left {
  align-items: flex-start;
}

.jfb-button {
  --jfb-bg: #E83E72;
  --jfb-color: #FFFFFF;

  display: flex;
  align-items: stretch;
  overflow: hidden;
  background: var(--jfb-bg);
  color: var(--jfb-color);
  text-decoration: none;
  pointer-events: auto;
  transition: transform .22s ease, box-shadow .22s ease, opacity .22s ease;
  will-change: transform;
}

.jfb-button:hover,
.jfb-button:focus-visible {
  color: var(--jfb-color);
  text-decoration: none;
}

.jfb-right .jfb-button:hover,
.jfb-right .jfb-button:focus-visible {
  transform: translateX(-3px);
}

.jfb-left .jfb-button:hover,
.jfb-left .jfb-button:focus-visible {
  transform: translateX(3px);
}

.jfb-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--jfb-color);
}

.jfb-icon i,
.jfb-icon svg {
  color: inherit;
  fill: currentColor;
}

.jfb-label {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding: 0;
  color: var(--jfb-color);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;

  max-width: 0;
  opacity: 0;

  /* CHIUSURA */
  transition:
    max-width .38s cubic-bezier(.4,0,.2,1),
    opacity .18s ease .16s,
    padding .38s cubic-bezier(.4,0,.2,1);
}

.jfb-left .jfb-button {
  flex-direction: row-reverse;
}

.jfb-left .jfb-label {
  padding: 0 4px 0 16px;
}

/* Modalità compatta: icona visibile, testo in hover */
.jfb-hover .jfb-label {
  max-width: 0;
  opacity: 0;
  padding-left: 0;
  padding-right: 0;
}

.jfb-hover .jfb-button:hover .jfb-label,
.jfb-hover .jfb-button:focus-visible .jfb-label {
  max-width: 260px;
  opacity: 1;

  /* APERTURA PIÙ LENTA */
  transition:
    max-width .9s cubic-bezier(.22,.61,.36,1),
    opacity .35s ease,
    padding .9s cubic-bezier(.22,.61,.36,1);
}

.jfb-right.jfb-hover .jfb-button:hover .jfb-label,
.jfb-right.jfb-hover .jfb-button:focus-visible .jfb-label {
  padding-right: 16px;
  padding-left: 4px;
}

.jfb-left.jfb-hover .jfb-button:hover .jfb-label,
.jfb-left.jfb-hover .jfb-button:focus-visible .jfb-label {
  padding-left: 16px;
  padding-right: 4px;
}

/* Sempre visibile */
.jfb-always .jfb-label {
  max-width: 260px;
  opacity: 1;
}

/* Accessibilità tastiera */
.jfb-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, .9);
  outline-offset: 2px;
}

/* Visibilità responsive */
@media (min-width: 1025px) {
  .jfb-hide-desktop {
    display: none !important;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .jfb-hide-tablet {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .jfb-hide-mobile {
    display: none !important;
  }
}

/* Riduce animazioni se richiesto dal sistema */
@media (prefers-reduced-motion: reduce) {
  .jfb-button,
  .jfb-label {
    transition: none;
  }
}
