/*!
 * Enhanced Color and Image Swatches for WooCommerce Variation Swatches
 * 
 * Author: Enhanced by AI Assistant
 * Date: 2024
 * Released under the GPLv3 license.
 */

/* Enhanced Color Swatches */
.variable-item-span-color {
  position: relative;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.variable-item-span-color:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.variable-item-span-color.selected {
  border-color: #333;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #333;
}

/* Dual Color Gradient Enhancement */
.variable-item-span-color.wvs-dual-color {
  background-size: 200% 200%;
  animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Enhanced Image Swatches */
.variable-item-image {
  border-radius: 4px;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  object-fit: cover;
}

.variable-item-image:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.variable-item.selected .variable-item-image {
  border-color: #333;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #333;
}

/* Loading State */
.variable-item.loading .variable-item-span-color,
.variable-item.loading .variable-item-image {
  opacity: 0.6;
  pointer-events: none;
}

.variable-item.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Tooltip Enhancements */
.variable-item[data-wvstooltip]::before {
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 1000;
}

.variable-item[data-wvstooltip]::after {
  border-top-color: rgba(0, 0, 0, 0.9);
}

/* Responsive Design - Mobile min-size removed to allow natural sizing */

/* Accessibility Improvements */
.variable-item:focus {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

.variable-item[aria-checked="true"] {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

/* Color Swatch Size Variations */
.variable-item-span-color.size-small {
  width: 24px;
  height: 24px;
}

.variable-item-span-color.size-medium {
  width: 32px;
  height: 32px;
}

.variable-item-span-color.size-large {
  width: 48px;
  height: 48px;
}

/* Image Swatch Size Variations */
.variable-item-image.size-small {
  width: 24px;
  height: 24px;
}

.variable-item-image.size-medium {
  width: 32px;
  height: 32px;
}

.variable-item-image.size-large {
  width: 48px;
  height: 48px;
}

/* Disabled State */
.variable-item.disabled .variable-item-span-color,
.variable-item.disabled .variable-item-image {
  opacity: 0.4;
  filter: grayscale(100%);
  cursor: not-allowed;
}

.variable-item.disabled:hover {
  transform: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Out of Stock State */
.variable-item.out-of-stock .variable-item-span-color,
.variable-item.out-of-stock .variable-item-image {
  opacity: 0.5;
  filter: grayscale(50%);
  position: relative;
}

.variable-item.out-of-stock .variable-item-span-color::after,
.variable-item.out-of-stock .variable-item-image::after {
  content: "✕";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ff0000;
  font-weight: bold;
  font-size: 16px;
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.8);
}
