/**
 * Landing mobile — native app shell (≤768px)
 * Desktop tidak terpengaruh.
 */

:root {
    --app-topbar-h: 56px;
    --app-tabbar-h: 64px;
    --app-accent: #0d9488;
    --app-accent-2: #059669;
    --app-surface: #07111f;
    --app-surface-elevated: #0c1a2e;
    --app-ink: #f1f5f9;
    --app-muted: #94a3b8;
}

/* —— Meta / base —— */
@media (max-width: 768px) {
    html.landing-app-ready,
    html.landing-app-ready body.landing-page.landing-app-mode {
        overscroll-behavior: none;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    body.landing-page.landing-app-mode {
        display: flex !important;
        flex-direction: column !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow: hidden !important;
        padding: 0 !important;
        padding-bottom: 0 !important;
        margin: 0 !important;
        background:
            radial-gradient(ellipse 120% 80% at 50% -20%, rgba(13, 148, 136, 0.22), transparent 55%),
            radial-gradient(ellipse 80% 50% at 100% 100%, rgba(5, 150, 105, 0.12), transparent 45%),
            var(--app-surface) !important;
        color: var(--app-ink);
    }

    body.landing-page.landing-app-mode.light-mode {
        --app-surface: #f0f4f8;
        --app-surface-elevated: #ffffff;
        --app-ink: #0f172a;
        --app-muted: #64748b;
        background:
            radial-gradient(ellipse 120% 70% at 50% -10%, rgba(13, 148, 136, 0.14), transparent 50%),
            linear-gradient(180deg, #e8eef4 0%, #f0f4f8 40%, #e2e8f0 100%) !important;
        color: var(--app-ink);
    }

    /* Sembunyikan chrome website */
    body.landing-app-mode > .nav-header,
    body.landing-app-mode > .mobile-nav-overlay,
    body.landing-app-mode > .bg-glow-1,
    body.landing-app-mode > .bg-glow-2,
    body.landing-app-mode > .bg-glow-3,
    body.landing-app-mode #dishub-portal-bar,
    body.landing-app-mode .landing-sticky-nav:not(.landing-app-tabbar),
    body.landing-app-mode .landing-portal-wrap .public-mobile-tabs {
        display: none !important;
    }

    /* —— Top bar —— */
    .landing-app-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        flex-shrink: 0;
        height: calc(var(--app-topbar-h) + env(safe-area-inset-top, 0px));
        padding:
            env(safe-area-inset-top, 0px)
            max(0.85rem, env(safe-area-inset-right, 0px))
            0
            max(0.85rem, env(safe-area-inset-left, 0px));
        background: rgba(7, 17, 31, 0.88);
        backdrop-filter: blur(18px) saturate(1.2);
        -webkit-backdrop-filter: blur(18px) saturate(1.2);
        border-bottom: 1px solid rgba(148, 163, 184, 0.12);
        z-index: 1200;
        position: relative;
    }

    body.landing-app-mode.light-mode .landing-app-topbar {
        background: rgba(255, 255, 255, 0.92);
        border-bottom-color: rgba(15, 23, 42, 0.08);
    }

    .landing-app-topbar-brand {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        min-width: 0;
        cursor: pointer;
        -webkit-user-select: none;
        user-select: none;
    }

    .landing-app-topbar-brand img {
        width: 36px;
        height: 36px;
        object-fit: contain;
        border-radius: 10px;
        background: rgba(13, 148, 136, 0.12);
        padding: 2px;
    }

    .landing-app-topbar-titles {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 0.05rem;
    }

    .landing-app-topbar-titles strong {
        font-family: 'Outfit', sans-serif;
        font-size: 0.95rem;
        font-weight: 750;
        letter-spacing: -0.02em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: inherit;
        line-height: 1.15;
    }

    .landing-app-topbar-titles span {
        font-size: 0.65rem;
        font-weight: 600;
        color: var(--app-muted);
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        letter-spacing: 0.02em;
        text-transform: uppercase;
    }

    .landing-app-live-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #10b981;
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
        animation: landingAppPulse 2s ease-out infinite;
    }

    @keyframes landingAppPulse {
        0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
        70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
        100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
    }

    .landing-app-topbar-actions {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        flex-shrink: 0;
    }

    .landing-app-icon-btn {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        border: 1px solid rgba(148, 163, 184, 0.18);
        background: rgba(255, 255, 255, 0.04);
        color: var(--app-ink);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.95rem;
        cursor: pointer;
        transition: transform 0.15s ease, background 0.15s ease;
    }

    body.landing-app-mode.light-mode .landing-app-icon-btn {
        background: rgba(15, 23, 42, 0.04);
        border-color: rgba(15, 23, 42, 0.1);
    }

    .landing-app-icon-btn:active {
        transform: scale(0.94);
        background: rgba(13, 148, 136, 0.18);
    }

    /* —— Stage / screens —— */
    .landing-app-stage {
        flex: 1 1 auto;
        min-height: 0;
        position: relative;
        overflow: hidden;
        width: 100%;
    }

    body.landing-app-mode > *:not(.landing-app-topbar):not(.landing-app-stage):not(.landing-app-tabbar):not(.landing-modal):not(#howToRideModal):not(#loginModal):not(#guidelinesModal):not(#landingConnectionBanner):not(#operatingHoursBanner):not(#runningTextBanner) {
        /* Sections dipindah JS ke dalam stage; sisanya disembunyikan jika masih di body */
    }

    .landing-app-screen {
        position: absolute;
        inset: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        padding-bottom: 0.5rem;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translate3d(18px, 0, 0);
        transition:
            opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
            transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
            visibility 0.32s;
        z-index: 1;
    }

    .landing-app-screen.is-active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translate3d(0, 0, 0);
        z-index: 2;
    }

    .landing-app-screen.is-exit-left {
        transform: translate3d(-12px, 0, 0);
    }

    /* Map / naik: full bleed, no page scroll — portal scrolls internally */
    body.landing-app-mode[data-app-screen="map"] .landing-app-screen[data-screen="map"],
    body.landing-app-mode[data-app-screen="naik"] .landing-app-screen[data-screen="map"] {
        overflow: hidden;
        display: flex;
        flex-direction: column;
        padding: 0;
    }

    body.landing-app-mode[data-app-screen="map"] #peta-masyarakat,
    body.landing-app-mode[data-app-screen="naik"] #peta-masyarakat {
        flex: 1 1 auto;
        min-height: 0;
        display: flex !important;
        flex-direction: column;
        margin: 0 !important;
        padding: 0 !important;
        max-width: none !important;
    }

    body.landing-app-mode[data-app-screen="map"] #peta-masyarakat .sec-header,
    body.landing-app-mode[data-app-screen="naik"] #peta-masyarakat .sec-header {
        display: none !important;
    }

    body.landing-app-mode[data-app-screen="map"] .landing-portal-wrap,
    body.landing-app-mode[data-app-screen="naik"] .landing-portal-wrap {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
    }

    body.landing-app-mode[data-app-screen="map"] .public-portal-container,
    body.landing-app-mode[data-app-screen="naik"] .public-portal-container {
        flex: 1 1 auto;
        min-height: 0 !important;
        height: 100% !important;
        gap: 0 !important;
    }

    body.landing-app-mode[data-app-screen="map"] .public-right-panel.active,
    body.landing-app-mode[data-app-screen="naik"] .public-left-panel.active {
        height: 100% !important;
        max-height: none !important;
        border-radius: 0 !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    body.landing-app-mode[data-app-screen="naik"] .public-left-panel.active {
        padding: 0.75rem 0.85rem !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    body.landing-app-mode[data-app-screen="map"] .public-right-panel .map-container-wrapper,
    body.landing-app-mode[data-app-screen="map"] .public-right-panel #publicMap,
    body.landing-app-mode[data-app-screen="map"] .public-right-panel .map-element {
        min-height: 0 !important;
        height: 100% !important;
        border-radius: 0 !important;
    }

    body.landing-app-mode[data-app-screen="map"] .floating-legend {
        bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* —— Home screen polish —— */
    body.landing-app-mode .landing-app-screen[data-screen="home"] .hero-sec {
        min-height: auto !important;
        padding: 1rem 1rem 0.5rem !important;
    }

    body.landing-app-mode .landing-app-screen[data-screen="home"] .hero-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        max-width: none !important;
        padding: 0 !important;
    }

    body.landing-app-mode .landing-app-screen[data-screen="home"] .hero-slider-right {
        order: -1;
        width: 100%;
        border-radius: 18px;
        overflow: hidden;
        aspect-ratio: 16 / 10;
        max-height: 42vw;
        min-height: 160px;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    }

    body.landing-app-mode .landing-app-screen[data-screen="home"] .hero-logo-wrap {
        display: none !important;
    }

    body.landing-app-mode .landing-app-screen[data-screen="home"] .hero-brand {
        font-family: 'Outfit', sans-serif;
        font-size: 1.65rem !important;
        font-weight: 800 !important;
        letter-spacing: -0.03em;
        margin-bottom: 0.35rem !important;
        line-height: 1.1;
    }

    body.landing-app-mode .landing-app-screen[data-screen="home"] .hero-title {
        font-size: 1.15rem !important;
        line-height: 1.35 !important;
        margin-bottom: 0.5rem !important;
    }

    body.landing-app-mode .landing-app-screen[data-screen="home"] .hero-subtitle {
        font-size: 0.88rem !important;
        line-height: 1.5 !important;
        color: var(--app-muted) !important;
        margin-bottom: 1rem !important;
    }

    body.landing-app-mode .landing-app-screen[data-screen="home"] .hero-actions {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.65rem !important;
        width: 100%;
    }

    body.landing-app-mode .landing-app-screen[data-screen="home"] .hero-actions > * {
        width: 100% !important;
        justify-content: center !important;
        min-height: 48px;
        border-radius: 14px !important;
        font-size: 0.92rem !important;
    }

    body.landing-app-mode .landing-app-screen[data-screen="home"] .landing-steps-sec {
        padding: 0.5rem 1rem 1.25rem !important;
    }

    body.landing-app-mode .landing-app-screen[data-screen="home"] .landing-steps-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.65rem !important;
    }

    body.landing-app-mode .landing-app-screen[data-screen="home"] .landing-citizen-stats {
        padding: 0 1rem 1.25rem !important;
        margin: 0 !important;
        grid-template-columns: repeat(2, 1fr) !important;
    }

    body.landing-app-mode .landing-app-screen[data-screen="home"] .landing-bts-banner {
        margin: 0 1rem 1rem !important;
        border-radius: 14px !important;
    }

    /* —— Info / more screens —— */
    body.landing-app-mode .landing-app-screen[data-screen="info"] > *,
    body.landing-app-mode .landing-app-screen[data-screen="more"] > * {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    body.landing-app-mode .landing-app-screen[data-screen="info"] .sec-header,
    body.landing-app-mode .landing-app-screen[data-screen="more"] .sec-header {
        text-align: left !important;
        margin-bottom: 0.85rem !important;
    }

    body.landing-app-mode .landing-app-screen[data-screen="info"] .sec-title,
    body.landing-app-mode .landing-app-screen[data-screen="more"] .sec-title {
        font-size: 1.2rem !important;
    }

    body.landing-app-mode .landing-app-screen[data-screen="more"] .landing-footer {
        padding-bottom: 1.5rem !important;
    }

    body.landing-app-mode .landing-app-screen[data-screen="more"] .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }

    /* —— Bottom tab bar —— */
    .landing-app-tabbar {
        display: flex !important;
        flex-shrink: 0;
        align-items: stretch;
        justify-content: space-around;
        gap: 0.15rem;
        height: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px));
        padding:
            0.35rem 0.35rem
            calc(0.35rem + env(safe-area-inset-bottom, 0px));
        background: rgba(7, 17, 31, 0.94);
        backdrop-filter: blur(20px) saturate(1.25);
        -webkit-backdrop-filter: blur(20px) saturate(1.25);
        border-top: 1px solid rgba(148, 163, 184, 0.14);
        z-index: 1200;
        position: relative;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.28);
    }

    body.landing-app-mode.light-mode .landing-app-tabbar {
        background: rgba(255, 255, 255, 0.96);
        border-top-color: rgba(15, 23, 42, 0.08);
        box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.08);
    }

    .landing-app-tab {
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        padding: 0.35rem 0.2rem;
        margin: 0;
        border: none;
        background: transparent;
        color: var(--app-muted);
        font-family: inherit;
        font-size: 0.62rem;
        font-weight: 650;
        letter-spacing: 0.01em;
        cursor: pointer;
        border-radius: 12px;
        transition: color 0.18s ease, background 0.18s ease, transform 0.15s ease;
        -webkit-user-select: none;
        user-select: none;
    }

    .landing-app-tab i {
        font-size: 1.2rem;
        line-height: 1;
        transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .landing-app-tab span {
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .landing-app-tab.active {
        color: var(--app-accent);
        background: rgba(13, 148, 136, 0.12);
    }

    .landing-app-tab.active i {
        transform: translateY(-1px) scale(1.08);
        color: var(--app-accent-2);
    }

    .landing-app-tab:active {
        transform: scale(0.96);
    }

    /* —— Splash —— */
    .landing-app-splash {
        position: fixed;
        inset: 0;
        z-index: 9999;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1rem;
        background:
            radial-gradient(circle at 50% 35%, rgba(13, 148, 136, 0.28), transparent 55%),
            #07111f;
        transition: opacity 0.45s ease, visibility 0.45s ease;
    }

    .landing-app-splash.is-done {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    .landing-app-splash img {
        width: 88px;
        height: 88px;
        object-fit: contain;
        animation: landingAppLogoIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .landing-app-splash strong {
        font-family: 'Outfit', sans-serif;
        font-size: 1.35rem;
        font-weight: 800;
        letter-spacing: -0.03em;
        color: #f8fafc;
        animation: landingAppLogoIn 0.7s 0.08s cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .landing-app-splash em {
        font-style: normal;
        font-size: 0.75rem;
        font-weight: 600;
        color: #94a3b8;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        animation: landingAppLogoIn 0.7s 0.14s cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    @keyframes landingAppLogoIn {
        from { opacity: 0; transform: translateY(10px) scale(0.96); }
        to { opacity: 1; transform: translateY(0) scale(1); }
    }

    /* Running text / ticker hanya di beranda — unfix agar tidak “nempel” di viewport */
    body.landing-app-mode #runningTextBanner {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        z-index: 1 !important;
        flex-shrink: 0;
        margin-bottom: 0.35rem;
    }

    body.landing-app-mode[data-app-screen="map"] #runningTextBanner,
    body.landing-app-mode[data-app-screen="naik"] #runningTextBanner,
    body.landing-app-mode[data-app-screen="info"] #runningTextBanner,
    body.landing-app-mode[data-app-screen="more"] #runningTextBanner {
        display: none !important;
    }

    body.landing-app-mode .wa-float,
    body.landing-app-mode .whatsapp-float,
    body.landing-app-mode .wa-floating-btn,
    body.landing-app-mode a[href*="wa.me"].floating,
    body.landing-app-mode .floating-wa {
        display: none !important;
    }

    body.landing-app-mode #operatingHoursBanner {
        flex-shrink: 0;
        position: relative !important;
        top: auto !important;
    }

    body.landing-app-mode #landingConnectionBanner {
        flex-shrink: 0;
    }

    /* Modal full-sheet feel on mobile */
    body.landing-app-mode .landing-modal.active {
        align-items: flex-end;
        padding: 0;
    }

    body.landing-app-mode .landing-modal.active .landing-modal-card {
        width: 100%;
        max-width: none;
        border-radius: 20px 20px 0 0;
        max-height: min(88dvh, 640px);
        margin: 0;
        animation: landingAppSheetUp 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    }

    @keyframes landingAppSheetUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
}

/* Desktop: jangan tampilkan shell */
@media (min-width: 769px) {
    .landing-app-topbar,
    .landing-app-stage,
    .landing-app-tabbar,
    .landing-app-splash {
        display: none !important;
    }
}
