/* ============================================================
   FIX: Logo and nav bar shift to the right on mobile

   Root cause: The nav <ul> uses overflow-x:auto (mobile-hor-swipe)
   but the grandparent div has text-center, which combined with
   the overflow scroll container creates a rightward offset.
   Nav items are inline-block with total width > screen width,
   so the scroll starts off-center and content appears shifted right.

   Upload to: public/assets/css/mobile-header-fix.css
   (Already linked in app.blade.php head - just replace the file)
   ============================================================ */

@media (max-width: 991.98px) {

    /* 1. Make nav container a column on mobile:
          logo on top, nav strip below, both left-aligned */
    .aiz-header .aiz-navbar .container > .d-lg-flex {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        width: 100% !important;
    }

    /* 2. Logo: full width, left-aligned (change to center if preferred) */
    .aiz-header .logo {
        width: 100% !important;
        text-align: left !important;
        flex-shrink: 0 !important;
    }

    /* 3. Nav ul: proper flex row from LEFT edge — eliminates right shift */
    .aiz-header ul.mobile-hor-swipe {
        display: flex !important;
        flex-direction: row !important;
        justify-content: flex-start !important;
        align-items: stretch !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        white-space: nowrap !important;
        width: 100% !important;
        padding-left: 0 !important;
        margin-left: 0 !important;
        text-align: left !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }

    /* Hide scrollbar visually - still scrollable by touch */
    .aiz-header ul.mobile-hor-swipe::-webkit-scrollbar {
        display: none !important;
    }

    /* 4. Nav items: flex items that don't shrink */
    .aiz-header ul.mobile-hor-swipe > li {
        display: flex !important;
        flex-shrink: 0 !important;
        align-items: center !important;
        padding-bottom: 0 !important;
    }
}

/* ============================================================
   FIX: Center the "Create Account" slide-in popup on mobile
   Currently it's a right-anchored sliding drawer (works fine on
   desktop). On mobile, this is converted into a centered modal
   so non-technical users don't need to scroll right to find it.

   Upload to: public/assets/css/mobile-header-fix.css
   (Already linked in app.blade.php <head> - just append this block)
   ============================================================ */

@media (max-width: 767px) {

    .form-slide-wrapper {
        /* Switch from right-anchored drawer to a centered modal */
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        width: 92% !important;
        max-width: 92% !important;
        height: auto !important;
        max-height: 88vh !important;
        border-radius: 12px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;

        /* Center via transform, and use scale instead of translateX
           for the show/hide animation so it stays centered throughout */
        transform: translate(-50%, -50%) scale(0.92) !important;
        opacity: 0;
        visibility: hidden;
        transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, visibility 0.3s !important;
    }

    /* Make sure no child element (button, input, recaptcha widget, etc.)
       can stretch past the popup's own width and cause horizontal scroll */
    .form-slide-wrapper * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Left-align the "Create Your Account" heading and subtitle text on
       mobile too, with enough left margin to clear the close (X) button
       which sits absolutely positioned in the top-left corner */
    .form-slide-wrapper .card-body > .mb-4.text-center {
        text-align: left !important;
        padding-left: 56px !important;
    }

    /* Left-align the Create Account button text on mobile, with some
       left padding, so the label is visible without needing to scroll */
    .form-slide-wrapper #createAccountBtn {
        text-align: left !important;
        padding-left: 24px !important;
    }

    .form-slide-wrapper.active {
        transform: translate(-50%, -50%) scale(1) !important;
        opacity: 1;
        visibility: visible;
    }

    /* Dim background behind the centered popup, like a standard modal */
    .form-slide-wrapper.active::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.45);
        z-index: -1;
    }
}
