/**
 * WooCommerce Custom Variations Widget - Frontend Styles
 */

.wvw-variations-wrapper {
    width: 100%;
}

.wvw-variations-container {
    margin-bottom: 20px;
}

.wvw-variation-item {
    margin-bottom: 20px;
}

.wvw-variation-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

/* Layout Spalten */
.wvw-variation-selector-wrapper {
    display: grid;
    gap: 10px; /* Default, wird von Elementor überschrieben */
    margin-bottom: 15px;
}

.wvw-variation-selector-wrapper.columns-1 {
    grid-template-columns: 1fr;
}

.wvw-variation-selector-wrapper.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.wvw-variation-selector-wrapper.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.wvw-variation-selector-wrapper.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Varianten Selector Styles */
.wvw-variation-selector {
    position: relative;
    padding: 12px 15px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
}

/* Anpassung wenn Bild vorhanden */
.wvw-variation-selector:has(.wvw-variation-image) {
    padding: 8px 12px;
}

.wvw-variation-selector:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.wvw-variation-selector.selected {
    background: #007cba;
    border-color: #005a87;
    color: #fff;
}

.wvw-variation-selector.selected label {
    color: #fff;
}

.wvw-variation-selector.disabled {
    opacity: 0.4; /* Wird von Elementor überschrieben */
    cursor: not-allowed;
    background: #f0f0f0; /* Wird von Elementor überschrieben */
    position: relative;
}

.wvw-variation-selector.disabled * {
    cursor: not-allowed !important;
    pointer-events: none;
}

/* Standard Schraffur für disabled Elemente */
.wvw-variation-selector.disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        transparent 45%, 
        rgba(255,0,0,0.1) 45%, 
        rgba(255,0,0,0.1) 55%, 
        transparent 55%);
    background-size: 20px 20px;
    border-radius: inherit;
    pointer-events: none;
    z-index: 1;
}

/* Select/Dropdown Style */
.wvw-variation-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wvw-variation-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.wvw-variation-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Radio Button Style */
.wvw-variation-selector.radio-style {
    background: transparent;
    border: none;
    padding: 8px 0;
    display: flex;
    align-items: center;
}

.wvw-variation-selector.radio-style input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    opacity: 1;
    position: relative;
}

.wvw-variation-selector.radio-style label {
    cursor: pointer;
}

/* Checkbox Style */
.wvw-variation-selector.checkbox-style {
    background: transparent;
    border: none;
    padding: 8px 0;
    display: flex;
    align-items: center;
}

.wvw-variation-selector.checkbox-style input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    opacity: 1;
    position: relative;
}

/* Color Swatch Style */
.wvw-variation-selector.color-swatch {
    background: transparent;
    border: none;
    padding: 0;
    width: auto;
    height: auto;
    display: inline-block;
}

