/**
 * Global Variations Manager - Frontend Styles
 */

/* Main container */
.gvm-product-variations {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
}

.gvm-variations-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Attribute fields */
.gvm-attribute-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.gvm-attribute-field label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 5px;
}

.gvm-attribute-select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    color: #333;
    transition: border-color 0.3s ease;
}

.gvm-attribute-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.gvm-attribute-select:hover {
    border-color: #999;
}

/* Selected state */
.gvm-attribute-select.selected {
    border-color: #46b450;
    background-color: #f7fff7;
}

/* Price display - WooCommerce style */
.gvm-price-display {
    margin: 10px 0;
}

.gvm-current-price {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.gvm-price-placeholder {
    color: #666;
    font-style: italic;
    font-size: 16px;
    font-weight: normal;
}

/* Stock status - simple text only */
.gvm-stock-info {
    margin: 5px 0;
    font-size: 14px;
    color: #666;
}

/* Loading states */
.gvm-loading {
    position: relative;
    opacity: 0.6;
}

.gvm-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error states */
.gvm-error {
    color: #dc3232;
    background: #fff2f2;
    border: 1px solid #dc3232;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

/* Success states */
.gvm-success {
    color: #46b450;
    background: #f7fff7;
    border: 1px solid #46b450;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

/* Required indicator */
.gvm-required {
    color: #dc3232;
    font-weight: 600;
}

.gvm-attribute-field.required label::after {
    content: ' *';
    color: #dc3232;
}

/* Responsive design */
@media (min-width: 768px) {
    .gvm-variations-form {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }
    
    .gvm-attribute-field {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .gvm-product-variations {
        margin: 15px 0;
        padding: 15px;
    }
    
    .gvm-attribute-select {
        padding: 12px 10px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* WooCommerce integration */
.single-product .gvm-product-variations {
    margin-bottom: 25px;
}

/* Add to cart button states */
.single_add_to_cart_button.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.single_add_to_cart_button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Form disabled state */
.gvm-form-disabled {
    opacity: 0.7;
    pointer-events: none;
}

.gvm-form-disabled .single_add_to_cart_button {
    opacity: 0.5;
    cursor: not-allowed;
}

.gvm-form-disabled input[type="number"] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Out of stock specific styling */
.single_add_to_cart_button.gvm-out-of-stock {
    background-color: #999 !important;
    border-color: #999 !important;
    color: #fff !important;
}

/* Animation for smooth transitions */
.gvm-attribute-select,
.gvm-price-display,
.gvm-stock-info {
    transition: all 0.3s ease;
}

/* Disabled state */
.gvm-attribute-select:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* Focus styles for accessibility */
.gvm-attribute-select:focus-visible {
    outline: 2px solid #005cee;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .gvm-attribute-select {
        border-width: 3px;
    }
    
    .gvm-attribute-select:focus {
        border-color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .gvm-attribute-select,
    .gvm-price-display,
    .gvm-stock-info {
        transition: none;
    }
    
    .gvm-loading::after {
        animation: none;
    }
}