/* ================================================
   PARCELAMENTO PIX PLUGIN - CSS COMPLETO v1.0.0
   ================================================ */

/* Estilos gerais */
.container-parcelamento {
    margin: 10px 0;
    font-family: inherit;
    line-height: 1.4;
}

.container-parcelamento.grid-loop {
    margin: 5px 0;
    border-top: 1px solid #ededed;

}

.container-parcelamento.single-product-price {
    margin: 15px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.container-parcelamento.single-product-button-only {
    margin: 10px 0;
}

.container-parcelamento.single-product-price .pix-icon {
    background: #32bcad;
    color: #f9f9f9;
    font-size: 14px;
}

.container-parcelamento .single-product-price .pix-price {
    font-size: 18px;
}

.container-parcelamento .single-product-price .pix-price {
    font-size: 18px;
}


/* Estilo PIX */
.pix-discount {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
    flex-wrap: wrap;
}

.pix-icon {
    background: white;
    color: #4b9b92;
    padding: 2px 4px;
    border: 1px solid #ededed;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pix-price {
    font-size: 16px;
    font-weight: bold;
    color: #32BCAD;
    margin: 0;
}

.pix-discount-text {
    font-size: 11px;
    color: #878787;
    font-style: italic;
}

/* Informações de parcelamento */
.installment-info {
    margin: 5px 0;
    font-size: 13.2px;
    color: #555;
    line-height: 1.3;
}

.installment-info-small {
    margin: 3px 0;
    font-size: 12px;
    color: #777;
    line-height: 1.3;
}

.installment-text,
.installment-text-small {
    display: inline-block;
}

/* Botão de detalhes */
.installment-details-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    display: inline-block;
}

.installment-details-btn:hover {
    background: #32BCAD;
    border-color: #32BCAD;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(50, 188, 173, 0.2);
}

.installment-details-btn:active {
    transform: translateY(0);
}

/* Tabela de parcelamento na página do produto */
.installment-table-container {
    margin: 20px 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
}

.pix-highlight {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #32BCAD 0%, #2A9D8F 100%);
    border-radius: 8px;
    color: white;
}

.pix-icon-large {
    font-size: 24px;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 15px;
    border-radius: 6px;
    letter-spacing: 1px;
}

.pix-info {
    flex: 1;
}

.pix-price-large {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 5px;
}

.pix-discount-large {
    font-size: 14px;
    opacity: 0.9;
}

