/**
 * WD Appreciate Frontend Styles
 * Beautiful animated feedback buttons
 */

/* Base Button Styles */
.wd-appreciate-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  pointer-events: none;
}

.wd-appreciate-container * {
  pointer-events: auto;
}

/* Fixed positioning for auto-display buttons */
.wd-appreciate-container.fixed-position {
  position: fixed;
  z-index: 999999;
}

/* Inline positioning for manual placement */
.wd-appreciate-container.inline-position {
  position: relative;
  display: inline-block;
  z-index: 1;
}

/* Positioning */
.wd-appreciate-container.position-bottom-right {
  bottom: 30px;
  right: 30px;
}

.wd-appreciate-container.position-bottom-left {
  bottom: 30px;
  left: 30px;
}

.wd-appreciate-container.position-top-right {
  top: 30px;
  right: 30px;
}

.wd-appreciate-container.position-top-left {
  top: 30px;
  left: 30px;
}

.wd-appreciate-container.position-center-right {
  top: 50%;
  right: 30px;
  transform: translateY(-50%);
}

.wd-appreciate-container.position-center-left {
  top: 50%;
  left: 30px;
  transform: translateY(-50%);
}

/* Button Styles */
.wd-appreciate-btn,
a.wd-appreciate-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%), #3b82f6;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 30px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
  justify-content: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.wd-appreciate-btn::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.wd-appreciate-btn:hover,
a.wd-appreciate-btn:hover,
.wd-appreciate-btn:focus,
a.wd-appreciate-btn:focus {
  transform: translateY(-4px) scale(1.02) !important;
  box-shadow: 0 20px 35px -10px rgba(59, 130, 246, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.4) !important;
  filter: brightness(1.1) !important;
  color: white !important;
  text-decoration: none !important;
}

.wd-appreciate-btn:hover::after {
  opacity: 1;
}

.wd-appreciate-btn:active,
a.wd-appreciate-btn:active,
.wd-appreciate-btn:visited,
a.wd-appreciate-btn:visited {
  transform: translateY(1px) scale(0.98) !important;
  box-shadow: 0 5px 15px -5px rgba(59, 130, 246, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.2) !important;
  color: white !important;
  text-decoration: none !important;
}

.wd-appreciate-btn:disabled,
a.wd-appreciate-btn:disabled {
  cursor: not-allowed;
  opacity: 0.9;
  filter: grayscale(0.2);
}

/* Button Text */
.btn-text {
  letter-spacing: 0.01em;
  z-index: 2;
}

/* Button Count */
.btn-count {
  background: rgba(255, 255, 255, 0.25);
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  z-index: 2;
  backdrop-filter: blur(4px);
}

/* Button Icons */
.btn-icon {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 2;
  width: 20px;
  height: 20px;
}

.btn-icon svg {
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}

/* Initial state - show the primary icon, hide check */
.btn-icon .icon-check {
  opacity: 0;
  transform: scale(0) rotate(-45deg);
  pointer-events: none;
}

/* Clicked state - hide primary icons, show check */
.wd-appreciate-btn.success.clicked .icon-heart,
.wd-appreciate-btn.success.clicked .icon-thumbs-up,
.wd-appreciate-btn.success.clicked .icon-star,
.wd-appreciate-btn.clicked .icon-heart,
.wd-appreciate-btn.clicked .icon-thumbs-up,
.wd-appreciate-btn.clicked .icon-star {
  opacity: 0 !important;
  transform: scale(0.5) rotate(45deg) !important;
  pointer-events: none;
}

.wd-appreciate-btn.success.clicked .icon-check,
.wd-appreciate-btn.clicked .icon-check {
  opacity: 1 !important;
  transform: scale(1) rotate(0deg) !important;
  pointer-events: auto;
}

/* Particles Animation */
.btn-particles {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
}

.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(255,255,255,0.8);
}

