/**
 * AFV Lead Conversion UI
 * Elementos visuais focados em converter LEAD GRATUITO → CLIENTE PAGANTE
 * Foco: Mobile-First + Presença de Marca + Locked States Atraentes
 * 
 * @package AFV_Simple_Portal
 * @version 2.0.0
 */

/* ========================================
   VARIÁVEIS DE CONVERSÃO
======================================== */
:root {
    --afv-lead-color: #f59e0b;
    --afv-client-color: #8b5cf6;
    --afv-locked-overlay: rgba(17, 24, 39, 0.75);
    --afv-success-pulse: #10b981;
    --afv-conversion-gradient: linear-gradient(135deg, #f59e0b 0%, #ec4899 50%, #8b5cf6 100%);
}

/* ========================================
   1. BADGE DE STATUS DINÂMICO (Header)
======================================== */

/* Badge para Lead Gratuito */
.afv-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
}

.afv-status-badge.is-lead {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border: 2px solid #fbbf24;
    animation: pulse-badge 2s ease-in-out infinite;
}

.afv-status-badge.is-lead::before {
    content: '🎁';
    font-size: 1.1rem;
}

.afv-status-badge.is-client,
.afv-status-badge.is-member {
    background: linear-gradient(135deg, #ddd6fe, #c4b5fd);
    color: #5b21b6;
    border: 2px solid #8b5cf6;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.afv-status-badge.is-client::before,
.afv-status-badge.is-member::before {
    content: '⭐';
    font-size: 1rem;
}

@keyframes pulse-badge {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(251, 191, 36, 0);
    }
}

/* Injetar badge no flow-brand */
.flow-brand-text .afv-status-badge {
    display: inline-flex;
    margin-top: 6px;
    font-size: 0.75rem;
    padding: 4px 10px;
}

@media (min-width: 1024px) {
    .flow-brand-text .afv-status-badge {
        font-size: 0.8125rem;
        padding: 5px 12px;
        margin-top: 8px;
    }
}

/* ========================================
   2. CHECKLIST PREMIUM (Única área ativa do Lead)
======================================== */

/* Container do checklist com destaque visual */
.afv-checklist-premium-wrapper {
    background: linear-gradient(135deg, #fefcff 0%, #fef7ff 100%);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.15);
    position: relative;
    overflow: hidden;
    margin-bottom: 48px;
}

/* Watermark sutil da marca */
.afv-checklist-premium-wrapper::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 300px;
    height: 300px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><text x="50%" y="50%" text-anchor="middle" fill="%23c4b5fd" opacity="0.08" font-size="80" font-weight="bold">AFV</text></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 1;
}

.afv-checklist-premium-wrapper > * {
    position: relative;
    z-index: 2;
}

/* Header do checklist com micro-copy motivacional */
.afv-checklist-lead-header {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-left: 4px solid #f59e0b;
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.afv-checklist-lead-header .icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.afv-checklist-lead-header .content h3 {
    color: #92400e;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.afv-checklist-lead-header .content p {
    color: #78350f;
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.5;
}

/* Progress bar com animação suave */
.afv-progress-animated {
    position: relative;
    height: 12px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    margin: 24px 0;
}

.afv-progress-animated .fill {
    height: 100%;
    background: var(--afv-conversion-gradient);
    border-radius: 999px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.afv-progress-animated .fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.afv-progress-label {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Itens do checklist com micro-interações */
.afv-checklist-item {
    background: white;
    border: 2px solid #f3f4f6;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.afv-checklist-item:hover {
    border-color: #a78bfa;
    box-shadow: 0 8px 24px rgba(167, 139, 250, 0.15);
    transform: translateY(-2px);
}

.afv-checklist-item.is-checked {
    border-color: #10b981;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
}

.afv-checklist-item.is-checked .checkbox-custom {
    background: #10b981;
    border-color: #10b981;
}

/* Checkbox customizado */
.checkbox-custom {
    width: 28px;
    height: 28px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background: white;
}

.checkbox-custom svg {
    width: 16px;
    height: 16px;
    stroke: white;
    stroke-width: 3;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.afv-checklist-item.is-checked .checkbox-custom svg {
    opacity: 1;
}

/* ========================================
   3. LOCKED STATES ATRAENTES (Áreas Bloqueadas)
======================================== */

/* WRAPPER - Container geral para seções bloqueadas */
.afv-locked-section {
    position: relative;
}

/* Conteúdo normal atrás do vidro */
.afv-locked-base {
    position: relative;
    z-index: 1;
}

/* Overlay ocupa toda a área do bloco */
.afv-locked-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* Vidro escuro com blur */
.afv-locked-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.25); /* Mais claro e transparente */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1;
}

/* Conteúdo sobre o vidro */
.afv-locked-icon,
.afv-locked-content {
    position: relative;
    z-index: 10;
}

/* Ícone de cadeado */
.afv-locked-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    text-align: center;
    position: relative;
    z-index: 15;
}

/* Cartão branco */
.afv-locked-content {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    padding: 20px 24px;
    max-width: 480px;
    text-align: left;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.35);
    z-index: 20;
}

.afv-locked-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: #1e293b;
    position: relative;
    z-index: 25;
}

