/* PWA install banner, iOS guided overlay and update toast.
 * On-brand: mirrors the app's bottom-sheet + primary-button look. Self-contained
 * (loaded on layouts that don't include dashboard.css). */

:root {
    --pwa-red: #990011;
    --pwa-red-2: #bd0018;
}

/* ---- Install banner (fixed, bottom) ---- */
.pwa-banner {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    transform: translate(-50%, 140%);
    z-index: 9990;
    width: min(460px, calc(100vw - 24px));
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e9dedd;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(79, 21, 26, .22);
    opacity: 0;
    transition: transform .32s cubic-bezier(.2, .8, .2, 1), opacity .32s ease;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.pwa-banner.pwa-above-nav {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
}

.pwa-banner.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
}

.pwa-banner-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(153, 0, 17, .08);
    color: var(--pwa-red);
}

.pwa-banner-icon svg {
    width: 22px;
    height: 22px;
}

.pwa-banner-text {
    flex: 1 1 auto;
    min-width: 0;
}

.pwa-banner-text strong {
    display: block;
    font-size: 14px;
    font-weight: 900;
    color: #1e1e1e;
}

.pwa-banner-sub {
    display: block;
    font-size: 12px;
    color: #6f6a6a;
    line-height: 1.35;
}

.pwa-banner-action {
    flex: 0 0 auto;
    border: 0;
    border-radius: 12px;
    background: var(--pwa-red);
    color: #fff;
    font-weight: 900;
    font-size: 13px;
    min-height: 40px;
    padding: 0 16px;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(153, 0, 17, .22);
}

.pwa-banner-close {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: #6f6a6a;
    cursor: pointer;
    padding: 6px;
    display: grid;
    place-items: center;
}

.pwa-banner-close svg {
    width: 18px;
    height: 18px;
}

/* ---- iOS guided overlay (bottom-sheet styling) ---- */
.pwa-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(35, 19, 20, .5);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    z-index: 9995;
    opacity: 0;
    transition: opacity .24s ease;
}

.pwa-sheet-backdrop.is-open {
    opacity: 1;
}

.pwa-sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 100%);
    z-index: 9996;
    width: min(460px, 100vw);
    background: #fff;
    border-radius: 26px 26px 0 0;
    padding: 10px 22px calc(env(safe-area-inset-bottom, 0px) + 22px);
    box-shadow: 0 -18px 50px rgba(35, 19, 20, .22);
    transition: transform .32s cubic-bezier(.2, .8, .2, 1);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.pwa-sheet.is-open {
    transform: translate(-50%, 0);
}

.pwa-sheet-handle {
    width: 42px;
    height: 5px;
    border-radius: 999px;
    background: #e9dedd;
    margin: 4px auto 16px;
}

.pwa-sheet-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.pwa-sheet-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(153, 0, 17, .08);
    color: var(--pwa-red);
}

.pwa-sheet-mark svg {
    width: 24px;
    height: 24px;
}

.pwa-sheet-eyebrow {
    margin: 0;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pwa-red);
}

.pwa-sheet-head h2 {
    margin: 2px 0 0;
    font-size: 18px;
    color: #1e1e1e;
}

.pwa-steps {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    display: grid;
    gap: 12px;
    counter-reset: pwa-step;
}

.pwa-steps li {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fcf6f5;
    border: 1px solid #f1e4e3;
    border-radius: 14px;
    padding: 12px 14px;
}

.pwa-step-ico {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: #fff;
    border: 1px solid #efe2e1;
    color: var(--pwa-red);
}

.pwa-step-ico svg {
    width: 20px;
    height: 20px;
}

.pwa-steps p {
    margin: 0;
    font-size: 13px;
    color: #4a4040;
    line-height: 1.4;
}

.pwa-steps strong {
    color: #1e1e1e;
}

.pwa-sheet-done {
    width: 100%;
    border: 0;
    border-radius: 16px;
    min-height: 50px;
    background: var(--pwa-red);
    color: #fff;
    font-weight: 900;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(153, 0, 17, .2);
}

/* ---- "New version available" update toast ---- */
.pwa-update {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    transform: translate(-50%, 160%);
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px 12px 18px;
    background: #1e1e1e;
    color: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 13px;
    font-weight: 700;
    opacity: 0;
    transition: transform .32s cubic-bezier(.2, .8, .2, 1), opacity .32s ease;
}

.pwa-update.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
}

.pwa-update-btn {
    border: 0;
    border-radius: 10px;
    background: var(--pwa-red);
    color: #fff;
    font-weight: 900;
    font-size: 13px;
    min-height: 36px;
    padding: 0 16px;
    cursor: pointer;
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    .pwa-banner,
    .pwa-sheet,
    .pwa-update,
    .pwa-sheet-backdrop {
        transition-duration: .01ms;
    }
}
