/* ============================================================
   BEDEEL MOBILE V1
   HOME + LOGIN + REGISTER
   Scoped to mobile/tablet only. Desktop stays untouched.
   ============================================================ */

@media (max-width: 900px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    body {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    a,
    button,
    input,
    select,
    textarea {
        -webkit-tap-highlight-color: transparent;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    /* --------------------------------------------------------
       PUBLIC HOME
       -------------------------------------------------------- */

    body.np4-public {
        min-height: 100vh;
        min-height: 100dvh;
        padding-bottom: calc(72px + env(safe-area-inset-bottom));
    }

    .np4-header {
        position: sticky !important;
        top: 0;
        z-index: 150 !important;
        height: auto !important;
        padding-top: env(safe-area-inset-top);
        background:
            color-mix(
                in srgb,
                var(--np-page) 96%,
                transparent
            ) !important;
        backdrop-filter: blur(22px) saturate(135%);
    }

    .np4-header-inner {
        width: 100% !important;
        max-width: none !important;
        min-height: 58px;
        padding: 8px 12px !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        grid-template-rows: auto auto;
        gap: 8px 10px !important;
    }

    .np4-brand-r5 {
        min-width: 0 !important;
        height: 42px !important;
        gap: 8px !important;
    }

    .np4-brand-symbol-real {
        width: 34px !important;
        height: 34px !important;
        flex: 0 0 34px !important;
        display: block !important;
    }

    .np4-brand-wordmark-image {
        width: 96px !important;
        max-width: 100% !important;
    }

    .np4-header-actions {
        min-width: 0;
        gap: 6px !important;
    }

    .np4-header-actions .bd-lang-switcher,
    .np4-header-actions .bd-lang-switcher-v2,
    .np4-header-actions .bd-lang-switcher-v3 {
        flex: 0 0 auto;
    }

    .np4-login {
        display: none !important;
    }

    .np4-register {
        min-height: 38px;
        padding: 0 12px !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 11px !important;
        white-space: nowrap;
        font-size: 9px !important;
    }

    .np4-search {
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
        display: grid !important;
        width: 100% !important;
        height: 42px !important;
        border-radius: 13px !important;
    }

    .np4-search input {
        min-width: 0;
        font-size: 16px !important;
    }

    .np4-shell {
        width: 100% !important;
        max-width: 760px !important;
        display: block !important;
        margin: 0 auto !important;
        padding:
            10px
            10px
            calc(28px + env(safe-area-inset-bottom)) !important;
    }

    .np4-main {
        width: 100%;
        min-width: 0;
    }

    .np4-left {
        position: static !important;
        margin: 0 !important;
    }

    .np4-sectors,
    .np4-left-cta,
    .np4-right {
        display: none !important;
    }

    /* Bottom navigation using the existing 4 public nav links */
    .np4-left-nav {
        position: fixed !important;
        left: 8px;
        right: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom));
        z-index: 170;
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 4px !important;
        padding: 5px !important;
        border: 1px solid var(--np-border);
        border-radius: 17px;
        background:
            color-mix(
                in srgb,
                var(--np-page) 94%,
                transparent
            );
        backdrop-filter: blur(22px) saturate(145%);
        box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
    }

    .np4-left-nav > a {
        min-width: 0;
        min-height: 48px !important;
        padding: 4px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 12px !important;
    }

    .np4-left-nav > a > i {
        width: 36px !important;
        height: 36px !important;
        flex: 0 0 36px;
        border-radius: 11px !important;
        font-size: 16px;
    }

    .np4-left-nav > a > span {
        display: none !important;
    }

    .np4-left-nav > a.is-active {
        background:
            color-mix(
                in srgb,
                var(--np-surface) 92%,
                #ff6f3c
            ) !important;
    }

    .np4-hero {
        margin-top: 0 !important;
        border-radius: 18px !important;
        overflow: hidden;
    }

    .np4-hero-media {
        width: 100%;
        height: clamp(300px, 58vh, 420px) !important;
        min-height: 300px !important;
        max-height: 440px;
        border-radius: 18px !important;
    }

    .np4-hero-media > img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
    }

    .np4-hero-copy {
        left: 18px !important;
        right: 18px !important;
        top: auto !important;
        bottom: 22px !important;
        transform: none !important;
        max-width: none !important;
    }

    .np4-hero-copy > span {
        font-size: 8px !important;
        letter-spacing: .12em;
    }

    .np4-hero-copy h1 {
        margin-top: 8px !important;
        font-size: clamp(34px, 10vw, 48px) !important;
        line-height: .95 !important;
        letter-spacing: -.045em;
        text-wrap: balance;
    }

    .np4-hero-copy p {
        max-width: 92% !important;
        margin-top: 12px !important;
        font-size: 11px !important;
        line-height: 1.55 !important;
    }

    .np4-hero-live {
        top: 14px !important;
        right: 14px !important;
        padding: 7px 9px !important;
        border-radius: 999px !important;
    }

    .np4-hero-actions {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px !important;
        padding: 8px !important;
    }

    .np4-hero-actions > a {
        min-width: 0;
        min-height: 64px !important;
        padding: 8px 6px !important;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px !important;
        text-align: center;
    }

    .np4-hero-actions > a i {
        width: 28px !important;
        height: 28px !important;
    }

    .np4-hero-actions > a > span {
        min-width: 0;
    }

    .np4-hero-actions strong {
        font-size: 8px !important;
    }

    .np4-hero-actions small {
        display: none !important;
    }

    .np4-r4-pulse,
    .np4-stories,
    .np4-feed-header,
    .np4-feed,
    .np4-search-preview,
    .np4-r4-opportunity-banner {
        width: 100%;
        min-width: 0;
    }

    .np4-r4-section-heading,
    .np4-stories > header,
    .np4-feed-header {
        gap: 10px;
        align-items: flex-end !important;
    }

    .np4-r4-section-heading h2,
    .np4-stories > header h2,
    .np4-feed-header h2 {
        font-size: clamp(19px, 5.5vw, 25px) !important;
        line-height: 1.06;
        text-wrap: balance;
    }

    .np4-r4-section-heading > a,
    .np4-stories > header > a {
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .np4-r4-pulse-grid {
        display: flex !important;
        width: 100%;
        gap: 8px !important;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        padding: 2px 1px 8px !important;
    }

    .np4-r4-pulse-grid::-webkit-scrollbar,
    .np4-story-row::-webkit-scrollbar {
        display: none;
    }

    .np4-r4-pulse-card,
    .np4-r4-pulse-visual {
        width: min(76vw, 270px) !important;
        min-width: min(76vw, 270px) !important;
        scroll-snap-align: start;
    }

    .np4-story-row {
        display: flex !important;
        width: 100%;
        gap: 8px !important;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        padding-bottom: 6px;
    }

    .np4-story-row .np4-story {
        display: block !important;
        width: min(35vw, 132px) !important;
        min-width: min(35vw, 132px) !important;
        scroll-snap-align: start;
    }

    .np4-story-image {
        height: 112px !important;
        border-radius: 14px !important;
    }

    .np4-feed {
        display: grid;
        gap: 10px;
    }

    .np4-post {
        width: 100%;
        min-width: 0;
        border-radius: 16px !important;
        overflow: hidden;
    }

    .np4-post-header {
        padding: 12px !important;
    }

    .np4-post-image {
        width: 100%;
        height: clamp(220px, 58vw, 330px) !important;
    }

    .np4-post-body {
        padding: 12px !important;
    }

    .np4-post-actions {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px !important;
        padding: 7px !important;
    }

    .np4-post-actions > a {
        min-width: 0;
        min-height: 42px;
        padding: 6px 4px !important;
        justify-content: center;
    }

    .np4-theme-control {
        right: 10px !important;
        bottom: calc(76px + env(safe-area-inset-bottom)) !important;
    }

    .np4-theme-control > span {
        display: none !important;
    }

    /* --------------------------------------------------------
       AUTH: LOGIN + REGISTER
       -------------------------------------------------------- */

    body.ba4-body {
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .ba4-app {
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        height: auto !important;
        overflow: visible !important;
        grid-template-rows: auto 1fr !important;
    }

    .ba4-topbar {
        min-height: calc(58px + env(safe-area-inset-top));
        height: auto !important;
        padding:
            env(safe-area-inset-top)
            12px
            0 !important;
        gap: 8px !important;
    }

    .ba4-brand {
        min-width: 0;
        gap: 7px !important;
    }

    .ba4-brand-symbol {
        width: 32px !important;
        height: 32px !important;
        flex: 0 0 32px;
    }

    .ba4-brand-wordmark {
        width: 96px !important;
    }

    .ba4-top-actions {
        min-width: 0;
        gap: 6px !important;
    }

    .ba4-home-link {
        width: 36px !important;
        min-width: 36px;
        height: 36px !important;
        padding: 0 !important;
        justify-content: center;
        border-radius: 11px !important;
    }

    .ba4-home-link strong {
        display: none !important;
    }

    .ba4-grid {
        width: 100%;
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .ba4-story {
        display: none !important;
    }

    .ba4-auth-panel {
        width: 100%;
        min-height: calc(100dvh - 58px);
        height: auto !important;
        background:
            radial-gradient(
                circle at 50% -10%,
                rgba(70,126,189,.17),
                transparent 30%
            ),
            #08101a !important;
    }

    .ba4-auth-scroll {
        width: 100%;
        height: auto !important;
        min-height: calc(100dvh - 58px);
        overflow: visible !important;
        display: block !important;
        padding:
            22px
            14px
            calc(34px + env(safe-area-inset-bottom)) !important;
    }

    .ba4-auth-card,
    .ba4-register-v2 {
        width: 100% !important;
        max-width: 560px !important;
        margin: 0 auto !important;
    }

    .ba4-form-head {
        margin-bottom: 16px !important;
    }

    .ba4-form-kicker {
        font-size: 9px !important;
    }

    .ba4-form-head h2 {
        margin-top: 8px !important;
        font-size: clamp(32px, 9vw, 42px) !important;
        line-height: .98 !important;
    }

    .ba4-form-head p {
        max-width: 92%;
        font-size: 11px !important;
    }

    .ba4-p360 {
        min-height: 64px !important;
        border-radius: 15px !important;
        padding: 10px 12px !important;
    }

    .ba4-p360-logo {
        width: 42px !important;
        height: 42px !important;
        flex-basis: 42px !important;
    }

    .ba4-p360-copy strong {
        font-size: 11px !important;
    }

    .ba4-p360-copy small {
        font-size: 8px !important;
    }

    .ba4-divider {
        height: 34px !important;
    }

    .ba4-providers,
    .ba4-providers-register {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 7px !important;
    }

    .ba4-provider {
        min-height: 64px !important;
        height: auto !important;
        border-radius: 13px !important;
        gap: 6px !important;
    }

    .ba4-provider-icon {
        width: 27px !important;
        height: 27px !important;
    }

    .np-provider-logo {
        width: 26px !important;
        height: 26px !important;
    }

    .ba4-provider strong {
        font-size: 8.5px !important;
    }

    .ba4-form {
        gap: 12px !important;
    }

    .ba4-form-section {
        padding: 12px !important;
        border-radius: 15px !important;
        gap: 11px !important;
    }

    .ba4-two-cols,
    .ba4-register-v2 .ba4-two-cols {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .ba4-field {
        width: 100%;
        grid-template-rows: auto auto auto !important;
    }

    .ba4-field > span {
        min-height: 14px !important;
        font-size: 9px !important;
    }

    .ba4-control {
        width: 100%;
        min-height: 50px !important;
        height: 50px !important;
        border-radius: 13px !important;
        padding: 0 12px !important;
    }

    .ba4-control input {
        height: 48px !important;
        font-size: 16px !important;
    }

    .ba4-password-fields .ba4-field,
    .ba4-register-v2 .ba4-password-fields .ba4-field,
    .ba4-register-v2 .ba4-password-fields .ba4-field:first-child {
        grid-template-rows: auto 50px auto !important;
    }

    .ba4-register-v2 .ba4-password-fields .ba4-field:first-child::after {
        display: none !important;
    }

    .ba4-section-title,
    .ba4-register-v2 .ba4-section-title,
    .ba4-register-v2 .ba4-section-title.ba4-section-title-actions {
        grid-template-columns: 30px minmax(0, 1fr) !important;
        row-gap: 8px;
    }

    .ba4-ghost-action {
        grid-column: 1 / -1 !important;
        width: 100%;
        min-height: 38px;
        margin: 0 !important;
        justify-self: stretch !important;
        justify-content: center !important;
        border-radius: 10px !important;
    }

    .ba4-strength-card {
        padding: 10px !important;
    }

    .ba4-strength-head {
        align-items: flex-end;
    }

    .ba4-password-meter-v2,
    .ba4-register-v2 .ba4-password-meter-v2 {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 5px !important;
    }

    .ba4-password-meter-v2 span {
        min-height: 31px !important;
        font-size: 7.5px !important;
    }

    .ba4-password-meter-v2 span:last-child {
        grid-column: 1 / -1 !important;
    }

    .ba4-security-card,
    .ba4-register-v2 .ba4-security-card {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0 !important;
        border-radius: 12px !important;
    }

    .ba4-security-badge,
    .ba4-captcha-question,
    .ba4-captcha-field,
    .ba4-register-v2 .ba4-security-badge,
    .ba4-register-v2 .ba4-captcha-question,
    .ba4-register-v2 .ba4-captcha-field {
        width: 100% !important;
        min-height: auto !important;
    }

    .ba4-security-badge {
        padding: 12px !important;
    }

    .ba4-captcha-question,
    .ba4-register-v2 .ba4-captcha-question {
        min-width: 0 !important;
        padding: 12px !important;
        border-left: 0 !important;
        border-right: 0 !important;
        border-top: 1px solid var(--ba-line) !important;
        border-bottom: 1px solid var(--ba-line) !important;
    }

    .ba4-captcha-question strong {
        font-size: 19px !important;
    }

    .ba4-captcha-field,
    .ba4-register-v2 .ba4-captcha-field {
        padding: 12px !important;
        grid-template-rows: auto 50px !important;
    }

    .ba4-control-captcha {
        height: 50px !important;
        min-height: 50px !important;
    }

    .ba4-terms-card {
        min-height: 52px !important;
        padding: 10px 11px !important;
    }

    .ba4-terms-copy {
        font-size: 9px !important;
        line-height: 1.4 !important;
    }

    .ba4-primary,
    .ba4-register-submit {
        min-height: 52px !important;
        border-radius: 13px !important;
        font-size: 11px !important;
    }

    .ba4-form-foot {
        padding-bottom: 4px;
        font-size: 9px !important;
    }

    .ba4-theme-control {
        right: 10px !important;
        bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    }

    .ba4-modal {
        padding:
            calc(12px + env(safe-area-inset-top))
            12px
            calc(12px + env(safe-area-inset-bottom)) !important;
    }

    .ba4-modal-card {
        width: 100% !important;
        max-width: 440px;
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
        border-radius: 18px !important;
        padding: 15px !important;
    }

    .ba4-toast {
        max-width: calc(100vw - 28px);
        bottom: calc(16px + env(safe-area-inset-bottom)) !important;
        text-align: center;
    }
}

@media (max-width: 620px) {
    /* Public header becomes intentionally compact */
    .np4-header-inner {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .np4-brand-symbol-real {
        display: none !important;
    }

    .np4-brand-wordmark-image {
        width: 104px !important;
    }

    .np4-register {
        max-width: 112px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .np4-shell {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .np4-hero-media {
        height: clamp(290px, 52vh, 370px) !important;
        min-height: 290px !important;
    }

    .np4-hero-copy {
        left: 16px !important;
        right: 16px !important;
        bottom: 18px !important;
    }

    .np4-hero-copy h1 {
        font-size: clamp(32px, 11vw, 43px) !important;
    }

    .np4-hero-copy p {
        max-width: 100% !important;
        font-size: 10px !important;
    }

    .np4-r4-pulse-card,
    .np4-r4-pulse-visual {
        width: 78vw !important;
        min-width: 78vw !important;
    }

    .np4-story-row .np4-story {
        width: 36vw !important;
        min-width: 36vw !important;
    }

    .np4-post-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    /* Auth */
    .ba4-topbar {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .ba4-brand-symbol {
        display: none !important;
    }

    .ba4-brand-wordmark {
        width: 106px !important;
    }

    .ba4-auth-scroll {
        padding:
            18px
            10px
            calc(30px + env(safe-area-inset-bottom)) !important;
    }

    .ba4-form-head h2 {
        font-size: clamp(30px, 10vw, 39px) !important;
    }

    .ba4-providers,
    .ba4-providers-register {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .ba4-provider {
        min-height: 62px !important;
        padding: 7px 4px !important;
    }

    .ba4-form-section {
        padding: 11px !important;
    }
}

@media (max-width: 390px) {
    .np4-brand-wordmark-image,
    .ba4-brand-wordmark {
        width: 92px !important;
    }

    .np4-header-actions,
    .ba4-top-actions {
        gap: 4px !important;
    }

    .np4-register {
        padding: 0 9px !important;
        font-size: 8px !important;
    }

    .np4-hero-copy h1 {
        font-size: 31px !important;
    }

    .ba4-providers,
    .ba4-providers-register {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .ba4-password-meter-v2 {
        grid-template-columns: 1fr !important;
    }

    .ba4-password-meter-v2 span:last-child {
        grid-column: auto !important;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    .np4-hero-media {
        height: min(78vh, 360px) !important;
    }

    .ba4-auth-scroll {
        padding-top: 16px !important;
    }

    .ba4-form-head {
        margin-bottom: 12px !important;
    }
}

/* Signature */
html::before {
    content: "BEDEEL_MOBILE_V1";
    display: none;
}

/* BEDEEL MOBILE HEADER V2 START */
@media (max-width: 900px) {
    .np4-header-inner {
        grid-template-columns: minmax(0, 1fr) auto !important;
        grid-template-rows: auto auto !important;
        align-items: center !important;
    }

    .np4-header-actions {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 5px !important;
        min-width: 0 !important;
        flex-wrap: nowrap !important;
    }

    .np4-login,
    .np4-register {
        min-height: 36px !important;
        height: 36px !important;
        padding: 0 10px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 10px !important;
        white-space: nowrap !important;
        line-height: 1 !important;
        font-size: 8.5px !important;
        font-weight: 800 !important;
        text-decoration: none !important;
    }

    .np4-login {
        color: var(--np-text) !important;
        border: 1px solid var(--np-border) !important;
        background: color-mix(in srgb, var(--np-surface) 90%, transparent) !important;
    }

    .np4-register {
        color: #fff !important;
        border: 1px solid rgba(255,111,60,.45) !important;
    }

    .np4-search {
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
        margin-top: 1px !important;
    }
}

@media (max-width: 620px) {
    .np4-header-inner {
        grid-template-columns: minmax(88px, 1fr) auto !important;
        gap: 7px !important;
    }

    .np4-header-actions {
        gap: 4px !important;
    }

    .np4-header-actions .bd-lang-switcher,
    .np4-header-actions .bd-lang-switcher-v2,
    .np4-header-actions .bd-lang-switcher-v3 {
        transform: scale(.92);
        transform-origin: right center;
        margin-left: -4px;
        margin-right: -3px;
    }

    .np4-login,
    .np4-register {
        min-height: 34px !important;
        height: 34px !important;
        padding: 0 8px !important;
        font-size: 8px !important;
        border-radius: 9px !important;
    }

    .np4-register {
        max-width: none !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }
}

@media (max-width: 430px) {
    .np4-brand-wordmark-image {
        width: 88px !important;
    }

    .np4-header-inner {
        grid-template-columns: minmax(82px, 1fr) auto !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
        gap: 5px !important;
    }

    .np4-header-actions {
        gap: 3px !important;
    }

    .np4-header-actions .bd-lang-switcher,
    .np4-header-actions .bd-lang-switcher-v2,
    .np4-header-actions .bd-lang-switcher-v3 {
        transform: scale(.84);
        margin-left: -8px;
        margin-right: -7px;
    }

    .np4-login,
    .np4-register {
        min-height: 32px !important;
        height: 32px !important;
        padding: 0 7px !important;
        font-size: 7.5px !important;
    }
}

@media (max-width: 370px) {
    .np4-brand-wordmark-image {
        width: 80px !important;
    }

    .np4-header-inner {
        grid-template-columns: minmax(74px, 1fr) auto !important;
        gap: 4px !important;
    }

    .np4-header-actions .bd-lang-switcher,
    .np4-header-actions .bd-lang-switcher-v2,
    .np4-header-actions .bd-lang-switcher-v3 {
        transform: scale(.78);
        margin-left: -12px;
        margin-right: -10px;
    }

    .np4-login,
    .np4-register {
        padding: 0 6px !important;
        font-size: 7px !important;
    }
}
/* BEDEEL MOBILE HEADER V2 END */
