/* ============================================
   Baha Checkout Form - Dynamic Design
   ============================================ */

/* ============================================
   0. إخفاء عناصر WooCommerce عند وجود فورم Baha المخصص
   الفورم المخصص مستقل تماماً — لا يحتاج لفورم WooCommerce
   ============================================ */
body:has(.baha-onepage-checkout) .woocommerce-checkout .col2-set,
body:has(.baha-onepage-checkout) .woocommerce-checkout #order_review,
body:has(.baha-onepage-checkout) .woocommerce-checkout #order_review_heading,
body:has(.baha-onepage-checkout) #place_order,
body:has(.baha-onepage-checkout) #baha-inline-order-btn,
body:has(.baha-onepage-checkout) #baha-dynamic-pricing,
body:has(.baha-onepage-checkout) .woocommerce-billing-fields,
body:has(.baha-onepage-checkout) .woocommerce-checkout-review-order,
body:has(.baha-onepage-checkout) .woocommerce-checkout-payment,
body:has(.baha-onepage-checkout) .woocommerce-form-coupon-toggle,
body:has(.baha-onepage-checkout) .woocommerce-NoticeGroup,
body:has(.baha-onepage-checkout) .woocommerce-error,
body:has(.baha-onepage-checkout) .woocommerce-info {
    display: none !important;
}

/* 1. إخفاء العناصر غير المطلوبة */
#billing_country_field,
.woocommerce-checkout h3:not(#order_review_heading),
.woocommerce-form-coupon-toggle,
.woocommerce-info,
#ship-to-different-address,
.woocommerce-additional-fields,
.woocommerce-shipping-fields,
.woocommerce-checkout .woocommerce-shipping-totals,
.payment_methods,
#payment .place-order>p,
.wc_payment_methods,
.woocommerce-privacy-policy-text,
.woocommerce-terms-and-conditions-wrapper,
.woocommerce-checkout-review-order-table .cart-subtotal,
.woocommerce-checkout-review-order-table .order-total,
.woocommerce-checkout-review-order-table tfoot {
    display: none !important;
}

/* 2. الحاوية الرئيسية */
.woocommerce-checkout {
    direction: rtl;
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
}

/* Desktop: تكبير العناصر */
@media (min-width: 992px) {
    .woocommerce-checkout {
        padding: 40px;
    }

    .woocommerce-checkout .col2-set,
    .woocommerce-checkout #order_review {
        padding: 35px 40px;
    }
}

.woocommerce-checkout .col2-set,
.woocommerce-checkout #order_review {
    background: var(--baha-form-bg, #FFFFFF);
    padding: 25px 30px;
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    border: 1px solid var(--baha-form-border, #E5E7EB);
    width: 100%;
    box-sizing: border-box;
}

.woocommerce-checkout .col2-set .col-1,
.woocommerce-checkout .col2-set .col-2 {
    width: 100% !important;
    float: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* 3. عنوان الفورم */
.baha-form-header {
    text-align: center;
    margin-bottom: 25px;
}

.baha-form-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--baha-text-primary, #1F2937);
    margin: 0;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--baha-primary, #8B5CF6);
    display: inline-block;
}

/* 4. نظام الشبكة (Grid) */
.woocommerce-billing-fields__field-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
}

.woocommerce-billing-fields__field-wrapper .form-row {
    width: 100% !important;
}

.baha-col-1 {
    grid-column: 2;
}

.baha-col-2 {
    grid-column: 1;
}

.baha-col-full {
    grid-column: 1 / span 2;
}

