/* PWA: install, banner iOS, QR desktop, toast aggiornamento */

.pwa-install-btn {
    position: fixed;
    top: calc(58px + env(safe-area-inset-top, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    z-index: 45;
    min-height: 44px;
    padding: 10px 14px;
    border: 0;
    border-radius: 999px;
    background: #00adb5;
    color: #fff;
    font: 700 14px/1.2 'Segoe UI', sans-serif;
    box-shadow: 0 4px 16px rgba(0, 173, 181, 0.35);
    cursor: pointer;
}

.pwa-install-btn[hidden],
.pwa-update-toast[hidden],
.pwa-ios-banner[hidden],
.pwa-ios-foglio[hidden],
.pwa-installa-link[hidden],
.pwa-qr-card[hidden] {
    display: none !important;
}

.pwa-update-toast {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100vw - 24px);
    padding: 10px 12px;
    border-radius: 12px;
    background: #1a2a36;
    color: #fff;
    font: 600 14px/1.3 'Segoe UI', sans-serif;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.pwa-update-toast button {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    background: #00adb5;
    color: #fff;
    font: 700 13px/1 'Segoe UI', sans-serif;
    padding: 8px 12px;
    cursor: pointer;
}

.pwa-ios-slot {
    margin: 0 0 12px;
}

.pwa-ios-banner {
    position: static;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 4px;
    max-height: 56px;
    overflow: hidden;
    margin: 0;
    padding: 0 4px 0 10px;
    border-radius: 12px;
    background: #1a2a36;
    color: #fff;
    border: 1px solid #16303a;
}

.pwa-ios-banner-open {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    max-height: 56px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    font: 600 13px/1.15 'Segoe UI', sans-serif;
    cursor: pointer;
}

.pwa-ios-banner-open span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pwa-share-icon {
    flex: 0 0 auto;
}

.pwa-ios-chiudi {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #fff;
    font: 700 22px/1 'Segoe UI', sans-serif;
    cursor: pointer;
}

.pwa-installa-link {
    background: none;
    border: 0;
    color: #00adb5;
    font: 600 14px/1.2 'Segoe UI', sans-serif;
    cursor: pointer;
    padding: 10px 4px;
    min-height: 44px;
}

.pwa-ios-foglio {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    background: rgba(15, 23, 32, 0.48);
}

.pwa-ios-foglio-card {
    width: min(420px, 100%);
    max-height: calc(100vh - 32px - env(safe-area-inset-bottom, 0px));
    overflow: auto;
    background: #fff;
    color: #1a2a36;
    border-radius: 16px;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.pwa-ios-foglio-card h2 {
    margin: 0 0 12px;
    font: 700 18px/1.3 'Segoe UI', sans-serif;
}

.pwa-ios-passi {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pwa-ios-passi li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font: 15px/1.35 'Segoe UI', sans-serif;
}

.pwa-ios-passo-icon {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #e7f7f8;
    color: #0b6e75;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-ios-capito {
    margin-top: 14px;
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    background: #00adb5;
    color: #fff;
    font: 700 15px/1 'Segoe UI', sans-serif;
    cursor: pointer;
}

@media (max-width: 420px) {
    .pwa-ios-banner {
        max-height: 56px;
    }
    .pwa-ios-foglio-card {
        width: 100%;
    }
}

.pwa-qr-card {
    display: none;
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 35;
    width: 196px;
    padding: 12px 12px 10px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(26, 42, 54, 0.16);
    color: #2c3e50;
    font: 12px/1.35 'Segoe UI', sans-serif;
}

@media (min-width: 1024px) {
    html[data-pwa-qr="1"] .pwa-qr-card:not([hidden]) {
        display: block;
    }
}

html[data-pwa-qr="0"] .pwa-qr-card {
    display: none !important;
}

.btn-mostra-qr {
    display: none;
}

@media (min-width: 1024px) {
    .btn-mostra-qr {
        display: inline;
    }
}

.pwa-qr-card strong {
    display: block;
    color: #00adb5;
    font-size: 13px;
    margin: 0 22px 6px 0;
}

.pwa-qr-chiudi {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #566573;
    font: 700 18px/1 'Segoe UI', sans-serif;
    cursor: pointer;
}

.pwa-qr-card canvas,
.pwa-qr-card img,
.pwa-qr-card svg {
    display: block;
    width: 160px;
    height: 160px;
    margin: 0 auto 6px;
}

.pwa-qr-card p {
    margin: 0;
    color: #566573;
}

.pwa-qr-url {
    font: 700 11px/1.3 'Segoe UI', sans-serif;
    color: #1a2a36 !important;
    text-align: center;
    margin-bottom: 4px !important;
    word-break: break-all;
}

.pwa-nascondi,
#chk-nascondi-pwa-promo + span,
label.pwa-nascondi {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 8px;
    color: #566573;
    font: 12px/1.35 'Segoe UI', sans-serif;
    cursor: pointer;
}

.pwa-nascondi input,
#chk-nascondi-pwa-promo {
    margin-top: 2px;
    flex: 0 0 auto;
}
