/**
 * Public landing — native mobile app chrome (≤768px)
 */
:root {
    --pl-topbar-h: 56px;
    --pl-tabbar-h: 64px;
    --pl-accent: #0d9488;
    --pl-accent-2: #059669;
    --pl-surface: #07111f;
    --pl-elevated: #0c1a2e;
    --pl-ink: #f8fafc;
    --pl-muted: #94a3b8;
}

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

    body.public-landing-shell.public-landing-app-mode {
        display: flex !important;
        flex-direction: column !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        background:
            radial-gradient(ellipse 120% 70% at 50% -15%, rgba(13, 148, 136, 0.22), transparent 55%),
            var(--pl-surface) !important;
        color: var(--pl-ink);
    }

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

    /* —— Top bar —— */
    body.public-landing-app-mode .public-landing-topbar {
        flex-shrink: 0;
        height: calc(var(--pl-topbar-h) + env(safe-area-inset-top, 0px));
        padding:
            env(safe-area-inset-top, 0px)
            max(0.75rem, env(safe-area-inset-right, 0px))
            0
            max(0.75rem, env(safe-area-inset-left, 0px));
        background: rgba(7, 17, 31, 0.9);
        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: 40;
    }

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

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

    body.public-landing-app-mode .public-landing-brand strong {
        font-size: 0.95rem;
        line-height: 1.15;
    }

    body.public-landing-app-mode .public-landing-brand small {
        display: flex !important;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.65rem;
        color: var(--pl-muted);
    }

    body.public-landing-app-mode .public-landing-brand small::before {
        content: '';
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #22c55e;
        box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
        animation: plLivePulse 1.6s ease-in-out infinite;
    }

    body.public-landing-app-mode .public-landing-actions .btn {
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.95rem;
    }

    body.public-landing-app-mode .public-landing-actions .btn .btn-label {
        display: none;
    }

    body.public-landing-app-mode .public-landing-actions .btn-login-petugas {
        width: auto;
        padding: 0 0.7rem;
        gap: 0.35rem;
        font-size: 0.72rem;
    }

    body.public-landing-app-mode .public-landing-actions .btn-login-petugas .btn-label {
        display: inline;
    }

    /* —— Stage —— */
    body.public-landing-app-mode .public-landing-stage {
        flex: 1 1 auto;
        min-height: 0;
        height: auto !important;
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0 !important;
        padding-bottom: calc(var(--pl-tabbar-h) + env(safe-area-inset-bottom, 0px)) !important;
        overflow: hidden;
    }

    body.public-landing-app-mode .public-landing-extras {
        flex-shrink: 0;
        padding: 0.55rem 0.75rem 0.35rem;
        gap: 0.45rem;
    }

    body.public-landing-app-mode .public-landing-bts {
        padding: 0.55rem 0.75rem;
        border-radius: 14px;
        background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(6, 182, 212, 0.12));
        border: 1px solid rgba(16, 185, 129, 0.28);
    }

    body.public-landing-app-mode .public-landing-bts strong {
        font-size: 0.78rem;
    }

    body.public-landing-app-mode .public-landing-bts span {
        font-size: 0.66rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    body.public-landing-app-mode .public-landing-presets {
        gap: 0.4rem;
        margin: 0 -0.15rem;
        padding: 0.1rem 0.15rem 0.2rem;
    }

    body.public-landing-app-mode .public-landing-presets button {
        padding: 0.42rem 0.75rem;
        font-size: 0.7rem;
        border-radius: 999px;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    }

    body.public-landing-app-mode .public-landing-portal {
        flex: 1 1 auto;
        min-height: 0;
        margin: 0 0.55rem 0.35rem;
        border-radius: 18px;
        padding: 0.5rem;
        overflow: hidden;
        box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
    }

    body.public-landing-app-mode[data-app-screen="map"] .public-landing-extras {
        display: none !important;
    }

    body.public-landing-app-mode[data-app-screen="map"] .public-landing-portal {
        margin: 0;
        border-radius: 0;
        border: none;
        padding: 0;
        box-shadow: none;
    }

    body.public-landing-app-mode .public-mobile-tabs {
        display: none !important;
    }

    body.public-landing-app-mode .public-portal-container {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        gap: 0 !important;
        position: relative;
    }

    body.public-landing-app-mode .public-portal-back-bar {
        flex-shrink: 0;
        margin: 0 0 0.45rem;
        position: sticky;
        top: 0;
        z-index: 30;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    }

    body.public-landing-app-mode:not(.light-mode) .public-portal-back-bar {
        background: rgba(7, 17, 31, 0.94);
        border-color: rgba(6, 182, 212, 0.35);
    }

    /* Di layar peta: tombol kembali mengambang di atas peta */
    body.public-landing-app-mode[data-app-screen="map"] .public-portal-back-bar:not([hidden]) {
        position: absolute;
        top: 10px;
        left: 10px;
        right: 10px;
        margin: 0;
        z-index: 1200;
    }

    body.public-landing-app-mode .public-left-panel,
    body.public-landing-app-mode .public-right-panel {
        flex: 1 1 auto;
        min-height: 0;
        height: auto !important;
        max-height: none !important;
        border-radius: 14px;
    }

    body.public-landing-app-mode .public-left-panel.active {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 0.15rem 0.15rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    }

    body.public-landing-app-mode .public-right-panel.active {
        display: flex !important;
        overflow: hidden;
    }

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

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

    body.public-landing-app-mode .glass-card.Card {
        border-radius: 16px;
        margin-bottom: 0.65rem;
        box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    }

    body.public-landing-app-mode .public-brand-header {
        margin-bottom: 0.65rem !important;
    }

    body.public-landing-app-mode .public-home-slider,
    body.public-landing-app-mode .public-slide {
        min-height: 148px;
        border-radius: 16px;
    }

    body.public-landing-app-mode .public-stat-strip {
        gap: 0.45rem;
    }

    body.public-landing-app-mode .public-stat-pill {
        border-radius: 14px;
        padding: 0.55rem 0.35rem;
    }

    body.public-landing-app-mode .public-menu-card {
        border-radius: 14px;
        min-height: 64px;
    }

    body.public-landing-app-mode .floating-legend {
        bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        right: 12px !important;
        max-width: min(220px, 72vw);
        border-radius: 14px !important;
    }

    /* Hide floating WA — diganti di tab Lainnya / topbar */
    body.public-landing-app-mode .public-landing-wa {
        display: none !important;
    }

    /* —— Bottom tab bar —— */
    .public-landing-tabbar {
        display: none;
    }

    body.public-landing-app-mode .public-landing-tabbar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        height: calc(var(--pl-tabbar-h) + env(safe-area-inset-bottom, 0px));
        padding:
            0.3rem 0.35rem
            calc(0.3rem + 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);
        box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.25);
        gap: 0.15rem;
    }

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

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

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

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

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

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

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

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

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

    .public-landing-splash img {
        width: 84px;
        height: 84px;
        object-fit: contain;
        animation: plLogoIn 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .public-landing-splash strong {
        font-family: 'Outfit', sans-serif;
        font-size: 1.25rem;
        color: #f8fafc;
        letter-spacing: 0.02em;
    }

    .public-landing-splash em {
        font-style: normal;
        font-size: 0.75rem;
        color: #94a3b8;
    }

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

    @keyframes plLivePulse {
        0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
        50% { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.08); }
    }
}

