/**
 * Binance Pay Frontend Styles
 */

/* Flex-break element for forcing line breaks in flex containers */
/* This element is dynamically inserted by flex-break.js */
.binance-flex-break {
    width: 100% !important;
    height: 0 !important;
    flex-basis: 100% !important;
    order: 998 !important;  /* Just before the button wrapper */
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    display: block !important;
    overflow: hidden !important;
    visibility: hidden !important;
}

/* Binance Pay Button Wrapper - Ensures button is on its own line */
.binance-pay-btn-wrapper {
    display: block !important;
    width: 100% !important;
    clear: both;
    margin: 15px 0;
    flex-basis: 100% !important;  /* Force full width in flex containers */
    max-width: 100% !important;
    min-width: 100% !important;
}

/* Force line break in flex containers using pseudo-element trick */
.binance-pay-btn-wrapper::before {
    content: "" !important;
    display: block !important;
    width: 100% !important;
    height: 0 !important;
    order: 1 !important;
}

/* Force wrapper to break to new line in flex containers */
form.cart .binance-pay-btn-wrapper,
.single-product form.cart .binance-pay-btn-wrapper,
.product form.cart .binance-pay-btn-wrapper,
div.product form.cart .binance-pay-btn-wrapper {
    display: block !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    order: 999 !important;  /* Push to end after other buttons */
    float: none !important;
    clear: both !important;
}

/* Override any inline-block or inline-flex from parent */
.woocommerce form.cart .binance-pay-btn-wrapper,
.woocommerce-page form.cart .binance-pay-btn-wrapper {
    display: block !important;
}

/* Force parent container to wrap */
form.cart:has(.binance-pay-btn-wrapper),
.single-product form.cart:has(.binance-pay-btn-wrapper) {
    flex-wrap: wrap !important;
}

/* Binance Pay Button - Base Styles */
.binance-pay-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px 24px;
    margin-top: 12px;
    background: linear-gradient(135deg, #f0b90b 0%, #d4a30a 100%);
    color: #1e2026;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(240, 185, 11, 0.3);
    clear: both;
    box-sizing: border-box !important;
}

.binance-pay-btn:hover {
    background: linear-gradient(135deg, #d4a30a 0%, #b88f08 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(240, 185, 11, 0.4);
    color: #1e2026;
    text-decoration: none;
}

.binance-pay-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(240, 185, 11, 0.3);
}

.binance-pay-btn svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.binance-pay-btn span {
    line-height: 1;
}

/* Cart page button */
.binance-pay-btn-cart {
    margin: 15px 0;
    max-width: 100%;
}

/* Dark theme variant */
.binance-pay-btn.binance-pay-btn-dark {
    background: #1e2026;
    color: #f0b90b;
}

.binance-pay-btn.binance-pay-btn-dark:hover {
    background: #2b2f36;
    color: #f0b90b;
}

/* Responsive */
@media (max-width: 768px) {
    .binance-pay-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* WooCommerce form integration */
form.cart .binance-pay-btn {
    margin-top: 15px;
}

/* Checkout page payment method label */
.payment_method_binance_pay label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.payment_method_binance_pay label img {
    max-height: 24px;
    width: auto;
}

/* Disabled state */
.binance-pay-btn:disabled,
.binance-pay-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.binance-pay-btn:disabled:hover,
.binance-pay-btn[disabled]:hover {
    transform: none;
    box-shadow: none;
    background: linear-gradient(135deg, #f0b90b 0%, #d4a30a 100%);
}

/* Loading state */
.binance-pay-btn.loading {
    position: relative;
    pointer-events: none;
}

.binance-pay-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    right: 20px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: #1e2026;
    border-radius: 50%;
    animation: binance-spin 0.8s linear infinite;
}

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