/* WC Product Sample - Frontend Styles */

/* Sample Wrapper (AJAX loading) */
.wcps-sample-wrapper {
    display: inline-block;
    vertical-align: middle;
    margin-left: 10px;
    min-width: 120px;
    min-height: 40px;
}

.wcps-sample-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
}

.wcps-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top-color: #666;
    border-radius: 50%;
    animation: wcps-spin 0.8s linear infinite;
}

.wcps-sample-wrapper.loaded .wcps-sample-loading {
    display: none;
}

/* Sample Button - Inline next to Add to Cart */
.wcps-sample-button {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    vertical-align: middle;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wcps-sample-button:hover {
    opacity: 0.85;
}

.wcps-sample-button .wcps-button-text {
    font-weight: 600;
}

.wcps-sample-button .wcps-button-price {
    font-size: 0.9em;
    opacity: 0.9;
}

/* Filled Style */
.wcps-sample-button.wcps-style-filled {
    border-radius: 4px;
    padding: 12px 20px;
    border-style: solid;
    border-width: 1px;
}

/* Outlined Style */
.wcps-sample-button.wcps-style-outlined {
    border-radius: 4px;
    padding: 10px 18px;
    background: transparent;
}

.wcps-sample-button.wcps-style-outlined:hover {
    opacity: 0.7;
}

/* Match Cart Button Style - copy WooCommerce button styles */
.wcps-sample-button.single_add_to_cart_button {
    /* This class inherits from theme's add to cart button */
}

/* Success Checkmark */
.wcps-sample-button .wcps-checkmark {
    display: none;
    width: 18px;
    height: 18px;
    margin-left: 6px;
}

.wcps-sample-button.success .wcps-checkmark {
    display: inline-block;
}

.wcps-checkmark svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Loading state */
.wcps-sample-button.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Loading Spinner */
.wcps-sample-button.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: wcps-spin 0.8s linear infinite;
}

/* Hide spinner when success */
.wcps-sample-button.success::after {
    display: none !important;
}

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

/* Error state - shake animation */
.wcps-sample-button.error {
    animation: wcps-shake 0.5s ease;
}

@keyframes wcps-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Sample Badge in Cart/Order */
.wcps-sample-badge {
    display: inline-block;
    padding: 2px 8px;
    margin-right: 5px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    background: #96588a;
    color: #fff;
    border-radius: 3px;
    vertical-align: middle;
}

/* Cart Table Sample Badge */
.woocommerce-cart-form .wcps-sample-badge,
.woocommerce-checkout .wcps-sample-badge {
    font-size: 10px;
    padding: 2px 6px;
}

/* Order Details Sample Badge */
.woocommerce-order .wcps-sample-badge,
.woocommerce-account .wcps-sample-badge {
    font-size: 10px;
    padding: 2px 6px;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .wcps-sample-wrapper {
        display: block;
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }
    
    .wcps-sample-button {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
        justify-content: center;
    }
}

/* RTL Support */
[dir="rtl"] .wcps-sample-badge {
    margin-right: 0;
    margin-left: 5px;
}

[dir="rtl"] .wcps-sample-button {
    margin-left: 0;
    margin-right: 10px;
}

[dir="rtl"] .wcps-sample-button.loading::after {
    margin-left: 0;
    margin-right: 8px;
}

[dir="rtl"] .wcps-sample-button .wcps-checkmark {
    margin-left: 0;
    margin-right: 6px;
}