/* 5. تصميم الحقول */
.woocommerce-checkout .form-row {
    margin-bottom: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

.woocommerce-checkout .form-row label {
    display: none !important;
}

.woocommerce-checkout input.input-text,
.woocommerce-checkout select,
.woocommerce-checkout textarea {
    width: 100% !important;
    height: 52px !important;
    padding: 14px 18px !important;
    border: 2px solid var(--baha-form-border, #E5E7EB) !important;
    border-radius: 12px !important;
    background: var(--baha-form-bg, #FFFFFF) !important;
    font-size: 15px !important;
    color: var(--baha-text-primary, #1F2937) !important;
    transition: all 0.3s ease !important;
    text-align: right !important;
    box-sizing: border-box !important;
}

.woocommerce-checkout input.input-text::placeholder {
    color: var(--baha-text-secondary, #9CA3AF) !important;
}

.woocommerce-checkout input.input-text:focus,
.woocommerce-checkout select:focus {
    border-color: var(--baha-primary, #8B5CF6) !important;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--baha-primary, #8B5CF6) 15%, transparent) !important;
    outline: none !important;
}

/* 5. محدد طريقة التوصيل */
.baha-shipping-selector {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed var(--baha-form-border, #E5E7EB);
}

.baha-shipping-label {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--baha-text-primary, #1F2937);
    margin-bottom: 15px;
}

.baha-shipping-options {
    display: flex;
    gap: 10px;
}

.baha-shipping-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 2px solid var(--baha-form-border, #E5E7EB);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    background: var(--baha-form-bg, #FFFFFF);
}

.baha-shipping-option:hover {
    border-color: var(--baha-primary, #8B5CF6);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--baha-primary, #8B5CF6) 12%, transparent);
}

.baha-shipping-option input[type="radio"] {
    display: none;
}

.baha-shipping-option input[type="radio"]:checked+.baha-option-icon+.baha-option-content+.baha-option-check {
    display: flex;
}

.baha-shipping-option:has(input:checked) {
    border-color: var(--baha-primary, #8B5CF6);
    background: color-mix(in srgb, var(--baha-primary, #8B5CF6) 6%, var(--baha-form-bg, #FFFFFF));
}

.baha-option-icon {
    font-size: 20px;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border-radius: 0;
    flex-shrink: 0;
}

.baha-option-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.baha-option-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--baha-text-primary, #1F2937);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Delivery company logo on desk shipping button */
.baha-shipping-option[data-type="desk"] {
    position: relative;
}

.baha-company-logo {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 50%;
    object-fit: contain;
    border-top-left-radius: 8px;
    z-index: 1;
    pointer-events: none;
}

/* Delivery company logo on desk shipping button */
.baha-shipping-option[data-type="desk"] {
    position: relative;
}

.baha-company-logo {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 25%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 4px;
    z-index: 1;
    pointer-events: none;
}

/* Inline checkout image variations — rectangle style */
.baha-inline-checkout-wrap .baha-custom-image-btn {
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #E5E7EB;
    transition: all 0.2s ease;
    padding: 0;
    background: #fff;
}

.baha-inline-checkout-wrap .baha-custom-image-btn img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.baha-inline-checkout-wrap .baha-custom-image-btn.selected {
    border-color: var(--baha-primary, #8B5CF6);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.baha-inline-checkout-wrap .baha-image-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.baha-option-price {
    font-size: 12px;
    font-weight: 700;
    color: var(--baha-primary, #8B5CF6);
    white-space: nowrap;
}

.baha-option-check {
    display: none;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    background: var(--baha-success, #10B981);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    flex-shrink: 0;
}

/* 6. ملخص الطلب */
#order_review_heading {
    display: block !important;
    text-align: center !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    color: var(--baha-text-primary, #1F2937) !important;
    margin: 0 0 25px 0 !important;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--baha-form-border, #E5E7EB);
    position: relative;
}

#order_review_heading::after {
    content: '🛒';
    position: absolute;
    left: 50%;
    bottom: -15px;
    transform: translateX(-50%);
    background: var(--baha-form-bg, #FFFFFF);
    padding: 0 15px;
    font-size: 24px;
}

.woocommerce-checkout-review-order-table {
    width: 100% !important;
    border: none !important;
    border-collapse: collapse !important;
}

.woocommerce-checkout-review-order-table thead {
    display: none !important;
}

.woocommerce-checkout-review-order-table tbody,
.woocommerce-checkout-review-order-table tfoot {
    display: block !important;
}

.woocommerce-checkout-review-order-table tr {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 15px 0 !important;
    border-bottom: 1px solid var(--baha-form-border, #E5E7EB) !important;
}

.woocommerce-checkout-review-order-table tr:last-child {
    border-bottom: none !important;
}

.woocommerce-checkout-review-order-table td,
.woocommerce-checkout-review-order-table th {
    padding: 0 !important;
    border: none !important;
    text-align: right !important;
    font-size: 15px !important;
}

.woocommerce-checkout-review-order-table .product-name {
    flex: 1;
    text-align: right !important;
    color: var(--baha-text-secondary, #6B7280) !important;
}

.woocommerce-checkout-review-order-table .product-name .product-quantity {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--baha-primary, #8B5CF6) 0%, var(--baha-secondary, #06B6D4) 100%);
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    margin-right: 10px;
}

.woocommerce-checkout-review-order-table .product-total {
    font-weight: 700 !important;
    color: var(--baha-primary, #8B5CF6) !important;
    font-size: 16px !important;
}

/* صف المجموع */
.woocommerce-checkout-review-order-table .order-total {
    border-top: 3px solid var(--baha-primary, #8B5CF6) !important;
    border-bottom: none !important;
    margin-top: 15px !important;
    padding-top: 20px !important;
    background: linear-gradient(135deg, color-mix(in srgb, var(--baha-primary, #8B5CF6) 5%, transparent) 0%, color-mix(in srgb, var(--baha-secondary, #06B6D4) 5%, transparent) 100%);
    margin: 15px -30px 0 -30px !important;
    padding: 20px 30px !important;
    border-radius: 0 0 16px 16px;
}

.woocommerce-checkout-review-order-table .order-total th {
    font-size: 18px !important;
    font-weight: 800 !important;
    color: var(--baha-text-primary, #1F2937) !important;
}

.woocommerce-checkout-review-order-table .order-total td {
    font-size: 24px !important;
    font-weight: 800 !important;
    color: var(--baha-primary, #8B5CF6) !important;
}

/* 7. زر الشراء */
#place_order {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 64px !important;
    height: auto !important;
    padding: 18px 32px !important;
    background: linear-gradient(135deg, var(--baha-button-bg, var(--baha-primary, #8B5CF6)) 0%, var(--baha-secondary, #06B6D4) 100%) !important;
    color: var(--baha-button-text, #FFFFFF) !important;
    border: none !important;
    border-radius: 16px !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    margin-top: 25px !important;
    font-family: inherit !important;
    box-shadow: 0 10px 40px color-mix(in srgb, var(--baha-primary, #8B5CF6) 35%, transparent) !important;
    position: relative;
    overflow: hidden;
    box-sizing: border-box !important;
    line-height: 1.3 !important;
    text-align: center !important;
    white-space: normal !important;
}

#place_order:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 15px 50px color-mix(in srgb, var(--baha-primary, #8B5CF6) 45%, transparent) !important;
}

#place_order:active {
    transform: translateY(-1px) !important;
}

/* 8. الزر العائم الثابت في أسفل الشاشة */
#place_order.baha-sticky-active {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    z-index: 999999 !important;
    border-radius: 20px 20px 0 0 !important;
    height: 60px !important;
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.2) !important;
    animation: none !important;
    margin: 0 !important;
    transition: transform 0.3s ease, opacity 0.3s ease !important;
}

#place_order.baha-sticky-active:hover {
    transform: none !important;
    box-shadow: 0 -5px 40px color-mix(in srgb, var(--baha-primary, #8B5CF6) 40%, transparent) !important;
}

#place_order.baha-sticky-active.baha-sticky-hidden {
    transform: translateY(100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

body.has-baha-sticky-btn {
    padding-bottom: 70px !important;
}

body.has-baha-sticky-btn .woocommerce-checkout {
    padding-bottom: 80px !important;
}

/* 8.0 حقل الكمية */
.baha-quantity-selector {
    margin-bottom: 20px;
}

.baha-quantity-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--baha-text-primary, #1F2937);
    margin-bottom: 12px;
    text-align: center;
}

.baha-quantity-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: var(--baha-form-bg, #FFFFFF);
    border: 2px solid var(--baha-form-border, #E5E7EB);
    border-radius: 14px;
    overflow: hidden;
    max-width: 200px;
    margin: 0 auto;
}

.baha-qty-btn {
    width: 50px;
    height: 50px;
    border: none;
    background: transparent;
    color: var(--baha-primary, #8B5CF6);
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.baha-qty-btn:hover {
    background: var(--baha-primary, #8B5CF6);
    color: white;
}

.baha-qty-btn:active {
    transform: scale(0.95);
}

.baha-qty-input {
    width: 60px;
    height: 50px;
    border: none;
    border-right: 1px solid var(--baha-form-border, #E5E7EB);
    border-left: 1px solid var(--baha-form-border, #E5E7EB);
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--baha-text-primary, #1F2937);
    background: transparent;
    -moz-appearance: textfield;
}

.baha-qty-input::-webkit-outer-spin-button,
.baha-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.baha-product-name {
    text-align: center;
    margin-top: 12px;
    font-size: 14px;
    color: var(--baha-text-secondary, #6B7280);
}

.baha-product-name .baha-unit-price {
    color: var(--baha-primary, #8B5CF6);
    font-weight: 600;
}

/* 8.1 الزر العادي (تحت طرق التوصيل) */
.baha-inline-order-btn {
    width: 100%;
    height: 56px;
    background: linear-gradient(135deg, var(--baha-button-bg, var(--baha-primary, #8B5CF6)) 0%, var(--baha-secondary, #06B6D4) 100%);
    color: var(--baha-button-text, #FFFFFF);
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    font-family: inherit;
    box-shadow: 0 8px 30px color-mix(in srgb, var(--baha-primary, #8B5CF6) 35%, transparent);
}

.baha-inline-order-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px color-mix(in srgb, var(--baha-primary, #8B5CF6) 45%, transparent);
}

.baha-inline-order-btn:active {
    transform: translateY(0);
}

/* 9. Responsive */
@media (max-width: 600px) {
    .woocommerce-checkout {
        padding: 15px;
    }

    .woocommerce-checkout .col2-set,
    .woocommerce-checkout #order_review {
        padding: 20px;
        border-radius: 12px;
    }

    .woocommerce-billing-fields__field-wrapper {
        grid-template-columns: 1fr;
    }

    .baha-col-1,
    .baha-col-2,
    .baha-col-full {
        grid-column: 1;
    }

    .baha-shipping-options {
        flex-direction: row;
        gap: 6px;
    }

    .baha-shipping-option {
        padding: 8px 10px;
        gap: 6px;
    }

    .baha-shipping-option .baha-option-check {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    #place_order:not(.baha-sticky-active) {
        height: 56px !important;
        font-size: 18px !important;
        border-radius: 14px !important;
    }
}

/* 10. Select2 Customization */
.select2-container--default .select2-selection--single {
    height: 52px !important;
    border: 2px solid var(--baha-form-border, #E5E7EB) !important;
    border-radius: 12px !important;
    padding: 12px 18px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 26px !important;
    padding-right: 0 !important;
    color: var(--baha-text-primary, #1F2937) !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 48px !important;
    left: 12px !important;
    right: auto !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--baha-primary, #8B5CF6) !important;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--baha-primary, #8B5CF6) 15%, transparent) !important;
}

.select2-dropdown {
    border: 2px solid var(--baha-primary, #8B5CF6) !important;
    border-radius: 12px !important;
    margin-top: 5px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.select2-results__option--highlighted {
    background: var(--baha-primary, #8B5CF6) !important;
}

/* 11. Animations */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

.baha-shipping-option:has(input:checked) {
    /* animation removed for cleaner UX */
}

/* 12. Loading State */
.woocommerce-checkout.processing #place_order {
    pointer-events: none;
    opacity: 0.7;
}

/* 13. Validation Popup */
.baha-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 9999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.baha-popup-overlay.active {
    display: flex;
}

.baha-popup-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    animation: popupSlide 0.3s ease;
}

@keyframes popupSlide {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.baha-popup-header {
    margin-bottom: 20px;
}

.baha-popup-icon {
    font-size: 50px;
    display: block;
    margin-bottom: 10px;
}

.baha-popup-header h3 {
    margin: 0;
    font-size: 22px;
    color: #1F2937;
    font-weight: 700;
}

.baha-popup-errors {
    list-style: none;
    padding: 0;
    margin: 0 0 25px 0;
    text-align: right;
}

.baha-popup-errors li {
    background: #FEF2F2;
    color: #DC2626;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 15px;
    border-right: 4px solid #DC2626;
}

.baha-popup-errors li:last-child {
    margin-bottom: 0;
}

.baha-popup-close {
    background: linear-gradient(135deg, var(--baha-primary, #8B5CF6) 0%, var(--baha-secondary, #06B6D4) 100%);
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.baha-popup-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px color-mix(in srgb, var(--baha-primary, #8B5CF6) 40%, transparent);
}

/* 14. Field Error State */
.baha-field-error,
.baha-field-error input,
.baha-field-error select {
    border-color: #DC2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}

/* 15. إخفاء رسائل WooCommerce الكلاسيكية */
.woocommerce-error,
.woocommerce-NoticeGroup-checkout,
.woocommerce-notices-wrapper .woocommerce-error {
    display: none !important;
}

/* 16. عرض السعر الديناميكي */
.baha-pricing-breakdown {
    background: var(--baha-form-bg, #FFFFFF);
    border-radius: 16px;
    padding: 20px;
    margin-top: 20px;
    border: 2px solid var(--baha-form-border, #E5E7EB);
}

.baha-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px dashed var(--baha-form-border, #E5E7EB);
}

.baha-price-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.baha-price-label {
    font-size: 15px;
    color: var(--baha-text-secondary, #6B7280);
    font-weight: 500;
}

.baha-price-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--baha-text-primary, #1F2937);
}

/* سعر المنتج */
.baha-product-price .baha-price-label::before {
    content: '🛒 ';
}

/* مصاريف الشحن */
.baha-shipping-price .baha-price-label::before {
    content: '🚚 ';
}

.baha-shipping-price .baha-price-value {
    color: var(--baha-secondary, #06B6D4);
}

/* المجموع الكلي */
.baha-total-price {
    margin-top: 15px;
    padding-top: 15px !important;
    border-top: 3px solid var(--baha-primary, #8B5CF6) !important;
    border-bottom: none !important;
    background: linear-gradient(135deg, color-mix(in srgb, var(--baha-primary, #8B5CF6) 5%, transparent) 0%, color-mix(in srgb, var(--baha-secondary, #06B6D4) 5%, transparent) 100%);
    margin: 15px -20px 0 -20px;
    padding: 20px !important;
    border-radius: 0 0 14px 14px;
}

.baha-total-price .baha-price-label {
    font-size: 18px;
    font-weight: 700;
    color: var(--baha-text-primary, #1F2937);
}

.baha-total-price .baha-price-label::before {
    content: '💰 ';
}

.baha-total-price .baha-price-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--baha-primary, #8B5CF6);
}

/* ============================================
   Baha One-Page Checkout Form Styles
   ============================================ */

.baha-onepage-checkout {
    direction: rtl;
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.baha-onepage-checkout .baha-form-header {
    text-align: center;
    margin-bottom: 25px;
}

.baha-onepage-checkout .baha-form-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--baha-text-primary, #1F2937);
    margin: 0;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--baha-primary, #8B5CF6);
    display: inline-block;
}

/* Product Info Box */
.baha-product-info-box {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--baha-primary, #8B5CF6) 8%, transparent) 0%, color-mix(in srgb, var(--baha-secondary, #06B6D4) 8%, transparent) 100%);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 25px;
    border: 2px solid var(--baha-primary, #8B5CF6);
}

.baha-product-image {
    flex-shrink: 0;
}

.baha-product-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.baha-product-details {
    flex: 1;
}

.baha-product-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--baha-text-primary, #1F2937);
    margin: 0 0 8px 0;
}

.baha-product-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--baha-primary, #8B5CF6);
    margin: 0;
}

/* Checkout Form */
.baha-checkout-form {
    background: var(--baha-form-bg, #FFFFFF);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--baha-form-border, #E5E7EB);
}

.baha-field-group {
    margin-bottom: 20px;
}

.baha-field-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--baha-text-primary, #1F2937);
    margin-bottom: 8px;
}

.baha-field-group label .required {
    color: #EF4444;
}

.baha-field-group input[type="text"],
.baha-field-group input[type="tel"],
.baha-field-group input[type="email"],
.baha-field-group select {
    width: 100%;
    height: 52px;
    padding: 14px 18px;
    border: 2px solid var(--baha-form-border, #E5E7EB);
    border-radius: 12px;
    background: var(--baha-form-bg, #FFFFFF);
    font-size: 15px;
    color: var(--baha-text-primary, #1F2937);
    transition: all 0.3s ease;
    text-align: right;
    box-sizing: border-box;
    font-family: inherit;
}

.baha-field-group input::placeholder {
    color: var(--baha-text-secondary, #9CA3AF);
}

.baha-field-group input:focus,
.baha-field-group select:focus {
    border-color: var(--baha-primary, #8B5CF6);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--baha-primary, #8B5CF6) 15%, transparent);
    outline: none;
}

/* Quantity Field */
.baha-quantity-field {
    text-align: center;
}

.baha-quantity-field label {
    text-align: center;
    font-size: 16px;
    margin-bottom: 12px;
}

.baha-quantity-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: var(--baha-form-bg, #FFFFFF);
    border: 2px solid var(--baha-form-border, #E5E7EB);
    border-radius: 14px;
    overflow: hidden;
    max-width: 200px;
    margin: 0 auto;
}

.baha-qty-btn {
    width: 50px;
    height: 50px;
    border: none;
    background: transparent;
    color: var(--baha-primary, #8B5CF6);
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.baha-qty-btn:hover {
    background: var(--baha-primary, #8B5CF6);
    color: white;
}

.baha-qty-input {
    width: 60px !important;
    height: 50px !important;
    border: none !important;
    border-right: 1px solid var(--baha-form-border, #E5E7EB) !important;
    border-left: 1px solid var(--baha-form-border, #E5E7EB) !important;
    text-align: center !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    color: var(--baha-text-primary, #1F2937) !important;
    background: transparent !important;
    padding: 0 !important;
    -moz-appearance: textfield;
}

.baha-qty-input::-webkit-outer-spin-button,
.baha-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Price Summary */
.baha-price-summary {
    background: linear-gradient(135deg, color-mix(in srgb, var(--baha-primary, #8B5CF6) 5%, transparent) 0%, color-mix(in srgb, var(--baha-secondary, #06B6D4) 5%, transparent) 100%);
    border: 2px solid var(--baha-form-border, #E5E7EB);
    border-radius: 16px;
    padding: 20px;
    margin: 25px 0;
}

.baha-price-summary .baha-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 15px;
    color: var(--baha-text-secondary, #6B7280);
}

.baha-price-summary .baha-price-row:not(:last-child) {
    border-bottom: 1px dashed var(--baha-form-border, #E5E7EB);
}

.baha-price-summary .baha-total-row {
    font-size: 18px;
    font-weight: 700;
    color: var(--baha-text-primary, #1F2937);
    padding-top: 15px;
    margin-top: 5px;
    border-top: 2px solid var(--baha-primary, #8B5CF6);
    border-bottom: none;
}

.baha-price-summary .baha-total-row span:last-child {
    font-size: 22px;
    font-weight: 800;
    color: var(--baha-primary, #8B5CF6);
}

/* Submit Button */
.baha-submit-btn {
    width: 100%;
    height: 60px;
    background: linear-gradient(135deg, var(--baha-button-bg, var(--baha-primary, #8B5CF6)) 0%, var(--baha-primary-hover, #7C3AED) 100%);
    color: var(--baha-button-text, #FFFFFF);
    border: none;
    border-radius: 14px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 8px 25px color-mix(in srgb, var(--baha-primary, #8B5CF6) 35%, transparent);
}

.baha-submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px color-mix(in srgb, var(--baha-primary, #8B5CF6) 45%, transparent);
}

.baha-submit-btn:active {
    transform: translateY(0);
}

.baha-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Form Messages */
.baha-form-message {
    margin-top: 15px;
    display: none;
}

.baha-form-message .baha-error {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    color: #991B1B;
    padding: 15px 20px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    border: 1px solid #F87171;
}

.baha-form-message .baha-success {
    background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%);
    color: #065F46;
    padding: 15px 20px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    border: 1px solid #34D399;
    text-align: center;
}

/* Responsive */
@media (max-width: 640px) {
    .baha-onepage-checkout {
        padding: 15px;
    }

    .baha-checkout-form {
        padding: 20px;
    }

    .baha-product-info-box {
        flex-direction: column;
        text-align: center;
    }

    .baha-shipping-options {
        flex-direction: row;
        gap: 8px;
    }

    .baha-shipping-option {
        flex-direction: column;
        text-align: center;
        gap: 6px;
        padding: 10px 8px;
    }

    .baha-shipping-option .baha-option-content {
        align-items: center;
    }

    .baha-shipping-option .baha-option-check {
        position: absolute;
        top: 6px;
        left: 6px;
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
}

/* ============================================
   Validation Popup Styles
   ============================================ */

.baha-validation-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.baha-popup-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    overflow: hidden;
    animation: slideIn 0.3s ease;
    direction: rtl;
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
}

.baha-popup-header {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 2px solid #F87171;
}

.baha-popup-icon {
    font-size: 28px;
}

.baha-popup-title {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    color: #991B1B;
}

.baha-popup-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(153, 27, 27, 0.1);
    border-radius: 50%;
    font-size: 20px;
    color: #991B1B;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.baha-popup-close:hover {
    background: #991B1B;
    color: white;
}

.baha-popup-body {
    padding: 20px;
}

.baha-error-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.baha-error-list li {
    padding: 12px 15px;
    background: #FEF2F2;
    border-right: 4px solid #EF4444;
    margin-bottom: 10px;
    border-radius: 0 8px 8px 0;
    font-size: 15px;
    font-weight: 600;
    color: #DC2626;
    display: flex;
    align-items: center;
    gap: 8px;
}

.baha-error-list li:last-child {
    margin-bottom: 0;
}

.baha-error-list li::before {
    content: '✗';
    width: 24px;
    height: 24px;
    background: #EF4444;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

/* ============================================
   Floating Sticky Order Button
   ============================================ */

.baha-sticky-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    padding: 16px 40px;
    background: linear-gradient(135deg, var(--baha-button-bg, var(--baha-primary, #8B5CF6)) 0%, var(--baha-primary-hover, #7C3AED) 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    cursor: pointer;
    box-shadow: 0 8px 30px color-mix(in srgb, var(--baha-primary, #8B5CF6) 50%, transparent);
    transition: all 0.3s ease;
    opacity: 1;
    visibility: visible;
}

.baha-sticky-btn:hover {
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 0 12px 40px color-mix(in srgb, var(--baha-primary, #8B5CF6) 60%, transparent);
}

.baha-sticky-btn:active {
    transform: translateX(-50%) translateY(0);
}

.baha-sticky-btn.baha-sticky-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-50%) translateY(100%);
}

/* Responsive Sticky Button */
@media (max-width: 640px) {
    .baha-sticky-btn {
        left: 15px;
        right: 15px;
        width: calc(100% - 30px);
        transform: translateX(0);
        padding: 18px 30px;
        font-size: 17px;
        border-radius: 14px;
    }

    .baha-sticky-btn:hover,
    .baha-sticky-btn:active {
        transform: translateX(0);
    }

    .baha-sticky-btn.baha-sticky-hidden {
        transform: translateX(0) translateY(100%);
    }
}

/* Add padding for sticky button */
body:has(.baha-sticky-btn:not(.baha-sticky-hidden)) {
    padding-bottom: 80px;
}

/* ============================================
   Mobile Compact Styles - تصغير العناصر للهاتف
   ============================================ */

@media (max-width: 600px) {

    /* تصغير حقول الإدخال */
    .woocommerce-checkout input.input-text,
    .woocommerce-checkout select,
    .woocommerce-checkout textarea {
        height: 46px !important;
        padding: 11px 14px !important;
        font-size: 14px !important;
        border-radius: 10px !important;
    }

    /* تصغير Select2 */
    .select2-container--default .select2-selection--single {
        height: 46px !important;
        padding: 9px 14px !important;
        border-radius: 10px !important;
    }

    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 24px !important;
        font-size: 14px !important;
    }

    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 42px !important;
    }

    /* تصغير المسافات بين الحقول */
    .woocommerce-billing-fields__field-wrapper {
        gap: 10px;
    }

    /* تصغير عنوان الفورم */
    .baha-form-title {
        font-size: 20px;
        padding-bottom: 12px;
    }

    .baha-form-header {
        margin-bottom: 18px;
    }

    /* ========== تصغير الكمية ========== */
    .baha-quantity-wrapper {
        max-width: 160px;
        border-radius: 10px;
    }

    .baha-qty-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .baha-qty-input {
        width: 50px;
        height: 40px;
        font-size: 16px;
    }

    .baha-quantity-label,
    .baha-quantity-selector label {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }

    .baha-quantity-field label {
        font-size: 14px !important;
    }

    .baha-product-name {
        font-size: 12px;
        margin-top: 8px;
    }

    /* ========== تصغير طرق التوصيل ========== */
    .baha-shipping-selector {
        margin-top: 15px;
        padding-top: 15px;
    }

    .baha-shipping-label {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .baha-shipping-options {
        flex-direction: row;
        gap: 6px;
    }

    .baha-shipping-option {
        padding: 8px 6px;
        border-radius: 8px;
        gap: 4px;
        flex-direction: column;
        text-align: center;
    }

    .baha-shipping-option .baha-option-content {
        align-items: center;
    }

    .baha-shipping-option .baha-option-check {
        position: absolute;
        top: 4px;
        left: 4px;
        width: 18px;
        height: 18px;
        font-size: 9px;
    }

    .baha-option-icon {
        font-size: 18px;
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    .baha-option-title {
        font-size: 12px;
    }

    .baha-option-price {
        font-size: 11px;
    }

    .baha-option-check {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    /* ========== تصغير ملخص الطلب ========== */
    .baha-price-summary {
        padding: 15px;
        border-radius: 10px;
        margin-top: 15px;
    }

    .baha-price-row {
        padding: 8px 0;
        font-size: 13px;
    }

    .baha-price-row span:first-child {
        font-size: 13px;
    }

    .baha-price-row span:last-child {
        font-size: 14px;
    }

    .baha-total-row {
        padding: 12px 0 !important;
        margin-top: 8px;
    }

    .baha-total-row span:first-child {
        font-size: 14px !important;
    }

    .baha-total-row span:last-child {
        font-size: 16px !important;
    }

    /* ========== تصغير زر الطلب ========== */
    .baha-submit-btn,
    .baha-inline-order-btn {
        height: 48px !important;
        font-size: 15px !important;
        border-radius: 10px !important;
        margin-top: 15px !important;
    }

    /* ========== تصغير الحاوية الرئيسية ========== */
    .baha-onepage-checkout {
        padding: 18px;
    }

    .woocommerce-checkout .col2-set,
    .woocommerce-checkout #order_review {
        padding: 16px;
        border-radius: 10px;
        margin-bottom: 12px;
    }
}

/* ============================================
   Upsell Mobile Compact Styles
   ============================================ */

@media (max-width: 600px) {
    .baha-upsell-container {
        margin: 12px 0;
    }

    .baha-upsell-header {
        padding: 8px 10px;
        gap: 8px;
        border-radius: 8px;
        margin-bottom: 10px;
    }

    .baha-upsell-header-icon {
        font-size: 18px;
    }

    .baha-upsell-header-title {
        font-size: 12px;
    }

    .baha-upsell-header-subtitle {
        font-size: 10px;
    }

    .baha-upsell-offers-grid {
        gap: 8px;
    }

    .baha-upsell-offer {
        padding: 10px 12px;
        border-radius: 10px;
    }

    .baha-upsell-badge {
        padding: 3px 8px;
        font-size: 9px;
        border-radius: 0 0 6px 6px;
        left: 8px;
    }

    .baha-upsell-content {
        gap: 10px;
    }

    .baha-upsell-radio {
        width: 18px;
        height: 18px;
        border-width: 2px;
    }

    .baha-upsell-radio-inner {
        width: 6px;
        height: 6px;
    }

    .baha-upsell-title {
        font-size: 12px;
        margin-bottom: 4px;
    }

    .baha-upsell-qty-badge {
        padding: 2px 6px;
        font-size: 11px;
    }

    .baha-upsell-prices {
        gap: 6px;
    }

    .baha-upsell-old-price {
        font-size: 11px;
    }

    .baha-upsell-new-price {
        font-size: 14px;
    }

    .baha-upsell-savings-tag {
        padding: 2px 6px;
        font-size: 9px;
    }

    .baha-upsell-unit-price {
        font-size: 10px;
        margin-top: 3px;
    }
}

/* ===========================================
   زر واتساب للتواصل
   =========================================== */

.baha-whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 25px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #FFFFFF !important;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none !important;
    margin-top: 15px;
    font-family: inherit;
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.3);
}

.baha-whatsapp-btn:hover {
    background: linear-gradient(135deg, #20BD5A, #0F7A6E);
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(37, 211, 102, 0.4);
    color: #FFFFFF !important;
}

.baha-whatsapp-btn:active {
    transform: translateY(0);
}

.baha-whatsapp-icon {
    font-size: 22px;
}

@media (max-width: 600px) {
    .baha-whatsapp-btn {
        font-size: 15px;
        padding: 12px 20px;
    }

    .baha-whatsapp-icon {
        font-size: 20px;
    }
}

/* ============================================
   Floating (Sticky) Order Button - الزر العائم
   ============================================ */

.baha-sticky-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    padding: 16px 40px;
    background: linear-gradient(135deg, var(--baha-button-bg, var(--baha-primary, #8B5CF6)) 0%, var(--baha-primary-hover, #7C3AED) 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    cursor: pointer;
    box-shadow: 0 8px 30px color-mix(in srgb, var(--baha-primary, #8B5CF6) 50%, transparent);
    transition: all 0.3s ease;
    opacity: 1;
    visibility: visible;
}

.baha-sticky-btn:hover {
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 0 12px 40px color-mix(in srgb, var(--baha-primary, #8B5CF6) 60%, transparent);
}

.baha-sticky-btn:active {
    transform: translateX(-50%) translateY(0);
}

.baha-sticky-btn.baha-sticky-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-50%) translateY(100%);
}

/* Responsive Sticky Button */
@media (max-width: 640px) {
    .baha-sticky-btn {
        left: 15px;
        right: 15px;
        width: calc(100% - 30px);
        transform: translateX(0);
        padding: 18px 30px;
        font-size: 17px;
        border-radius: 14px;
    }

    .baha-sticky-btn:hover,
    .baha-sticky-btn:active {
        transform: translateX(0);
    }

    .baha-sticky-btn.baha-sticky-hidden {
        transform: translateX(0) translateY(100%);
    }
}

/* Add padding for sticky button */
body:has(.baha-sticky-btn:not(.baha-sticky-hidden)) {
    padding-bottom: 80px;
}