/* assets/css/pwa.css
 * The install and update bars built by assets/js/pwa.js. Plain CSS rather than Tailwind classes:
 * the markup only exists inside JS strings, and the pages mix Tailwind 2, Tailwind 3 and Bootstrap.
 *
 * Phones/tablets: centred above the bottom nav (includes/bottom_nav.php, 64px + safe area).
 * From 1024px (where the bottom nav hides): bottom-right corner.
 * z-index sits above the bottom nav (45) and below its More sheet (55/56) and page modals.
 */

.pwa-bar {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 76px);
    transform: translate(-50%, 140%);
    z-index: 50;
    width: calc(100% - 24px);
    max-width: 460px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(21, 94, 111, 0.16);
    box-shadow: 0 14px 36px rgba(15, 69, 82, 0.24);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: #1F2937;
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.22, 0.7, 0.3, 1), opacity 0.2s ease;
    box-sizing: border-box;
}
.pwa-bar *, .pwa-bar *::before, .pwa-bar *::after { box-sizing: border-box; }
.pwa-bar.is-open { transform: translate(-50%, 0); opacity: 1; }

/* Public/guest layouts have no bottom nav */
body:not(:has(.si-bottom-nav)) .pwa-bar { bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); }

@media (min-width: 1024px) {
    .pwa-bar,
    body:not(:has(.si-bottom-nav)) .pwa-bar {
        left: auto;
        right: 24px;
        bottom: 24px;
        transform: translate(0, 140%);
    }
    .pwa-bar.is-open { transform: translate(0, 0); }
}

.pwa-bar__body { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.pwa-bar__icon {
    width: 44px; height: 44px; flex: 0 0 44px;
    border-radius: 11px;
    box-shadow: 0 2px 8px rgba(15, 69, 82, 0.18);
}
.pwa-bar__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pwa-bar__text strong { font-size: 0.92rem; font-weight: 700; color: #111827; line-height: 1.25; }
.pwa-bar__text span { font-size: 0.78rem; color: #4B5563; line-height: 1.35; }

.pwa-bar__actions { display: flex; gap: 8px; flex: 0 0 auto; }
.pwa-bar__btn {
    appearance: none;
    border: 0;
    border-radius: 10px;
    padding: 9px 14px;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.pwa-bar__btn--solid { background: #155E6F; color: #fff; }
.pwa-bar__btn--solid:hover { background: #0F4552; }
.pwa-bar__btn--ghost { background: transparent; color: #4B5563; }
.pwa-bar__btn--ghost:hover { background: #F3F4F6; color: #111827; }

/* iOS share glyph (square with an up arrow), drawn in CSS */
.pwa-bar__share {
    display: inline-block;
    width: 11px; height: 12px;
    margin: 0 1px -1px;
    border: 1.6px solid #155E6F;
    border-top: 0;
    border-radius: 0 0 2px 2px;
    position: relative;
}
.pwa-bar__share::before {
    content: '';
    position: absolute;
    left: 50%; top: -6px;
    width: 1.6px; height: 9px;
    margin-left: -0.8px;
    background: #155E6F;
}
.pwa-bar__share::after {
    content: '';
    position: absolute;
    left: 50%; top: -6px;
    width: 5px; height: 5px;
    margin-left: -2.5px;
    border-top: 1.6px solid #155E6F;
    border-left: 1.6px solid #155E6F;
    transform: rotate(45deg);
    transform-origin: center;
}

.pwa-bar--update { justify-content: space-between; }

@media (max-width: 360px) {
    .pwa-bar { flex-wrap: wrap; }
    .pwa-bar__actions { width: 100%; justify-content: flex-end; }
}

/* The [hidden] attribute must win over display utilities (Tailwind .flex etc.) */
[data-si-install][hidden] { display: none !important; }
