/* ========== CSS VARIABLES FOR CUSTOM COLORS ========== */
:root {
    --sm-progress-low: #f44336;
    --sm-progress-medium-low: #ff9800;
    --sm-progress-medium: #2196f3;
    --sm-progress-high: #4caf50;
}

.supermembros-carousel-wrapper {
    position: relative;
    width: 100%;
    margin: 20px 0;
}

.supermembros-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 15px;
    padding: 10px 0;
    scroll-behavior: smooth;
    /* Melhorar performance do scroll/swipe */
    will-change: scroll-position;
    -webkit-transform: translateZ(0); /* Force hardware acceleration */
}

.supermembros-carousel::-webkit-scrollbar {
    display: none; /* Hide scrollbar completely */
}

.supermembros-carousel {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

/* Estado durante swipe */
.supermembros-carousel.swiping {
    scroll-snap-type: none; /* Desabilitar snap durante swipe */
    scroll-behavior: auto; /* Movimento instantâneo durante swipe */
}

/* Dica de swipe */
.swipe-hint {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-align: center;
    user-select: none;
    pointer-events: none;
}

.carousel-item {
    flex: 0 0 auto;
    width: 250px;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    scroll-snap-align: start;
}

.carousel-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.carousel-item.grayscale img {
    filter: grayscale(100%);
}

.course-link {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
    z-index: 5; /* Garantir que os links estejam acima de outros elementos */
}

.carousel-item img {
    width: 100%;
    height: auto; /* Mantém tamanho original da imagem */
    object-fit: cover;
    display: block;
    transition: filter 0.3s ease;
}

.no-image {
    width: 100%;
    height: 150px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #666;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.lock-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 10;
}

.placeholder-image {
    width: 100%;
    height: 150px;
    background: #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #666;
    border: 2px dashed #ccc;
    box-sizing: border-box;
    text-align: center;
    padding: 10px;
}

/* ========== PROGRESS INDICATOR STYLES ========== */

.progress-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.8);
    color: white;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 5;
}

.progress-bar {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 4px;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.3s ease;
    z-index: 1;
}

.progress-text {
    font-size: 12px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    z-index: 2;
    position: relative;
    margin-left: auto;
}

/* Progress indicator on hover */
.carousel-item:hover .progress-indicator {
    background: rgba(0,0,0,0.9);
}

.carousel-item:hover .progress-bar {
    height: 6px;
    background: linear-gradient(90deg, #66BB6A, #9CCC65);
}

/* ========== FLIP BOX STYLES ========== */

.flip-box-enabled {
    perspective: 1000px;
    height: auto; /* Garante que a altura se ajuste ao conteúdo */
}

.elementor-flip-box {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-box-enabled:hover .elementor-flip-box {
    transform: rotateY(180deg);
}

.flip-box--direction-left:hover .elementor-flip-box {
    transform: rotateY(-180deg);
}

.flip-box--direction-up:hover .elementor-flip-box {
    transform: rotateX(180deg);
}

.flip-box--direction-down:hover .elementor-flip-box {
    transform: rotateX(-180deg);
}

.elementor-flip-box__layer {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    overflow: hidden;
    top: 0;
    left: 0;
}

.elementor-flip-box__front {
    z-index: 2;
    position: relative; /* Mudança importante */
}

.elementor-flip-box__back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: absolute;
}

.flip-box--direction-left .elementor-flip-box__back {
    transform: rotateY(-180deg);
}

.flip-box--direction-up .elementor-flip-box__back {
    transform: rotateX(180deg);
}

.flip-box--direction-down .elementor-flip-box__back {
    transform: rotateX(-180deg);
}

.elementor-flip-box__layer__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Front side - estrutura simplificada sem overlay/inner */
.elementor-flip-box__front {
    z-index: 2;
    position: relative;
}

.elementor-flip-box__front img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    border-radius: 10px;
}

.elementor-flip-box__front .no-image {
    width: 100%;
    height: 150px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #666;
    text-align: center;
    border-radius: 10px;
}

