/**
* Floating Action Buttons Component
* Version: 1.0.0
* Features: Scroll to Top, Dark Mode, WhatsApp
*/

/*--------------------------------------------------------------
# Container for All Floating Buttons
--------------------------------------------------------------*/
.floating-buttons {
  position: fixed;
  bottom: 30px;
  left: 30px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 995;
  direction: ltr;
}

[dir="rtl"] .floating-buttons {
  left: auto;
  right: 30px;
}

/*--------------------------------------------------------------
# Base Floating Button Style
--------------------------------------------------------------*/
.floating-btn {
  width: 55px;
  height: 55px;
  background: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: visible;
  text-decoration: none;
}

.floating-btn:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.floating-btn i {
  font-size: 1.5rem;
  transition: all 0.3s ease;
}

/*--------------------------------------------------------------
# Scroll to Top Button
--------------------------------------------------------------*/
.scroll-top {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.scroll-top.active {
  opacity: 1;
  visibility: visible;
}

.scroll-top i {
  color: white;
  font-size: 2rem;
}

.scroll-top:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.scroll-top:hover i {
  animation: bounce-up 0.6s ease infinite;
}

@keyframes bounce-up {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/*--------------------------------------------------------------
# Dark Mode Toggle Button
--------------------------------------------------------------*/
.theme-btn {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.theme-btn i {
  color: white;
  transition: all 0.3s ease;
}

.theme-btn:hover {
  background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
}

.theme-btn:hover i {
  transform: rotate(180deg);
}

/* Dark mode active state */
body.dark-mode .theme-btn {
  background: linear-gradient(135deg, #ffd93d 0%, #ff9d4d 100%);
}

/*--------------------------------------------------------------
# WhatsApp Button
--------------------------------------------------------------*/
.whatsapp-btn {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  position: relative;
}

.whatsapp-btn i {
  color: white;
  font-size: 1.8rem;
}

.whatsapp-btn:hover {
  background: linear-gradient(135deg, #128c7e 0%, #25d366 100%);
}

.whatsapp-btn:hover i {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

/* WhatsApp Pulse Effect */
.whatsapp-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(37, 211, 102, 0.4);
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  pointer-events: none;
}

@keyframes pulse-ring {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
}

/*--------------------------------------------------------------
# Tooltip on Hover
--------------------------------------------------------------*/
.floating-btn::before {
  content: attr(title);
  position: absolute;
  left: 70px;
  top: 50%;
  transform: translateY(-50%) translateX(-10px);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 8px 15px;
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
  font-family: 'El Messiri', sans-serif;
  font-weight: 500;
  z-index: 1;
}

[dir="rtl"] .floating-btn::before {
  left: auto;
  right: 70px;
  transform: translateY(-50%) translateX(10px);
}

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

/* Arrow for tooltip */
.floating-btn::after {
  content: '';
  position: absolute;
  left: 55px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid rgba(0, 0, 0, 0.85);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

[dir="rtl"] .floating-btn::after {
  left: auto;
  right: 55px;
  border-left: none;
  border-right: 8px solid rgba(0, 0, 0, 0.85);
}

.floating-btn:hover::after {
  opacity: 1;
  visibility: visible;
}

/*--------------------------------------------------------------
# Mobile Responsive
--------------------------------------------------------------*/
@media (max-width: 767px) {
  .floating-buttons {
    bottom: 20px;
    left: 20px;
    gap: 12px;
  }
  
  [dir="rtl"] .floating-buttons {
    left: auto;
    right: 20px;
  }
  
  .floating-btn {
    width: 50px;
    height: 50px;
  }
  
  .floating-btn i {
    font-size: 1.3rem;
  }
  
  /* إخفاء Tooltip على الموبايل */
  .floating-btn::before,
  .floating-btn::after {
    display: none;
  }
}

@media (max-width: 480px) {
  .floating-buttons {
    bottom: 15px;
    left: 15px;
  }
  
  [dir="rtl"] .floating-buttons {
    left: auto;
    right: 15px;
  }
  
  .floating-btn {
    width: 45px;
    height: 45px;
  }
  
  .floating-btn i {
    font-size: 1.2rem;
  }
}

/*--------------------------------------------------------------
# Print Styles
--------------------------------------------------------------*/
@media print {
  .floating-buttons {
    display: none !important;
  }
}

/*--------------------------------------------------------------
# Accessibility
--------------------------------------------------------------*/
.floating-btn:focus {
  outline: 3px solid rgba(102, 126, 234, 0.5);
  outline-offset: 3px;
}

.floating-btn:focus:not(:focus-visible) {
  outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .floating-btn {
    border: 2px solid currentColor;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .floating-btn,
  .floating-btn i,
  .whatsapp-pulse {
    animation: none !important;
    transition: none !important;
  }
}
