/**
 * BB-WooAutomate Styles
 * Version: 1.0.0
 */

/* Widget Container */
.bbwa-widget {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.bbwa-header {
    margin-bottom: 15px;
}

.bbwa-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #333;
}

/* Live Inventory Table */
.bbwa-table {
    width: 100%;
    margin: 15px 0;
}

.bbwa-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1.5fr;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
}

.bbwa-row--head {
    background: #f8f8f8;
    font-weight: 600;
    border-radius: 4px;
}

.bbwa-row.is-out {
    opacity: 0.5;
    pointer-events: none;
}

.bbwa-color,
.bbwa-size,
.bbwa-stock {
    text-align: center;
}

.bbwa-qty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.bbwa-qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
}

.bbwa-qty-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.bbwa-qty-input {
    width: 60px;
    height: 32px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Button */
.bbwa-button {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.bbwa-button:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.bbwa-button:active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .bbwa-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        font-size: 13px;
    }
    
    .bbwa-row--head {
        display: none;
    }
    
    .bbwa-color::before {
        content: 'Color: ';
        font-weight: 600;
    }
    
    .bbwa-size::before {
        content: 'Size: ';
        font-weight: 600;
    }
    
    .bbwa-stock::before {
        content: 'Stock: ';
        font-weight: 600;
    }
    
    .bbwa-qty {
        grid-column: 1 / -1;
    }
}

/* =============================================
   CHECKOUT PAGE CUSTOMIZATIONS
   Only applies when BBWA checkout is active (body.bbwa-custom-checkout)
   ============================================= */

/* Coupon Code Section - WooCommerce Blocks */
body.bbwa-custom-checkout .wc-block-components-totals-coupon {
    margin: 15px 0;
}

body.bbwa-custom-checkout .wc-block-components-totals-coupon__content {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

/* Coupon Input Field - Better Size */
body.bbwa-custom-checkout .wc-block-components-totals-coupon__input-wrapper,
body.bbwa-custom-checkout .wc-block-components-totals-coupon .wc-block-components-text-input {
    flex: 1;
    min-width: 200px;
}

body.bbwa-custom-checkout .wc-block-components-totals-coupon .wc-block-components-text-input input {
    width: 100% !important;
    padding: 12px 14px !important;
    font-size: 14px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    background: #fff !important;
    height: auto !important;
    min-height: 44px !important;
    box-sizing: border-box !important;
}

body.bbwa-custom-checkout .wc-block-components-totals-coupon .wc-block-components-text-input input:focus {
    border-color: #333 !important;
    outline: none !important;
    box-shadow: 0 0 0 1px #333 !important;
}

/* Coupon Apply Button */
body.bbwa-custom-checkout .wc-block-components-totals-coupon .wc-block-components-button {
    padding: 12px 20px !important;
    min-height: 44px !important;
    font-size: 14px !important;
    white-space: nowrap;
}

/* Coupon Toggle Link */
body.bbwa-custom-checkout .wc-block-components-totals-coupon__button {
    font-size: 14px;
    padding: 8px 0;
}

/* Cart Items in Checkout - Remove Button */
body.bbwa-custom-checkout .wc-block-cart-item__remove-link,
body.bbwa-custom-checkout .wc-block-cart-item__quantity .wc-block-components-quantity-selector__button--minus,
body.bbwa-custom-checkout .wc-block-cart-items__row .wc-block-cart-item__remove-link {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Show remove/delete link */
body.bbwa-custom-checkout .wc-block-cart-item__remove-link {
    color: #dc3545 !important;
    font-size: 12px !important;
    text-decoration: underline;
    cursor: pointer;
    margin-top: 8px;
    display: block !important;
}

body.bbwa-custom-checkout .wc-block-cart-item__remove-link:hover {
    color: #c82333 !important;
}

/* Quantity Controls in Checkout */
body.bbwa-custom-checkout .wc-block-cart-item__quantity {
    display: flex !important;
    align-items: center;
    gap: 10px;
}

body.bbwa-custom-checkout .wc-block-components-quantity-selector {
    display: flex !important;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

body.bbwa-custom-checkout .wc-block-components-quantity-selector__button {
    display: flex !important;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

body.bbwa-custom-checkout .wc-block-components-quantity-selector__button:hover {
    background: #e5e5e5;
}

body.bbwa-custom-checkout .wc-block-components-quantity-selector__input {
    width: 50px !important;
    text-align: center;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    padding: 6px;
    font-size: 14px;
}

/* Order Summary in Checkout */
body.bbwa-custom-checkout .wc-block-components-order-summary-item__quantity {
    display: flex !important;
    align-items: center;
}

/* Classic Checkout Coupon Fix */
body.bbwa-custom-checkout .woocommerce-checkout #coupon_code {
    width: 100% !important;
    max-width: 300px;
    padding: 12px 14px !important;
    font-size: 14px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    margin-bottom: 10px;
}

body.bbwa-custom-checkout .woocommerce-checkout .checkout_coupon .button {
    padding: 12px 20px !important;
    font-size: 14px !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body.bbwa-custom-checkout .wc-block-components-totals-coupon__content {
        flex-direction: column;
    }
    
    body.bbwa-custom-checkout .wc-block-components-totals-coupon__input-wrapper,
    body.bbwa-custom-checkout .wc-block-components-totals-coupon .wc-block-components-text-input {
        width: 100%;
    }
    
    body.bbwa-custom-checkout .wc-block-components-totals-coupon .wc-block-components-button {
        width: 100%;
    }
}