.afv-locked-content p {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0 0 20px 0;
    color: #475569;
    position: relative;
    z-index: 25;
}

/* Lista de benefícios */
.afv-locked-benefits {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    text-align: left;
    position: relative;
    z-index: 25;
}

.afv-locked-benefits li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #334155;
    font-size: 0.9375rem;
    margin-bottom: 10px;
    font-weight: 500;
}

.afv-locked-benefits li::before {
    content: '✨';
    font-size: 1.125rem;
    flex-shrink: 0;
}

.afv-locked-benefits li:last-child {
    margin-bottom: 0;
}

/* CTA de upgrade no locked state */
.afv-locked-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
    transition: all 0.2s ease;
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 30;
}

.afv-locked-cta:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.afv-locked-cta::before {
    content: '🚀';
    font-size: 1.25rem;
}

/* Mobile: Locked overlay responsivo */
@media (max-width: 768px) {
    .afv-locked-overlay {
        padding: 16px;
    }

    .afv-locked-icon {
        font-size: 2.5rem;
        margin-bottom: 12px;
    }

    .afv-locked-content {
        padding: 18px 20px;
    }

    .afv-locked-content h3 {
        font-size: 1.25rem;
    }

    .afv-locked-content p {
        font-size: 0.9375rem;
    }

    .afv-locked-benefits li {
        font-size: 0.875rem;
    }

    .afv-locked-cta {
        padding: 12px 24px;
        font-size: 0.9375rem;
    }
}

/* ========================================
   4. SOCIAL PROOF WIDGET (Sidebar)
======================================== */

.afv-social-proof-widget {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-left: 4px solid #10b981;
    border-radius: 16px;
    padding: 24px;
    margin: 24px 0;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.15);
}

.afv-social-proof-widget h4 {
    color: #065f46;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.afv-social-proof-widget h4::before {
    content: '🎉';
    font-size: 1.5rem;
}

.afv-social-proof-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(16, 185, 129, 0.2);
}

.afv-social-proof-stat:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.afv-social-proof-stat .icon {
    font-size: 1.75rem;
    flex-shrink: 0;
}

.afv-social-proof-stat .content {
    flex: 1;
}

.afv-social-proof-stat .content strong {
    display: block;
    color: #065f46;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.afv-social-proof-stat .content span {
    color: #047857;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Recent activity feed */
.afv-recent-activity {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(16, 185, 129, 0.2);
}

.afv-recent-activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 0.875rem;
    color: #065f46;
}

.afv-recent-activity-item::before {
    content: '✅';
    font-size: 1.1rem;
}

.afv-recent-activity-item strong {
    font-weight: 600;
}

.afv-recent-activity-item .time {
    color: #059669;
    font-size: 0.75rem;
    margin-left: auto;
}

/* ========================================
   5. STICKY CTA MODAL (WhatsApp)
======================================== */

body.afv-cta-modal-open {
    overflow: hidden;
}

#afvStickyCTABackdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

#afvStickyCTABackdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

#afvStickyCTA {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.98);
    z-index: 9999;
    background: #ffffff;
    padding: 24px 28px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
    width: min(520px, 92vw);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

#afvStickyCTA.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.afv-sticky-cta-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.afv-sticky-cta-text {
    color: #111827;
}

.afv-sticky-cta-text strong {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.afv-sticky-cta-text span {
    font-size: 0.95rem;
    color: #4b5563;
}

.afv-sticky-cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #10b981;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.afv-sticky-cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(16, 185, 129, 0.4);
}

