/**
 * Cart Quantity Updater Styles
 * Styles for bulk discount cart quantity updates
 */

/* Loading indicator */
.cart_item.updating-quantity {
  opacity: 0.7;
  position: relative;
}

.quantity-updating-spinner {
  display: inline-block;
  margin-left: 5px;
  animation: spin 1s linear infinite;
  font-size: 14px;
  color: #007cba;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Success indicator */
.quantity-update-success {
  display: inline-block;
  margin-left: 5px;
  color: #28a745;
  font-weight: bold;
  animation: fadeInOut 2s ease-in-out;
}

/* Error indicator */
.quantity-update-error {
  display: inline-block;
  margin-left: 5px;
  color: #dc3545;
  font-weight: bold;
  cursor: help;
  animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  20% {
    opacity: 1;
    transform: scale(1);
  }
  80% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.8);
  }
}

/* Bulk discount notice */
.bulk-discount-notice {
  margin-bottom: 20px;
  border-left: 4px solid #007cba;
}

.bulk-discount-notice i {
  margin-right: 8px;
}

/* MOQ (Minimum Order Quantity) Warning */
.moq-warning {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  color: #856404;
  font-size: 13px;
  line-height: 1.4;
  animation: slideInDown 0.3s ease-out;
  width: 100%;
  text-align: center;
}

.moq-warning i {
  margin-right: 5px;
  color: #ffc107;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Quantity input enhancements */
.woocommerce-cart .product-quantity {
  position: relative;
}

.woocommerce-cart .qty:focus {
  border-color: #007cba;
  box-shadow: 0 0 5px rgba(0, 124, 186, 0.3);
  outline: none;
}

/* Quantity buttons (if they exist) */
.quantity-btn {
  background: #f8f9fa;
  border: 1px solid #ddd;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.quantity-btn:hover {
  background: #e9ecef;
  border-color: #007cba;
}

.quantity-btn:disabled,
.quantity-btn.disabled {
  background: #e9ecef;
  color: #adb5bd;
  cursor: not-allowed;
  opacity: 0.6;
}

.quantity-btn.quantity-plus {
  border-radius: 0 4px 4px 0;
  margin-left: -1px;
}

.quantity-btn.quantity-minus {
  border-radius: 4px 0 0 4px;
  margin-right: -1px;
}

/* Style quantity input when at minimum */
.woocommerce-cart .qty[value]:not([value=""]) {
  transition: border-color 0.3s ease;
}

.woocommerce-cart .qty.at-minimum {
  border-color: #ffc107;
  background-color: #fffbf0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .bulk-discount-notice {
    font-size: 14px;
    padding: 12px;
  }

  .quantity-updating-spinner,
  .quantity-update-success,
  .quantity-update-error {
    font-size: 12px;
  }
}

/* Integration with existing cart styles */
.woocommerce-cart-form .cart_item.updating-quantity .product-name a {
  color: #999;
}

.woocommerce-cart-form .cart_item.updating-quantity .product-price .amount {
  color: #999;
}

/* Accessibility improvements */
.quantity-updating-spinner[aria-label],
.quantity-update-success[aria-label],
.quantity-update-error[aria-label] {
  position: relative;
}

/* Smooth transitions for updated content */
.product-subtotal,
.cart-totals {
  transition: background-color 0.3s ease;
}

.product-subtotal.updated,
.cart-totals.updated {
  background-color: #f0f8ff;
}

/* ==========================================================================
   Product Page MOQ Warning
   ========================================================================== */

/**
 * Warning banner for MOQ violations on single product page
 * Displays when user attempts to enter quantity below MOQ
 */
.product-moq-warning {
  position: relative;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 0.5rem;
  color: #856404;
  font-size: 0.875rem;
  line-height: 1.5;
  animation: slideInDown 0.3s ease-out;
}

.product-moq-warning strong {
  font-family: "Neue Montreal Medium";
  color: #664d03;
}

/* Warning icon styling */
.product-moq-warning::before {
  content: "\26A0"; /* Warning triangle symbol */
  font-size: 1rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* Close button for product MOQ warning */
.product-moq-warning .btn-close {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  padding: 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  color: #856404;
  opacity: 0.5;
}

.product-moq-warning .btn-close:hover {
  opacity: 1;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  .product-moq-warning {
    font-size: 0.75rem;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
  }

  .product-moq-warning::before {
    font-size: 0.875rem;
  }

  .product-moq-warning .btn-close {
    font-size: 1rem;
    right: 0.5rem;
  }
}
