/**
 * TTD Invoice Checkout Button Styles
 * Mimics PayPal button styling for consistent UX
 * Supports both classic shortcodes and Gutenberg blocks
 */

/* Button wrapper */
.ttd-invoice-button-wrapper {
    margin: 10px 0;
    width: 100%;
    display: block;
}

/* Product page: place above add to cart or PayPal */
.ttd-invoice-product-page {
    margin-top: 15px;
    order: -1;
}

/* Cart page: margin adjustments */
.ttd-invoice-cart-page {
    margin-bottom: 10px;
}

/* Gutenberg blocks specific */
.ttd-invoice-gutenberg {
    margin-bottom: 15px;
    width: 100%;
}

/* Main button styling - PayPal-like appearance */
.ttd-invoice-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 150px;
    max-width: 100%;
    height: 45px;
    padding: 0 24px;
    margin: 0 auto;
    
    /* PayPal-like colors - golden yellow */
    background: linear-gradient(to bottom, #FFC439 0%, #FFBC11 100%);
    border: 1px solid #D9A400;
    border-radius: 5px;
    
    /* Typography */
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #003087;
    letter-spacing: 0.3px;
    text-decoration: none;
    text-align: center;
    line-height: 1;
    
    /* Interaction */
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    
    /* Reset button defaults */
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    box-sizing: border-box;
}

/* Hover state */
.ttd-invoice-button:hover {
    background: linear-gradient(to bottom, #FFD366 0%, #FFC439 100%);
    border-color: #C69500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    color: #003087;
}

/* Active/pressed state */
.ttd-invoice-button:active {
    background: linear-gradient(to bottom, #FFBC11 0%, #E6A800 100%);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
    transform: translateY(1px);
}

/* Focus state for accessibility */
.ttd-invoice-button:focus {
    outline: 2px solid #003087;
    outline-offset: 2px;
}

/* Disabled state */
.ttd-invoice-button:disabled,
.ttd-invoice-button.ttd-loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

/* Loading spinner */
.ttd-invoice-button.ttd-loading .ttd-invoice-button-text::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid #003087;
    border-top-color: transparent;
    border-radius: 50%;
    animation: ttd-spin 0.8s linear infinite;
    vertical-align: middle;
}

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

/* Button text */
.ttd-invoice-button-text {
    display: inline-flex;
    align-items: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ttd-invoice-button {
        height: 48px;
        font-size: 14px;
        max-width: 100%;
    }
}

/* WooCommerce specific overrides */
.woocommerce .ttd-invoice-button,
.woocommerce-page .ttd-invoice-button {
    box-sizing: border-box;
}

/* Cart page specific (classic) */
.woocommerce-cart .ttd-invoice-button-wrapper {
    text-align: center;
}

.woocommerce-cart .wc-proceed-to-checkout .ttd-invoice-button-wrapper {
    order: -1;
}

/* Single product page alignment */
.woocommerce div.product form.cart .ttd-invoice-button-wrapper {
    clear: both;
    margin-top: 15px;
    display: inline-block;
}

/* ===== GUTENBERG BLOCK SUPPORT ===== */

/* Cart Block */
.wc-block-cart .ttd-invoice-button-wrapper {
    margin-bottom: 16px;
}

.wc-block-cart__submit-container .ttd-invoice-button-wrapper:first-child {
    margin-top: 0;
}

/* Express payment area in Gutenberg */
.wc-block-components-express-payment .ttd-invoice-button-wrapper {
    margin-bottom: 12px;
}

/* Totals container */
.wc-block-cart__totals-container .ttd-invoice-button-wrapper {
    margin-bottom: 16px;
}

/* Checkout Block - if needed */
.wc-block-checkout .ttd-invoice-button-wrapper {
    margin: 16px 0;
}

/* Override any conflicting block styles */
.wp-block-woocommerce-cart .ttd-invoice-button,
.wp-block-woocommerce-checkout .ttd-invoice-button {
    width: 100%;
    max-width: 100%;
}

/* High specificity to override theme/block styles */
body .ttd-invoice-button-wrapper .ttd-invoice-button {
    background: linear-gradient(to bottom, #FFC439 0%, #FFBC11 100%) !important;
    color: #003087 !important;
    border: 1px solid #D9A400 !important;
}

body .ttd-invoice-button-wrapper .ttd-invoice-button:hover {
    background: linear-gradient(to bottom, #FFD366 0%, #FFC439 100%) !important;
}