/* Animation Styles */
@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.5); }
  50% { transform: scale(1.04); box-shadow: 0 15px 35px -5px rgba(59, 130, 246, 0.6); }
  100% { transform: scale(1); box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.5); }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-8px); }
  60% { transform: translateY(-4px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.12); }
  28% { transform: scale(1); }
  42% { transform: scale(1.12); }
  70% { transform: scale(1); }
}

@keyframes particles {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes success-pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Apply Animations */
.wd-appreciate-container.animation-pulse .wd-appreciate-btn:hover {
  animation: pulse 0.6s ease-in-out;
}

.wd-appreciate-container.animation-bounce .wd-appreciate-btn:hover {
  animation: bounce 0.8s ease-in-out;
}

.wd-appreciate-container.animation-shake .wd-appreciate-btn:hover {
  animation: shake 0.5s ease-in-out;
}

.wd-appreciate-container.animation-heart .wd-appreciate-btn:hover {
  animation: heartbeat 1s ease-in-out;
}

/* Click Animation */
.wd-appreciate-btn.clicking {
  transform: scale(0.95);
}

.wd-appreciate-btn.clicking .particle {
  animation: particles 0.6s ease-out;
}

.wd-appreciate-btn.clicking .particle:nth-child(1) {
  animation-delay: 0s;
  top: -10px;
  left: -10px;
}

.wd-appreciate-btn.clicking .particle:nth-child(2) {
  animation-delay: 0.1s;
  top: -10px;
  right: -10px;
}

.wd-appreciate-btn.clicking .particle:nth-child(3) {
  animation-delay: 0.2s;
  bottom: -10px;
  left: -10px;
}

.wd-appreciate-btn.clicking .particle:nth-child(4) {
  animation-delay: 0.3s;
  bottom: -10px;
  right: -10px;
}

.wd-appreciate-btn.clicking .particle:nth-child(5) {
  animation-delay: 0.15s;
  top: -15px;
  left: 50%;
}

/* Success Pulse Animation */
.wd-appreciate-btn.success-pulse {
  animation: success-pulse 0.6s ease-in-out;
}

/* Ripple Effect */
.wd-appreciate-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 70%);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
  z-index: 0;
}

.wd-appreciate-btn.clicking::before {
  width: 250px;
  height: 250px;
  animation: ripple 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* Success State */
.wd-appreciate-btn.success {
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%), #10b981;
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.wd-appreciate-btn.success:hover {
  box-shadow: 0 20px 35px -10px rgba(16, 185, 129, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.4) !important;
}

/* Appreciation Message */
.appreciation-message {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 10px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.appreciation-message.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-5px);
}

.appreciation-message::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.8);
}

/* Count Update Animation */
.btn-count.updating {
  animation: pulse 0.4s ease-in-out;
  background: rgba(255, 255, 255, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
  .wd-appreciate-container.position-bottom-right,
  .wd-appreciate-container.position-bottom-left {
    bottom: 20px;
  }

  .wd-appreciate-container.position-bottom-right {
    right: 20px;
  }

  .wd-appreciate-container.position-bottom-left {
    left: 20px;
  }

  .wd-appreciate-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .wd-appreciate-btn {
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
  }

  .btn-count {
    background: rgba(255, 255, 255, 0.15);
  }

  .appreciation-message {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
  }

  .appreciation-message::after {
    border-top-color: rgba(255, 255, 255, 0.9);
  }
}

/* Accessibility */
.wd-appreciate-btn:focus,
a.wd-appreciate-btn:focus {
  outline: 2px solid rgba(59, 130, 246, 0.5) !important;
  outline-offset: 2px !important;
}

@media (prefers-reduced-motion: reduce) {
  .wd-appreciate-btn,
  .btn-icon svg,
  .particle,
  .appreciation-message {
    animation: none !important;
    transition: none !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .wd-appreciate-btn {
    border: 2px solid currentColor;
    box-shadow: none;
  }

  .btn-count {
    background: currentColor;
    color: white;
  }
}
