/**
 * TF Product Viewers - Estilos
 * Compatível com Flatsome Theme
 */

.tfpv-viewers-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    margin: 12px 0 18px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.2px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    border: 0;
    transition: opacity 0.3s ease;
    /* fallback caso CSS inline não carregue */
    background: #fde8ec;
    color: #333;
    border-radius: 6px;
}

.tfpv-viewers-box .tfpv-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 0;
}

.tfpv-viewers-box .tfpv-icon svg {
    width: 20px;
    height: 20px;
    /* fallback */
    stroke: #e91e63;
}

.tfpv-viewers-box .tfpv-text {
    flex: 1;
    margin: 0;
    padding: 0;
}

.tfpv-viewers-box .tfpv-count {
    font-weight: 700;
    transition: opacity 0.2s ease;
}

.tfpv-viewers-box .tfpv-count.tfpv-pulse {
    animation: tfpvPulse 0.6s ease;
}

@keyframes tfpvPulse {
    0%   { opacity: 0.4; transform: scale(0.92); }
    50%  { opacity: 1;   transform: scale(1.06); }
    100% { opacity: 1;   transform: scale(1); }
}

.tfpv-count {
    display: inline-block;
}

/* Mobile */
@media (max-width: 549px) {
    .tfpv-viewers-box {
        padding: 10px 14px;
        font-size: 12px;
        gap: 8px;
    }
    .tfpv-viewers-box .tfpv-icon svg {
        width: 18px;
        height: 18px;
    }
}

/* ============================
   Flatsome-specific fixes
   ============================ */

/* Garante que o box fique dentro da .product-info / .summary do Flatsome */
.product-info .tfpv-viewers-box,
.summary .tfpv-viewers-box,
.product-page-content .tfpv-viewers-box {
    clear: both;
}

/* Evita conflito com sticky-add-to-cart do Flatsome */
.sticky-add-to-cart .tfpv-viewers-box,
.product-footer .tfpv-viewers-box {
    display: none !important;
}

/* Evita que o texto seja afetado por estilos globais do Flatsome em strong */
.tfpv-viewers-box strong {
    color: inherit;
    font-weight: 700;
}

/* Garante visibilidade quando o tema usa visibility:hidden em elementos novos */
.tfpv-viewers-box {
    visibility: visible !important;
    opacity: 1;
}

/* RTL */
.rtl .tfpv-viewers-box {
    direction: rtl;
}

/* ============================
   POPUP (flutuante)
   ============================ */

.tfpv-popup {
    position: fixed;
    z-index: 999998; /* abaixo de modais críticos como o carrinho lateral do FunnelKit (999999+) */
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    max-width: 340px;
    min-width: 240px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.2px;
    box-sizing: border-box;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
    /* estado inicial: escondido */
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    /* fallbacks */
    background: #fff;
    color: #333;
    border-radius: 8px;
}

.tfpv-popup.tfpv-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.tfpv-popup .tfpv-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 0;
}

.tfpv-popup .tfpv-icon svg {
    width: 20px;
    height: 20px;
    stroke: #e91e63;
}

.tfpv-popup .tfpv-text {
    flex: 1;
    margin: 0;
    padding: 0;
}

.tfpv-popup .tfpv-count {
    font-weight: 700;
}

.tfpv-popup strong {
    color: inherit;
    font-weight: 700;
}

.tfpv-popup .tfpv-close {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0 -4px 0 4px;
    width: 22px;
    height: 22px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.55;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}
.tfpv-popup .tfpv-close:hover {
    opacity: 1;
}

/* Posições (desktop) */
.tfpv-popup.tfpv-pos-bottom-left  { bottom: 20px; left: 20px; }
.tfpv-popup.tfpv-pos-bottom-right { bottom: 20px; right: 20px; }
.tfpv-popup.tfpv-pos-top-left     { top: 20px; left: 20px; }
.tfpv-popup.tfpv-pos-top-right    { top: 20px; right: 20px; }

/* Direção de entrada muda conforme posição */
.tfpv-popup.tfpv-pos-top-left,
.tfpv-popup.tfpv-pos-top-right {
    transform: translateY(-20px);
}
.tfpv-popup.tfpv-pos-top-left.tfpv-visible,
.tfpv-popup.tfpv-pos-top-right.tfpv-visible {
    transform: translateY(0);
}

/* Popup no mobile: sempre em baixo com margens laterais */
@media (max-width: 549px) {
    .tfpv-popup {
        left: 10px !important;
        right: 10px !important;
        max-width: none;
        min-width: 0;
        bottom: 10px !important;
        top: auto !important;
        transform: translateY(20px);
        padding: 10px 14px;
        font-size: 12px;
    }
    .tfpv-popup.tfpv-visible {
        transform: translateY(0);
    }
    .tfpv-popup .tfpv-icon svg {
        width: 18px;
        height: 18px;
    }
}

/* Respeita prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .tfpv-popup {
        transition: opacity 0.2s ease;
        transform: none !important;
    }
}
