/* Estilos para o Modal de Parcelamento Mercado Pago */
/* Estilos base - podem ser sobrescritos pelo Elementor */

/* Botão principal */
.pmp-modal-button {
    background: #009ee3;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
}

.pmp-modal-button:hover {
    background: #0088cc;
    color: white;
    text-decoration: none;
}

/* Elementor pode sobrescrever estes estilos através de seletores específicos */

/* Modal - estilos base estruturais otimizados */
.pmp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999; /* Z-index muito alto para garantir prioridade */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Remove scroll do modal principal */
    padding: 20px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch; /* Scroll suave em iOS */
}

.pmp-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999998; /* Z-index alto mas menor que o conteúdo */
    -webkit-tap-highlight-color: transparent; /* Remove highlight no touch */
}

.pmp-modal-content {
    position: relative;
    background: white;
    border-radius: 8px;
    width: 90%;
    /* Largura e altura são definidas exclusivamente pelo Elementor */
    z-index: 999999; /* Z-index máximo para o conteúdo */
    min-height: 60vh;
    height: 100%;
    max-height: 90vh;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    margin: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Importante para o scroll interno funcionar */
    -webkit-transform: translate3d(0, 0, 0); /* Força aceleração de hardware */
    transform: translate3d(0, 0, 0);
}

/* Garante que o conteúdo do modal tenha scroll interno dinâmico */
.pmp-modal-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    flex: 1 1 auto; /* Permite crescimento e encolhimento */
    min-height: 0; /* Importante para flexbox funcionar corretamente */
    box-sizing: border-box;
    /* A altura será calculada dinamicamente pelo JavaScript */
    
    /* Scroll suave e estilizado com prioridade máxima */
    scroll-behavior: smooth;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #c1c1c1 #f1f1f1; /* Firefox */
    -webkit-overflow-scrolling: touch; /* Scroll suave em iOS */
    overscroll-behavior: contain; /* Impede que o scroll "escape" para a página */
    -ms-overflow-style: -ms-autohiding-scrollbar; /* IE/Edge */
    position: relative; /* Garante contexto de stacking */
    z-index: 1; /* Z-index local dentro do modal */
}

/* Estilização da scrollbar para Webkit (Chrome, Safari, Edge) */
.pmp-modal-body::-webkit-scrollbar {
    width: 8px;
}

.pmp-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.pmp-modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.pmp-modal-body::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Impede o scroll da página quando modal está aberto - prioridade máxima */
body.pmp-modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    top: 0 !important; /* Evita jumps na posição */
    left: 0 !important;
    -webkit-overflow-scrolling: auto !important; /* Desabilita scroll iOS */
    overscroll-behavior: none !important; /* Bloqueia overscroll */
    touch-action: none !important; /* Bloqueia gestos de scroll em touch */
}

html.pmp-modal-open {
    overflow: hidden !important;
    height: 100% !important;
    position: relative !important;
    overscroll-behavior: none !important; /* Bloqueia overscroll */
}

/* Header do modal - altura fixa para cálculo correto do scroll */
.pmp-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e1e1e1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Não permite que o header encolha */
    min-height: 60px; /* Altura mínima garantida */
    box-sizing: border-box;
}

.pmp-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.pmp-modal-close {
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pmp-modal-close svg {
    width: 16px;
    height: 16px;
    fill: #666;
}

.pmp-modal-close:hover svg {
    fill: #333;
}

/* Body do modal - estilos base - removido para evitar conflito */
/* .pmp-modal-body é definida acima para garantir scroll interno */

.pmp-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

/* Estrutura básica - Elementor pode customizar */
.pmp-tab-group {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    border-bottom: 1px solid #e1e1e1;
    display: flex;
}

.pmp-tab {
    margin-right: 20px;
}

.pmp-tab-link {
    display: block;
    padding: 10px 0;
    color: #666;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    font-weight: 500;
}

.pmp-tab.pmp-active .pmp-tab-link {
    color: #009ee3;
    border-bottom-color: #009ee3;
}

.pmp-tab-link:hover {
    color: #009ee3;
    text-decoration: none;
}

/* Seções de pagamento - estrutura melhorada */
.pmp-payment-section {
    margin-bottom: 35px;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #f0f0f0;
}

.pmp-payment-section:last-child {
    margin-bottom: 20px;
}

.pmp-h6 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #009ee3;
    display: inline-block;
}

.pmp-h4 {
    font-size: 20px;
    margin-bottom: 18px;
    color: #2c3e50;
}

.pmp-box {
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    background: #f8f9fa;
    overflow: hidden;
}

.pmp-px-3 {
    padding-left: 20px;
    padding-right: 20px;
}

.pmp-payment-method-total {
    padding: 18px 0;
    font-size: 16px;
    color: #495057;
}