@media (min-width: 769px) {
    .public-landing-tabbar,
    .public-landing-splash {
        display: none !important;
    }
}

/* Kontras mode terang — override terakhir */
body.light-mode .public-departure-route,
body.light-mode .public-departure-time {
    color: #0f172a !important;
}
body.light-mode .public-departure-bus {
    color: #475569 !important;
}
body.light-mode .public-departure-status--coming { color: #0891b2 !important; }
body.light-mode .public-departure-status--running { color: #059669 !important; }
body.light-mode .public-departure-status--cancel { color: #dc2626 !important; }
body.light-mode .public-departure-status--scheduled { color: #64748b !important; }

body.light-mode .public-portal-field,
body.light-mode .form-control-glass,
body.light-mode .form-select.form-control-glass {
    background: #fff !important;
    color: #0f172a !important;
    border-color: rgba(15, 23, 42, 0.2) !important;
}

.public-complaint-cats {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.public-complaint-cats-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
body.light-mode .public-complaint-cats-label {
    color: #64748b;
}
.public-complaint-cat {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.35);
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
body.light-mode .public-complaint-cat {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.14);
    color: #0f172a;
}
.public-complaint-cat input {
    accent-color: #0d9488;
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}
.public-complaint-cat:has(input:checked) {
    border-color: rgba(13, 148, 136, 0.55);
    background: rgba(13, 148, 136, 0.16);
    color: #5eead4;
}
body.light-mode .public-complaint-cat:has(input:checked) {
    background: rgba(13, 148, 136, 0.1);
    color: #0f766e;
    border-color: rgba(13, 148, 136, 0.45);
}
