/* assets/css/tap-feedback.css — tap feedback on every page (loaded by index.php)
   1) Pressed state on every tappable element. :active while the finger is down; on a link that
      starts loading another page, .bbm-pressed holds it until the page changes (tap-feedback.js).
   2) #bbm-nav-progress — thin brand-colour bar at the top while the next page loads.
   3) #bbm-nav-skel — (13 Nov) skeleton rows over the page's content while the next page loads; the header and the
      bottom bar stay (tap-feedback.js places it between them and gives it the page's own background colour).
   Uses the `scale` property, not `transform`, so elements already positioned or animated with
   transform (e.g. #go-live-fab) keep working. */

:root     { --bbm-press-tint: rgba(1, 170, 133, .12); }
body.dark { --bbm-press-tint: rgba(1, 170, 133, .25); }

/* The pressed states below replace the grey tap flash on these elements only */
a[href], button, [role="button"], [onclick], [data-bs-toggle], label[for], summary,
input[type="submit"], input[type="button"], .btn, .icon-btn, .dropdown-item, .cs-option, .custom-select-btn {
    -webkit-tap-highlight-color: transparent;
}

/* Buttons, icon buttons and links: shrink slightly and dim */
a[href]:active, a[href].bbm-pressed, button:not(:disabled):active, [role="button"]:active,
[onclick]:active, [data-bs-toggle]:active, label[for]:active, summary:active,
input[type="submit"]:not(:disabled):active, input[type="button"]:not(:disabled):active,
.btn:not(.disabled):active, .icon-btn:active, .custom-select-btn:active {
    scale: .96;
    opacity: .7;
    transition: scale .08s ease-out, opacity .08s ease-out;
}

/* Rows, menu items and options: tint the background instead (no shrink — rows are full width) */
.chat-list-box:active, .chat-list-box.bbm-pressed, .aka-row:active, .aka-row.bbm-pressed,
.dropdown-item:active, .dropdown-item.bbm-pressed, .cs-option:active, .list-group-item-action:active,
.link-section li > .pages:active, .profile-list li > a:active,
ul > li > a[href]:active, ul > li > a[href].bbm-pressed {
    background-color: var(--bbm-press-tint) !important;
    scale: none !important;
    opacity: 1 !important;
    transition: background-color .08s ease-out;
}

/* Footer nav items: icon + label shrink, no tint (the active highlight moves on tap instead) */
.navbar-menu li > a[href]:active, .bbm-tv-nav li > a[href]:active {
    background-color: transparent !important;
    scale: .9 !important;
    opacity: 1 !important;
    transition: scale .08s ease-out;
}

/* Footer icons for Updates/TV/Akasenge are server-rendered filled-green when active. When the
   highlight moves on tap, grey out the old filled icon (no effect on the grey outline icons). */
.navbar-menu ul li:not(.active) .icon svg { filter: grayscale(1); }

/* ── Navigation progress bar ─────────────────────────────── */
#bbm-nav-progress {
    position: fixed; top: 0; left: 0; right: 0; height: 3px;
    z-index: 2147483647; pointer-events: none; overflow: hidden;
    background: #01AA85;
    transform-origin: 0 50%; transform: scaleX(0); opacity: 0;
}
#bbm-nav-progress.bbm-running {
    opacity: 1;
    animation: bbm-nav-progress 15s cubic-bezier(.08, .7, .2, 1) forwards;
}
/* moving shine, so the bar visibly keeps going even when it has slowed near the end */
#bbm-nav-progress.bbm-running::after {
    content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent);
    animation: bbm-nav-shine 1.1s linear infinite;
}
@keyframes bbm-nav-progress {
    0%   { transform: scaleX(0); }
    8%   { transform: scaleX(.3); }
    100% { transform: scaleX(.95); }
}
@keyframes bbm-nav-shine {
    from { transform: translateX(-100%); }
    to   { transform: translateX(250%); }
}
@media (prefers-reduced-motion: reduce) {
    #bbm-nav-progress.bbm-running::after { animation: none; }
}