/* Utilitários básicos */
.pmp-font-weight-normal { font-weight: 400; }
.pmp-mb-3 { margin-bottom: 15px; }
.pmp-mt-1 { margin-top: 5px; }
.pmp-mt-2 { margin-top: 10px; }
.pmp-mt-3 { margin-top: 15px; }
.pmp-mb-2 { margin-bottom: 10px; }
.pmp-text-right { text-align: right; }
.pmp-mr-1 { margin-right: 5px; }

/* Tabela de parcelas - estrutura */
.pmp-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.pmp-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.pmp-table tr:hover {
    background: #f8f9fa;
}

/* Parcelas ocultas */
.pmp-payment-provider-installments-row.pmp-hidden {
    display: none;
}

/* Botão "Ver mais" */
.pmp-show-more-installments {
    text-align: center;
    margin: 15px 0;
}

.pmp-btn-link {
    background: none;
    border: none;
    color: #009ee3;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
}

.pmp-btn-link:hover {
    color: #0088cc;
}

/* Logos dos cartões - Layout melhorado */
.pmp-payment-logos {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin: 15px 0;
    padding: 20px 15px;
    border-bottom: 1px solid #e1e1e1;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.pmp-card-img {
    width: 55px!important;
    object-fit: contain;
    opacity: 1;
    transition: all 0.2s ease;
    padding: 4px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Classe específica para ícones customizados que devem ter prioridade */
.pmp-custom-icon {
    object-fit: contain !important;
    max-width: none !important;
}

/* Estilos base que podem ser sobrescritos pelos controles do Elementor */
.pmp-payment-method-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    font-size: 24px;
}

.pmp-payment-method-icon img {
    object-fit: contain;
    max-width: none;
}

.pmp-payment-method-icon i {
    line-height: 1;
}





/* Layout em linha para bandeiras quando configurado */
.pmp-payment-logos.pmp-brands-inline {
    justify-content: flex-start;
    gap: 8px;
}

.pmp-payment-logos.pmp-brands-center {
    justify-content: center;
}

.pmp-payment-logos.pmp-brands-spaced {
    justify-content: space-between;
}

/* Métodos de pagamento (PIX/Boleto) - Layout melhorado */
.pmp-payment-method-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    margin: 12px 0;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.pmp-payment-method-row:hover {
    background-color: #e9ecef;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.pmp-payment-method-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-grow: 1;
}

.pmp-payment-method-icon {
    font-size: 28px;
    color: #009ee3;
    min-width: 32px;
    text-align: center;
}

