/* ============================================================
   WooCommerce BaadMay Gateway – Frontend Styles (Updated)
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    --baadmay-primary:    #6016EB;
    --baadmay-primary-dk: #4b18b5;
    --baadmay-white:      #ffffff;
    --baadmay-gray-light: #f5f5f5;
    --baadmay-gray:       #888888;
    --baadmay-text:       #213D46;
    --baadmay-text-dark:  #222222;
    --baadmay-radius:     10px;
    --baadmay-shadow:     0 4px 24px rgba(99, 32, 238, 0.15);
}

/* ── Product Page Widget ───────────────────────────────────── */

/*
 * Moderno theme + generic WooCommerce: force the widget to sit
 * immediately below the price line and above everything else.
 * The JS reposition_script() handles DOM placement; these rules
 * guard against theme CSS overriding display / order.
 */
.summary #baadmay-widget,
.entry-summary #baadmay-widget,
.product-summary #baadmay-widget,
.woocommerce-product-details #baadmay-widget {
    order: 0 !important;          /* Flex/grid order reset               */
    display: block !important;
    width: 100% !important;
    clear: both !important;
    margin-top: 8px !important;
    margin-bottom: 0 !important;
}

/* Ensure the price block is always a block-level element so
   insertBefore/insertAfter lands in the right visual position. */
.summary .price,
.entry-summary .price,
.product-summary .price,
p.price {
    display: block !important;
    width: 100%;
}

.baadmay-widget {
    display: inline-flex !important;
    align-items: center !important;
    margin: 4px 0 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: opacity 0.2s;
    user-select: none;
    width: auto !important;
    max-width: 100%;
    box-sizing: border-box;
}

#baadmay-widget {
    display: block !important;
    width: 100% !important;
    clear: both !important;
    margin-top: 8px !important;
    margin-bottom: 0 !important;
}

.baadmay-widget:hover,
.baadmay-widget:focus {
    opacity: 0.85;
    outline: none;
    box-shadow: none !important;
    background: transparent !important;
}

.baadmay-widget-inner {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
}

.baadmay-widget-logo {
    height: 22px !important;
    width: auto !important;
    object-fit: contain;
    vertical-align: middle;
    flex-shrink: 0;
    display: block !important;
}

.baadmay-widget-text {
    display: inline !important;
    white-space: nowrap !important;
    line-height: 1.4;
    font-size: 13px !important;
    font-family: inherit !important;
}

.baadmay-widget-label {
    font-size: 13px !important;
    font-weight: 400 !important;
    color: #000000 !important;
    font-family: inherit !important;
    letter-spacing: 0;
}

.baadmay-widget-amount {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #6016eb !important;
    font-family: inherit !important;
    letter-spacing: 0;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* ── Overlay ───────────────────────────────────────────────── */
.baadmay-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

/* ── Popup Shell ───────────────────────────────────────────── */
.baadmay-popup {
    background: var(--baadmay-white);
    border-radius: 16px;
    max-width: 45%;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: baadmay-slide-in 0.25s ease;
}

@keyframes baadmay-slide-in {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Close Button ──────────────────────────────────────────── */
.baadmay-popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    text-decoration: none;
    transition: background 0.2s;
}

.baadmay-popup-close:hover {
    background: rgba(255,255,255,0.35);
}

/* ── Popup Head (purple section) ───────────────────────────── */
.baadmay-popup-head {
    background-color: #6016EB !important;
    text-align: center;
    color: var(--baadmay-white);
    height: 275px;
    position: relative;
    top: -20px;
    padding: 0;
}

.baadmay-popup-head h3 {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 22px;
    font-weight: bold;
    margin: 0;
    padding-top: 57px;
    color: white !important;
    line-height: 30px;
}

.baadmay-popup-logo {
    height: 32px;
    width: auto;
    display: block;
    margin: 26px auto;
}

/* White card inside the purple head */
.baadmay-info-box {
    background: var(--baadmay-white);
    border-radius: 10px;
    padding: 32px;
    margin: 0 auto;
    max-width: 339px;
    display: flex;
    justify-content: space-around;
    box-shadow: 0px 10px 20px #d7dff7;
    position: relative;
    top: 9px;
}

.baadmay-info-item-caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: transparent;
    padding: 0;
}