/* Back side - com flex para centralizar botão */
.elementor-flip-box__back .elementor-flip-box__layer__inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

/* Lock icon no flip box - agora direto no front */
.flip-box-enabled .elementor-flip-box__front .lock-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
}

/* Progress indicator no flip box */
.flip-box-enabled .elementor-flip-box__front .progress-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 15;
}

.elementor-flip-box__button {
    display: inline-block;
    padding: 12px 24px;
    background: #fff;
    color: #333;
    text-decoration: none;
    border-radius: 25px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.elementor-flip-box__button:hover {
    background: #333;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Button Sizes */
.elementor-size-xs {
    padding: 6px 12px;
    font-size: 10px;
}

.elementor-size-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.elementor-size-md {
    padding: 12px 24px;
    font-size: 14px;
}

.elementor-size-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.elementor-size-xl {
    padding: 20px 40px;
    font-size: 18px;
}

/* Non-3D Effect (for when 3D is disabled) */
.flip-box-enabled:not(.flip-box--3d) .elementor-flip-box {
    transform-style: flat;
}

.flip-box-enabled:not(.flip-box--3d):hover .elementor-flip-box {
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
    .supermembros-carousel-wrapper {
        margin: 20px 0 10px 0;
        position: relative;
        /* Importante: permitir overflow para o swipe funcionar */
        overflow: visible;
    }
    
    .supermembros-carousel {
        gap: 15px;
        padding: 10px 15px;
        scroll-snap-type: x mandatory;
        overflow-x: auto;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling no iOS */
        display: flex;
        width: auto;
        /* Melhorar responsividade do swipe */
        overscroll-behavior-x: contain; /* Evitar scroll da página durante swipe */
        touch-action: pan-x; /* Permitir apenas swipe horizontal */
    }
    
    .supermembros-carousel::-webkit-scrollbar {
        display: none; /* Hide scrollbar on mobile */
    }
    
    .carousel-item {
        width: calc((100vw - 60px) / 2); /* Exatamente 2 cards visíveis */
        min-width: calc((100vw - 60px) / 2);
        max-width: 180px;
        flex-shrink: 0; /* Evitar que cards encolham */
        scroll-snap-align: start; /* Snap no início de cada card */
        scroll-snap-stop: normal; /* Permitir scroll fluido através de múltiplos cards */
    }
    
    /* Feedback visual durante swipe */
    .supermembros-carousel.swiping .carousel-item {
        transition: transform 0.1s ease-out;
    }
    
    /* Indicador de autoplay no mobile */
    .supermembros-carousel[data-enable-autoplay="yes"]::before {
        width: 20px;
        height: 20px;
        font-size: 10px;
        top: 10px;
        right: 10px;
    }
    
    .elementor-flip-box__button {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .progress-text {
        font-size: 11px;
    }
    
    .progress-indicator {
        height: 25px;
        padding: 0 8px;
    }
    
    /* Garantir que touch-action funcione nos cards */
    .course-link {
        touch-action: manipulation; /* Permite cliques rápidos */
        /* Adicionar área de toque maior para facilitar cliques */
        position: relative;
    }
    
    /* Aumentar área clicável no mobile */
    .course-link::before {
        content: '';
        position: absolute;
        top: -5px;
        left: -5px;
        right: -5px;
        bottom: -5px;
        z-index: -1;
    }
}

@media (max-width: 480px) {
    .carousel-item {
        width: calc((100vw - 50px) / 2); /* Exatamente 2 cards visíveis em telas pequenas */
        min-width: calc((100vw - 50px) / 2);
        max-width: 160px;
        flex-shrink: 0;
    }
    
    .supermembros-carousel {
        gap: 10px;
        padding: 10px 15px;
    }
    
    .elementor-flip-box__button {
        padding: 6px 12px;
        font-size: 10px;
    }
    
    .elementor-flip-box__layer__inner {
        padding: 15px;
    }
    
    .progress-text {
        font-size: 10px;
    }
    
    .progress-indicator {
        height: 20px;
        padding: 0 6px;
    }
    
    .progress-bar {
        height: 3px;
    }
}