/**
 * Grupo FAM - Floating Actions Widget Styles
 * Dual Mode:
 *  - Modo Hub Multi-Acción (Toggle desplegable con WhatsApp, Cotización, Teléfono, Correo)
 *  - Modo Directo (WhatsApp directo con pulso y saludo tooltip + Volver Arriba estilo CY/MTA)
 */

:root {
  --fam-wa-green: #25D366;
  --fam-wa-green-hover: #20ba5a;
  --fam-wa-green-glow: rgba(37, 211, 102, 0.4);
  --fam-navy: #212c5d;
  --fam-navy-hover: #171f45;
  --fam-navy-glow: rgba(33, 44, 93, 0.35);
  --fam-accent-gold: #c29b38;
  --fam-accent-blue: #0284c7;
  --fam-accent-indigo: #6366f1;
}

/* Floating Actions Container */
.fam-floating-actions {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  pointer-events: none;
  font-family: inherit;
}

.fam-floating-actions > * {
  pointer-events: auto;
}

/* Base Floating Button */
.fam-floating-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(33, 44, 93, 0.22);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.28s ease,
              background-color 0.22s ease,
              opacity 0.25s ease,
              visibility 0.25s ease;
  text-decoration: none;
  position: relative;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.fam-floating-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 32px rgba(33, 44, 93, 0.32);
}

.fam-floating-btn:active {
  transform: translateY(0) scale(0.96);
}

/* =======================================================
   1. SCROLL TO TOP BUTTON
   ======================================================= */
