/* ==========================================================================
   PWA Install Top Banner (Faixa Superior Discreta de Instalação do App)
   ========================================================================== */

.pwa-install-banner {
    position: relative;
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #ebebeb;
    box-sizing: border-box;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 9998; /* Imediatamente abaixo da navbar fixa/sticky (9999) */
    font-family: var(--font-family, "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, padding 0.3s ease;
    overflow: hidden;
    max-height: 80px;
    opacity: 1;
}

.pwa-install-banner.is-hidden {
    display: none !important;
}

.pwa-install-banner.is-closing {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-color: transparent;
}

.pwa-banner-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

/* Ícone do App (Squircle com cantos arredondados) */
.pwa-banner-icon-wrap {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 9px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-banner-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Textos do Banner */
.pwa-banner-texts {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.pwa-banner-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.25;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-banner-desc {
    font-size: 0.74rem;
    font-weight: 400;
    color: #6b7280;
    margin: 2px 0 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ações do Banner (Botão Instalar + Botão Fechar) */
.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Botão de Instalar (Pill Button Elegante de Alto Contraste) */
.pwa-banner-btn-install {
    font-family: inherit;
    background: #18181b;
    color: #ffffff;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 600;
    padding: 7px 18px;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.pwa-banner-btn-install:hover {
    background: #27272a;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.pwa-banner-btn-install:active {
    transform: scale(0.96);
}

/* Botão de Fechar 'x' */
.pwa-banner-close {
    background: transparent;
    border: none;
    color: #71717a;
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.pwa-banner-close:hover {
    color: #111827;
    background-color: rgba(0, 0, 0, 0.05);
}

/* Suporte a Tema Escuro */
[data-theme="dark"] .pwa-install-banner {
    background: #18181b;
    border-bottom-color: #27272a;
}

[data-theme="dark"] .pwa-banner-title {
    color: #f4f4f5;
}

[data-theme="dark"] .pwa-banner-desc {
    color: #a1a1aa;
}

[data-theme="dark"] .pwa-banner-btn-install {
    background: #f4f4f5;
    color: #18181b;
}

[data-theme="dark"] .pwa-banner-close {
    color: #a1a1aa;
}

[data-theme="dark"] .pwa-banner-close:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Modal Interativo de Instalação Rápida com Barra de Progresso
   ========================================================================== */

.pwa-fast-modal-backdrop {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10070;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    transition: opacity 0.25s ease;
}

.pwa-fast-modal-backdrop.is-hidden {
    display: none !important;
}

.pwa-fast-modal-backdrop.is-closing {
    opacity: 0;
    pointer-events: none;
}

.pwa-fast-modal-card {
    background: #18181b;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    padding: 22px 20px 20px;
    width: 100%;
    max-width: 360px;
    box-sizing: border-box;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: pwaModalPop 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
    font-family: var(--font-family, "Poppins", system-ui, -apple-system, sans-serif);
}

@keyframes pwaModalPop {
    from {
        transform: scale(0.92) translateY(12px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.pwa-fast-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

/* Ícone vazado sem cor seguindo a identidade visual da plataforma */
.pwa-fast-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
}

.pwa-fast-icon-wrap svg {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.pwa-fast-header-text {
    flex: 1;
    min-width: 0;
}

.pwa-fast-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    line-height: 1.25;
}

.pwa-fast-modal-subtitle {
    font-size: 0.78rem;
    color: #a1a1aa;
    margin: 2px 0 0;
}

.pwa-fast-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.16);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.35);
    font-size: 0.72rem;
    font-weight: 600;
    flex-shrink: 0;
}

.pwa-fast-progress-section {
    margin-top: 14px;
}

.pwa-fast-progress-track {
    position: relative;
    width: 100%;
    height: 34px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.pwa-fast-progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    border-radius: 999px;
    transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 14px rgba(124, 58, 237, 0.4);
}

.pwa-fast-progress-glow {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 24px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.4));
}

.pwa-fast-progress-pct {
    position: relative;
    z-index: 2;
    font-size: 0.86rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.pwa-fast-status-msg {
    font-size: 0.8rem;
    color: #d4d4d8;
    text-align: center;
    margin: 12px 0 0;
    min-height: 20px;
    font-weight: 500;
    transition: color 0.2s ease;
}

/* ==========================================================================
   Instruções para iOS Safari (Bottom Sheet Discreta)
   ========================================================================== */

.pwa-ios-backdrop {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10060;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    box-sizing: border-box;
    transition: opacity 0.25s ease;
}

.pwa-ios-backdrop.is-hidden {
    display: none !important;
}

.pwa-ios-panel {
    background: var(--card-bg, #ffffff);
    color: var(--text-color, #111827);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 480px;
    padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 16px));
    box-sizing: border-box;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
    animation: pwaSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pwaSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.pwa-ios-handle {
    width: 36px;
    height: 4px;
    border-radius: 99px;
    background: #d1d5db;
    margin: 4px auto 14px;
}

.pwa-ios-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    position: relative;
    padding-right: 32px;
}

.pwa-ios-app-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.pwa-ios-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: #111827;
    line-height: 1.3;
}

.pwa-ios-subtitle {
    font-size: 0.82rem;
    color: #4b5563;
    margin: 2px 0 0;
    line-height: 1.35;
}

.pwa-ios-close-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: #4b5563;
    cursor: pointer;
    line-height: 1;
    padding: 6px;
    transition: color 0.15s ease;
}

.pwa-ios-close-btn:hover {
    color: #111827;
}

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

.pwa-ios-steps li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: #1f2937;
    line-height: 1.45;
}

.pwa-ios-steps li strong {
    color: #111827;
    font-weight: 600;
}

.pwa-ios-step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #111827;
    border: 1px solid #e5e7eb;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-ios-share-icon {
    display: inline-block;
    vertical-align: middle;
    margin: 0 2px;
    color: #0071e3;
}

