/* ==========================================================================
   VITALYS — FLOATING CONTACT WIDGET
   Fixed bottom-right WhatsApp + Call buttons, included site-wide from
   base.html. Sections: Variables, Widget, Buttons, Icons, Tooltips,
   Hover/Focus, Entrance Animation, Responsive Breakpoints.
   ========================================================================== */

/* ==========================================================================
   1. VARIABLES
   ========================================================================== */
:root {
  --floating-contact-offset-desktop: 25px;
  --floating-contact-offset-tablet: 20px;
  --floating-contact-offset-mobile: 15px;

  --floating-contact-size-desktop: 60px;
  --floating-contact-size-tablet: 56px;
  --floating-contact-size-mobile: 52px;

  --floating-contact-gap-desktop: 16px;
  --floating-contact-gap-mobile: 12px;

  --color-whatsapp: #25d366;
}

/* ==========================================================================
   2. WIDGET
   ========================================================================== */
.floating-contact {
  position: fixed;
  right: var(--floating-contact-offset-desktop);
  bottom: var(--floating-contact-offset-desktop);
  z-index: var(--z-floating-contact);
  /* Nudged upward by floating-contact.js as the footer scrolls into view,
     so the widget never overlaps footer content. Kept on its own element
     (not .floating-contact-inner) so it never fights the entrance
     animation below for control of `transform` on the same element. */
  transition: transform var(--duration-base) var(--ease-out-quart);
}

.floating-contact-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--floating-contact-gap-desktop);
}

/* ==========================================================================
   3. BUTTONS
   ========================================================================== */
.floating-contact-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--floating-contact-size-desktop);
  height: var(--floating-contact-size-desktop);
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 29, 0.22);
  transition: transform var(--duration-base) var(--ease-out-quart),
    box-shadow var(--duration-base) var(--ease-out-quart);
}

.floating-contact-btn-whatsapp {
  background: var(--color-whatsapp);
}

.floating-contact-btn-call {
  background: var(--color-accent);
}

/* ==========================================================================
   4. ICONS
   ========================================================================== */
.floating-contact-btn i {
  font-size: 26px;
  line-height: 1;
}

/* ==========================================================================
   5. TOOLTIPS (desktop/tablet pointer devices only — see breakpoints)
   ========================================================================== */
.floating-contact-tooltip {
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--color-ink);
  color: #ffffff;
  font-family: var(--font-nav);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out-quart),
    transform var(--duration-base) var(--ease-out-quart),
    visibility var(--duration-base) var(--ease-out-quart);
}

/* ==========================================================================
   6. HOVER / FOCUS
   ========================================================================== */
@media (hover: hover) and (pointer: fine) {
  .floating-contact-btn:hover,
  .floating-contact-btn:focus-visible {
    transform: translateY(-4px) scale(1.08);
  }

  .floating-contact-btn-whatsapp:hover,
  .floating-contact-btn-whatsapp:focus-visible {
    box-shadow: 0 10px 26px rgba(15, 23, 29, 0.2), 0 0 0 8px rgba(37, 211, 102, 0.18);
  }

  .floating-contact-btn-call:hover,
  .floating-contact-btn-call:focus-visible {
    box-shadow: 0 10px 26px rgba(15, 23, 29, 0.2), 0 0 0 8px rgba(24, 88, 162, 0.18);
  }

  .floating-contact-btn:hover .floating-contact-tooltip,
  .floating-contact-btn:focus-visible .floating-contact-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
  }
}

.floating-contact-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

/* ==========================================================================
   7. ENTRANCE ANIMATION
   ========================================================================== */
@keyframes floatingContactFadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.floating-contact-inner {
  animation: floatingContactFadeUp 0.6s var(--ease-out-quart) 400ms both;
}

@media (prefers-reduced-motion: reduce) {
  .floating-contact-inner {
    animation: none;
  }

  .floating-contact-btn,
  .floating-contact-tooltip {
    transition: none;
  }
}

/* ==========================================================================
   8. RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Tablet: 768px–991px */
@media (min-width: 768px) and (max-width: 991.98px) {
  .floating-contact {
    right: var(--floating-contact-offset-tablet);
    bottom: var(--floating-contact-offset-tablet);
  }

  .floating-contact-btn {
    width: var(--floating-contact-size-tablet);
    height: var(--floating-contact-size-tablet);
  }

  .floating-contact-btn i {
    font-size: 24px;
  }
}

/* Mobile: below 768px */
@media (max-width: 767.98px) {
  .floating-contact {
    right: var(--floating-contact-offset-mobile);
    bottom: var(--floating-contact-offset-mobile);
  }

  .floating-contact-inner {
    gap: var(--floating-contact-gap-mobile);
  }

  .floating-contact-btn {
    width: var(--floating-contact-size-mobile);
    height: var(--floating-contact-size-mobile);
  }

  .floating-contact-btn i {
    font-size: 22px;
  }

  /* Tooltips are hover-driven and mobile has no hover input; hide outright
     so a stray long-press can't leave one stuck visible. */
  .floating-contact-tooltip {
    display: none;
  }
}
