/*
 * ═══════════════════════════════════════════════════════════════════════════
 * KADI DIGITAL PORTAL - PWA INSTALL & UPDATE UI
 * pwa.css · loaded alongside styles.css/navbar.css, only where the install
 * sheet / update banner partial is included (see partials/pwa/widgets.blade.php)
 *
 * Reuses the portal's existing design tokens (--brand, --n-*, --r-*, --shadow-*,
 * --font-*) defined in styles.css - no new colour or radius scale is introduced.
 * ═══════════════════════════════════════════════════════════════════════════
 */

/* ── Install sheet ─────────────────────────────────────────────────────── */

.pwa-install-sheet {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 1075;
    max-width: 420px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--border-md);
    border-radius: var(--r-2xl);
    box-shadow: var(--shadow-xl);
    padding: 20px 20px 18px;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity var(--t-slow), transform var(--t-slow);
}

.pwa-install-sheet.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (min-width: 640px) {
    .pwa-install-sheet {
        left: auto;
        right: 24px;
        bottom: 24px;
        width: 380px;
    }
}

.pwa-install-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.pwa-install-icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--nav-bg, #0c1630);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-install-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6px;
}

.pwa-install-body {
    flex: 1 1 auto;
    min-width: 0;
}

.pwa-install-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.98rem;
    line-height: 1.3;
    color: var(--text-head);
    margin: 0 0 6px;
}

.pwa-install-text {
    font-family: var(--font-sans);
    font-size: 0.84rem;
    line-height: 1.55;
    color: var(--text-muted);
    margin: 0;
}

.pwa-install-close {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    margin: -2px -2px 0 2px;
    border: none;
    background: transparent;
    color: var(--text-faint);
    border-radius: var(--r-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
}

.pwa-install-close:hover,
.pwa-install-close:focus-visible {
    background: var(--surface-2);
    color: var(--text-head);
}

.pwa-install-actions {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}

.pwa-install-actions .btn-primary,
.pwa-install-actions .btn-secondary {
    flex: 1 1 auto;
    min-height: 40px;
    font-size: 0.82rem;
}

/* Single full-width action (iOS steps view, unsupported-browser view) */
.pwa-install-actions .pwa-install-action-full {
    flex-basis: 100%;
}

/* iOS "Add to Home Screen" steps */
.pwa-install-steps {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.pwa-install-steps li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    color: var(--text-head);
}

.pwa-install-steps .pwa-step-num {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: var(--r-pill);
    background: var(--brand-soft, rgba(80, 197, 255, 0.12));
    color: var(--brand-deeper, #0369a1);
    font-weight: 700;
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-install-steps i {
    color: var(--brand-deeper, #0369a1);
}

/* ── Update-available banner ───────────────────────────────────────────── */

.pwa-update-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    top: 16px;
    z-index: 1090;
    max-width: 480px;
    margin: 0 auto;
    background: var(--nav-bg, #0c1630);
    color: var(--text-inv);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-xl);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

@media (min-width: 640px) {
    .pwa-update-banner {
        left: auto;
        right: 24px;
        top: 90px;
        width: 360px;
    }
}

.pwa-update-icon {
    flex: 0 0 auto;
    font-size: 1.1rem;
    color: var(--brand);
}

.pwa-update-text {
    flex: 1 1 auto;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    line-height: 1.4;
}

.pwa-update-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pwa-update-actions button {
    border: none;
    border-radius: var(--r-md);
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background var(--t-fast);
}

#pwa-update-action {
    background: var(--brand);
    color: var(--text-head);
    padding: 7px 12px;
}

#pwa-update-action:hover,
#pwa-update-action:focus-visible {
    background: var(--brand-dark);
}

#pwa-update-dismiss {
    background: transparent;
    color: var(--nav-muted, rgba(255, 255, 255, 0.56));
    padding: 7px 8px;
}

#pwa-update-dismiss:hover,
#pwa-update-dismiss:focus-visible {
    color: var(--text-inv);
}

@media (max-width: 380px) {
    .pwa-update-banner {
        flex-wrap: wrap;
    }

    .pwa-update-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
