/* M3 Quantity Select Styling */
:root {
  --wx-primary-color: #2271b1;
  --wx-primary-light: #e8f4fd;
  --wx-border-color: #ddd;
  --wx-border-radius: 6px;
  --wx-text-color: #333;
  --wx-text-muted: #666;
  --wx-success-color: #00a32a;
  --wx-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --wx-shadow-focus: 0 0 0 2px rgba(34, 113, 177, 0.25);
}

/* Main select dropdown styling */
.wx-m3-select {
  width: 100%;
  min-height: 44px;
  padding: 12px 40px 12px 16px;
  border: 1px solid var(--wx-border-color);
  border-radius: var(--wx-border-radius);
  font-size: 15px;
  font-weight: 500;
  color: var(--wx-text-color);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23666' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 20px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--wx-shadow);
}

.wx-m3-select:hover {
  border-color: var(--wx-primary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.wx-m3-select:focus {
  outline: none;
  border-color: var(--wx-primary-color);
  box-shadow: var(--wx-shadow-focus);
}

.wx-m3-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #f8f9fa;
}

/* Default placeholder option styling */
.wx-m3-select option:first-child {
  color: var(--wx-text-muted);
  font-style: italic;
}

/* Helper text styling */
.wx-m3-helper {
  font-size: 13px;
  color: var(--wx-text-muted);
  margin-top: 8px;
  padding: 6px 12px;
  background: var(--wx-primary-light);
  border-radius: 4px;
  border-left: 2px solid var(--wx-primary-color);
  line-height: 1.4;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wx-m3-helper::before {
  content: "📦";
  font-size: 14px;
}

/* Quantity wrapper improvements for m3 products */
.quantity:has(.wx-m3-select) {
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Hide original elements for converted inputs */
.quantity input[data-wx-converted="true"] {
  display: none !important;
}

.quantity:has(.wx-m3-select) .quantity-btn {
  display: none !important;
}

/* Context-specific styling */
.single-product .wx-m3-select {
  min-height: 50px;
  font-size: 16px;
  font-weight: 600;
}

.single-product .wx-m3-helper {
  background: rgba(0, 163, 42, 0.08);
  border-left-color: var(--wx-success-color);
  color: var(--wx-success-color);
  margin-top: 12px;
}

.single-product .wx-m3-helper::before {
  content: "✓";
  color: var(--wx-success-color);
  font-weight: bold;
}

/* Shop/archive page styling */
.shop_table .wx-m3-select,
.woocommerce-loop-product .wx-m3-select {
  min-height: 38px;
  font-size: 14px;
  padding: 8px 32px 8px 12px;
}

.shop_table .wx-m3-helper,
.woocommerce-loop-product .wx-m3-helper {
  font-size: 12px;
  padding: 4px 8px;
  margin-top: 4px;
}

/* Cart page specific styling */
.woocommerce-cart .wx-m3-select {
  min-height: 40px;
}

/* Mobile responsive design */
@media (max-width: 768px) {
  .wx-m3-select {
    font-size: 16px; /* Prevent zoom on iOS */
    min-height: 48px;
    padding: 12px 36px 12px 14px;
  }
  
  .quantity:has(.wx-m3-select) {
    min-width: 100%;
    max-width: 300px;
  }
  
  .wx-m3-helper {
    font-size: 12px;
    padding: 4px 8px;
    margin-top: 6px;
  }
  
  .single-product .wx-m3-select {
    min-height: 52px;
    font-size: 16px;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .wx-m3-helper::before {
    display: none;
  }
  
  .wx-m3-helper {
    text-align: center;
    font-size: 11px;
  }
}

/* Integration with WooCommerce */
.woocommerce .wx-m3-select,
.woocommerce-page .wx-m3-select {
  box-sizing: border-box;
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
  :root {
    --wx-border-color: #444;
    --wx-text-color: #e0e0e0;
    --wx-text-muted: #aaa;
    --wx-primary-light: rgba(34, 113, 177, 0.2);
  }
  
  .wx-m3-select {
    background-color: #2d2d2d;
    color: var(--wx-text-color);
  }
  
  .wx-m3-select:disabled {
    background-color: #1a1a1a;
  }
}

/* Enhanced price display integration */
.wx-container-price-wrapper {
  margin-bottom: 12px;
}

/* Position ordering info below the entire product form */
.single-product .wx-ordering-info {
  font-size: 14px;
  color: var(--wx-success-color);
  font-weight: 700;
  padding: 12px 16px;
  background: rgba(0, 163, 42, 0.1);
  border: 1px solid rgba(0, 163, 42, 0.3);
  border-radius: 6px;
  display: block;
  margin: 20px 0 0 0;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  clear: both;
}

/* Ensure ordering info appears below cart form */
.single-product .wx-container-price-wrapper {
  position: relative;
  margin-bottom: 20px;
}

.single-product .wx-container-price-wrapper .wx-ordering-info {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 80px; /* Space for add to cart button and form */
  z-index: 1;
}

/* Alternative: If ordering info is rendered after the price wrapper */
.single-product .summary .wx-ordering-info {
  order: 999; /* Push to bottom if flexbox is used */
  margin-top: 30px;
}

/* Default (non-single-product) styling for ordering info */
.wx-ordering-info {
  font-size: 13px;
  color: var(--wx-primary-color);
  margin-top: 6px;
  font-weight: 600;
  padding: 6px 10px;
  background: var(--wx-primary-light);
  border-radius: 4px;
  display: inline-block;
  border: 1px solid rgba(34, 113, 177, 0.2);
}

.wx-conversion-info {
  font-size: 12px;
  color: var(--wx-text-muted);
  margin-top: 4px;
  padding: 4px 0;
  font-style: italic;
}

/* Remove old single-product ordering info styling - now handled above */


/* Custom price wrapper integration */
.costum-price-wrapper .wx-conversion-info {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 3px;
}

.costum-price-wrapper .wx-ordering-info {
  font-size: 12px;
  color: var(--wx-success-color);
  font-weight: 600;
  margin-top: 6px;
  padding: 3px 8px;
  background: rgba(0, 163, 42, 0.1);
  border: 1px solid rgba(0, 163, 42, 0.2);
  border-radius: 3px;
  display: inline-block;
}

/* Animation for smooth transitions */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wx-m3-helper {
  animation: fadeIn 0.3s ease;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .wx-m3-select {
    border-width: 2px;
  }
  
  .wx-m3-helper {
    border-left-width: 3px;
    font-weight: 700;
  }
}

/* Print styles */
@media print {
  .wx-m3-helper::before {
    display: none;
  }
  
  .wx-m3-helper {
    background: none !important;
    border: 1px solid #000 !important;
    color: #000 !important;
  }
}