/* Grid de parcelamento */
.installment-options h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.installment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.installment-option {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

.installment-option:hover {
    border-color: #32BCAD;
    box-shadow: 0 4px 12px rgba(50, 188, 173, 0.15);
    transform: translateY(-2px);
}

.installment-option.no-interest {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
}

.installment-option.no-interest:hover {
    border-color: #28a745;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.15);
}

.installment-number {
    font-weight: bold;
    color: #333;
    font-size: 18px;
    margin-bottom: 5px;
}

.installment-value {
    font-size: 16px;
    color: #666;
    margin: 8px 0;
    font-weight: 600;
}

.installment-total {
    margin-top: 8px;
}

.no-interest-text {
    color: #28a745;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.interest-text {
    color: #666;
    font-size: 11px;
}

/* ================================================
   BANDEIRAS DE CARTÃO - VERSÃO LIMPA
   ================================================ */

.credit-card-flags,
.card-flags {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.credit-card-flags img,
.card-flags img {
    height: 28px;
    width: auto;
    display: block;
}

/* Mobile - layout vertical e imagens menores */
@media (max-width: 480px) {
    .credit-card-flags,
    .card-flags {
        padding: 10px;
        gap: 6px;
    }
    
    .credit-card-flags img,
    .card-flags img {
        height: 20px;
    }
}

/* Mobile - layout grid loop adaptado */
@media (max-width: 480px) {
    .container-parcelamento.grid-loop .pix-price {
    font-size: 12px;
}

.container-parcelamento.grid-loop .pix-discount-text {
    font-size: 8px;
}

.container-parcelamento.grid-loop .installment-info {
    font-size: 9px;
}

.container-parcelamento.grid-loop .installment-info-small {
    font-size: 8.5px;
}

.container-parcelamento.grid-loop .pix-icon {
    padding: 0px 3px;
    font-size: 10px;
}


}

/* Popup cards section - mobile específico */
@media (max-width: 480px) {
    .popup-cards-section {
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid #e0e0e0;
    }
    
    .popup-cards-section h4 {
        font-size: 14px;
        margin-bottom: 8px;
        text-align: center;
    }
}

/* Popup de parcelamento */
.installment-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.popup-content {
    position: relative;
    background: white;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.popup-header h3 {
    margin: 0;
    color: #333;
}

.popup-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.popup-close:hover {
    color: #333;
    background: #f0f0f0;
}

.popup-body {
    padding: 20px;
}

.popup-pix-section {
    margin-bottom: 20px;
}

.popup-pix-highlight {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #32BCAD 0%, #2A9D8F 100%);
    border-radius: 8px;
    color: white;
}

.popup-pix-highlight .pix-icon {
    background: #ffffff;
    color: #32BCAD;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
}

.popup-pix-highlight .pix-price {
    font-size: 24px;
    font-weight: bold;
    color: white;
}

.popup-pix-highlight .pix-discount {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

/* Tabela no popup */
.installment-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
}

.installment-table th,
.installment-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.installment-table th {
    background: #f8f9fa;
    font-weight: bold;
    color: #333;
}

.installment-table tr:hover {
    background: #f8f9fa;
}

.no-interest-row {
    background: #f8fff9;
}

.no-interest-badge {
    background: #28a745;
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
}

.popup-cards-section h4 {
    margin-bottom: 10px;
    color: #333;
}

.card-flags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.card-flags img {
    height: 38px;
    width: auto;
}

/* Estados de loading */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.loading::after {
    content: "...";
    animation: loading 1s infinite;
}

/* Elementor widgets */
.elementor-parcelamento-widget {
    font-family: inherit;
}

.elementor-pix-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
}

.elementor-installment-compact {
    margin: 8px 0;
    font-size: 14px;
    color: #555;
}

.elementor-installment-full {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.elementor-installment-full .installment-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f9f9f9;
    border-radius: 4px;
}

.elementor-installment-full .no-interest {
    color: #28a745;
    font-size: 12px;
    font-weight: bold;
}

/* Compatibilidade com Shoptimizer */
.shoptimizer-loop .custom-price-display {
    margin-top: 10px;
}

/* ================================================
   ANIMAÇÕES E EFEITOS
   ================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loading {
    0% { content: "..."; }
    33% { content: "..."; }
    66% { content: "..."; }
    100% { content: "..."; }
}

/* ================================================
   RESPONSIVIDADE
   ================================================ */

@media (max-width: 768px) {
    .installment-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 8px;
    }
    
    .pix-highlight {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .popup-content {
        width: 95%;
        max-height: 90vh;
    }

    .installment-table {
        font-size: 14px;
    }

    .installment-table th,
    .installment-table td {
        padding: 8px;
    }
    
    .pix-discount {
    flex-direction: row;
    align-items: center;
    gap: 4px;
}
    
    .installment-details-btn {
        width: 100%;
        text-align: center;
    }
}

/* Mobile - 2 colunas otimizadas */
@media (max-width: 480px) {
    .installment-table {
        display: block;
        border: none;
    }
    
    .installment-table thead {
        display: none;
    }
    
    .installment-table tbody {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .installment-table tr {
        display: block;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 12px;
        background: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .installment-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        padding: 1px 0;
        border-bottom: 1px solid #f0f0f0;
        font-size: 13px;
    }
    
    .installment-table td:last-child {
        border-bottom: none;
        font-weight: bold;
    }
    
    .installment-table td:before {
        content: attr(data-label) ":";
        font-weight: 600;
        color: #666;
        min-width: 50px;
        font-size: 12px;
    }
    
    /* Destacar primeira linha (Parcelas) */
    .installment-table td:first-child {
        font-weight: bold;
        color: #32BCAD;
        margin-bottom: 3px;
    }
    
    .installment-table td:first-child:before {
        color: #32BCAD;
    }
    
    /* Badge sem juros menor */
    .no-interest-badge {
        font-size: 9px;
        padding: 1px 4px;
    }
}

/* Para telas muito pequenas - 1 coluna */
@media (max-width: 350px) {
    .installment-table tbody {
        grid-template-columns: 1fr;
    }
}

/* ================================================
   ACESSIBILIDADE
   ================================================ */

.installment-details-btn:focus,
.popup-close:focus {
    outline: 2px solid #32BCAD;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .pix-icon {
        background: #000;
        color: #fff;
    }
    
    .pix-price {
        color: #000;
    }

    .installment-option {
        border-color: #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .installment-option,
    .installment-details-btn,
    .credit-card-flags img {
        transition: none;
    }
    
    .installment-popup {
        animation: none;
    }
}