/**
 * PFAR Floating Action Buttons (FAB) - Collapsible Mobile Menu
 * Date: October 19, 2025
 * Purpose: Make FAB menu collapsible on mobile devices
 */

/* ========================================
   FAB MENU - DESKTOP & BASE STYLES
   ======================================== */

.fab-menu {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fab-buttons-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-button {
  position: relative;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
  cursor: pointer;
}

.fab-button:hover {
  transform: scale(1.1) translateX(-5px);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.fab-button i {
  font-size: 20px;
}

.fab-tooltip {
  position: absolute;
  right: 70px;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

.fab-button:hover .fab-tooltip {
  opacity: 1;
  visibility: visible;
  right: 75px;
}

/* Tooltip arrow */
.fab-tooltip::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid rgba(0, 0, 0, 0.85);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

/* Color variations for different buttons */
.fab-home {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.fab-features {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.fab-pricing {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.fab-sold {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.fab-reviews {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.fab-learning {
  background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
}

.fab-faq {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.fab-contact {
  background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

/* ========================================
   FAB TOGGLE BUTTON (Hidden on Desktop)
   ======================================== */

.fab-toggle {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: none; /* Hidden on desktop */
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.fab-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.7);
}

.fab-toggle:active {
  transform: scale(0.95);
}

/* Toggle button icons */
.fab-toggle .fa-bars {
  display: block;
}

.fab-toggle .fa-times {
  display: none;
}

.fab-menu.active .fab-toggle .fa-bars {
  display: none;
}

.fab-menu.active .fab-toggle .fa-times {
  display: block;
}

/* ========================================
   MOBILE RESPONSIVE (≤768px)
   ======================================== */

@media (max-width: 768px) {
  .fab-menu {
    position: fixed !important; /* Fixed to screen, not page */
    right: 15px;
    top: 20px; /* Close to top of screen */
    bottom: auto;
    transform: none;
    gap: 0;
    z-index: 9999; /* Ensure it's on top of everything */
  }

  .fab-toggle {
    display: flex; /* Show toggle button on mobile */
    margin-bottom: 10px;
  }

  .fab-buttons-container {
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    transform: translateY(20px);
    gap: 10px;
    margin-bottom: 10px;
  }

  .fab-menu.active .fab-buttons-container {
    max-height: 600px;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .fab-button {
    width: 50px;
    height: 50px;
    font-size: 18px;
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
  }

  .fab-menu.active .fab-button {
    opacity: 1;
  }

  /* Stagger animation for buttons */
  .fab-menu.active .fab-button:nth-child(1) {
    animation-delay: 0.05s;
  }
  .fab-menu.active .fab-button:nth-child(2) {
    animation-delay: 0.1s;
  }
  .fab-menu.active .fab-button:nth-child(3) {
    animation-delay: 0.15s;
  }
  .fab-menu.active .fab-button:nth-child(4) {
    animation-delay: 0.2s;
  }
  .fab-menu.active .fab-button:nth-child(5) {
    animation-delay: 0.25s;
  }
  .fab-menu.active .fab-button:nth-child(6) {
    animation-delay: 0.3s;
  }
  .fab-menu.active .fab-button:nth-child(7) {
    animation-delay: 0.35s;
  }
  .fab-menu.active .fab-button:nth-child(8) {
    animation-delay: 0.4s;
  }

  /* Hide tooltips on mobile */
  .fab-tooltip {
    display: none;
  }

  /* Slightly smaller buttons on mobile */
  .fab-button i {
    font-size: 18px;
  }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
  }
  50% {
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.8);
  }
}

.fab-toggle {
  animation: pulse 2s infinite;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.fab-button:focus,
.fab-toggle:focus {
  outline: 3px solid rgba(102, 126, 234, 0.5);
  outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .fab-button,
  .fab-toggle,
  .fab-buttons-container {
    transition: none;
    animation: none;
  }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
  .fab-menu {
    display: none;
  }
}