/* ── Skeleton over the content while the next page loads (13 Nov) ─────────────── */
#bbm-nav-skel {
    position: fixed; left: 0; right: 0; z-index: 2147483000; overflow: hidden;
    padding: 22px 16px 0; box-sizing: border-box;
    /* invisible for the first 0.18 s: a page that arrives at once never shows it (the delay is here, not in a script timer —
       Safari stops a page's timers once it starts leaving) */
    opacity: 0; animation: bbm-ns-in .12s ease-out .18s forwards;
}
/* iPhones: at once and still — Safari freezes every animation of a page that has started leaving (tap-feedback.js) */
#bbm-nav-skel.is-now { opacity: 1; animation: none; }
#bbm-nav-skel .bbm-ns-row { display: flex; align-items: center; gap: 12px; margin: 0 0 24px; max-width: 600px; }
#bbm-nav-skel .bbm-ns-dot { flex: none; width: 44px; height: 44px; border-radius: 50%; }
#bbm-nav-skel .bbm-ns-lines { flex: 1; min-width: 0; display: block; }
#bbm-nav-skel .bbm-ns-lines i { display: block; height: 12px; border-radius: 6px; margin: 0 0 9px; }
#bbm-nav-skel .bbm-ns-lines i:last-child { width: 38%; margin: 0; }
#bbm-nav-skel .bbm-ns-dot, #bbm-nav-skel .bbm-ns-lines i {
    background: linear-gradient(90deg, rgba(0, 0, 0, .06) 25%, rgba(0, 0, 0, .11) 50%, rgba(0, 0, 0, .06) 75%);
    background-size: 200% 100%; animation: bbm-ns-shimmer 1.4s linear infinite;
}
#bbm-nav-skel.is-dark .bbm-ns-dot, #bbm-nav-skel.is-dark .bbm-ns-lines i {
    background-image: linear-gradient(90deg, rgba(255, 255, 255, .07) 25%, rgba(255, 255, 255, .13) 50%, rgba(255, 255, 255, .07) 75%);
}
@keyframes bbm-ns-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes bbm-ns-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
    #bbm-nav-skel { animation-duration: .01s; }
    #bbm-nav-skel .bbm-ns-dot, #bbm-nav-skel .bbm-ns-lines i { animation: none; }
}

/* ── Side menu (16 Nov) ───────────────────────────────────────────────────────────
   The rows stay in the PAGE's own column: tap-feedback.js gives #bbm-nav-skel its left and width (left:0 / right:0 above are only
   the fallback), so on a wide window they are never where the side menu is. Plain bars for a page that is not a chat list
   (.bbm-ns-row.is-bar: no round picture). After 8 seconds the rows give way to words and two buttons (.is-slow): "Try again" and
   "Stay on this page" — 44 px to tap; light / dark follows the cover itself (.is-dark comes from the page's own background, which
   need not be the app's theme: the TV page is always dark). */
#bbm-nav-skel .bbm-ns-row.is-bar { margin-bottom: 28px; }
#bbm-nav-skel .bbm-ns-row.is-bar .bbm-ns-lines i { height: 14px; border-radius: 7px; margin-bottom: 10px; }
#bbm-nav-skel .bbm-ns-row.is-bar .bbm-ns-lines i:last-child { width: 52%; height: 12px; margin: 0; }
#bbm-nav-skel.is-slow { display: flex; align-items: center; justify-content: center; padding: 16px 24px; overflow-y: auto; opacity: 1; animation: none; }
#bbm-nav-skel .bbm-ns-slow { width: 100%; max-width: 320px; margin: auto; text-align: center; color: #1f2b28; }
#bbm-nav-skel.is-dark .bbm-ns-slow { color: #f3fbf8; }
#bbm-nav-skel .bbm-ns-slow p { margin: 0 0 16px; font-size: 16px !important; line-height: 1.4; font-weight: 500; color: inherit; }
#bbm-nav-skel .bbm-ns-retry, #bbm-nav-skel .bbm-ns-stay {
    display: block; width: 100%; min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px;
    font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; cursor: pointer;
}
#bbm-nav-skel .bbm-ns-retry { background: #01AA85; color: #fff; }
#bbm-nav-skel .bbm-ns-stay { margin-top: 8px; background: transparent; color: #4d5a56; font-weight: 500; }
#bbm-nav-skel.is-dark .bbm-ns-stay { color: #b8cdc7; }
