/* Variation radio button styling */
.variation-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.variation-options h6 {
    width: 100%;
    font-weight: 600;
    color: #333;
}

.variation-options label {
    position: relative;
    display: inline-block;
    padding: 8px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #f8f8f8;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 0 !important;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    font-weight: 500;
    color: #333;
}

.variation-options label:hover:not([disabled]) {
    border-color: var(--theme-color, #ffbd27);
    box-shadow: 0 2px 5px rgba(255, 189, 39, 0.15);
    transform: translateY(-1px);
    outline: 1px solid var(--theme-color, #ffbd27);
}

.variation-options input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.variation-options input[type="radio"]:checked + span.variation-value {
    color: #333;
    font-weight: 600;
}

/* Style for the value text to ensure proper readability */
.variation-options span.variation-value {
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
}

/* Focus state for keyboard accessibility */
.variation-options input[type="radio"]:focus ~ label {
    outline: 2px solid var(--theme-color, #ffbd27);
    outline-offset: 2px;
}

/* Discount styling */
.price-block {
    margin-bottom: 10px;
}

.original-price {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.original-price del {
    text-decoration: line-through;
    color: #6c757d;
}

.discount-badge {
    display: inline-block;
    background: #e74c3c;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.current-price {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 5px 0;
    color: #333;
}

/* If there's a discount, use a different color for the current price */
.original-price + .current-price,
.price-block:has(.original-price) .current-price {
    color: #e74c3c;
    font-weight: 700;
    animation: priceUpdate 0.3s ease-in-out;
}

@keyframes priceUpdate {
    0% { opacity: 0.8; transform: scale(0.98); }
    50% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 1; transform: scale(1); }
}

/* Active state */
.variation-options label.active,
.variation-options input[type="radio"]:checked ~ label {
    background-color: var(--theme-color, #ffbd27);
    border-color: var(--theme-color, #ffbd27);
    color: #333;
    box-shadow: 0 2px 8px rgba(255, 189, 39, 0.3);
    transform: translateY(-1px);
    font-weight: 600;
    outline: 2px solid rgba(0, 0, 0, 0.1);
}

/* Ensure the text in active labels is properly visible */
.variation-options label.active span.variation-value,
.variation-options input[type="radio"]:checked ~ label span.variation-value {
    color: #333;
    font-weight: 600;
}

/* Disabled state with improved visibility */
.variation-options input[type="radio"]:disabled ~ label,
.variation-options label:has(input[type="radio"]:disabled),
.variation-options label.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f0f0f0;
    border-color: #e0e0e0;
    color: #999;
    box-shadow: none;
    text-decoration: line-through;
    transform: none;
    position: relative;
}

.variation-options input[type="radio"]:disabled ~ label::after,
.variation-options label:has(input[type="radio"]:disabled)::after,
.variation-options label.disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        45deg,
        rgba(240, 240, 240, 0.5),
        rgba(240, 240, 240, 0.5) 5px,
        rgba(220, 220, 220, 0.5) 5px,
        rgba(220, 220, 220, 0.5) 10px
    );
    border-radius: 3px;
    pointer-events: none;
}

/* Disabled action buttons */
.btn-disabled {
    opacity: 0.7;
    cursor: not-allowed !important;
    position: relative;
    background-color: #f0f0f0 !important;
    color: #777 !important;
    border: 1px solid #ddd !important;
    transition: all 0.3s ease;
}

/* Add visual feedback to disabled buttons on hover */
.btn-disabled:hover {
    background-color: #e8e8e8 !important;
}

/* 
 * Layout fixes to prevent shifts when elements show/hide
 * during product variation selection
 */

/* Variation container with smooth transitions */
#variations-container {
    min-height: 120px; /* Adjust based on your specific layout needs */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    border: 1px solid #dee2e6 !important; /* Force consistent border */
}

#variations-container:after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border: 2px solid transparent;
    border-radius: 0.25rem;
    pointer-events: none;
    transition: border-color 0.5s ease;
}

#variations-container.highlight:after {
    border-color: var(--theme-color, #ffbd27);
}

/* Fix for selection message area to prevent layout shifts */
#select-combination-message {
    min-height: 60px; /* Set a minimum height that accommodates the content */
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
    margin-bottom: 1rem !important; /* Consistent spacing */
    transform: translateY(0);
}

#select-combination-message.d-none {
    display: block !important; /* Override Bootstrap's d-none */
    opacity: 0;
    height: 0;
    min-height: 0;
    margin: 0 !important;
    padding: 0;
    overflow: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, height 0.3s ease, min-height 0.3s ease, margin 0.3s ease, padding 0.3s ease, transform 0.3s ease;
}

/* Ensure the SKU container maintains consistent space */
#productSKUContainer {
    min-height: 24px; /* Adjust to match your font size */
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(0);
    opacity: 1;
}

#productSKUContainer[style*="display: none"],
#productSKUContainer[style*="visibility: hidden"] {
    display: block !important;
    opacity: 0;
    height: 24px; /* Keep the same height even when empty */
    visibility: hidden;
    transform: translateY(10px);
}

/* Make the price display consistent in height */
#productPrice {
    display: inline-block;
    min-height: 24px; /* Adjust based on your font size */
}

/* Ensure the sku container doesn't cause jumps */
.sku {
    position: relative;
    margin-bottom: 1rem;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .price-block {
        margin-bottom: 15px;
    }
    
    .original-price {
        font-size: 0.8rem;
    }
    
    .discount-badge {
        font-size: 0.7rem;
        padding: 1px 4px;
    }
    
    .current-price {
        font-size: 1.2rem;
        margin: 3px 0;
    }
}