.baadmay-calendar-icon {
    width: 48px;
    height: 48px;
    background: #f0eaff;
    border-radius: 50%;
    padding: 10px;
    box-sizing: border-box;
}

.baadmay-info-item-caption p {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    color: #213D46 !important;
    text-align: center;
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Popup Content (white section) ─────────────────────────── */
.baadmay-popup-content {
    padding: 0 32px 28px;
    background: var(--baadmay-white);
}

/* Utility classes used inline in the template */
.text-center  { text-align: center; }
.mt-40        { margin-top: 13% !important; }
.mb-24        { margin-bottom: 0; }
.mt-32        { margin: 30px 0 0 !important; }
.mt-sm-24     { margin-top: 16px; }
.mb-0         { margin-bottom: 0; }

.baadmay-color-dark {
    color: #6016EB !important;
    font-size: 25px;
    font-weight: bold;
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 30px;
}

.baadmay-color-primary {
    color: #6016EB !important;
    font-size: 15px;
    font-weight: 700;
    border-top: 1px solid #eee;
    padding-top: 20px;
    margin-top: 20px !important;
}

/* Step icons row */
.compact-box {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    background: transparent;
    padding: 35px 0 24px;
    border-radius: 0;
    max-width: 103%;
}

.compact-box .baadmay-info-item1 {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    background: transparent;
    padding: 0;
    flex: 1;
    margin: 0 5px;
    position: relative;
}

.compact-box .baadmay-info-item1 img {
    width: 44px;
    height: 44px;
    background: #6016EB;
    border-radius: 50%;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compact-box .baadmay-info-item1 p {
    margin: 0;
    font-size: 16px;
    color: #213D46;
    font-weight: bold;
    line-height: 22px;
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin-top: 8px;
    margin-left: 10px;
}

/* Connector lines between steps */
.compact-box .baadmay-info-item1::after {
    content: '';
    width: 68px;
    height: 2px;
    position: absolute;
    top: 24px;
    left: 100%;
    margin-left: -34px;
    background-color: #939393;
    opacity: 0.25;
}

.compact-box .baadmay-info-item1:last-child::after {
    content: none;
}

/* ── Product Loop / Grid Widget ────────────────────────────── */
.baadmay-loop-widget {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 4px 0 6px !important;
    flex-wrap: nowrap !important;
    width: 100%;
}

.baadmay-loop-logo {
    height: 18px !important;
    width: auto !important;
    max-width: none !important;
    object-fit: contain !important;
    vertical-align: middle !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
}

.baadmay-loop-text {
    font-size: 12px !important;
    color: var(--baadmay-primary) !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    line-height: 1 !important;
}

/* ── Checkout Page ─────────────────────────────────────────── */
/* ── Remove theme border/shadow from selected BaadMay payment option ── */
li.payment_method.payment_method_baadmay,
li.wc_payment_method.payment_method_baadmay,
.payment_methods li.payment_method_baadmay,
.woocommerce-checkout .payment_methods li.payment_method_baadmay {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
    border-radius: 0 !important;
}

li.payment_method.payment_method_baadmay.selected,
li.payment_method.payment_method_baadmay:checked,
.payment_methods li.payment_method_baadmay.selected {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
}

/* Also strip any inner payment_box wrapper styling */
li.payment_method_baadmay .payment_box,
li.payment_method_baadmay .payment_box > div,
li.payment_method_baadmay .payment_box > * {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    background-color: transparent !important;
    margin: 0 !important;
    padding: 2px 0 4px 0 !important;
    outline: none !important;
}

/* Always show BaadMay logo — no toggle, same as Swich */
li.payment_method_baadmay .payment_box {
    display: block !important;
}

.baadmay-checkout-block {
    border: none !important;
    border-radius: 0;
    padding: 0;
    background: transparent;
    margin-top: 2px;
}

.baadmay-checkout-logo-wrap {
    margin: 4px 0 0 0;
    padding: 0 0 0 0;
    display: block;
}

/* Indent logo to align under "BaadMay" text, not the radio button */
.woocommerce-checkout li.payment_method_baadmay .payment_box {
    padding-left: 28px !important;
    margin-left: 0 !important;
}

.baadmay-checkout-logo {
    height: 24px;
    width: auto;
    display: block;
}

.baadmay-checkout-tagline {
    font-size: 13px;
    color: var(--baadmay-gray);
    margin: 0 0 10px;
    line-height: 1.4;
}

.baadmay-checkout-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.baadmay-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--baadmay-text);
}

