/**
 * YITH Affiliate Promote Button Styles
 * Matches theme button styles for consistency
 */

/* Promote Button Base Styles - Matches exact WooCommerce .button class design */
.affiliate-promote-btn,
.promote-button {
    display: inline-block;
    background: linear-gradient(135deg, #0DCFF2 0%, #2172DD 100%) !important;
    color: white !important;
    border: none;
    border-radius: 5px;
    padding: 15px 25px !important;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: 0.3s;
    width: auto;
    margin: 0;
    vertical-align: middle;
}

/* Ensure icon and text are inline and aligned */
.affiliate-promote-btn .promote-icon,
.promote-button .promote-icon,
.affiliate-promote-btn .promote-text,
.promote-button .promote-text {
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

.affiliate-promote-btn .promote-icon,
.promote-button .promote-icon {
    margin-right: 0.25rem;
}

.affiliate-promote-btn:hover,
.promote-button:hover {
    background: linear-gradient(135deg, #0BB8E6 0%, #1A5BC7 100%) !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 207, 242, 0.4);
    text-decoration: none;
}

.affiliate-promote-btn:active,
.promote-button:active {
    transform: translateY(0);
}

.affiliate-promote-btn:disabled,
.promote-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Promote Icon */
.promote-icon {
    font-size: 1rem;
    line-height: 1;
    display: inline-block;
}

/* Promote Text */
.promote-text {
    display: inline-block;
}

/* Success State */
.affiliate-promote-btn.promote-success,
.promote-button.promote-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: white !important;
}

.affiliate-promote-btn.promote-success .promote-icon,
.promote-button.promote-success .promote-icon {
    animation: checkmark 0.3s ease;
}

/* Error State */
.affiliate-promote-btn.promote-error,
.promote-button.promote-error {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

/* When product-actions uses flex layout (horizontal buttons) - match existing button flex behavior */
.product-actions .affiliate-promote-btn,
.product-actions .promote-button {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: auto;
}

/* Exception: When product-actions doesn't use flex (simple block layout) */
.product-actions:not([style*="display: flex"]) .affiliate-promote-btn,
.product-actions:not([style*="display: flex"]) .promote-button {
    width: 100%;
    display: block;
    margin-top: 0.5rem;
    flex: none;
}

/* Match gradient button style when in sections with gradient buttons (top-rated-section, bestsellers-section) */
.top-rated-section .product-actions .affiliate-promote-btn,
.top-rated-section .product-actions .promote-button,
.bestsellers-section .product-actions .affiliate-promote-btn,
.bestsellers-section .product-actions .promote-button {
    flex: 1;
    padding: 15px 25px !important;
    border-radius: 5px;
    font-weight: 600;
    font-size: 1rem;
    background: linear-gradient(135deg, #0DCFF2 0%, #2172DD 100%) !important;
    color: white !important;
    border: none;
    width: auto;
    margin-top: 0;
}

.top-rated-section .product-actions .affiliate-promote-btn:hover,
.top-rated-section .product-actions .promote-button:hover,
.bestsellers-section .product-actions .affiliate-promote-btn:hover,
.bestsellers-section .product-actions .promote-button:hover {
    background: linear-gradient(135deg, #0BB8E6 0%, #1A5BC7 100%) !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 207, 242, 0.4);
}

/* Search Product Actions - Match existing inline button layout */
.search-product-actions .affiliate-promote-btn,
.search-product-actions .promote-button {
    width: auto;
    flex: 0 0 auto;
    margin-top: 0;
    padding: 15px 25px !important;
    font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .affiliate-promote-btn,
    .promote-button {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
        gap: 0.375rem;
    }
    
    .promote-icon {
        font-size: 0.875rem;
    }
    
    .product-actions,
    .search-product-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .affiliate-promote-btn,
    .promote-button {
        width: 100%;
    }
}

/* Animation for success state */
@keyframes checkmark {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Ensure button doesn't break layout */
.affiliate-promote-btn,
.promote-button {
    box-sizing: border-box;
    vertical-align: middle;
}

/* Override any conflicting styles from .button class */
.affiliate-promote-btn.button,
.promote-button.button {
    margin: 0;
    display: inline-block;
    vertical-align: middle;
}

/* Override WooCommerce default button styles for proper alignment */
.woocommerce ul.products li.product .button.add_to_cart_button,
.woocommerce ul.products li.product .button.affiliate-promote-btn,
.woocommerce ul.products li.product .button.promote-button {
    display: inline-block !important;
    vertical-align: top !important;
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
    width: auto !important;
    line-height: 1.5 !important;
}

/* Ensure Promote button aligns with Add to Cart button */
.woocommerce ul.products li.product .button.add_to_cart_button + .button.affiliate-promote-btn,
.woocommerce ul.products li.product .button.add_to_cart_button + .button.promote-button {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

/* When buttons are direct children of .product (WooCommerce loop) - align them properly */
li.product > .button.add_to_cart_button,
li.product > .button.affiliate-promote-btn,
li.product > .button.promote-button {
    display: inline-block !important;
    vertical-align: top !important;
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
    width: auto !important;
    line-height: 1.5 !important;
}

/* Ensure Promote button aligns with Add to Cart button */
li.product > .button.add_to_cart_button + .button.affiliate-promote-btn,
li.product > .button.add_to_cart_button + .button.promote-button {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

/* Single Product Page - Promote Button Styling */
.single-product .promote-button-wrapper,
.single-product .affiliate-promote-btn,
.single-product .promote-button {
    margin-top: 1rem;
    display: inline-block;
}

.single-product .quantity-cart-wrapper + .promote-button-wrapper,
.single-product form.cart .affiliate-promote-btn,
.single-product form.cart .promote-button {
    margin-top: 1rem;
    margin-left: 0;
}

/* Related Products Section - Promote Button Styling */
.related-product-actions .affiliate-promote-btn,
.related-product-actions .promote-button {
    margin-top: 0.5rem;
    width: 100%;
    display: block;
    text-align: center;
}

.more-product-actions .affiliate-promote-btn,
.more-product-actions .promote-button {
    margin-top: 0.5rem;
    width: 100%;
    display: block;
    text-align: center;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

