/* ============================================================================
   FLOATING CART BUTTON - Bottom Right Corner
   Purpose: Fixed cart button always visible for easy access
   ============================================================================ */

.floating-cart-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, var(--ab-green) 0%, var(--ab-green-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(45, 122, 82, 0.3);
  cursor: pointer;
  z-index: 999;
  transition: all 0.3s ease;
  border: 2px solid white;
  text-decoration: none;
  color: white;
}

.floating-cart-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(45, 122, 82, 0.5);
  background: linear-gradient(135deg, var(--ab-green-dark) 0%, var(--ab-green) 100%);
  color: white;
}

.floating-cart-btn:active {
  transform: scale(0.95);
}

.floating-cart-btn i {
  font-size: 1.1rem;
  color: white;
}

/* Cart count badge on floating button */
.floating-cart-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  animation: pulse-badge 2s infinite;
}

/* Pulse animation for new items */
@keyframes pulse-badge {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Bounce animation when item added */
.floating-cart-btn.bounce {
  animation: bounce-cart 0.6s ease;
}

@keyframes bounce-cart {
  0%, 100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.2);
  }
  50% {
    transform: scale(0.95);
  }
  75% {
    transform: scale(1.15);
  }
}

/* Hide on very small screens to avoid overlap with content */
@media (max-width: 360px) {
  .floating-cart-btn {
    width: 42px;
    height: 42px;
    bottom: 15px;
    right: 15px;
  }

  .floating-cart-btn i {
    font-size: 1rem;
  }

  .floating-cart-badge {
    min-width: 16px;
    height: 16px;
    font-size: 0.6rem;
  }
}

/* Responsive adjustments */
@media (max-width: 576px) {
  .floating-cart-btn {
    width: 44px;
    height: 44px;
    bottom: 70px; /* Higher up to avoid mobile browser bars */
    right: 15px;
  }

  .floating-cart-btn i {
    font-size: 1.05rem;
  }
}

/* Tablet adjustments */
@media (min-width: 577px) and (max-width: 768px) {
  .floating-cart-btn {
    bottom: 20px;
    right: 20px;
    width: 46px;
    height: 46px;
  }

  .floating-cart-btn i {
    font-size: 1.1rem;
  }
}

/* Desktop adjustments */
@media (min-width: 769px) {
  .floating-cart-btn {
    bottom: 25px;
    right: 25px;
    width: 48px;
    height: 48px;
  }

  .floating-cart-btn i {
    font-size: 1.15rem;
  }

  .floating-cart-badge {
    min-width: 18px;
    height: 18px;
    font-size: 0.65rem;
  }
}

/* Hide when scrolled to footer (optional) */
.floating-cart-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Smooth entry animation */
.floating-cart-btn {
  animation: slideInFromRight 0.5s ease-out;
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Tooltip on hover (optional) */
.floating-cart-btn::before {
  content: 'View Cart';
  position: absolute;
  right: 100%;
  margin-right: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.floating-cart-btn:hover::before {
  opacity: 1;
}

/* Remove tooltip on mobile */
@media (max-width: 768px) {
  .floating-cart-btn::before {
    display: none;
  }
}

/* Ensure button is above other fixed elements */
.floating-cart-btn {
  z-index: 1050; /* Higher than Bootstrap modals (1055) but visible */
}

/* Ripple effect on click */
.floating-cart-btn::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

.floating-cart-btn:active::after {
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Accessibility improvements */
.floating-cart-btn:focus {
  outline: 3px solid var(--ab-gold);
  outline-offset: 2px;
}

.floating-cart-btn:focus:not(:focus-visible) {
  outline: none;
}

/* For screen readers */
.floating-cart-btn .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