.fam-floating-backtotop,
.fam-back-to-top {
  background: var(--fam-navy, #212c5d);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  width: 48px;
  height: 48px;
  margin-right: 4px;
}

.fam-floating-backtotop.is-visible,
.fam-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.fam-floating-backtotop:hover,
.fam-back-to-top:hover {
  background: var(--fam-navy-hover, #171f45);
  color: #ffffff;
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 10px 28px rgba(33, 44, 93, 0.38);
}

.fam-floating-backtotop svg,
.fam-back-to-top svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fam-top-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  background: rgba(33, 44, 93, 0.95);
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.fam-floating-backtotop:hover .fam-top-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* =======================================================
   2. MODO DIRECTO: WHATSAPP BUTTON (CY & MTA Standard)
   ======================================================= */
.fam-floating-whatsapp {
  background: var(--fam-wa-green, #25D366);
  color: #ffffff;
}

.fam-floating-whatsapp:hover {
  background: var(--fam-wa-green-hover, #20ba5a);
}

.fam-floating-whatsapp svg {
  width: 32px;
  height: 32px;
  display: block;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

/* Glowing Pulse Wave */
.fam-wa-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2.5px solid var(--fam-wa-green, #25D366);
  opacity: 0;
  animation: famWaPulse 2.4s cubic-bezier(0.24, 0, 0.38, 1) infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes famWaPulse {
  0% {
    transform: scale(0.88);
    opacity: 0.9;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    transform: scale(1.48);
    opacity: 0;
  }
}

/* Greeting Tooltip / Speech Bubble */
.fam-wa-tooltip {
  position: absolute;
  right: calc(100% + 14px);
  background: #ffffff;
  color: #1a1a1a;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateX(10px);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.3s ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.fam-wa-tooltip::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -6px;
  transform: translateY(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.fam-floating-whatsapp:hover .fam-wa-tooltip,
.fam-wa-tooltip.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

.fam-wa-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fam-wa-green, #25D366);
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.25);
}

.fam-wa-tooltip-close {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  color: #888888;
  padding: 0 0 0 6px;
  margin-left: 2px;
  transition: color 0.18s ease;
}

.fam-wa-tooltip-close:hover {
  color: #111111;
}

/* =======================================================
   3. MODO HUB MULTI-ACCIÓN (Dropdown Expansible)
   ======================================================= */
.fam-hub-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Hub Toggle Button */
.fam-hub-toggle {
  background: var(--fam-navy, #212c5d);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 25px var(--fam-navy-glow);
  z-index: 10;
}

.fam-hub-toggle:hover {
  background: var(--fam-navy-hover, #171f45);
  box-shadow: 0 12px 30px rgba(33, 44, 93, 0.45);
}

.fam-hub-pulse {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--fam-accent-gold, #c29b38);
  opacity: 0;
  animation: famHubPulse 3s cubic-bezier(0.24, 0, 0.38, 1) infinite;
  pointer-events: none;
}

@keyframes famHubPulse {
  0% {
    transform: scale(0.9);
    opacity: 0.8;
  }
  50% {
    opacity: 0.4;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.fam-hub-container.is-open .fam-hub-pulse {
  display: none;
}

/* Toggle Icons (Chat vs Close X) */
.fam-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease;
}

.fam-toggle-icon svg {
  width: 24px;
  height: 24px;
}

.fam-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.7);
}

.fam-icon-chat {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.fam-hub-container.is-open .fam-icon-chat {
  opacity: 0;
  transform: rotate(90deg) scale(0.7);
}

.fam-hub-container.is-open .fam-icon-close {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* Badge con contador o indicador */
.fam-hub-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--fam-accent-gold, #c29b38);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 12;
}

.fam-hub-container.is-open .fam-hub-badge {
  opacity: 0;
  transform: scale(0.5);
}

/* Hub Menu Container */
.fam-hub-menu {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  z-index: 9;
}

.fam-hub-container.is-open .fam-hub-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Hub Item Card */
.fam-hub-item {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
  transform: translateY(16px) scale(0.85);
  opacity: 0;
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.24s ease;
}

/* Staggered entrance animation when opening */
.fam-hub-container.is-open .fam-hub-item:nth-last-child(1) {
  transform: translateY(0) scale(1);
  opacity: 1;
  transition-delay: 0.02s;
}

.fam-hub-container.is-open .fam-hub-item:nth-last-child(2) {
  transform: translateY(0) scale(1);
  opacity: 1;
  transition-delay: 0.06s;
}

.fam-hub-container.is-open .fam-hub-item:nth-last-child(3) {
  transform: translateY(0) scale(1);
  opacity: 1;
  transition-delay: 0.10s;
}

.fam-hub-container.is-open .fam-hub-item:nth-last-child(4) {
  transform: translateY(0) scale(1);
  opacity: 1;
  transition-delay: 0.14s;
}

/* Label Pill */
.fam-hub-label {
  background: #ffffff;
  color: var(--fam-navy, #212c5d);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  border: 1px solid rgba(33, 44, 93, 0.08);
}

.fam-hub-item:hover .fam-hub-label {
  background: var(--fam-navy, #212c5d);
  color: #ffffff;
  transform: translateX(-4px);
}

/* Icon Circle */
.fam-hub-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.24s ease;
}

.fam-hub-item:hover .fam-hub-icon {
  transform: scale(1.1);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.fam-hub-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* Sub-action Specific Colors */
.fam-hub-whatsapp .fam-hub-icon {
  background: var(--fam-wa-green, #25D366);
  color: #ffffff;
}

.fam-hub-quote .fam-hub-icon {
  background: var(--fam-navy, #212c5d);
  color: #ffffff;
}

.fam-hub-call .fam-hub-icon {
  background: var(--fam-accent-blue, #0284c7);
  color: #ffffff;
}

.fam-hub-email .fam-hub-icon {
  background: var(--fam-accent-indigo, #6366f1);
  color: #ffffff;
}

/* =======================================================
   4. RESPONSIVE BREAKPOINT (Mobile Devices)
   ======================================================= */
@media (max-width: 600px) {
  .fam-floating-actions {
    bottom: 20px;
    right: 18px;
    gap: 12px;
  }

  .fam-floating-btn {
    width: 52px;
    height: 52px;
  }

  .fam-floating-backtotop,
  .fam-back-to-top {
    width: 44px;
    height: 44px;
  }

  .fam-wa-tooltip {
    max-width: 230px;
    white-space: normal;
    font-size: 12px;
    padding: 8px 12px;
  }

  .fam-hub-label {
    font-size: 12px;
    padding: 7px 12px;
  }

  .fam-hub-icon {
    width: 44px;
    height: 44px;
  }

  .fam-hub-icon svg {
    width: 20px;
    height: 20px;
  }
}
