/*!
Conditional Free Product for WooCommerce
Frontend styles for changing free product
*/

#cfp-change-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cfp-change-content {
    background: white;
    padding: 20px;
    max-width: 600px;
    width: min(600px, calc(100vw - 32px));
    border-radius: 8px;
    max-height: 80%;
    overflow-y: auto;
}
#cfp-variation-select-wrap,
.cfp-variation-picker,
.cfp-variation-attributes-wrapper,
.cfp-variation-attributes {
    width: 100%;
}
.cfp-variation-attributes {
    display: grid;
    gap: 12px;
}
.cfp-variation-attribute {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 12px;
    align-items: center;
}
.cfp-variation-attribute label {
    display: block;
}
.cfp-variation-attribute select {
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
}
@media (max-width: 480px) {
    .cfp-variation-attribute {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}
#replacement-products {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    text-align: center;
}
#replacement-products-container{
    text-align: center;
    display: block;
}
.price-crossed-out-item span.cfp-product-item.price-crossed-out-item.optional,
.price-crossed-out-container .cfp-product-item.price-crossed-out-item.optional {
    display: none;
}
#replacement-products .price-crossed-out-item .price-crossed-out-value,
.price-crossed-out-container .price-crossed-out-value {
    text-decoration: line-through 2px #FF000050;
}
.cfp-change-content h3 {
    margin: 10px 0;
}

.cfp-modal-loading-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 88px;
    padding: 18px 20px;
    margin: 0 auto;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(138, 31, 17, 0.06), rgba(138, 31, 17, 0.03));
    color: #3b2018;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.cfp-modal-loading-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(138, 31, 17, 0.18);
    border-top-color: #8a1f11;
    animation: cfp-spin 0.7s linear infinite;
    flex: 0 0 auto;
}

.cfp-cart-item .wc-block-components-product-details,
[class*="cfp-cart-"] .wc-block-components-product-details {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.cfp-cart-item .wc-block-components-product-details:hover,
[class*="cfp-cart-"] .wc-block-components-product-details:hover {
    background: rgba(0, 0, 0, 0.04);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.cfp-cart-item .wc-block-components-product-details:focus-visible,
[class*="cfp-cart-"] .wc-block-components-product-details:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}

.cfp-cart-item .wc-block-components-product-details::after,
[class*="cfp-cart-"] .wc-block-components-product-details::after {
    content: "Choose an option";
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #8a1f11;
}

.woocommerce-cart-form tr[class*="cfp-cart-"] .product-name {
    cursor: pointer;
}

.woocommerce-cart-form tr[class*="cfp-cart-"] .product-name:hover {
    background: rgba(0, 0, 0, 0.04);
}

.cfp-cart-row-pending {
    filter: saturate(0.92);
}

.cfp-cart-row-pending .wc-block-components-product-details,
.cfp-cart-row-pending .product-name {
    position: relative;
    z-index: 1;
}

.cfp-cart-row-pending--classic {
    opacity: 0.84;
    box-shadow: inset 0 0 0 1px rgba(138, 31, 17, 0.10);
}

.cfp-cart-row-pending--block {
    opacity: 0.72;
    box-shadow: inset 0 0 0 1px rgba(138, 31, 17, 0.14);
    animation: cfp-row-pulse 1.2s ease-in-out infinite;
}

.woocommerce-cart-form tr[class*="cfp-cart-"] .product-name::after {
    content: "Choose an option";
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #8a1f11;
}

.woocommerce-cart-form tr[class*="cfp-cart-"] .variation {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    font-size: 0.875em;
    line-height: 1.45;
    color: rgba(0, 0, 0, 0.68);
}

.woocommerce-cart-form tr[class*="cfp-cart-"] .variation dt {
    font-weight: 600;
}

.woocommerce-cart-form tr[class*="cfp-cart-"] .variation dd {
    margin: 0;
}

.cfp-variation-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.cfp-variation-loading {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(138, 31, 17, 0.22);
    border-top-color: #8a1f11;
    animation: cfp-spin 0.8s linear infinite;
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: #8a1f11;
}

@keyframes cfp-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes cfp-row-pulse {
    0% {
        box-shadow: inset 0 0 0 1px rgba(138, 31, 17, 0.10), 0 0 0 0 rgba(138, 31, 17, 0.06);
    }
    50% {
        box-shadow: inset 0 0 0 1px rgba(138, 31, 17, 0.22), 0 0 0 8px rgba(138, 31, 17, 0.04);
    }
    100% {
        box-shadow: inset 0 0 0 1px rgba(138, 31, 17, 0.10), 0 0 0 0 rgba(138, 31, 17, 0.06);
    }
}
