/**
 * WATERJET app-shell effects (PWA / WebView / Add to Home Screen only).
 * Scoped to html.wj-app-shell — desktop & mobile browser unchanged.
 * Disable: Admin → Settings → PWA → App-like effects, or PWA_APP_EFFECTS=false in .env
 */

@media (max-width: 768px) {
    /* ── Page enter fade ── */
    html.wj-app-shell.wj-page-enter body.wj-ui {
        animation: wj-page-enter 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    @keyframes wj-page-enter {
        from {
            opacity: 0.92;
            transform: translateY(6px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* ── Modal spring (login / register) ── */
    html.wj-app-shell .modal.fade .modal-dialog {
        transition: transform 0.38s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.22s ease;
    }

    html.wj-app-shell .modal.wj-modal-spring.show .modal-dialog,
    html.wj-app-shell .modal.show .modal-dialog {
        transform: scale(1) translateY(0);
    }

    html.wj-app-shell .modal.fade:not(.show) .modal-dialog {
        transform: scale(0.94) translateY(12px);
    }

    html.wj-app-shell .modal-content {
        border-radius: 18px;
        overflow: hidden;
    }

    /* ── Tap feedback ── */
    html.wj-app-shell .wj-tap-active {
        transform: scale(0.97);
        transition: transform 0.12s ease;
    }

    html.wj-app-shell button,
    html.wj-app-shell .btn,
    html.wj-app-shell .wj-social-btn,
    html.wj-app-shell .mobile-bottom-nav .nav-item,
    html.wj-app-shell .wj-route-card,
    html.wj-app-shell .wj-ticket-card__cta {
        transition: transform 0.12s ease, opacity 0.12s ease;
    }

    html.wj-app-shell button:active:not(:disabled),
    html.wj-app-shell .btn:active:not(:disabled),
    html.wj-app-shell .wj-social-btn:active,
    html.wj-app-shell .mobile-bottom-nav .nav-item:active,
    html.wj-app-shell .wj-route-card:active,
    html.wj-app-shell .wj-ticket-card__cta:active {
        transform: scale(0.97);
        opacity: 0.92;
    }

    html.wj-app-shell .wj-search-prototype .inline-swap-btn:active {
        transform: translateY(-50%) scale(0.97);
        opacity: 1;
    }

    html.wj-app-shell .wj-search-prototype .direction-swap-btn:active {
        transform: scale(0.97);
        opacity: 1;
    }

    /* ── Skeleton shimmer (cards while images load) ── */
    html.wj-app-shell .wj-route-card.wj-is-loading,
    html.wj-app-shell .wj-ticket-card.wj-is-loading {
        position: relative;
        overflow: hidden;
        min-height: 88px;
    }

    html.wj-app-shell .wj-route-card.wj-is-loading::after,
    html.wj-app-shell .wj-ticket-card.wj-is-loading::after {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 45%, #f8fafc 90%);
        background-size: 200% 100%;
        animation: wj-skeleton-shimmer 1.1s ease-in-out infinite;
        border-radius: inherit;
        pointer-events: none;
        z-index: 2;
    }

    @keyframes wj-skeleton-shimmer {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }

    /* ── Pull to refresh indicator ── */
    .wj-ptr-indicator {
        position: fixed;
        top: calc(env(safe-area-inset-top, 0px) + 8px);
        left: 50%;
        z-index: 10090;
        width: 36px;
        height: 36px;
        margin-left: -18px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        transform: translateY(-120%) scale(0.8);
        transition: opacity 0.18s ease, transform 0.18s ease;
        pointer-events: none;
    }

    .wj-ptr-indicator.is-pulling {
        opacity: calc(0.35 + var(--wj-ptr-progress, 0) * 0.65);
        transform: translateY(calc(-120% + var(--wj-ptr-progress, 0) * 52px)) scale(calc(0.8 + var(--wj-ptr-progress, 0) * 0.2));
    }

    .wj-ptr-indicator.is-ready .wj-ptr-spinner {
        border-top-color: #2563eb;
    }

    .wj-ptr-indicator.is-refreshing {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    .wj-ptr-spinner {
        width: 18px;
        height: 18px;
        border: 2px solid #e2e8f0;
        border-top-color: #94a3b8;
        border-radius: 50%;
        animation: wj-ptr-spin 0.7s linear infinite;
    }

    @keyframes wj-ptr-spin {
        to { transform: rotate(360deg); }
    }

    /* ── Safe area: modals & drawers in app shell ── */
    html.wj-app-shell .modal-dialog {
        margin-top: max(1rem, env(safe-area-inset-top, 0px));
        margin-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    }

    html.wj-app-shell .wj-drawer__panel,
    html.wj-app-shell .bc-mobile-drawer {
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    html.wj-app-shell body.wj-ui .bc_header {
        padding-top: env(safe-area-inset-top, 0px);
    }

    html.wj-app-shell body.wj-ui .mobile-bottom-nav {
        bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    }

    html.wj-app-shell .wj-contact-fab {
        bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.wj-app-shell.wj-page-enter body.wj-ui,
    html.wj-app-shell .modal.fade .modal-dialog,
    html.wj-app-shell button,
    html.wj-app-shell .btn {
        animation: none !important;
        transition: none !important;
    }

    html.wj-app-shell .wj-route-card.wj-is-loading::after,
    html.wj-app-shell .wj-ticket-card.wj-is-loading::after {
        animation: none;
    }
}
