/**
 * Button Styles and Animations
 * Enhanced styling for Add to Cart, Wishlist, and Compare buttons
 */

/* Base button styles */
.add-to-cart-btn,
.add-to-wishlist,
.add-to-compare {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* Add to Cart Button Styles */
.add-to-cart-btn {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  border: none;
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.add-to-cart-btn:hover {
  background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
  color: white;
}

.add-to-cart-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.add-to-cart-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* Wishlist Button Styles */
.add-to-wishlist {
  color: #6c757d;
  text-decoration: none;
  display: inline-block;
  padding: 8px 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.add-to-wishlist:hover {
  color: #dc3545;
  background: rgba(220, 53, 69, 0.1);
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
  text-decoration: none;
}

.add-to-wishlist:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25);
}

/* Compare Button Styles */
.add-to-compare {
  color: #6c757d;
  text-decoration: none;
  display: inline-block;
  padding: 8px 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.add-to-compare:hover {
  color: #28a745;
  background: rgba(40, 167, 69, 0.1);
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
  text-decoration: none;
}

.add-to-compare:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.25);
}

/* Button Loading States */
.add-to-cart-btn.loading,
.add-to-wishlist.loading,
.add-to-compare.loading {
  position: relative;
  color: transparent !important;
}

.add-to-cart-btn.loading::after,
.add-to-wishlist.loading::after,
.add-to-compare.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: button-spin 1s linear infinite;
}

@keyframes button-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Button Success States */
.add-to-cart-btn.btn-success,
.add-to-wishlist.btn-success,
.add-to-compare.btn-success {
  background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
  color: white;
  animation: button-success 0.6s ease;
}

@keyframes button-success {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Button Error States */
.add-to-cart-btn.btn-danger,
.add-to-wishlist.btn-danger,
.add-to-compare.btn-danger {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  animation: button-error 0.6s ease;
}

@keyframes button-error {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
  100% {
    transform: translateX(0);
  }
}

/* Product Hover Effects */
.product:hover .add-to-cart-btn,
.product:hover .add-to-wishlist,
.product:hover .add-to-compare {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.product .add-to-cart-btn,
.product .add-to-wishlist,
.product .add-to-compare {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

/* Icon animations */
.add-to-wishlist i,
.add-to-compare i {
  transition: all 0.3s ease;
}

.add-to-wishlist:hover i {
  animation: heart-beat 0.6s ease;
}

.add-to-compare:hover i {
  animation: compare-bounce 0.6s ease;
}

@keyframes heart-beat {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.2);
  }
  50% {
    transform: scale(1);
  }
  75% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes compare-bounce {
  0% {
    transform: translateY(0);
  }
  25% {
    transform: translateY(-3px);
  }
  50% {
    transform: translateY(0);
  }
  75% {
    transform: translateY(-2px);
  }
  100% {
    transform: translateY(0);
  }
}

/* Button Groups */
.add-cart-button.btn-group {
  display: flex;
  align-items: center;
}

.add-cart-button .btn {
  border-radius: 0;
}

.add-cart-button .btn:first-child {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.add-cart-button .btn:last-child {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

/* Action Lists */
.action ul.list-unstyled {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 0;
}

.action ul.list-unstyled li {
  list-style: none;
}

/* Responsive Button Styles */
@media (max-width: 768px) {
  .add-to-cart-btn {
    font-size: 12px;
    padding: 8px 12px;
  }

  .add-to-wishlist,
  .add-to-compare {
    padding: 6px 10px;
  }

  .action ul.list-unstyled {
    gap: 3px;
  }
}

/* Message Styles */
.ecom-message {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  min-width: 300px;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.ecom-message.alert-success {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  border-color: #c3e6cb;
  color: #155724;
}

.ecom-message.alert-danger {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  border-color: #f5c6cb;
  color: #721c24;
}

.ecom-message.alert-warning {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  border-color: #ffeaa7;
  color: #856404;
}

/* Quantity Controls */
.quant-input {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

.quant-input input[type="text"] {
  border: none;
  text-align: center;
  width: 60px;
  padding: 8px;
  font-weight: 600;
}

.quant-input .arrow {
  background: #f8f9fa;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.quant-input .arrow:hover {
  background: #e9ecef;
}

.quant-input .arrow.plus {
  border-left: 1px solid #ddd;
}

.quant-input .arrow.minus {
  border-right: 1px solid #ddd;
}

/* Disabled State */
.add-to-cart-btn:disabled,
.add-to-wishlist:disabled,
.add-to-compare:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Focus States for Accessibility */
.add-to-cart-btn:focus-visible,
.add-to-wishlist:focus-visible,
.add-to-compare:focus-visible {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .add-to-cart-btn {
    border: 2px solid #000;
  }

  .add-to-wishlist,
  .add-to-compare {
    border: 2px solid #000;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .add-to-cart-btn,
  .add-to-wishlist,
  .add-to-compare {
    transition: none;
  }

  .add-to-cart-btn.loading::after,
  .add-to-wishlist.loading::after,
  .add-to-compare.loading::after {
    animation: none;
  }

  @keyframes button-spin,
    @keyframes button-success,
    @keyframes button-error,
    @keyframes heart-beat,
    @keyframes compare-bounce,
    @keyframes slideInRight {
    0%,
    100% {
      transform: none;
    }
  }
}
