/**
 * B2B Quantity Step Styles
 *
 * Supports both standard WooCommerce and Elementor Add to Cart widgets.
 *
 * @package TuttoCapsule_Sync
 */

/* Quantity wrapper - WooCommerce */
.b2b-quantity-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.b2b-quantity-wrapper input.qty {
    text-align: center;
    width: 70px;
    -moz-appearance: textfield;
}

.b2b-quantity-wrapper input.qty::-webkit-outer-spin-button,
.b2b-quantity-wrapper input.qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Elementor Add to Cart wrapper support */
.elementor-add-to-cart .quantity,
.e-atc-qty-button-holder {
    position: relative;
}

.elementor-add-to-cart .b2b-qty-error-msg,
.e-atc-qty-button-holder .b2b-qty-error-msg {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -30px;
    text-align: center;
    white-space: nowrap;
}

/* Quick buttons */
.b2b-qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.b2b-qty-btn:hover {
    background-color: #e0e0e0;
    border-color: #ccc;
}

.b2b-qty-btn:active {
    background-color: #d0d0d0;
    transform: scale(0.95);
}

.b2b-qty-btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.b2b-qty-minus {
    border-radius: 4px 0 0 4px;
}

.b2b-qty-plus {
    border-radius: 0 4px 4px 0;
}

/* Error state */
.b2b-qty-error,
input.qty.b2b-qty-error,
.e-atc-qty-button-holder input.b2b-qty-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25) !important;
}

.b2b-qty-error-msg {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 8px 12px;
    background-color: #fff5f5;
    border: 1px solid #dc3545;
    border-radius: 4px;
    color: #dc3545;
    font-size: 13px;
    line-height: 1.4;
}

/* Step notice */
.b2b-quantity-step-notice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 15px;
    padding: 10px 15px;
    background-color: #f0f6fc;
    border: 1px solid #c8e1ff;
    border-radius: 6px;
    color: #0969da;
    font-size: 14px;
}

.b2b-quantity-step-notice .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Elementor specific notice positioning */
.elementor-widget-woocommerce-product-add-to-cart .b2b-quantity-step-notice,
.elementor-add-to-cart .b2b-quantity-step-notice {
    display: flex;
    width: 100%;
    margin-bottom: 15px;
    box-sizing: border-box;
}

/* Cart page adjustments */
.woocommerce-cart-form .b2b-quantity-wrapper {
    justify-content: center;
}

.woocommerce-cart-form .b2b-qty-error-msg {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 12px;
}

.woocommerce-cart-form .quantity {
    position: relative;
}

/* Mini cart adjustments */
.widget_shopping_cart .b2b-quantity-wrapper {
    flex-wrap: wrap;
}

.widget_shopping_cart .b2b-qty-btn {
    min-width: 30px;
    height: 30px;
    font-size: 12px;
}

/* Elementor Cart widget */
.elementor-menu-cart .b2b-qty-error-msg {
    font-size: 11px;
    padding: 5px 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .b2b-quantity-wrapper {
        flex-wrap: wrap;
        justify-content: center;
    }

    .b2b-qty-btn {
        min-width: 45px;
        height: 45px;
        font-size: 16px;
    }

    .b2b-quantity-wrapper input.qty {
        width: 60px;
        height: 45px;
    }

    .b2b-quantity-step-notice {
        font-size: 13px;
        padding: 8px 12px;
    }

    .woocommerce-cart-form .b2b-qty-error-msg,
    .elementor-add-to-cart .b2b-qty-error-msg,
    .e-atc-qty-button-holder .b2b-qty-error-msg {
        position: static;
        transform: none;
        margin-top: 8px;
        white-space: normal;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .b2b-qty-btn {
        background-color: #2d2d2d;
        border-color: #444;
        color: #e0e0e0;
    }

    .b2b-qty-btn:hover {
        background-color: #3d3d3d;
        border-color: #555;
    }

    .b2b-quantity-step-notice {
        background-color: #1a2744;
        border-color: #3d5a80;
        color: #58a6ff;
    }

    .b2b-qty-error-msg {
        background-color: #2d1a1a;
        color: #f85149;
    }
}
