/**
 * Bizzswatches Frontend Styles
 *
 * @package Bizzswatches
 */

/* Swatch Wrapper */
.bizzswatches-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

/* Hide default dropdown when swatches are shown */
.variations select.bizzswatches-hidden {
    display: none !important;
    opacity: 0.22;
}

/* Swatch Item Base */
.bizzswatches-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    min-height: 30px;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.bizzswatches-item:hover {
    border-color: #999;
    transform: scale(1.05);
}

.bizzswatches-item.selected {
    border-color: #333;
}

.bizzswatches-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Shape Styles */
.bizzswatches-shape-rounded .bizzswatches-item {
    border-radius: 4px;
}

.bizzswatches-shape-squared .bizzswatches-item {
    border-radius: 0;
}

.bizzswatches-shape-circle .bizzswatches-item {
    border-radius: 50%;
}

/* Color Swatches */
.bizzswatches-color .bizzswatches-item {
    width: 30px;
    height: 30px;
}

.bizzswatches-color .bizzswatches-item.selected::after {
    content: '\2713';
    color: #fff;
    font-size: 14px;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

/* Image Swatches */
.bizzswatches-image .bizzswatches-item {
    width: 40px;
    height: 40px;
    padding: 2px;
    overflow: hidden;
}

.bizzswatches-image .bizzswatches-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Button Swatches */
.bizzswatches-button .bizzswatches-item {
    padding: 6px 12px;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
}

.bizzswatches-button .bizzswatches-item:hover {
    background: #f5f5f5;
}

.bizzswatches-button .bizzswatches-item.selected {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* Radio Swatches */
.bizzswatches-radio .bizzswatches-item {
    padding: 8px 15px;
    border: none;
}

.bizzswatches-radio .bizzswatches-item input[type="radio"] {
    margin-right: 5px;
}

/* Out of Stock Behaviors */
.bizzswatches-behavior-blur .bizzswatches-item.out-of-stock {
    opacity: 0.4;
    filter: blur(1px);
}

.bizzswatches-item-cross {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.bizzswatches-behavior-cross .bizzswatches-item.out-of-stock .bizzswatches-item-cross {
    display: block;
}

.bizzswatches-behavior-cross .bizzswatches-item.out-of-stock .bizzswatches-item-cross::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #ff0000;
    transform: rotate(-45deg);
}

.bizzswatches-behavior-hide .bizzswatches-item.out-of-stock {
    display: none;
}

/* Tooltip */
.bizzswatches-tooltip .bizzswatches-item[data-tooltip] {
    position: relative;
}

.bizzswatches-tooltip .bizzswatches-item[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 100;
    margin-bottom: 5px;
}

.bizzswatches-tooltip .bizzswatches-item[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
}

.bizzswatches-tooltip .bizzswatches-item[data-tooltip]:hover::before,
.bizzswatches-tooltip .bizzswatches-item[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Selected Variation Label */
.bizzswatches-show-label .variations tr th label::after {
    content: attr(data-selected);
    margin-left: 5px;
    font-weight: normal;
    color: #666;
}

/* WooCommerce Integration */
.woocommerce-variation-add-to-cart-enabled .bizzswatches-wrapper {
    margin-bottom: 15px;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .bizzswatches-item {
        min-width: 36px;
        min-height: 36px;
    }

    .bizzswatches-button .bizzswatches-item {
        padding: 8px 14px;
    }
}