/* Phase 48 - Professional PWA install prompt + UK cookie consent */
.af-pwa-toast,
.af-cookie-banner {
    position: fixed;
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    z-index: 2147483000;
    display: none;
    font-family: inherit;
}
.af-pwa-toast {
    bottom: calc(82px + env(safe-area-inset-bottom));
    max-width: 520px;
    right: auto;
}
.af-pwa-toast.show,
.af-cookie-banner.show { display: block; }
.af-pwa-card,
.af-cookie-card {
    background: rgba(255,255,255,.96);
    color: #0f172a;
    border: 1px solid rgba(15,23,42,.10);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(15,23,42,.18);
    backdrop-filter: blur(14px);
}
.af-pwa-card {
    display: grid;
    grid-template-columns: 58px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
}
.af-pwa-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(103,183,228,.26);
}
.af-pwa-title {
    margin: 0 0 2px;
    font-size: 15px;
    font-weight: 1000;
}
.af-pwa-text {
    margin: 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
}
.af-pwa-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.af-pwa-install,
.af-cookie-accept,
.af-cookie-save {
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #67B7E4, #F25C2E);
    color: #fff;
    font-weight: 900;
    padding: 10px 14px;
    white-space: nowrap;
}
.af-pwa-later,
.af-cookie-reject,
.af-cookie-settings,
.af-cookie-close {
    border: 1px solid rgba(15,23,42,.12);
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-weight: 900;
    padding: 10px 14px;
    white-space: nowrap;
}
.af-pwa-x {
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 18px;
    padding: 6px;
}
.af-cookie-banner {
    bottom: calc(16px + env(safe-area-inset-bottom));
}
.af-cookie-card {
    max-width: 980px;
    margin: 0 auto;
    padding: 18px;
}
.af-cookie-main {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 18px;
    align-items: center;
}
.af-cookie-title {
    margin: 0 0 6px;
    font-weight: 1000;
    font-size: 17px;
}
.af-cookie-text {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.55;
}
.af-cookie-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.af-cookie-panel {
    display: none;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(15,23,42,.10);
}
.af-cookie-panel.show { display: block; }
.af-cookie-option {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
}
.af-cookie-option input {
    margin-top: 4px;
    width: 18px;
    height: 18px;
}
.af-cookie-option strong { display:block; font-size: 14px; }
.af-cookie-option span { display:block; color:#64748b; font-size: 12px; line-height:1.45; }
.af-cookie-link {
    color: #0f5b80;
    font-weight: 900;
    text-decoration: none;
}
.af-pwa-ios-help {
    display: none;
    margin-top: 10px;
    padding: 10px 12px;
    background: #f8fbfd;
    border-radius: 16px;
    font-size: 12px;
    color: #475569;
}
.af-pwa-ios-help.show { display: block; }

@media (max-width: 680px) {
    .af-pwa-toast {
        max-width: none;
        bottom: calc(76px + env(safe-area-inset-bottom));
    }
    .af-pwa-card {
        grid-template-columns: 48px 1fr;
    }
    .af-pwa-icon {
        width: 48px;
        height: 48px;
        border-radius: 15px;
    }
    .af-pwa-actions {
        grid-column: 1 / -1;
        justify-content: stretch;
    }
    .af-pwa-install,
    .af-pwa-later { flex: 1; }
    .af-pwa-x {
        position: absolute;
        right: 16px;
        top: 10px;
    }
    .af-cookie-main {
        grid-template-columns: 1fr;
    }
    .af-cookie-actions {
        justify-content: stretch;
    }
    .af-cookie-actions button {
        flex: 1 1 auto;
    }
}

/* Phase 50.11 - Mobile PWA prompt width fix */
@media (max-width: 767px) {
    .af-pwa-toast,
    .af-cookie-banner {
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        padding-left: 14px !important;
        padding-right: 14px !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    .af-pwa-card,
    .af-cookie-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .af-pwa-card {
        grid-template-columns: 52px minmax(0, 1fr) 30px !important;
        gap: 12px !important;
        padding: 14px !important;
    }

    .af-pwa-text,
    .af-pwa-title {
        min-width: 0 !important;
        overflow-wrap: anywhere !important;
    }

    .af-pwa-actions {
        grid-column: 1 / -1 !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        width: 100% !important;
    }

    .af-pwa-install,
    .af-pwa-later {
        width: 100% !important;
        min-width: 0 !important;
        white-space: nowrap !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .af-pwa-x {
        position: static !important;
        justify-self: end !important;
    }
}
