/**
 * Custom Swatches Styles - Fioreria
 * Personalizzazione per Variation Swatches plugin
 */

/* Style the attribute label */
.variations .label {
    font-size: 16px;
    color: #8b9090 !important;
    font-weight: 400;
    margin-bottom: 5px;
}

/* Target the dimension attribute specifically */
.variations tr[data-attribute_name="attribute_pa_dimensione"] .label,
.variations tr[data-attribute_name="attribute_dimensione"] .label {
    font-size: 16px;
    color: #8b9090 !important;
    font-weight: 400;
    margin-bottom: 5px !important;
}

/* Style the swatches container */
.variable-items-wrapper {
    display: flex !important;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 0 !important;
}

/* Target dimension swatches specifically */
.variations tr[data-attribute_name="attribute_pa_dimensione"] .variable-items-wrapper,
.variations tr[data-attribute_name="attribute_dimensione"] .variable-items-wrapper {
    display: flex !important;
    gap: 15px;
    flex-wrap: wrap;
}

/* Style button-type swatches */
.variable-item.button-variable-item {
    background: #ffffff !important;
    border: 2px solid #e5e5e5 !important;
    border-radius: 12px !important;
    padding: 20px 15px !important;
    min-width: 120px !important;
    min-height: 100px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    color: #333333 !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    margin: 0 !important;
    gap: 15px !important;
}

.variable-item.button-variable-item:hover {
    border-color: #d4d4d4 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    transform: none !important;
}

.variable-item.button-variable-item.selected {
    border-color: #4c6b5c !important;
    background-color: #f8faf9 !important;
    box-shadow: 0 2px 12px rgba(76, 107, 92, 0.15) !important;
    color: #4c6b5c !important;
}

/* Add checkmark for selected state */
.variable-item.button-variable-item.selected::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background-color: #4c6b5c;
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='white' d='M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
}

/* Icon container */
.variable-item.button-variable-item .fioreria-swatch-icon {
    width: 45px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.variable-item.button-variable-item .fioreria-swatch-icon img {
    width: 80px;
    height: 70px;
    object-fit: contain;
    filter: opacity(0.8);
    transition: filter 0.3s ease;
}

.variable-item.button-variable-item.selected .fioreria-swatch-icon img {
    filter: opacity(1) brightness(0) saturate(100%) invert(27%) sepia(18%) saturate(1088%) hue-rotate(113deg) brightness(96%) contrast(88%);
}

/* Text content container */
.variable-item.button-variable-item .fioreria-swatch-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-right: 15px;
}

/* Label styling */
.variable-item.button-variable-item .fioreria-swatch-label {
    font-size: 14px;
    font-weight: 500;
    color: #333333;
    text-transform: capitalize;
    line-height: 1.2;
}

.variable-item.button-variable-item.selected .fioreria-swatch-label {
    color: #4c6b5c;
}

/* Price display */
.variable-item.button-variable-item .fioreria-swatch-price {
    font-size: 16px;
    font-weight: 600;
    color: #8a7a5c;
    line-height: 1.2;
}

.variable-item.button-variable-item.selected .fioreria-swatch-price {
    color: #4c6b5c;
}

/* Hide the default plugin tooltip on dimension swatches */
.variations tr[data-attribute_name="attribute_pa_dimensione"] .variable-item[data-wvstooltip]:before,
.variations tr[data-attribute_name="attribute_pa_dimensione"] .variable-item[data-wvstooltip]:after,
.variations tr[data-attribute_name="attribute_dimensione"] .variable-item[data-wvstooltip]:before,
.variations tr[data-attribute_name="attribute_dimensione"] .variable-item[data-wvstooltip]:after {
    display: none !important;
}

/* Remove default button styling */
.variable-item.button-variable-item {
    text-shadow: none !important;
    box-shadow: none !important;
    background-image: none !important;
}

.variable-item.button-variable-item:before {
    display: none !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .variable-items-wrapper {
        gap: 10px;
    }
    
    .variable-item.button-variable-item {
        min-width: 100px !important;
        padding: 15px 10px !important;
    }
    
    .variable-item.button-variable-item .fioreria-swatch-icon img {
        width: 60px;
        height: 50px;
    }
    
    .variable-item.button-variable-item .fioreria-swatch-label {
        font-size: 13px;
    }
    
    .variable-item.button-variable-item .fioreria-swatch-price {
        font-size: 15px;
    }
}

/* Ensure the variation description shows "Seleziona la dimensione" */
.variations tr[data-attribute_name="attribute_pa_dimensione"] .label label:after,
.variations tr[data-attribute_name="attribute_dimensione"] .label label:after {
    content: "Seleziona la dimensione";
}

.variations tr[data-attribute_name="attribute_pa_dimensione"] .label label,
.variations tr[data-attribute_name="attribute_dimensione"] .label label {
    font-size: 0; /* Hide original text */
}

/* Override any conflicting styles from the plugin */
.woo-variation-swatches .variable-item.button-variable-item {
    background: #ffffff !important;
}

/* Remove any default margins from the plugin */
.variable-items-wrapper .variable-item {
    margin-right: 0 !important;
    margin-bottom: 0 !important;
}