/* WooCommerce Product Badges - Premium Styling */

.wc-product-badges-container {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    z-index: 10;
    pointer-events: none;
}

.wc-badge {
    padding: 6px 14px;
    height: 30px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 50px;
    color: #fff;
    /* Default color */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.8px;
    white-space: pre-wrap;
    /* Preserve spaces in labels */
    animation: badgeAppear 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badgeAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Sold Out Badge - Dramatic Red/Orange Gradient */
.wc-badge-out-of-stock {
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 15px rgba(255, 65, 108, 0.3);
}

/* Backorder Badge - Royal Purple/Blue Gradient */
.wc-badge-backorder {
    background: linear-gradient(135deg, #8e2de2, #4a00e0);
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 15px rgba(142, 45, 226, 0.3);
}

/* Elementor Loop Grid Compatibility Fixes */
.elementor-loop-container .wc-product-badges-container,
.elementor-grid .wc-product-badges-container {
    position: absolute;
    top: 15px;
    left: 15px;
}

/* Hover Effect for products containing badges */
.product:hover .wc-badge,
.woocommerce-loop-product:hover .wc-badge {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}

/* Badge Tooltips */
.wc-badge[data-tooltip] {
    position: relative;
    pointer-events: auto;
    /* Enable mouse events for tooltips */
    cursor: help;
}

.wc-badge[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--tooltip-bg, #333);
    color: var(--tooltip-color, #fff);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0.4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    /* High z-index to overlay everything */
}

/* Tooltip Arrow */
.wc-badge[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: 112%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: var(--tooltip-bg, #333) transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.wc-badge[data-tooltip]:hover::after,
.wc-badge[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Admin Styling for Select2 and Custom Badges */
.custom-badge-item .select2-container--default .select2-selection--multiple {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 2px;
    min-height: 38px;
}

.custom-badge-item .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #2271b1 !important;
    box-shadow: 0 0 0 1px #2271b1 !important;
}

.custom-badge-item .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #2271b1 !important;
    border: none !important;
    color: #fff !important;
    padding: 2px 8px !important;
    border-radius: 3px !important;
    font-size: 11px !important;
    margin-top: 5px !important;
}

.custom-badge-item .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff !important;
    margin-right: 5px !important;
    border: none !important;
}

.custom-badge-item .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    background: none !important;
    color: #ffdce0 !important;
}