/**
 * HMVIP Floating Gifts - Instagram/TikTok Style
 * Mobile-first, GPU-accelerated, glassmorphism
 *
 * @since 1.5.0
 */

:root {
  /* Gift Colors */
  --gift-rose: #ff6b9d;
  --gift-heart: #ff4757;
  --gift-diamond: #7efff5;
  --gift-crown: #ffd700;
  --gift-car: #ff9ff3;
  
  /* Glassmorphism */
  --glass-bg: rgba(0, 0, 0, 0.4);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: 12px;
  
  /* Animations */
  --gift-float-duration: 3s;
  --gift-entrance: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========================================
   FLOATING GIFT CONTAINER (Media Overlay)
   ======================================== */

.hmvip-gift-float-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

/* Ativa pointer events apenas no botão de presentear */
.hmvip-gift-float-container .hmvip-gift-trigger-btn {
  pointer-events: auto;
}

/* ========================================
   INDIVIDUAL FLOATING GIFT
   ======================================== */

.hmvip-floating-gift {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  font-size: 12px;
  color: white;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  animation: giftFloatIn 0.5s var(--gift-entrance) forwards,
             giftFloat var(--gift-float-duration) ease-in-out infinite;
  transform-origin: center;
  will-change: transform, opacity;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.hmvip-floating-gift.exit {
  animation: giftFloatOut 0.4s ease forwards;
}

/* Gift Icon */
.hmvip-floating-gift .gift-icon {
  font-size: 16px;
  filter: drop-shadow(0 0 4px currentColor);
  animation: giftIconPulse 1.5s ease-in-out infinite;
}

.hmvip-floating-gift .gift-sender {
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.9;
}

.hmvip-floating-gift .gift-amount {
  font-size: 10px;
  opacity: 0.7;
  margin-left: 2px;
}

/* ========================================
   GIFT TRIGGER BUTTON (Floating)
   ======================================== */

.hmvip-gift-trigger-btn {
  position: absolute;
  bottom: 60px;
  right: 12px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--gift-entrance);
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  z-index: 101;
}

.hmvip-gift-trigger-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.hmvip-gift-trigger-btn:active {
  transform: scale(0.95);
}

.hmvip-gift-trigger-btn .gift-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ff4757;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  animation: countPulse 2s ease-in-out infinite;
}

/* ========================================
   GIFT BAR (Future Sidebar Mode)
   ======================================== */

.hmvip-gift-bar {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 8px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border-radius: 24px;
  border: 1px solid var(--glass-border);
}

.hmvip-gift-bar .gift-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: white;
  font-size: 11px;
}

.hmvip-gift-bar .gift-stat .stat-icon {
  font-size: 24px;
  filter: drop-shadow(0 0 6px currentColor);
}

.hmvip-gift-bar .gift-stat .stat-count {
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* ========================================
   RECENT GIFTS STRIP (Top Overlay)
   ======================================== */

.hmvip-gifts-strip {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 60px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
}

.hmvip-gifts-strip .strip-gift {
  padding: 4px 10px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  font-size: 11px;
  color: white;
  display: flex;
  align-items: center;
  gap: 4px;
  animation: stripSlideIn 0.4s ease forwards;
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes giftFloatIn {
  from {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes giftFloatOut {
  to {
    opacity: 0;
    transform: scale(0.8) translateY(-20px);
  }
}

@keyframes giftFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-8px) rotate(1deg);
  }
  75% {
    transform: translateY(4px) rotate(-1deg);
  }
}

@keyframes giftIconPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 4px currentColor);
  }
  50% {
    transform: scale(1.2);
    filter: drop-shadow(0 0 12px currentColor);
  }
}

@keyframes countPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes stripSlideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Lottie Container for flying gifts */
.hmvip-lottie-fly {
  position: absolute;
  width: 100px;
  height: 100px;
  pointer-events: none;
  z-index: 200;
}

/* ========================================
   MOBILE FIRST OPTIMIZATIONS
   ======================================== */

@media (max-width: 768px) {
  .hmvip-gift-trigger-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
    bottom: 50px;
    right: 8px;
  }
  
  .hmvip-floating-gift {
    padding: 4px 8px;
    font-size: 11px;
  }
  
  .hmvip-floating-gift .gift-icon {
    font-size: 14px;
  }
  
  .hmvip-floating-gift .gift-sender {
    max-width: 60px;
  }
  
  /* Mobile: Gift bar vertical compacta */
  .hmvip-gift-bar {
    right: 6px;
    padding: 8px 6px;
    gap: 6px;
  }
  
  .hmvip-gift-bar .gift-stat .stat-icon {
    font-size: 20px;
  }
}

/* ========================================
   DESKTOP: Sidebar Mode
   ======================================== */

@media (min-width: 1024px) {
  .hmvip-gift-float-container.sidebar-mode .hmvip-gift-bar {
    right: 16px;
  }
  
  .hmvip-gift-float-container.sidebar-mode .hmvip-gift-trigger-btn {
    position: relative;
    bottom: auto;
    right: auto;
    margin-top: 8px;
  }
}

/* ========================================
   DARK THEME COMPATIBILITY
   ======================================== */

.buddypress-wrap.bb-template-dark .hmvip-floating-gift,
body.dark-theme .hmvip-floating-gift {
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  .hmvip-floating-gift,
  .hmvip-gift-trigger-btn,
  .gift-icon {
    animation: none !important;
    transition: opacity 0.2s ease !important;
  }
}

/* Focus states for keyboard navigation */
.hmvip-gift-trigger-btn:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}
