/**
 * 4Square Points Badge Styles
 * 
 * Optimized for performance with minimal specificity and GPU-accelerated transitions.
 */

/* Base badge styles */
.fsq-points-badge {
    display: inline-block;
    padding: 4px 12px;
    margin: 8px 0;
    background-color: #28a745;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
    position: relative;
    z-index: 1;
}

/* Hover effect for interactive feel */
.fsq-points-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Shop loop context */
.fsq-points-badge--loop {
    font-size: 13px;
    padding: 3px 10px;
    margin: 6px 0 0 0;
}

/* Single product context */
.fsq-points-badge--single {
    font-size: 16px;
    padding: 6px 16px;
    margin: 12px 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Add icon before badge text on single product */
.fsq-points-badge--single::before {
    content: "★";
    font-size: 18px;
    opacity: 0.9;
}

/* Variation context */
.fsq-points-badge--variation {
    font-size: 14px;
    margin: 8px 0 4px 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .fsq-points-badge {
        font-size: 13px;
        padding: 3px 10px;
    }
    
    .fsq-points-badge--single {
        font-size: 15px;
        padding: 5px 14px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .fsq-points-badge {
        border: 2px solid currentColor;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .fsq-points-badge {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    }
}

/* Animation for badge appearance */
@keyframes fsq-badge-appear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fsq-points-badge {
    animation: fsq-badge-appear 0.3s ease-out;
}

/* Product grid specific adjustments */
.products .product .fsq-points-badge {
    width: auto;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ensure badge doesn't interfere with add to cart button */
.products .product .add_to_cart_button {
    clear: both;
    margin-top: 8px;
}

/* Variable product price display adjustment */
.single-product .variations_form .fsq-points-badge {
    display: block;
    margin-top: 10px;
}

/* Loading state for dynamic badge updates */
.fsq-points-badge.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Accessibility improvements */
.fsq-points-badge:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .fsq-points-badge {
        background-color: transparent !important;
        color: #000000 !important;
        border: 1px solid #000000;
    }
}