.afv-sticky-cta-button::before {
    content: '??';
    font-size: 1.2rem;
}

.afv-sticky-cta-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f3f4f6;
    border: none;
    color: #111827;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.afv-sticky-cta-close:hover {
    background: #e5e7eb;
}

/* ========================================
   6. TOOLTIP DE UNLOCK (Hover em Locked)
======================================== */

.afv-unlock-tooltip {
    position: absolute;
    top: 16px;
    right: 16px;
    background: white;
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    max-width: 280px;
    z-index: 11;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.afv-locked-section:hover .afv-unlock-tooltip {
    opacity: 1;
}

.afv-unlock-tooltip h5 {
    color: #1f2937;
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.afv-unlock-tooltip p {
    color: #6b7280;
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.5;
}

.afv-unlock-tooltip ul {
    list-style: none;
    padding: 0;
    margin: 12px 0 0 0;
}

.afv-unlock-tooltip ul li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #374151;
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.afv-unlock-tooltip ul li::before {
    content: '🔓';
    font-size: 0.9rem;
}

/* ========================================
   7. ANIMAÇÃO DE "SHAKE" (Quando tenta acessar bloqueado)
======================================== */

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-8px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(8px);
    }
}

.afv-locked-section.shake {
    animation: shake 0.6s ease-in-out;
}

/* ========================================
   8. EMPTY STATE MELHORADO (Nenhum documento)
======================================== */

.afv-empty-state {
    text-align: center;
    padding: 64px 32px;
    background: linear-gradient(135deg, #fefcff, #fef7ff);
    border-radius: 24px;
    margin: 32px 0;
}

.afv-empty-state-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #ddd6fe, #c4b5fd);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
}

.afv-empty-state h3 {
    color: #374151;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 12px 0;
}

.afv-empty-state p {
    color: #6b7280;
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0 0 32px 0;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.afv-empty-state-cta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--afv-conversion-gradient);
    color: white;
    padding: 16px 32px;
    border-radius: 999px;
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.3);
    transition: all 0.3s ease;
}

.afv-empty-state-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 50px rgba(139, 92, 246, 0.4);
}

/* ========================================
   9. MOBILE-FIRST RESPONSIVIDADE
======================================== */

@media (max-width: 768px) {
    .afv-checklist-premium-wrapper {
        padding: 24px 20px;
        border-radius: 20px;
    }

    .afv-checklist-premium-wrapper::before {
        width: 200px;
        height: 200px;
        top: -30px;
        right: -30px;
    }

    .afv-checklist-lead-header {
        flex-direction: column;
        text-align: center;
        padding: 16px 20px;
    }

    .afv-checklist-lead-header .content h3 {
        font-size: 1.1rem;
    }

    .afv-checklist-lead-header .content p {
        font-size: 0.875rem;
    }

    .afv-social-proof-widget {
        padding: 20px;
        margin: 16px 0;
    }

    .afv-empty-state {
        padding: 48px 24px;
    }

    .afv-empty-state-icon {
        width: 100px;
        height: 100px;
        font-size: 3rem;
    }

    .afv-empty-state h3 {
        font-size: 1.5rem;
    }

    .afv-empty-state p {
        font-size: 1rem;
    }
}

/* ========================================
   10. ACESSIBILIDADE (WCAG 2.2)
======================================== */

/* Focus states para teclado */
.afv-locked-cta:focus,
.afv-sticky-cta-button:focus,
.afv-empty-state-cta:focus {
    outline: 3px solid #fbbf24;
    outline-offset: 3px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .afv-locked-icon,
    .afv-progress-animated .fill::after,
    .afv-status-badge.is-lead {
        animation: none;
    }

    #afvStickyCTA {
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: more) {
    .afv-locked-overlay {
        background: rgba(0, 0, 0, 0.9);
    }

    .afv-status-badge.is-lead {
        border-width: 3px;
    }
}

/* ========================================
   11. INTEGRAÇÕES COM CLASSES EXISTENTES
======================================== */

/* Aplicar locked overlay automaticamente */
.afv-lead-restricted {
    position: relative;
}

.afv-lead-restricted::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--afv-locked-overlay);
    backdrop-filter: blur(6px);
    z-index: 5;
    pointer-events: all;
    cursor: not-allowed;
}

/* Sidebar link disabled state (sem ícone) */
.flow-sidebar-link.is-disabled {
    opacity: 0.9;
    pointer-events: auto;
}
