/* Carrossel Container */
.cpw2-carousel-container { /* Renomeado para .cpw2-container no PHP, mas mantido aqui para compatibilidade */
    position: relative;
    width: 100%;
    overflow: hidden;
    margin: 20px 0;
}

/* Container principal (agora .cpw2-container) */
.cpw2-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
}

/* Estilos específicos para o modo carrossel */
.cpw2-container.carousel {
    overflow: hidden; /* Esconde o overflow para o carrossel */
}

/* Carousel Wrapper */
.cpw2-carousel-wrapper {
    overflow: hidden;
    width: 100%;
    position: relative;
}

/* Carousel Track */
.cpw2-carousel {
    display: flex;
    transition: transform 0.5s ease-in-out;
    gap: 15px;
    padding: 0 10px;
    will-change: transform;
}

/* Product Items */
.cpw2-item {
    flex: 0 0 auto;
    text-align: center;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #f0f0f0;
}

.cpw2-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.cpw2-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
}

.cpw2-item h3 {
    margin: 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    height: auto;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow-wrap: break-word;
    word-break: break-word;
}

.cpw2-desc {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.3;
    height: auto;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow-wrap: break-word;
}

.cpw2-price {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 12px;
    color: #e91e63;
}

.cpw2-button {
    display: inline-block;
    padding: 8px 16px;
    color: #fff;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #FF007A;
}

.cpw2-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 0, 122, 0.3);
    background: #E6006B;
}

/* Navigation Arrows */
.cpw2-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none !important;
    border: none;
    border-radius: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    color: #333;
    box-shadow: none !important;
}

.cpw2-nav:hover {
    background: none !important;
    transform: translateY(-50%) scale(1.1);
}

.cpw2-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.cpw2-nav-prev {
    left: -22px;
}

.cpw2-nav-next {
    right: -22px;
}

/* Remove qualquer fundo de ícones ou pseudo-elementos */
.cpw2-nav svg, 
.cpw2-nav::before, 
.cpw2-nav::after {
    background: none !important;
    fill: currentColor;
}

/* Dots Navigation */
.cpw2-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.cpw2-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cpw2-dot.active,
.cpw2-dot:hover {
    background: #FF007A;
    transform: scale(1.2);
}

/* Estilos para o Modo Grid */

/* O container principal quando está no modo grid */
.cpw2-container.grid {
    overflow: visible; /* Permite que o grid se expanda sem cortes */
}

/* O container dos itens no modo grid */
.cpw2-grid {
    display: grid;
    /* grid-template-columns e gap são definidos dinamicamente pelo Elementor */
    padding: 0 10px; /* Mantém o padding horizontal */
}

/* Itens individuais no modo grid */
.cpw2-container.grid .cpw2-item {
    width: auto; 
    min-width: auto;
    max-width: auto;
    margin-right: 0; 
    flex: 1 1 auto;
}

/* Esconder elementos de navegação do carrossel quando em modo grid */
.cpw2-container.grid .cpw2-nav,
.cpw2-container.grid .cpw2-dots,
.cpw2-container.grid .cpw2-carousel-wrapper {
    display: none;
}

/* Responsive Design */

/* Desktop - 5 items per view (para carrossel) */
@media (min-width: 1200px) {
    .cpw2-item {
        width: calc(20% - 12px);
        min-height: 320px;
    }
}

/* Large Tablet - 4 items per view (para carrossel) */
@media (min-width: 992px) and (max-width: 1199px) {
    .cpw2-item {
        width: calc(25% - 12px);
        min-height: 300px;
    }
}

/* Tablet - 3 items per view (para carrossel) */
@media (min-width: 768px) and (max-width: 991px) {
    .cpw2-item {
        width: calc(33.333% - 10px);
        min-height: 280px;
    }
    
    .cpw2-nav {
        width: 40px;
        height: 40px;
    }
    
    .cpw2-nav-prev {
        left: -20px;
    }
    
    .cpw2-nav-next {
        right: -20px;
    }
    
    .cpw2-item img {
        height: 160px;
    }
}

/* Mobile - 2 items per view - CORRIGIDO (para carrossel) */
@media (max-width: 767px) { /* Alterado para 767px para evitar sobreposição com breakpoint do tablet */
    .cpw2-container.carousel .cpw2-carousel-container {
        margin: 0;
        padding: 0;
    }

    .cpw2-container.carousel .cpw2-carousel {
        display: flex;
        gap: 0;
        padding: 0;
    }

    .cpw2-container.carousel .cpw2-item {
        flex: 0 0 50%;
        max-width: 50%;
        min-width: 50%;
        margin-right: 5px;
        box-sizing: border-box;
    }

    .cpw2-container.carousel .cpw2-item:last-child {
        margin-right: 0;
    }

    .cpw2-item img {
        width: 100%;
        height: auto;
        display: block;
    }

    .cpw2-item h3 {
        font-size: 13px;
        height: auto;
        min-height: 40px;
        margin: 6px 0;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
    
    .cpw2-desc {
        font-size: 11px;
        height: auto;
        min-height: 32px;
        margin-bottom: 8px;
        white-space: normal;
        overflow: visible;
    }
    
    .cpw2-price {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .cpw2-button {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .cpw2-nav {
        width: 36px;
        height: 36px;
    }
    
    .cpw2-nav-prev {
        left: 10px;
    }
    
    .cpw2-nav-next {
        right: 10px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .cpw2-container.carousel .cpw2-carousel-container {
        padding: 0 35px;
    }
    
    .cpw2-container.carousel .cpw2-carousel {
        gap: 6px;
    }
    
    .cpw2-container.carousel .cpw2-item {
        width: calc(50% - 3px);
        min-width: calc(50% - 3px);
        max-width: calc(50% - 3px);
        min-height: 260px;
        padding: 10px;
    }
    
    .cpw2-item img {
        height: 100px;
    }
    
    .cpw2-nav {
        width: 32px;
        height: 32px;
    }
    
    .cpw2-nav-prev {
        left: 8px;
    }
    
    .cpw2-nav-next {
        right: 8px;
    }
    
    .cpw2-item h3 {
        font-size: 12px;
        min-height: 36px;
    }
    
    .cpw2-desc {
        font-size: 10px;
        min-height: 28px;
    }
    
    .cpw2-price {
        font-size: 13px;
    }
}

/* Loading animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cpw2-item {
    animation: fadeInUp 0.6s ease-out;
}

/* Smooth transitions */
.cpw2-carousel {
    scroll-behavior: smooth;
}

/* Fix for potential overflow issues */
.cpw2-carousel-wrapper {
    position: relative;
    width: 100%;
}

/* Ensure proper flexbox behavior */
.cpw2-carousel {
    flex-wrap: nowrap;
    align-items: stretch;
}

/* CORREÇÃO: Evita corte no carrossel no mobile */
@media (max-width: 767px) {
    .cpw2-container.carousel .cpw2-carousel {
        gap: 0 !important;
        padding: 0 !important;
    }

    .cpw2-container.carousel .cpw2-item {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        min-width: 50% !important;
        margin: 0 !important; /* Remove espaço extra */
        box-sizing: border-box;
    }
}
