/* Product Variants Styling */

/* Out of stock styling for select options */
.variant-attribute-select option.out-of-stock {
    color: #999;
    font-style: italic;
}

.variant-attribute-select option.out-of-stock:hover {
    background-color: #f5f5f5;
}

/* Out of stock styling for radio buttons */
.radio-options .form-check.out-of-stock {
    opacity: 0.6;
}

.radio-options .form-check.out-of-stock input {
    cursor: not-allowed;
}

.radio-options .form-check.out-of-stock label {
    color: #999;
    cursor: not-allowed;
}

/* Out of stock styling for color swatches */
.color-swatch.out-of-stock {
    position: relative;
}

.color-swatch.out-of-stock::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 120%;
    background-color: #ff0000;
    transform: translate(-50%, -50%) rotate(45deg);
    z-index: 1;
    pointer-events: none;
}

.swatch-color.no-stock,
.swatch-text.no-stock {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(50%);
}

.swatch-color.no-stock::before,
.swatch-text.no-stock::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(255, 0, 0, 0.3) 2px,
        rgba(255, 0, 0, 0.3) 4px
    );
    pointer-events: none;
    border-radius: inherit;
}

/* Hover effects for available swatches */
.swatch-color:not(.no-stock):hover,
.swatch-text:not(.no-stock):hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

/* Selected state styling */
.swatch-color.selected {
    border-width: 3px !important;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.swatch-text.selected {
    background-color: #f0f0f0 !important;
    border-color: #333 !important;
    font-weight: bold;
}

/* Loading states */
.variant-loading {
    opacity: 0.7;
    pointer-events: none;
}

.variant-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive improvements */
@media (max-width: 768px) {
    .color-swatches {
        justify-content: center;
    }
    
    .swatch-color,
    .swatch-text {
        margin-bottom: 10px;
    }
}

/* Accessibility improvements */
.swatch-color:focus,
.swatch-text:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.variant-attribute-select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Product price update animation */
.product-price .amount {
    transition: all 0.3s ease;
}

.product-price.updating {
    opacity: 0.7;
}

/* Stock status indicators */
.stock-indicator {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
}

.stock-indicator.in-stock {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.stock-indicator.out-of-stock {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.stock-indicator.low-stock {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Variant selector improvements */
.variant-selector {
    margin-bottom: 1rem;
}

.variant-selector label {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    display: block;
}

.variant-selector .form-control {
    border: 2px solid #e9ecef;
    transition: border-color 0.15s ease-in-out;
}

.variant-selector .form-control:focus {
    border-color: #333;
    box-shadow: none;
}

/* Error states */
.variant-error {
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 0.25rem;
}