.pwa-ios-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pwa-ios-secondary-btn {
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    background: #f3f4f6;
    color: #111827;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid #d1d5db;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.pwa-ios-secondary-btn:hover {
    background: #e5e7eb;
}

.pwa-ios-secondary-btn.is-hidden {
    display: none;
}

.pwa-ios-done-btn {
    width: 100%;
    padding: 11px 14px;
    border-radius: 12px;
    background: #111827;
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.pwa-ios-done-btn:hover {
    opacity: 0.9;
}

/* Tema Escuro — Alto Contraste nas Sheets de Orientação (iOS e Desktop) */
[data-theme="dark"] .pwa-ios-panel {
    background: var(--card-bg, #222222);
    color: var(--text-color, #f5f5f5);
    border-top-color: var(--border-color, #333333);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .pwa-ios-handle {
    background: #52525b;
}

[data-theme="dark"] .pwa-ios-app-icon {
    border-color: rgba(255, 255, 255, 0.14);
}

[data-theme="dark"] .pwa-ios-title {
    color: #f5f5f5;
}

[data-theme="dark"] .pwa-ios-subtitle {
    color: #a1a1aa;
}

[data-theme="dark"] .pwa-ios-close-btn {
    color: #a1a1aa;
}

[data-theme="dark"] .pwa-ios-close-btn:hover {
    color: #ffffff;
}

[data-theme="dark"] .pwa-ios-steps li {
    color: #e4e4e7;
}

[data-theme="dark"] .pwa-ios-steps li strong {
    color: #ffffff;
}

[data-theme="dark"] .pwa-ios-step-num {
    background: #2f2f35;
    color: #f5f5f5;
    border-color: #3f3f46;
}

[data-theme="dark"] .pwa-ios-share-icon {
    color: #60a5fa;
}

[data-theme="dark"] .pwa-ios-secondary-btn {
    background: #2c2c31;
    color: #f4f4f5;
    border-color: #3f3f46;
}

[data-theme="dark"] .pwa-ios-secondary-btn:hover {
    background: #38383f;
}

[data-theme="dark"] .pwa-ios-done-btn {
    background: #f4f4f5;
    color: #18181b;
}

/* Responsividade Mobile Estreito (<360px) */
@media (max-width: 360px) {
    .pwa-install-banner {
        padding: 6px 10px;
        gap: 8px;
    }
    .pwa-banner-icon-wrap {
        width: 34px;
        height: 34px;
        min-width: 34px;
    }
    .pwa-banner-title {
        font-size: 0.82rem;
    }
    .pwa-banner-desc {
        font-size: 0.7rem;
    }
    .pwa-banner-btn-install {
        padding: 5px 12px;
        font-size: 0.78rem;
    }
}