/* Ícone específico para PIX */
.pmp-payment-method-icon.pmp-pix-icon {
    background: linear-gradient(135deg, #4c956c, #2d6a4f);
    color: white;
    border-radius: 6px;
    padding: 4px;
    font-size: 20px;
}

/* Ícone específico para Boleto */
.pmp-payment-method-icon.pmp-boleto-icon {
    background: linear-gradient(135deg, #ff7b00, #e56600);
    color: white;
    border-radius: 6px;
    padding: 4px;
    font-size: 20px;
}

.pmp-payment-method-name {
    font-weight: 600;
    color: #333;
    margin: 0;
    font-size: 16px;
}

.pmp-payment-method-price {
    font-weight: bold;
    color: #2d5a27;
    font-size: 18px;
    white-space: nowrap;
    padding: 8px 15px;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(76, 175, 80, 0.2);
}

/* Layout em linha única quando configurado */
.pmp-payment-methods-inline .pmp-payment-method-row {
    display: inline-flex;
    margin: 8px 8px 8px 0;
    min-width: 200px;
    vertical-align: top;
}

.pmp-payment-methods-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Esconder elementos conforme configuração */
.pmp-hidden-element {
    display: none !important;
}

/* Footer do modal - altura fixa para cálculo correto do scroll */
.pmp-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e1e1e1;
    background: #f8f9fa;
    flex-shrink: 0; /* Não permite que o footer encolha */
    min-height: 50px; /* Altura mínima garantida */
    box-sizing: border-box;
}

.pmp-pull-right {
    float: right;
}

/* Ícones */
.pmp-icon-inline {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: middle;
}

.pmp-svg-icon-secondary {
    fill: #666;
}

/* Responsividade aprimorada - múltiplos breakpoints */
@media (max-width: 1200px) {
    .pmp-modal-content {
        width: 95%;
    }
    
    .pmp-payment-method-row {
        flex-direction: row;
        align-items: center;
    }
    
    .pmp-payment-logos {
        justify-content: center;
        gap: 8px;
    }
}

@media (max-width: 992px) {
    .pmp-modal-content {
        width: 98%;
        margin: 10px auto;
    }
    
    .pmp-payment-section {
        padding: 15px;
        margin-bottom: 25px;
    }
    
    .pmp-h6 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .pmp-h4 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .pmp-payment-logos {
        flex-wrap: wrap;
        justify-content: center;
    }
    
  
}

@media (max-width: 768px) {
    .pmp-modal {
        padding: 5px; /* Reduz padding em dispositivos móveis */
        align-items: flex-start;
        padding-top: 20px;
    }
    
    .pmp-modal-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        height: 100vh;
        max-height: 100vh;
    }
    
    .pmp-modal-header {
        padding: 12px 15px;
        min-height: 45px;
        flex-shrink: 0;
    }
    
    .pmp-modal-header h3 {
        font-size: 16px;
    }
    
    .pmp-modal-body {
        padding: 15px;
        height: calc(100vh - 90px); /* Subtrai header + footer */
    }
    
    .pmp-modal-footer {
        padding: 8px 15px;
        min-height: 35px;
        flex-shrink: 0;
    }
    
    .pmp-table {
        font-size: 13px;
    }
    
    .pmp-table td {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .pmp-payment-logos {
        gap: 5px;
        padding: 15px 10px;
        flex-wrap: wrap;
        justify-content: center;
    }
    

    
    .pmp-payment-method-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
        gap: 10px;
    }
    
    .pmp-payment-method-left {
        width: 100%;
        justify-content: flex-start;
    }
    
    .pmp-payment-method-price {
        align-self: flex-end;
        font-size: 16px;
        padding: 6px 12px;
    }
    
    .pmp-payment-method-name {
        font-size: 14px;
    }
    
    .pmp-payment-method-icon {
        font-size: 24px;
        min-width: 28px;
    }
    
    .pmp-payment-section {
        padding: 12px;
        margin-bottom: 20px;
    }
    
    .pmp-h6 {
        font-size: 15px;
        margin-bottom: 10px;
    }
    
    .pmp-h4 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .pmp-tab-group {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .pmp-tab {
        margin-right: 0;
        flex: 1;
        text-align: center;
        min-width: 120px;
    }
    
    .pmp-tab-link {
        padding: 8px 5px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .pmp-modal {
        padding: 0;
    }
    
    .pmp-modal-content {
        border-radius: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        min-height: 100vh;
    }
    
    .pmp-modal-header {
        padding: 10px 12px;
        min-height: 40px;
    }
    
    .pmp-modal-header h3 {
        font-size: 14px;
    }
    
    .pmp-modal-body {
        padding: 12px;
        height: calc(100vh - 75px);
    }
    
    .pmp-modal-footer {
        padding: 6px 12px;
        min-height: 30px;
    }
    
    .pmp-payment-method-row {
        padding: 12px;
        margin: 8px 0;
    }
    
    .pmp-payment-method-price {
        font-size: 14px;
        padding: 5px 10px;
    }
    
    .pmp-payment-method-icon {
        font-size: 20px;
        min-width: 24px;
    }
    

    
    .pmp-payment-logos {
        padding: 10px 8px;
        gap: 3px;
    }
    
    .pmp-table td {
        padding: 4px 6px;
        font-size: 11px;
    }
    
    .pmp-payment-section {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .pmp-h6 {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .pmp-h4 {
        font-size: 15px;
        margin-bottom: 10px;
    }
    
    .pmp-tab {
        min-width: 100px;
        font-size: 12px;
    }
    
    .pmp-tab-link {
        padding: 6px 3px;
        font-size: 12px;
    }
}

@media (max-width: 320px) {
    .pmp-modal-body {
        padding: 8px;
    }
    
    .pmp-payment-method-row {
        padding: 8px;
    }
    
    .pmp-payment-section {
        padding: 8px;
    }
    

    
    .pmp-payment-method-icon {
        font-size: 18px;
        min-width: 22px;
    }
    
    .pmp-h6 {
        font-size: 13px;
    }
    
    .pmp-h4 {
        font-size: 14px;
    }
}

/* Estilos específicos para Elementor - garante que o modal sempre tenha scroll interno */
.elementor-widget-pmp-modal-parcelamento .pmp-modal-body {
    overflow-y: auto;
    flex: 1;
}

/* Animações básicas */
.pmp-modal {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pmp-modal.pmp-show {
    opacity: 1;
    pointer-events: auto; /* Garante que apenas o modal receba eventos */
}

.pmp-modal-content {
    transform: scale(0.7);
    transition: transform 0.3s ease;
}

.pmp-modal.pmp-show .pmp-modal-content {
    transform: scale(1);
}

/* Variações básicas do botão */
.pmp-modal-button.pmp-btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.pmp-modal-button.pmp-btn-large {
    padding: 15px 30px;
    font-size: 16px;
}

.pmp-modal-button.pmp-btn-outline {
    background: transparent;
    color: #009ee3;
    border: 1px solid #009ee3;
}

.pmp-modal-button.pmp-btn-outline:hover {
    background: #009ee3;
    color: white;
}

.pmp-modal-button.btn-block {
    width: 100%;
    display: block;
}

/* Nota: Classes especiais para elementos controlados pelo Elementor 
   podem ser customizadas através do painel do Elementor:
   - .elementor-widget-pmp-modal-parcelamento 
   - Permite sobrescrever estilos via interface visual */

/* Prévia de parcelamento */
.pmp-installments-preview {
    margin-bottom: 10px;
    font-weight: 500;
    color: #4CAF50;
}

/* Classes responsivas específicas adicionadas via JavaScript */
.pmp-mobile .pmp-payment-logos.pmp-mobile-layout {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 12px;
}

.pmp-mobile .pmp-payment-method-row.pmp-mobile-layout {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.pmp-mobile .pmp-table.pmp-mobile-layout {
    font-size: 13px;
}

.pmp-mobile .pmp-table.pmp-mobile-layout td {
    padding: 6px 8px;
    word-wrap: break-word;
}

.pmp-mobile-small .pmp-payment-logos.pmp-compact-mobile {
    gap: 3px;
    padding: 8px;
}

.pmp-mobile-small .pmp-payment-method-row.pmp-compact-mobile {
    padding: 8px;
    margin: 6px 0;
}

.pmp-mobile-small .pmp-table.pmp-compact-mobile {
    font-size: 11px;
}

.pmp-mobile-small .pmp-table.pmp-compact-mobile td {
    padding: 4px 6px;
}

/* Otimizações para touch devices */
.pmp-modal.pmp-touch-device .pmp-modal-close {
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
}

.pmp-modal.pmp-touch-device .pmp-btn-link {
    min-height: 44px;
    padding: 10px 15px;
}

.pmp-modal.pmp-touch-device .pmp-tab-link {
    min-height: 44px;
    padding: 12px 8px;
}

/* Landscape mode em dispositivos móveis */
@media (max-height: 500px) and (orientation: landscape) {
    .pmp-modal-content {
        height: 100vh !important;
        max-height: 100vh !important;
    }
    
    .pmp-modal-header {
        padding: 8px 15px !important;
        min-height: 35px !important;
    }
    
    .pmp-modal-body {
        padding: 10px 15px !important;
        height: calc(100vh - 70px) !important;
    }
    
    .pmp-modal-footer {
        padding: 5px 15px !important;
        min-height: 30px !important;
    }
    
    .pmp-payment-section {
        margin-bottom: 10px !important;
        padding: 8px !important;
    }
    
    .pmp-h6 {
        font-size: 13px !important;
        margin-bottom: 6px !important;
    }
}

/* Estilos específicos para garantir prioridade do scroll do modal */
.pmp-modal.pmp-show {
    opacity: 1;
    pointer-events: auto; /* Garante que apenas o modal receba eventos */
}

.pmp-modal:not(.pmp-show) {
    pointer-events: none; /* Bloqueia eventos quando modal não está visível */
}

.pmp-modal-body:focus {
    outline: none; /* Remove outline do foco */
}

.pmp-modal-body::-webkit-scrollbar {
    width: 8px;
    z-index: 999999; /* Z-index alto para a scrollbar */
}

.pmp-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
    position: relative;
    z-index: 999999;
}

.pmp-modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    position: relative;
    z-index: 999999;
}

.pmp-modal-body::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Bloqueia scroll da página de forma mais agressiva */
body.pmp-modal-open * {
    -webkit-overflow-scrolling: auto !important;
}

body.pmp-modal-open *:not(.pmp-modal):not(.pmp-modal *) {
    overflow: hidden !important;
    pointer-events: none !important;
}

body.pmp-modal-open .pmp-modal * {
    pointer-events: auto !important;
}

/* Força contenção de scroll no modal */
.pmp-modal-body {
    contain: layout style paint; /* CSS Containment para performance */
    isolation: isolate; /* Cria novo contexto de stacking */
}

/* Previne propagação de eventos de scroll para elementos pai */
.pmp-modal-body,
.pmp-modal-content,
.pmp-modal {
    overscroll-behavior-y: contain;
    overscroll-behavior-x: contain;
}

/* Estilos para garantir que o modal funcione corretamente em diferentes navegadores */
@supports (-webkit-overflow-scrolling: touch) {
    .pmp-modal-body {
        -webkit-overflow-scrolling: touch;
        transform: translateZ(0); /* Força aceleração de hardware */
    }
}

/* Para navegadores que suportam scroll-snap */
@supports (scroll-snap-type: y mandatory) {
    .pmp-modal-body {
        scroll-snap-type: none; /* Desabilita scroll-snap no modal */
    }
}
