/* Sticky mobile order bar — product detail page */
@media (max-width: 991px) {
    .ahlmall-pdp-mobile-bar {
        --pdp-bar-radius: 14px;
        --pdp-bar-h: 54px;
        --pdp-bar-buy-shadow: 0 6px 20px rgba(234, 88, 12, 0.32);
        --pdp-bar-wa-shadow: 0 4px 14px rgba(22, 163, 74, 0.18);
    }

    body.ahlmall-pdp-has-mobile-bar {
        padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }

    .ahlmall-pdp-mobile-bar {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10060;
        isolation: isolate;
        padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
        background: rgba(255, 255, 255, 0.97);
        border-top: 1px solid rgba(15, 23, 42, 0.07);
        box-shadow: 0 -10px 32px rgba(15, 23, 42, 0.1);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
    }

    .ahlmall-pdp-mobile-bar__inner {
        display: flex;
        align-items: stretch;
        gap: 8px;
        max-width: 520px;
        margin: 0 auto;
    }

    /* AI assistant FAB — لا يغطي زر واتساب في الشريط */
    body.ahlmall-pdp-has-mobile-bar .ai-assistant-root {
        bottom: calc(98px + env(safe-area-inset-bottom, 0px)) !important;
        z-index: 10055 !important;
    }

    [dir="rtl"] body.ahlmall-pdp-has-mobile-bar .ai-assistant-root {
        left: max(12px, env(safe-area-inset-left, 0px));
        right: auto;
    }

    body.ahlmall-pdp-has-mobile-bar:not([dir="rtl"]) .ai-assistant-root {
        right: max(12px, env(safe-area-inset-right, 0px));
    }

    .ahlmall-pdp-mobile-bar__buy,
    .ahlmall-pdp-mobile-bar__wa {
        min-height: var(--pdp-bar-h);
        border-radius: var(--pdp-bar-radius);
        font-family: inherit;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
    }

    .ahlmall-pdp-mobile-bar__buy {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 0 12px 0 14px;
        border: none;
        background: linear-gradient(135deg, #fb923c 0%, #f97316 52%, #ea580c 100%);
        color: #fff;
        text-align: inherit;
        box-shadow: var(--pdp-bar-buy-shadow);
    }

    .ahlmall-pdp-mobile-bar__buy:disabled,
    .ahlmall-pdp-mobile-bar__wa:disabled {
        opacity: 0.52;
        cursor: not-allowed;
        box-shadow: none;
        filter: grayscale(0.15);
    }

    .ahlmall-pdp-mobile-bar__buy:not(:disabled):active,
    .ahlmall-pdp-mobile-bar__wa:not(:disabled):active {
        transform: scale(0.985);
    }

    .ahlmall-pdp-mobile-bar__buy-text {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 1px;
        line-height: 1.15;
    }

    .ahlmall-pdp-mobile-bar__buy-title {
        font-size: 15px;
        font-weight: 800;
        letter-spacing: 0.01em;
    }

    .ahlmall-pdp-mobile-bar__buy-price {
        font-size: 12px;
        font-weight: 600;
        opacity: 0.92;
        letter-spacing: 0.02em;
    }

    .ahlmall-pdp-mobile-bar__buy-icon {
        flex: 0 0 38px;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.22);
        border: 1px solid rgba(255, 255, 255, 0.28);
        font-size: 17px;
        line-height: 1;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    }

    .ahlmall-pdp-mobile-bar__wa {
        flex: 0 0 108px;
        width: 108px;
        position: relative;
        z-index: 2;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 8px;
        border: 1px solid rgba(34, 197, 94, 0.32);
        background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
        color: #166534;
        box-shadow: var(--pdp-bar-wa-shadow);
    }

    .ahlmall-pdp-mobile-bar__wa:not(:disabled):hover {
        background: linear-gradient(180deg, #ecfdf5 0%, #bbf7d0 100%);
    }

    .ahlmall-pdp-mobile-bar__wa-icon {
        color: #16a34a;
        line-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .ahlmall-pdp-mobile-bar__wa-icon svg {
        width: 24px;
        height: 24px;
        display: block;
    }

    .ahlmall-pdp-mobile-bar__wa-label {
        font-size: 10px;
        font-weight: 800;
        line-height: 1.2;
        text-align: center;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    [dir="rtl"] .ahlmall-pdp-mobile-bar__buy {
        padding: 0 14px 0 12px;
    }

    [dir="rtl"] .ahlmall-pdp-mobile-bar__buy-text {
        align-items: flex-end;
        text-align: end;
    }

    [dir="rtl"] .ahlmall-pdp-mobile-bar__buy-icon i {
        transform: scaleX(-1);
    }

    [dir="ltr"] .ahlmall-pdp-mobile-bar__buy-text {
        align-items: flex-start;
        text-align: start;
    }
}

/* Toast after copying WhatsApp order message */
.ahlmall-wa-copy-toast {
    display: none;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    z-index: 10070;
    max-width: 420px;
    margin: 0 auto;
    padding: 14px 16px;
    border-radius: 12px;
    background: #1f2937;
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.28);
    animation: ahlmall-wa-toast-in 0.3s ease;
}

.ahlmall-wa-copy-toast.is-visible {
    display: block;
}

@keyframes ahlmall-wa-toast-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 992px) {
    .ahlmall-pdp-mobile-bar {
        display: none !important;
    }

    .ahlmall-wa-copy-toast {
        bottom: 24px;
    }
}