.wvw-color-swatch {
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.wvw-variation-selector.color-swatch:hover .wvw-color-swatch {
    transform: scale(1.1);
    box-shadow: 0 0 0 2px #007cba;
}

.wvw-variation-selector.color-swatch.selected .wvw-color-swatch {
    box-shadow: 0 0 0 3px #007cba;
    transform: scale(1.15);
}

/* Image Swatch Style */
.wvw-variation-selector.image-swatch {
    background: transparent;
    border: none;
    padding: 0;
    width: auto;
    height: auto;
    display: inline-block;
}

.wvw-image-swatch {
    border-radius: 8px;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.wvw-image-swatch img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wvw-variation-selector.image-swatch:hover .wvw-image-swatch {
    transform: scale(1.1);
    box-shadow: 0 0 0 2px #007cba;
}

.wvw-variation-selector.image-swatch.selected .wvw-image-swatch {
    box-shadow: 0 0 0 3px #007cba;
    transform: scale(1.15);
}

/* Tooltip für Swatches */
.wvw-swatch-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 5px;
}

.wvw-swatch-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

.wvw-variation-selector.color-swatch:hover .wvw-swatch-tooltip,
.wvw-variation-selector.image-swatch:hover .wvw-swatch-tooltip {
    opacity: 1;
}

/* Grid Layout für Swatches */
.wvw-variation-selector-wrapper[data-display-type="color"],
.wvw-variation-selector-wrapper[data-display-type="image"] {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Disabled States für neue Typen */
.wvw-variation-selector.color-swatch.disabled,
.wvw-variation-selector.image-swatch.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.wvw-variation-selector.radio-style.disabled,
.wvw-variation-selector.checkbox-style.disabled {
    opacity: 0.5;
}

.wvw-variation-selector.radio-style.disabled input,
.wvw-variation-selector.checkbox-style.disabled input {
    cursor: not-allowed;
}

/* Radio/Checkbox verstecken */
.wvw-variation-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.wvw-variation-selector label {
    margin: 0;
    cursor: pointer;
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

/* Variantenbild */
.wvw-variation-image {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    position: relative;
}

.wvw-variation-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Verstecke leere Bildcontainer */
.wvw-variation-image:empty,
.wvw-variation-image img[src=""] {
    display: none;
}

/* Placeholder/Loading State für Bilder */
.wvw-variation-image.loading::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { opacity: 0.8; }
    50% { opacity: 0.4; }
    100% { opacity: 0.8; }
}

/* Button Style Variation */
.wvw-variation-selector.button-style {
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
}

.wvw-variation-selector.button-style:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Color Swatch Style */
.wvw-variation-selector.color-swatch {
    width: 50px;
    height: 50px;
    padding: 5px;
    border-radius: 50%;
}

.wvw-variation-selector.color-swatch .wvw-color-preview {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

.wvw-variation-selector.color-swatch.selected {
    box-shadow: 0 0 0 3px #007cba;
}

/* Image Swatch Style */
.wvw-variation-selector.image-swatch {
    padding: 5px;
    background: #fff;
}

.wvw-variation-selector.image-swatch img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

/* Preis Wrapper */
.wvw-price-wrapper {
    margin: 20px 0;
}

.wvw-price-wrapper .woocommerce-variation-price {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
}

.wvw-price-wrapper .price del {
    opacity: 0.5;
    font-weight: 400;
}

.wvw-price-wrapper .price ins {
    text-decoration: none;
    color: #77a464;
}

/* Stückzahl Styles */
.wvw-quantity-wrapper {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.wvw-quantity-wrapper label {
    font-weight: 600;
    min-width: 80px;
}

/* Standard Input Style */
.wvw-quantity-wrapper input[type="number"] {
    width: 80px;
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    text-align: center;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.wvw-quantity-wrapper input[type="number"]:focus {
    outline: none;
    border-color: #007cba;
}

/* Plus/Minus Buttons Style */
.wvw-quantity-buttons {
    display: flex;
    align-items: center;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
}

.wvw-quantity-buttons button {
    width: 40px;
    height: 40px;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    font-size: 20px;
    font-weight: 600;
    color: #495057;
    transition: all 0.3s ease;
}

.wvw-quantity-buttons button:hover {
    background: #007cba;
    color: #fff;
}

.wvw-quantity-buttons input {
    width: 60px;
    height: 40px;
    border: none;
    border-left: 1px solid #dee2e6;
    border-right: 1px solid #dee2e6;
    text-align: center;
    font-size: 16px;
}

/* Dropdown Style */
.wvw-quantity-dropdown {
    padding: 10px 15px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: border-color 0.3s ease;
    min-width: 100px;
}

.wvw-quantity-dropdown:focus {
    outline: none;
    border-color: #007cba;
}

/* Add to Cart Button */
.wvw-add-to-cart-wrapper {
    margin-top: 20px;
}

.wvw-add-to-cart-btn {
    display: inline-block;
    padding: 14px 30px;
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
}

.wvw-add-to-cart-btn:hover {
    background: linear-gradient(135deg, #005a87 0%, #007cba 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 124, 186, 0.4);
}

.wvw-add-to-cart-btn.loading {
    opacity: 0.7;
    cursor: wait;
}

.wvw-add-to-cart-btn.added {
    background: linear-gradient(135deg, #77a464 0%, #5e8a51 100%);
}

/* Stock Status */
.wvw-stock-status {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
}

.wvw-stock-status.in-stock {
    background: #d4edda;
    color: #155724;
}

.wvw-stock-status.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

/* Variation Description */
.wvw-variation-description {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .wvw-variation-selector-wrapper.columns-3,
    .wvw-variation-selector-wrapper.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .wvw-variation-selector {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    /* Kleinere Bilder auf Mobile */
    .wvw-variation-image {
        width: 40px !important;
        height: 40px !important;
    }
    
    .wvw-add-to-cart-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .wvw-variation-selector-wrapper.columns-2,
    .wvw-variation-selector-wrapper.columns-3,
    .wvw-variation-selector-wrapper.columns-4 {
        grid-template-columns: 1fr;
    }
    
    /* Noch kleinere Bilder auf sehr kleinen Bildschirmen */
    .wvw-variation-image {
        width: 35px !important;
        height: 35px !important;
    }
    
    .wvw-quantity-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .wvw-quantity-wrapper label {
        min-width: auto;
    }
}

/* Animation */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 124, 186, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 124, 186, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 124, 186, 0);
    }
}

.wvw-variation-selector.updated {
    animation: pulse 1s;
}

/* Loading State */
.wvw-variations-wrapper.loading {
    position: relative;
    pointer-events: none;
}

.wvw-variations-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Notices */
.wvw-notice {
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wvw-notice.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.wvw-notice.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.wvw-notice.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}