/* ================================================================
   PWA.CSS — Modal de instalação PWA
   ================================================================ */

/* 1. OVERLAY (Fundo Escuro) */
#pwa-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    z-index: 2147483645;
    backdrop-filter: blur(4px);
}

/* 2. MODAL CENTRALIZADO */
#pwa-install-banner {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    max-width: 360px;
    background: #ffffff;
    padding: 24px;
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 2147483646;
    text-align: center;
    font-family: 'Inter', sans-serif;
    border: none;
}

/* 3. LOGO E TEXTOS */
.pwa-modal-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    display: block;
    border-radius: 20px;
    object-fit: cover;
}

.pwa-modal-title {
    font-size: 22px;
    color: var(--text-color);
    font-weight: 800;
    margin-bottom: 8px;
}

.pwa-modal-desc {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 20px;
}

/* 4. CARD DE INSTRUÇÕES iOS */
.pwa-ios-card {
    background: #f1f5f9;
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 20px;
    text-align: left;
    border: 1px solid var(--border-color);
}

.pwa-ios-step-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.pwa-ios-step-item:last-child {
    margin-bottom: 0;
}

.step-icon {
    background: #ffffff;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.step-icon img {
    width: 20px;
    height: 20px;
}

.pwa-ios-step-item p {
    margin: 0;
    font-size: 13px;
    color: #475569;
    line-height: 1.4;
}

.pwa-ios-step-item strong {
    color: #6366f1;
    font-weight: 700;
}

/* 5. BOTÕES */
.pwa-btn-main {
    width: 100%;
    background: #6366f1;
    color: #ffffff;
    border: none;
    padding: 14px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-btn-main:active {
    background: #4f46e5;
    transform: scale(0.98);
}

.pwa-btn-link {
    background: none;
    border: none;
    color: #94a3b8;
    padding: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: block;
    margin: 8px auto 0;
}

/* 6. TOAST DE FEEDBACK */
.pwa-toast {
    position: fixed;
    /* Inclui safe-area-inset-bottom para iPhone X+ (home bar) */
    bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-color, #060606);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    z-index: 2147483647;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    animation: pwaToastIn 0.3s ease, pwaToastOut 0.3s ease 2.7s forwards;
    /* Sem delay de toque */
    touch-action: manipulation;
}

@keyframes pwaToastIn {
    from { opacity: 0; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
    to   { opacity: 1; bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
}

@keyframes pwaToastOut {
    from { opacity: 1; bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
    to   { opacity: 0; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
}

/* 7. RESPONSIVIDADE MOBILE */
@media (max-width: 480px) {
    #pwa-install-banner {
        width: 92%;
        padding: 20px 18px;
        /* Safe area inferior para phones com home bar */
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        border-radius: 20px;
    }

    .pwa-modal-logo {
        width: 64px;
        height: 64px;
    }

    .pwa-modal-title {
        font-size: 19px;
    }

    .pwa-btn-main {
        min-height: 48px;
    }
}