.baadmay-step-number {
    width: 20px;
    height: 20px;
    background: var(--baadmay-primary);
    color: var(--baadmay-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Cart Page Widget ──────────────────────────────────────── */
.baadmay-cart-widget {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 8px 0 0 !important;
    flex-wrap: nowrap !important;
    width: 100%;
    padding: 6px 0;
}

.baadmay-cart-logo {
    height: 18px !important;
    width: auto !important;
    max-width: none !important;
    object-fit: contain !important;
    vertical-align: middle !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
}

.baadmay-cart-text {
    font-size: 12px !important;
    color: var(--baadmay-primary) !important;
    font-weight: 600 !important;
    white-space: normal !important;
    line-height: 1.2 !important;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 767px) {
    html .checkout-index-index .modal-popup .modal-inner-wrap {
        width: 100% !important;
    }

    aside.modal-popup.modal-slide._show {
        left: 0;
        height: fit-content;
    }

    .baadmay-popup {
        max-width: 100%;
    }

    .baadmay-popup-head {
        height: auto;
        padding: 22px 16px 0;
        top: 0;
    }

    .baadmay-popup-head h3 {
        padding-top: 20px;
        font-size: 22px;
    }

    .baadmay-popup-content {
        padding: 0 16px 20px;
    }

    .baadmay-info-box {
        padding: 16px;
        margin-top: 20px;
    }

    .compact-box .baadmay-info-item1 img {
        width: 38px;
        height: 38px;
    }

    .compact-box .baadmay-info-item1 p {
        font-size: 14px;
        margin-left: 0;
    }

    .baadmay-color-dark.text-center.mt-40.mb-24 {
        margin: 35% 0 0 0;
        font-size: 22px;
    }

    .hide-on-mobile {
        display: none !important;
    }

    .pl-10-mobile {
        padding-left: 10px;
    }

    .fz-18-mobile {
        font-size: 16px !important;
    }

    /* Widget: force identical appearance as desktop */
    .baadmay-widget {
        display: inline-flex !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        outline: none !important;
        padding: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        width: auto !important;
    }

    .baadmay-widget-inner {
        gap: 6px !important;
    }

    .baadmay-widget-logo {
        height: 22px !important;
    }

    .baadmay-widget-text {
        font-size: 13px !important;
        white-space: nowrap !important;
    }

    .baadmay-widget-label {
        font-size: 13px !important;
        font-weight: 400 !important;
    }

    .baadmay-widget-amount {
        font-size: 13px !important;
        font-weight: 700 !important;
        margin-left: 0 !important;
        padding-left: 0 !important;
    }

    /* Mobile: strip ALL borders/outlines from payment method li */
    li.payment_method.payment_method_baadmay,
    li.wc_payment_method.payment_method_baadmay,
    .payment_methods li.payment_method_baadmay,
    .woocommerce-checkout .payment_methods li.payment_method_baadmay,
    li.payment_method.payment_method_baadmay.selected,
    li.payment_method.payment_method_baadmay:checked,
    .payment_methods li.payment_method_baadmay.selected,
    li.payment_method_baadmay .payment_box,
    li.payment_method_baadmay .payment_box > div,
    li.payment_method_baadmay .payment_box > * {
        border: none !important;
        box-shadow: none !important;
        outline: none !important;
        background: transparent !important;
        background-color: transparent !important;
        border-radius: 0 !important;
        -webkit-appearance: none !important;
        appearance: none !important;
    }

    /* Always show BaadMay logo in payment section — no toggle */
    li.payment_method_baadmay .payment_box {
        display: block !important;
        border: none !important;
        box-shadow: none !important;
        outline: none !important;
        background: transparent !important;
        padding-left: 28px !important;
    }
}

@media (max-width: 480px) {
    .baadmay-popup {
        max-width: 100%;
        border-radius: 12px;
    }

    .baadmay-popup-head {
        height: auto;
        padding: 22px 16px 0;
        top: 0;
    }

    .baadmay-popup-head h3 {
        padding-top: 20px;
        font-size: 18px;
        line-height: 24px;
    }

    .baadmay-popup-logo {
        height: 28px;
        margin: 16px auto 20px;
    }

    .baadmay-info-box {
        padding: 16px;
        max-width: 100%;
        margin: 15px auto 0;
    }

    .baadmay-info-item-caption p {
        font-size: 14px;
    }

    .baadmay-popup-content {
        padding: 0 16px 20px;
    }

    .baadmay-color-dark.text-center.mt-40.mb-24 {
        margin: 20px 0 0 0;
        font-size: 18px;
        line-height: 24px;
    }

    .compact-box {
        padding: 20px 0 16px;
        gap: 4px;
    }

    .compact-box .baadmay-info-item1 {
        margin: 0 2px;
    }

    .compact-box .baadmay-info-item1 img {
        width: 36px;
        height: 36px;
    }

    .compact-box .baadmay-info-item1 p {
        font-size: 12px;
        line-height: 16px;
        margin-top: 6px;
        margin-left: 0;
    }

    .compact-box .baadmay-info-item1::after {
        width: 50px;
        height: 1.5px;
        top: 18px;
        left: 100%;
        margin-left: -25px;
    }

    .baadmay-color-primary.text-center.mt-32.mt-sm-24.mb-0 {
        margin: 20px 0 0;
        font-size: 13px;
        border-top: none;
        padding-top: 0;
    }

    .baadmay-widget {
        display: inline-flex !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        outline: none !important;
        padding: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        width: auto !important;
    }

    .baadmay-widget-inner {
        gap: 6px !important;
    }

    .baadmay-widget-logo {
        height: 18px !important;
    }

    .baadmay-widget-text {
        font-size: 13px !important;
        white-space: nowrap !important;
    }

    .baadmay-widget-label {
        font-size: 13px !important;
        font-weight: 400 !important;
    }

    .baadmay-widget-amount {
        font-size: 13px !important;
        font-weight: 700 !important;
        margin-left: 0 !important;
        padding-left: 0 !important;
    }

    /* Mobile: strip ALL borders/outlines from payment method li */
    li.payment_method.payment_method_baadmay,
    li.wc_payment_method.payment_method_baadmay,
    .payment_methods li.payment_method_baadmay,
    .woocommerce-checkout .payment_methods li.payment_method_baadmay,
    li.payment_method.payment_method_baadmay.selected,
    li.payment_method.payment_method_baadmay:checked,
    .payment_methods li.payment_method_baadmay.selected,
    li.payment_method_baadmay .payment_box,
    li.payment_method_baadmay .payment_box > div,
    li.payment_method_baadmay .payment_box > * {
        border: none !important;
        box-shadow: none !important;
        outline: none !important;
        background: transparent !important;
        background-color: transparent !important;
        border-radius: 0 !important;
        -webkit-appearance: none !important;
        appearance: none !important;
    }
}

/* Modal overrides for Magento/checkout pages */
.modal-popup .modal-content {
    padding-left: 0;
    padding-right: 0;
}

.modal-popup .modal-header {
    padding-bottom: 0;
    padding-top: 0;
}

.modal-slide .action-close {
    z-index: 9;
}

html .checkout-index-index .modal-popup .modal-inner-wrap {
    width: 50% !important;
}

.modal-popup .modal-inner-wrap {
    max-width: 50%;
    overflow-y: visible !important;
}

aside.modal-popup.modal-slide._show {
    z-index: 99 !important;
}